Author: scabanovich
Date: 2011-09-27 18:06:37 -0400 (Tue, 27 Sep 2011)
New Revision: 35088
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
Log:
JBIDE-9785
https://issues.jboss.org/browse/JBIDE-9785
KB model file storage is reduced.
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 2011-09-27
21:37:55 UTC (rev 35087)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java 2011-09-27
22:06:37 UTC (rev 35088)
@@ -12,8 +12,11 @@
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import javax.swing.text.html.HTMLEditorKit.LinkController;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -311,18 +314,31 @@
* Store this EL into XML element.
* @param element
*/
- public synchronized void store(Element element) {
- element.setAttribute("path", path.toString()); //$NON-NLS-1$
+ public synchronized void store(Element element, Map<String,String> pathIds) {
+ element.setAttribute("path", getAlias(pathIds, path.toString()));
//$NON-NLS-1$
element.setAttribute("offset", "" + startPosition); //$NON-NLS-1$
//$NON-NLS-2$
element.setAttribute("length", "" + length); //$NON-NLS-1$
//$NON-NLS-2$
}
+ public static String getAlias(Map<String, String> pathAliases, String path) {
+ String result = pathAliases.get(path);
+ if(result == null) {
+ result = "%" + pathAliases.size(); //$NON-NLS-1$
+ pathAliases.put(path, result);
+ }
+ return result;
+ }
+
+ public static String getPath(Map<String, String> pathAliases, String alias) {
+ return pathAliases.containsKey(alias) ? pathAliases.get(alias) : alias;
+ }
+
/**
* Load this EL from XML element.
* @param element
*/
- public synchronized void load(Element element) {
- path = new Path(element.getAttribute("path")); //$NON-NLS-1$
+ public synchronized void load(Element element, Map<String, String> pathAliases) {
+ path = new Path(getPath(pathAliases, element.getAttribute("path")));
//$NON-NLS-1$
startPosition = new Integer(element.getAttribute("offset")); //$NON-NLS-1$
length = new Integer(element.getAttribute("length")); //$NON-NLS-1$
}