### Eclipse Workspace Patch 1.0
#P org.eclipse.ui.ide
Index: src/org/eclipse/ui/ide/dialogs/PathVariableSelectionDialog.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/PathVariableSelectionDialog.java,v
retrieving revision 1.16
diff -u -r1.16 PathVariableSelectionDialog.java
--- src/org/eclipse/ui/ide/dialogs/PathVariableSelectionDialog.java 10 May 2010 09:47:59 -0000 1.16
+++ src/org/eclipse/ui/ide/dialogs/PathVariableSelectionDialog.java 12 May 2010 15:04:41 -0000
@@ -88,6 +88,7 @@
updateExtendButtonState();
}
});
+ pathVariablesGroup.setAutomaticSave(true);
setShellStyle(getShellStyle() | SWT.SHEET);
}
Index: src/org/eclipse/ui/internal/ide/dialogs/CreateLinkedResourceGroup.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/CreateLinkedResourceGroup.java,v
retrieving revision 1.38
diff -u -r1.38 CreateLinkedResourceGroup.java
--- src/org/eclipse/ui/internal/ide/dialogs/CreateLinkedResourceGroup.java 11 May 2010 19:25:51 -0000 1.38
+++ src/org/eclipse/ui/internal/ide/dialogs/CreateLinkedResourceGroup.java 12 May 2010 15:04:42 -0000
@@ -23,6 +23,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -413,7 +414,17 @@
// 3) A path variable relative path, ex: VAR\foo\bar\file.txt
URI uri;
try {
+ IPath path = Path.fromOSString(linkTarget);
+ if (path != null && path.toFile().exists())
+ return URIUtil.toURI(path);
+
uri = new URI(linkTarget);
+ URI resolved = getPathVariableManager().resolveURI(uri);
+ try {
+ EFS.getStore(resolved);
+ } catch (CoreException e) {
+ return URIUtil.toURI(path);
+ }
}catch(URISyntaxException e) {
uri = convertToURI(linkTarget);
}
@@ -559,13 +570,8 @@
* the entered value is a variable.
*/
private void resolveVariable() {
- IPathVariableManager pathVariableManager;
+ IPathVariableManager pathVariableManager = getPathVariableManager();
// use the resolved link target name
- if (updatableResourceName.getResource() != null)
- pathVariableManager = updatableResourceName.getResource().getPathVariableManager();
- else
- pathVariableManager = ResourcesPlugin
- .getWorkspace().getPathVariableManager();
boolean isURL = true;
URI uri;
try {
@@ -592,6 +598,19 @@
}
/**
+ * @return
+ */
+ private IPathVariableManager getPathVariableManager() {
+ IPathVariableManager pathVariableManager;
+ if (updatableResourceName.getResource() != null)
+ pathVariableManager = updatableResourceName.getResource().getPathVariableManager();
+ else
+ pathVariableManager = ResourcesPlugin
+ .getWorkspace().getPathVariableManager();
+ return pathVariableManager;
+ }
+
+ /**
* Sets the GridData
on the specified button to be one that
* is spaced for the current dialog page units. The method
* initializeDialogUnits
must be called once before calling
Index: src/org/eclipse/ui/internal/ide/dialogs/PathVariableDialog.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/PathVariableDialog.java,v
retrieving revision 1.27
diff -u -r1.27 PathVariableDialog.java
--- src/org/eclipse/ui/internal/ide/dialogs/PathVariableDialog.java 14 Apr 2010 16:34:46 -0000 1.27
+++ src/org/eclipse/ui/internal/ide/dialogs/PathVariableDialog.java 12 May 2010 15:04:42 -0000
@@ -318,7 +318,7 @@
Composite buttonsComposite = new Composite(contents, SWT.NONE);
buttonsComposite.setLayoutData(new GridData(SWT.END, SWT.CENTER, false,
false, 1, 1));
- GridLayout layout = new GridLayout(1, true);
+ GridLayout layout = new GridLayout(0, true);
layout.marginWidth = 0;
layout.marginHeight = 0;
buttonsComposite.setLayout(layout);
@@ -355,28 +355,32 @@
setButtonLayoutData(folderButton);
}
- variableButton = new Button(buttonsComposite, SWT.PUSH);
- variableButton.setText(IDEWorkbenchMessages.PathVariableDialog_variable);
-
- variableButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
- false));
-
- variableButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectVariable();
- }
- });
- setButtonLayoutData(variableButton);
+ // the workspace path variable manager does not support variables.
+ if (currentResource != null) {
+ layout.numColumns++;
+ variableButton = new Button(buttonsComposite, SWT.PUSH);
+ variableButton.setText(IDEWorkbenchMessages.PathVariableDialog_variable);
+
+ variableButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
+ false));
+
+ variableButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ selectVariable();
+ }
+ });
+ setButtonLayoutData(variableButton);
- // variable value label
- variableResolvedValueLabel = new Label(contents, SWT.LEAD);
- variableResolvedValueLabel.setText(resolvedValueLabelText);
-
- // variable value field. Attachments done after all widgets created.
- variableResolvedValueField = new Label(contents, SWT.LEAD | SWT.SINGLE | SWT.READ_ONLY);
- variableResolvedValueField.setText(TextProcessor.process(getVariableResolvedValue()));
- variableResolvedValueField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
- false, 2, 1));
+ // variable value label
+ variableResolvedValueLabel = new Label(contents, SWT.LEAD);
+ variableResolvedValueLabel.setText(resolvedValueLabelText);
+
+ // variable value field. Attachments done after all widgets created.
+ variableResolvedValueField = new Label(contents, SWT.LEAD | SWT.SINGLE | SWT.READ_ONLY);
+ variableResolvedValueField.setText(TextProcessor.process(getVariableResolvedValue()));
+ variableResolvedValueField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
+ false, 2, 1));
+ }
}
private IPathVariableManager getPathVariableManager() {
Index: src/org/eclipse/ui/internal/ide/dialogs/PathVariablesGroup.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/PathVariablesGroup.java,v
retrieving revision 1.21
diff -u -r1.21 PathVariablesGroup.java
--- src/org/eclipse/ui/internal/ide/dialogs/PathVariablesGroup.java 22 Apr 2010 20:54:28 -0000 1.21
+++ src/org/eclipse/ui/internal/ide/dialogs/PathVariablesGroup.java 12 May 2010 15:04:42 -0000
@@ -131,6 +131,8 @@
// reference to the workspace's path variable manager
private IPathVariableManager pathVariableManager;
+ private boolean autoSave = false;
+
// file image
private final Image FILE_IMG = PlatformUI.getWorkbench().getSharedImages()
.getImage(ISharedImages.IMG_OBJ_FILE);
@@ -208,6 +210,7 @@
// the UI must be updated
updateWidgetState();
+ autoSave();
}
/**
@@ -435,6 +438,7 @@
// now we must refresh the UI state
updateWidgetState();
+ autoSave();
}
/**
@@ -453,6 +457,20 @@
}
/**
+ * Automatically save the path variable list when new variables
+ * are added, changed, or removed by the user.
+ *
+ */
+ public void setAutomaticSave(boolean value) {
+ autoSave = value;
+ }
+
+ private void autoSave() {
+ if (autoSave) {
+ performOk();
+ }
+ }
+ /**
* Returns the selected variables.
*
* @return the selected variables. Returns an empty array if
@@ -656,6 +674,7 @@
tempPathVariables.remove(varName);
}
updateWidgetState();
+ autoSave();
}
private boolean canChangeSelection() {