[yocto] [PATCH] [Upstream patch: org.eclipse.ui]Adjust project location for non-default location

Ioana Grigoropol ioanax.grigoropol at intel.com
Mon Jul 29 06:12:36 PDT 2013


Signed-off-by: Ioana Grigoropol <ioanax.grigoropol at intel.com>
---
 .../ide/dialogs/ProjectContentsLocationArea.java   |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java
index 35cd387..7de5255 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java
@@ -23,7 +23,9 @@ import org.eclipse.core.filesystem.IFileInfo;
 import org.eclipse.core.filesystem.URIUtil;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.osgi.util.TextProcessor;
@@ -471,10 +473,27 @@ public class ProjectContentsLocationArea {
 	 *            existing project name.
 	 */
 	public void updateProjectName(String newName) {
+		boolean append = false;
+		if (projectName.isEmpty())
+			append = true;
 		projectName = newName;
 		if (isDefault()) {
 			locationPathField.setText(TextProcessor
 					.process(getDefaultPathDisplayString()));
+		} else {
+			try {
+				URI uri = new URI(locationPathField.getText());
+				IPath path = new Path(uri.getPath());
+				if (!append)
+					path = path.removeLastSegments(1);
+				path = path.addTrailingSeparator();
+				path = path.append(projectName);
+			    URI newURI = new URI(uri.getScheme(), uri.getAuthority(), path.toPortableString(), uri.getQuery(), uri.getFragment());
+				locationPathField.setText(TextProcessor
+						.process(newURI.toString()));
+			} catch (URISyntaxException e) {
+				e.printStackTrace();
+			}
 		}
 
 	}
-- 
1.7.9.5




More information about the yocto mailing list