Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 89989 Details for
Bug 219329
Pathmap Manager doesn't support file-based pathmaps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed solution
filepathmaps.patch (text/plain), 8.12 KB, created by
Chris McGee
on 2008-02-18 11:23:10 EST
(
hide
)
Description:
Proposed solution
Filename:
MIME Type:
Creator:
Chris McGee
Created:
2008-02-18 11:23:10 EST
Size:
8.12 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.runtime.emf.core >Index: src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core/src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java,v >retrieving revision 1.8 >diff -u -r1.8 PathmapManager.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java 3 Oct 2006 15:05:22 -0000 1.8 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/resources/PathmapManager.java 18 Feb 2008 16:04:22 -0000 >@@ -54,6 +54,7 @@ > import org.eclipse.gmf.runtime.emf.core.internal.util.EMFCoreConstants; > import org.eclipse.gmf.runtime.emf.core.resources.GMFResource; > import org.eclipse.gmf.runtime.emf.core.resources.IPathmapManager; >+import org.eclipse.gmf.runtime.emf.core.resources.IPathmapManager2; > import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; > import org.osgi.framework.Bundle; > import org.osgi.service.prefs.BackingStoreException; >@@ -63,7 +64,7 @@ > * > * @author rafikj > */ >-public class PathmapManager extends AdapterImpl implements IPathmapManager { >+public class PathmapManager extends AdapterImpl implements IPathmapManager, IPathmapManager2 { > // path maps can be defined using an extension point: Pathmaps > // or by referencing an eclipse path variable > // or by adding a pathmap manually >@@ -83,6 +84,7 @@ > // The path map as defined by the extensions and the referenced path variables and the manually > // added pathmaps. > private static final Map PATH_MAP = Collections.synchronizedMap(configure()); >+ private static final Set FILE_VARIABLES = Collections.synchronizedSet(new HashSet()); > > private static final Map instances = Collections.synchronizedMap(new WeakHashMap()); > >@@ -318,6 +320,14 @@ > * @param val the path map variable value (must be an encoded URI) > */ > public static void setPathVariable(String var, String val) { >+ internalSetPathVariable(var, val); >+ >+ for (Iterator i = allInstances().iterator(); i.hasNext();) { >+ ((PathmapManager) i.next()).resyncEntries(true); >+ } >+ } >+ >+ private static void internalSetPathVariable(String var, String val) { > // We must try to determine if this pathmap resides in the workspace as some container > // so that we store into the pathmap a substitution that is a platform:/resource > // type of substitution. This is required because otherwise, pathmap URIs normalize >@@ -337,7 +347,51 @@ > } > > PATH_MAP.put(var, val); >- >+ } >+ >+ /** >+ * Set the value of a pathmap variable to point to a specific file (not a folder) >+ * >+ * @param var the path map variable name >+ * @param val the path map variable value (must be an encoded URI pointing to a file, not a folder) >+ */ >+ public static void setFilePathVariable(String var, String val) { >+ FILE_VARIABLES.add(var); >+ internalSetPathVariable(var, val); >+ for (Iterator i = allInstances().iterator(); i.hasNext();) { >+ ((PathmapManager) i.next()).resyncEntries(true); >+ } >+ } >+ >+ /** >+ * Sets the value of a map of pathmap variables to point to specific files (not folders) >+ * >+ * @param settings A map of new variables(Strings) to their values(Strings). >+ */ >+ public static void setFilePathVariables(Map settings) { >+ FILE_VARIABLES.addAll(settings.keySet()); >+ >+ for (Iterator i = settings.entrySet().iterator(); i.hasNext();) { >+ Map.Entry entry = (Map.Entry)i.next(); >+ internalSetPathVariable((String)entry.getKey(), (String)entry.getValue()); >+ } >+ >+ for (Iterator i = allInstances().iterator(); i.hasNext();) { >+ ((PathmapManager) i.next()).resyncEntries(true); >+ } >+ } >+ >+ /** >+ * Sets the value of a map of pathmap variables to point specific folders (not files) >+ * >+ * @param settings A map of new variables(Strings) to their values(Strings). >+ */ >+ public static void setPathVariables(Map settings) { >+ for (Iterator i = settings.entrySet().iterator(); i.hasNext();) { >+ Map.Entry entry = (Map.Entry)i.next(); >+ internalSetPathVariable((String)entry.getKey(), (String)entry.getValue()); >+ } >+ > for (Iterator i = allInstances().iterator(); i.hasNext();) { > ((PathmapManager) i.next()).resyncEntries(true); > } >@@ -349,6 +403,30 @@ > return Status.OK_STATUS; // TODO: report accurate status > } > >+ public IStatus addFilePathVariable(String name, String value) { >+ setFilePathVariable(name, value); >+ >+ return Status.OK_STATUS; // TODO: report accurate status >+ } >+ >+ public IStatus addFilePathVariables(Map settings) { >+ setFilePathVariables(settings); >+ >+ return Status.OK_STATUS; // TODO: report accurate status >+ } >+ >+ public IStatus addFolderPathVariable(String name, String value) { >+ setPathVariable(name, value); >+ >+ return Status.OK_STATUS; >+ } >+ >+ public IStatus addFolderPathVariables(Map settings) { >+ setPathVariables(settings); >+ >+ return Status.OK_STATUS; >+ } >+ > /** > * Remove a pathmap variable. > */ >@@ -637,7 +715,8 @@ > > uri.append(val); > >- if (val.charAt(len - 1) != EMFCoreConstants.PATH_SEPARATOR) >+ // TODO >+ if (!FILE_VARIABLES.contains(var) && val.charAt(len - 1) != EMFCoreConstants.PATH_SEPARATOR) > uri.append(EMFCoreConstants.PATH_SEPARATOR); > > URI valURI = URI.createURI(uri.toString()); >@@ -728,7 +807,8 @@ > uri.append(EMFCoreConstants.PATH_SEPARATOR); > uri.append(var); > >- if (var.charAt(len - 1) != EMFCoreConstants.PATH_SEPARATOR) >+ //TODO >+ if (!FILE_VARIABLES.contains(var) && var.charAt(len - 1) != EMFCoreConstants.PATH_SEPARATOR) > uri.append(EMFCoreConstants.PATH_SEPARATOR); > > return URI.createURI(uri.toString()); >Index: src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager2.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager2.java >diff -N src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/runtime/emf/core/resources/IPathmapManager2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+package org.eclipse.gmf.runtime.emf.core.resources; >+ >+import java.util.Map; >+ >+import org.eclipse.core.runtime.IStatus; >+ >+public interface IPathmapManager2 extends IPathmapManager { >+ /** >+ * Adds a map of file path variables (not folders). >+ * >+ * @param settings A map from variables(String) to values(String). >+ * >+ * @return a status indicating success (OK) or failure (ERROR) to set the >+ * path variable. In case of error, the status message provides a >+ * user-friendly explanation of the reason >+ */ >+ public IStatus addFilePathVariables(Map settings); >+ >+ /** >+ * Sets the value of a path variable to a file (not a folder). >+ * >+ * @param name the path variable name >+ * @param value the path variable value pointing to a specific file (not a folder) >+ * >+ * @return a status indicating success (OK) or failure (ERROR) to set the >+ * path variable. In case of error, the status message provides a >+ * user-friendly explanation of the reason >+ */ >+ public IStatus addFilePathVariable(String name, String value); >+ >+ /** >+ * Adds a map of folder path variables (not files). >+ * >+ * @param settings A map from variables(String) to values(String). >+ * >+ * @return a status indicating success (OK) or failure (ERROR) to set the >+ * path variable. In case of error, the status message provides a >+ * user-friendly explanation of the reason >+ */ >+ public IStatus addFolderPathVariables(Map settings); >+ >+ /** >+ * Sets the value of a path variable to a folder (not a file). >+ * >+ * @param name the path variable name >+ * @param value the path variable value pointing to a specific folder (not a file) >+ * >+ * @return a status indicating success (OK) or failure (ERROR) to set the >+ * path variable. In case of error, the status message provides a >+ * user-friendly explanation of the reason >+ */ >+ public IStatus addFolderPathVariable(String name, String value); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 219329
: 89989