Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/.project28
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/META-INF/MANIFEST.MF17
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/build.properties5
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.pdoc4
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.xml27
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/Activator.java54
-rw-r--r--sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/handler/EMFSaveAsHandler.java222
9 files changed, 0 insertions, 371 deletions
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.classpath b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.project b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.project
deleted file mode 100644
index 0b9b0f18ac1..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.dev.infra.emf.export</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.settings/org.eclipse.jdt.core.prefs b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 44217f8c068..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/META-INF/MANIFEST.MF
deleted file mode 100644
index f6dd48cafd8..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Export EMF (Incubation)
-Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.export;singleton:=true
-Bundle-Version: 0.10.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.dev.infra.emf.export.Activator
-Bundle-Vendor: Eclipse Modeling Language
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.emf.transaction;bundle-version="1.4.0",
- org.eclipse.emf.edit.ui;bundle-version="2.8.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="0.9.1",
- org.eclipse.ui.ide,
- org.eclipse.papyrus.infra.core.log;bundle-version="0.9.1"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/build.properties b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/build.properties
deleted file mode 100644
index 6f20375d6c7..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.pdoc b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.pdoc
deleted file mode 100644
index e164d7294e3..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.pdoc
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides action to export a part of an EMF-Model in a new file">
- <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
-</doc:Documentation>
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.xml b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.xml
deleted file mode 100644
index e97242df9a7..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/plugin.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="org.eclipse.papyrus.dev.infra.emf.export.handler.EMFSaveAsHandler"
- description="Allow to do a &quot;Save As&quot; of a part of a model"
- id="org.eclipse.papyrus.dev.infra.emf.export.save.as.command"
- name="EMF Save As">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.ui.popup.any">
- <command
- commandId="org.eclipse.papyrus.dev.infra.emf.export.save.as.command"
- label="&quot;Save As&quot; a part of the model"
- style="push"
- tooltip="&quot;Save As&quot; a part of the model">
- </command>
- </menuContribution>
- </extension>
-
-</plugin>
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/Activator.java b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/Activator.java
deleted file mode 100644
index f3c2a5c641a..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/Activator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.papyrus.dev.infra.emf.export;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.dev.infra.emf.export"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/handler/EMFSaveAsHandler.java b/sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/handler/EMFSaveAsHandler.java
deleted file mode 100644
index 78c019c2850..00000000000
--- a/sandbox/org.eclipse.papyrus.dev.infra.emf.export/src/org/eclipse/papyrus/dev/infra/emf/export/handler/EMFSaveAsHandler.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.eclipse.papyrus.dev.infra.emf.export.handler;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.internal.resources.File;
-import org.eclipse.core.internal.resources.Workspace;
-import org.eclipse.core.internal.resources.WorkspaceRoot;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.dev.infra.emf.export.Activator;
-import org.eclipse.papyrus.infra.widgets.editors.InputDialog;
-import org.eclipse.papyrus.infra.widgets.providers.WorkspaceContentProvider;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-
-
-public class EMFSaveAsHandler extends AbstractHandler {
-
- private ITreeContentProvider contentProvider = null;
-
- private ILabelProvider labelProvider = null;
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ResourceSet set = new ResourceSetImpl();
- final List<Resource> selectedResources = getSelectedResource(set);
-
- // the dialog used to choose a file to browse
- final CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(Display.getCurrent().getActiveShell(), getLabelProvider(), getContentProvider());
- dialog.setTitle("Browse Model");
- dialog.setMessage("Select the elements to export");
- dialog.setInput(selectedResources);
-
- if(dialog.open() == Window.OK) {
- final Object[] selectedEObject = dialog.getResult();
- final Collection<EObject> toExport = new ArrayList<EObject>();
- for(final Object current : selectedEObject) {
- assert current instanceof EObject;
- EcoreUtil.resolveAll((EObject)current);
- toExport.add((EObject)current);
- }
-
- SaveAsDialog saveAsDialog = new SaveAsDialog(Display.getCurrent().getActiveShell());
- // saveAsDialog.setTitle("Select the destination for the exported elements"); //without effect
- if(saveAsDialog.open() == Window.OK) {
- Resource newResource = createNewResource(set, saveAsDialog.getResult());
- newResource.getContents().addAll(toExport);
- try {
- newResource.save(Collections.emptyMap());
- for(final Resource current : selectedResources) {
- current.save(Collections.emptyMap());
- }
-
- } catch (IOException e) {
- Activator.log.error(e);
- }
- }
- }
-
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- *
- * @return
- */
- @Override
- public boolean isEnabled() {
- return getSelectedResource(new ResourceSetImpl()).size() != 0;
- }
-
- /**
- * FIXME : use the label provider service
- *
- * @return
- * the label provider to use
- */
- public ILabelProvider getLabelProvider() {
- if(labelProvider == null) {
- final AdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
- labelProvider = new AdapterFactoryLabelProvider(factory);
- }
- return labelProvider;
- }
-
- /**
- * FIXME : use the content provider service
- *
- * @return
- * the content provider to use
- */
- public ITreeContentProvider getContentProvider() {
- final AdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
- if(contentProvider == null) {
- contentProvider = new AdapterFactoryContentProvider(factory) {
-
- @Override
- public Object[] getElements(Object inputElement) {
- if(inputElement instanceof Resource) {
- return ((Resource)inputElement).getContents().toArray();
-
- } else if(inputElement instanceof Collection<?>) {
- return ((Collection)inputElement).toArray();
- } else {
- return super.getElements(inputElement);
- }
- }
- };
- }
- return contentProvider;
- }
-
- /**
- *
- * @param set
- * a resource set
- * @return
- * the selected resource
- */
- protected List<Resource> getSelectedResource(final ResourceSet set) {
- IStructuredSelection selection = (IStructuredSelection)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- final List<Resource> selectedResources = new ArrayList<Resource>();
- final List<?> selectedElement = selection.toList();
- for(Object object : selectedElement) {
-
- if(object instanceof IAdaptable) {
- final File file = (File)((IAdaptable)object).getAdapter(IFile.class);
- if(file != null) {
-
- final String pathName = ((File)file).getFullPath().toString();
-
-
- final URI uri = URI.createPlatformResourceURI(pathName, true);
- final Resource res = set.getResource(uri, true);
- EcoreUtil.resolveAll(res);
- if(pathName.contains("notation")) {
-
- selectedResources.add(0, res);
- } else {
- selectedResources.add(res);
- }
- }
- }
-
- }
- // final Object selectedElement = ((IStructuredSelection)selection).getFirstElement();
- // String pathName = "";
- // Resource res = null;
- // if(selectedElement instanceof IAdaptable) {
- // final File file = (File)((IAdaptable)selectedElement).getAdapter(IFile.class);
- // if(file!=null){
- //
- // pathName = ((File)file).getFullPath().toString();
- //
- // final URI uri = URI.createPlatformResourceURI(pathName, true);
- // res = set.getResource(uri, true);
- // }
- // }
- // return res;
- // System.out.println(object);
- return selectedResources;
- }
-
- /**
- *
- * @param set
- * the resourceset to use
- * @param iPath
- * a path
- * @return
- * the created resource with the wanted path
- */
- protected Resource createNewResource(final ResourceSet set, final IPath iPath) {
- // EcoreResourceUtil.
- // URIConverter converter = set.getURIConverter();
- // converter.
- // IPath wsPath = ResourcesPlugin.getWorkspace().getDescription()
- // java.io.File file = iPath.toFile();
- // file.
- // URI.createPlatformResourceURI(pathName)
-
- //FIXME : the references to the new files are stored with OS path (F:/....)
- IPath fullPath = ResourcesPlugin.getWorkspace().getRoot().getFile(iPath).getLocation();
- // fullPath.get
- final URI uri = URI.createPlatformResourceURI(iPath.toString(), true);//FileURI(fullPath.toFile().getAbsolutePath());
- final URI uri2 = URI.createPlatformResourceURI(iPath.toFile().getPath(), true);
- String device = iPath.getDevice();
- final Resource newResource = set.createResource(uri);
- return newResource;
- }
-
-}

Back to the top