[jbosstools-commits] JBoss Tools SVN: r43935 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 21 12:24:02 EDT 2012


Author: scabanovich
Date: 2012-09-21 12:24:02 -0400 (Fri, 21 Sep 2012)
New Revision: 43935

Modified:
   trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
Log:
JBIDE-12479
Avoid keeping IResource references.


Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java	2012-09-21 16:14:36 UTC (rev 43934)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java	2012-09-21 16:24:02 UTC (rev 43935)
@@ -40,8 +40,6 @@
  * @author Alexey Kazakov
  */
 public class ELReference implements ITextSourceReference {
-
-	private IFile resource;
 	private IPath path;
 	private int length;
 	private int lineNumber;
@@ -105,20 +103,15 @@
 	 * @return the resource
 	 */
 	public IFile getResource() {
-		if(resource==null) {
-			IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
-			resource = wsRoot.getFile(path);
-		}
-		return resource;
+		return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
 	}
 
 	/**
 	 * @param resource the resource to set
 	 */
 	public void setResource(IFile resource) {
-		this.resource = resource;
-		if(resource!=null) {
-			this.path = resource.getFullPath();
+		if(resource != null) {
+			this.path = UniquePaths.getInstance().intern(resource.getFullPath());
 		}
 	}
 
@@ -178,7 +171,7 @@
 	}
 
 	private String getText() {
-		String text = FileUtil.getContentFromEditorOrFile(resource);
+		String text = FileUtil.getContentFromEditorOrFile(getResource());
 		if(getStartPosition() >= 0 && getLength() >= 0 && text.length() >= getStartPosition() + getLength()) {
 			return source = "" + text.substring(getStartPosition(), getStartPosition() + getLength());
 		} else {
@@ -313,6 +306,7 @@
 	 */
 	public synchronized void load(Element element, Map<String, String> pathAliases) {
 		path = new Path(getPath(pathAliases, element.getAttribute("path"))); //$NON-NLS-1$
+		setPath(path);
 		startPosition = new Integer(element.getAttribute("offset")); //$NON-NLS-1$
 		length = new Integer(element.getAttribute("length")); //$NON-NLS-1$
 	}



More information about the jbosstools-commits mailing list