Changeset 3522


Ignore:
Timestamp:
Mar 14, 2008, 12:19:22 PM (13 years ago)
Author:
yura
Message:
Location:
devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpBuilder.java

    r3521 r3522  
    5151    private void makeClass (String className, byte[] bytes) {
    5252        IProject project = getProject();
    53         IJavaProject javaProject = RfpCore.getJavaProject(project);
     53        IJavaProject javaProject = RfpCore.getRfpProject(project).getJavaProject();
    5454        try {
    5555            IPath projectPath = project.getFullPath();
     
    163163                for (IClasspathEntry entry : getClasspathEntries(project))
    164164                    if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
    165                         IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), RfpCore
    166                                 .getJavaProject(project));
     165                        IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), RfpCore.getRfpProject(project).getJavaProject());
    167166                        for (IClasspathEntry entry2 : container.getClasspathEntries()) {
    168167                            if (entry2.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
     
    448447    private static IClasspathEntry[] getClasspathEntries (IProject project) {
    449448        try {
    450             return RfpCore.getJavaProject(project).getRawClasspath();
     449            return RfpCore.getRfpProject(project).getJavaProject().getRawClasspath();
    451450        } catch (Exception e) {
    452451            RfpCore.log(e);
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpCore.java

    r3521 r3522  
    11package org.refal.rfpdt.core;
    22
    3 import java.util.HashMap;
    4 import java.util.Map;
     3import java.util.WeakHashMap;
    54
    65import org.eclipse.core.resources.IProject;
     
    98import org.eclipse.core.runtime.Plugin;
    109import org.eclipse.core.runtime.Status;
    11 import org.eclipse.jdt.core.IJavaProject;
    1210import org.eclipse.jdt.core.JavaCore;
    1311
     
    1715public class RfpCore extends Plugin {
    1816    private static RfpCore plugin = null;
     17
     18    private static final WeakHashMap<IProject, RfpProject> rfpProjects = new WeakHashMap<IProject, RfpProject>();
    1919
    2020    private static void log (IStatus status) {
     
    4545    }
    4646
    47     public RfpCore () {
    48         plugin = this;
    49     }
    50 
    51     private static final Map<IProject, IJavaProject> javaProjects = new HashMap<IProject, IJavaProject>();
    52 
    53     public static IJavaProject getJavaProject (IProject project) {
     47    /**
     48     * May return <code>null</code>.
     49     */
     50    public static RfpProject getRfpProject (IProject project) {
    5451        try {
    55             if (project == null || !project.exists() || !project.hasNature(RfpCore.NATURE_ID))
     52            if (project == null || !project.exists() || !project.hasNature(NATURE_ID)
     53                    || !project.hasNature(JavaCore.NATURE_ID))
    5654                return null;
    5755        } catch (CoreException e) {
     
    5957            return null;
    6058        }
    61         IJavaProject p = (IJavaProject) javaProjects.get(project);
    62         if (p == null) {
    63             p = JavaCore.create(project);
    64             javaProjects.put(project, p);
     59        RfpProject rfpProject = RfpCore.rfpProjects.get(project);
     60        if (rfpProject == null) {
     61            rfpProject = new RfpProject(project);
     62            RfpCore.rfpProjects.put(project, rfpProject);
    6563        }
    66         return p;
     64        return rfpProject;
     65    }
     66
     67    public RfpCore () {
     68        plugin = this;
    6769    }
    6870}
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpNature.java

    r3521 r3522  
    3434
    3535        { // setup the .classpath
    36             IJavaProject javaProject = RfpCore.getJavaProject(project);
     36            IJavaProject javaProject = RfpCore.getRfpProject(project).getJavaProject();
    3737            IClasspathEntry[] entriesOld = javaProject.getRawClasspath();
    3838            IClasspathEntry[] entriesNew = new IClasspathEntry[entriesOld.length + 2];
Note: See TracChangeset for help on using the changeset viewer.