summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjcadavid2014-05-27 11:42:52 (EDT)
committerjcadavid2014-05-27 12:22:47 (EDT)
commit5db4b47d2c9eb151c34a6e4d54424f110b9f1281 (patch)
treef41bd0af6c384ee3f2ccfb8dc0dc2a95b863c5f8
parenta558e1e89ffcaad4ead52967b18fb7e5c86e6c97 (diff)
downloadorg.eclipse.papyrus-5db4b47d2c9eb151c34a6e4d54424f110b9f1281.zip
org.eclipse.papyrus-5db4b47d2c9eb151c34a6e4d54424f110b9f1281.tar.gz
org.eclipse.papyrus-5db4b47d2c9eb151c34a6e4d54424f110b9f1281.tar.bz2
Bug 434633: [Control Mode] "Browse workspace" in control mode dialog notrefs/changes/95/27395/1
working https://bugs.eclipse.org/bugs/show_bug.cgi?id=434633 Override prepareBrowseWorkspaceButton() so that the file text field of the "Browse Workspace" dialog shows the default file name. When the user selects a folder, the string returned by this dialog will contain the full path including the selected folder. Change-Id: I8c7eb9630e282845800178411adbfa46d385880f Signed-off-by: jcadavid <juan.cadavid@cea.fr>
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/CreateModelFragmentDialog.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/CreateModelFragmentDialog.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/CreateModelFragmentDialog.java
index fe63d83..b86ae0e 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/CreateModelFragmentDialog.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/ui/CreateModelFragmentDialog.java
@@ -9,11 +9,17 @@
******************************************************************************/
package org.eclipse.papyrus.infra.services.controlmode.ui;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
+import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
@@ -46,6 +52,23 @@ public class CreateModelFragmentDialog extends ResourceDialog {
this.defaultName = defaultName;
}
+ @Override
+ protected void prepareBrowseWorkspaceButton(Button browseWorkspaceButton) {
+ browseWorkspaceButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ IFile file = null;
+ String path = URI.createURI(computeDefaultURI()).lastSegment();
+ file = WorkspaceResourceDialog.openNewFile(getShell(), null, null, path != null ? new Path(path) : null, null);
+ if(file != null) {
+ uriField.setText(URI.createPlatformResourceURI(file.getFullPath().toString(), true).toString());
+ }
+ }
+
+ });
+ }
+
public String computeDefaultURI() {
String ext = currentResource.getURI().fileExtension();
URI uri = currentResource.getURI().trimSegments(1);