Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 fe63d837fa6..b86ae0e58e6 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);

Back to the top