[jbosstools-commits] JBoss Tools SVN: r43887 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Sep 20 19:50:05 EDT 2012
Author: scabanovich
Date: 2012-09-20 19:50:05 -0400 (Thu, 20 Sep 2012)
New Revision: 43887
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/Dependencies.java
Log:
JBIDE-12479
https://issues.jboss.org/browse/JBIDE-12479
Cache unique Path objects.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2012-09-20 23:37:49 UTC (rev 43886)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2012-09-20 23:50:05 UTC (rev 43887)
@@ -55,6 +55,7 @@
import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.UniquePaths;
import org.jboss.tools.common.web.WebUtils;
public class CDICoreBuilder extends IncrementalProjectBuilder {
@@ -244,6 +245,8 @@
} finally {
n.fireChanges();
}
+
+ resourceVisitor = null;
return null;
}
@@ -442,6 +445,7 @@
public boolean visit(IResource resource) throws CoreException {
IPath path = resource.getFullPath();
+ path = UniquePaths.getInstance().intern(path);
if(resource instanceof IFile) {
if(visited.contains(path)) {
return false;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2012-09-20 23:37:49 UTC (rev 43886)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2012-09-20 23:50:05 UTC (rev 43887)
@@ -21,6 +21,7 @@
import org.jboss.tools.cdi.core.extension.CDIExtensionManager;
import org.jboss.tools.common.java.ParametedType;
import org.jboss.tools.common.java.ParametedTypeFactory;
+import org.jboss.tools.common.util.UniquePaths;
/**
*
@@ -90,7 +91,11 @@
}
public void setSourcePath(IPath source) {
+ if(source != null) {
+ source = UniquePaths.getInstance().intern(source);
+ }
this.source = source;
+
}
@Override
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2012-09-20 23:37:49 UTC (rev 43886)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2012-09-20 23:50:05 UTC (rev 43887)
@@ -53,7 +53,6 @@
protected List<IAnnotationDeclaration> annotations = new ArrayList<IAnnotationDeclaration>(2);
protected IAnnotatable member;
private IAnnotationMap annotationsByType = EmptyMap.instance;
- protected IResource resource;
protected ITextSourceReference originalDefinition = null;
@@ -98,7 +97,6 @@
protected void init(IType contextType, IRootDefinitionContext context, int flags) throws CoreException {
project = context.getProject();
- resource = ((IJavaElement)member).getResource();
if((flags & FLAG_NO_ANNOTATIONS) == 0) {
IAnnotation[] ts = member.getAnnotations();
for (int i = 0; i < ts.length; i++) {
@@ -118,6 +116,7 @@
protected void addDependency(IMember reference, IRootDefinitionContext context) {
if(reference == null || reference.isBinary()) return;
+ IResource resource = getResource();
if(!(resource instanceof IFile)) return;
IFile target = (IFile)resource;
IFile source = (IFile)reference.getResource();
@@ -227,7 +226,7 @@
}
public IResource getResource() {
- return resource;
+ return ((IJavaElement)member).getResource();
}
public ITextSourceReference getOriginalDefinition() {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2012-09-20 23:37:49 UTC (rev 43886)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2012-09-20 23:50:05 UTC (rev 43887)
@@ -14,9 +14,9 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
@@ -121,6 +121,7 @@
public String getContent() {
if(type == null || type.isBinary()) return null;
+ IResource resource = getResource();
if(resource instanceof IFile && resource.getName().endsWith(".java")) {
return FileUtil.getContentFromEditorOrFile((IFile)resource);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2012-09-20 23:37:49 UTC (rev 43886)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2012-09-20 23:50:05 UTC (rev 43887)
@@ -26,6 +26,7 @@
import org.jboss.tools.cdi.core.extension.IDefinitionContextExtension;
import org.jboss.tools.cdi.core.extension.feature.IProcessAnnotatedTypeFeature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.UniquePaths;
/**
*
@@ -166,6 +167,7 @@
public void addPackage(IPath file, String packageName, PackageDefinition def) {
if(file != null) {
+ file = UniquePaths.getInstance().intern(file);
Set<String> ts = resources.get(file);
if(ts == null) {
ts = new HashSet<String>();
@@ -192,6 +194,7 @@
public void addType(IPath file, String typeName) {
if(file != null) {
+ file = UniquePaths.getInstance().intern(file);
Set<String> ts = resources.get(file);
if(ts == null) {
ts = new HashSet<String>();
@@ -212,7 +215,7 @@
q = q.removeLastSegments(1);
Set<IPath> cs = childPaths.get(q);
if(cs == null) {
- childPaths.put(q, cs = new HashSet<IPath>());
+ childPaths.put(UniquePaths.getInstance().intern(q), cs = new HashSet<IPath>());
}
cs.add(file);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/Dependencies.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/Dependencies.java 2012-09-20 23:37:49 UTC (rev 43886)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/Dependencies.java 2012-09-20 23:50:05 UTC (rev 43887)
@@ -16,6 +16,7 @@
import java.util.Set;
import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.util.UniquePaths;
public class Dependencies {
protected Map<IPath, Set<IPath>> direct = new HashMap<IPath, Set<IPath>>();
@@ -24,6 +25,8 @@
public Dependencies() {}
public void addDependency(IPath source, IPath target) {
+ source = UniquePaths.getInstance().intern(source);
+ target = UniquePaths.getInstance().intern(target);
Set<IPath> ps = direct.get(source);
if(ps == null) {
ps = new HashSet<IPath>();
More information about the jbosstools-commits
mailing list