Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-01-21 16:27:58 +0000
committerptessier2014-01-21 16:27:58 +0000
commitd1eedebe39cc2f8995c4d0c6c11d85f10bff3bee (patch)
tree0eb8e7db0e886fdbc598fd3c365d7b0573f6c982 /deprecated
parent4af4e531738ee2f8d495f8bef5f1fe4fdddb8619 (diff)
downloadorg.eclipse.papyrus-d1eedebe39cc2f8995c4d0c6c11d85f10bff3bee.tar.gz
org.eclipse.papyrus-d1eedebe39cc2f8995c4d0c6c11d85f10bff3bee.tar.xz
org.eclipse.papyrus-d1eedebe39cc2f8995c4d0c6c11d85f10bff3bee.zip
386118: [EMF Facet] Papyrus should progressively support EMF Facet 0.2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386118 move /org.eclipse.papyrus.infra.table.controlmode
Diffstat (limited to 'deprecated')
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF22
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/build.properties8
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.properties12
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.xml11
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java30
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/ControlTableCommand.java135
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/TableControlParticipant.java74
10 files changed, 355 insertions, 0 deletions
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/.classpath b/deprecated/org.eclipse.papyrus.infra.table.controlmode/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/.classpath
@@ -0,0 +1,7 @@
+<?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/deprecated/org.eclipse.papyrus.infra.table.controlmode/.project b/deprecated/org.eclipse.papyrus.infra.table.controlmode/.project
new file mode 100644
index 00000000000..ff00eace11e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.table.controlmode</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/deprecated/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ebdb50332a1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.infra.services.controlmode;bundle-version="1.0.0",
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.emf.facet.widgets.nattable.instance,
+ org.eclipse.papyrus.infra.table.instance;bundle-version="1.0.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.7.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.infra.table.controlmode.Activato
+ r
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.table.controlmode;singl
+ eton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/about.html b/deprecated/org.eclipse.papyrus.infra.table.controlmode/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/build.properties b/deprecated/org.eclipse.papyrus.infra.table.controlmode/build.properties
new file mode 100644
index 00000000000..30e2cedf44d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+src.includes = about.html
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.properties b/deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.properties
new file mode 100644
index 00000000000..300c952e6b7
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.properties
@@ -0,0 +1,12 @@
+#/*****************************************************************************
+# * Copyright (c) 2009 Atos Origin.
+# *
+# *
+# * All rights reserved. This program and the accompanying materials
+# * are made available under the terms of the Eclipse Public License v1.0
+# * which accompanies this distribution, and is available at
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# *****************************************************************************/
+pluginName=Control Mode extension for tables (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.xml b/deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.xml
new file mode 100644
index 00000000000..8d61608de75
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.services.controlmode.participant">
+ <participant
+ class="org.eclipse.papyrus.infra.table.controlmode.TableControlParticipant">
+ </participant>
+ </extension>
+
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java b/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java
new file mode 100644
index 00000000000..833d9e8d7ee
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/Activator.java
@@ -0,0 +1,30 @@
+package org.eclipse.papyrus.infra.table.controlmode;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/ControlTableCommand.java b/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/ControlTableCommand.java
new file mode 100644
index 00000000000..e7544a20820
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/ControlTableCommand.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Atos.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Arthur Daussy <a href="mailto:arthur.daussy@atos.net"> - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.papyrus.infra.table.controlmode;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.SashModel;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequestParameters;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.infra.table.instance.util.TableContentsUtils;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Command to control tab in correct resources
+ *
+ * @author adaussy
+ *
+ */
+public class ControlTableCommand extends AbstractTransactionalCommand {
+
+ /**
+ * Control request used to control tabs
+ */
+ protected ControlModeRequest request;
+
+ /**
+ * @param request
+ * {@link ControlTableCommand#request}
+ */
+ @SuppressWarnings("unchecked")
+ public ControlTableCommand(ControlModeRequest request) {
+ super(request.getEditingDomain(), "Move table to new resource", null);
+ this.request = request;
+
+ try {
+ getAffectedFiles().addAll(getWorkspaceFiles(getTables()));
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ EObject objectTOControl = request.getTargetObject();
+ EMFHelper.getUsages(objectTOControl);
+ //Retrieve new di resource created previously
+ Resource newDiResource = getTargetDiResource();
+ if(newDiResource == null) {
+ return CommandResult.newErrorCommandResult("The di model has not been created");
+ }
+ List<EObject> tables = getTables();
+ if(!tables.isEmpty()) {
+ for(EObject tab : tables) {
+ if(tab instanceof PapyrusTableInstance) {
+ newDiResource.getContents().add(tab);
+ newDiResource.getContents().add(((PapyrusTableInstance)tab).getTable());
+ }
+ }
+ addMovedTabToRequest(tables);
+ }
+ return CommandResult.newOKCommandResult(newDiResource);
+ }
+
+ /**
+ * Retrieve the DI target resource from the request
+ *
+ * @return
+ */
+ protected Resource getTargetDiResource() {
+ return request.getTargetResource(SashModel.MODEL_FILE_EXTENSION);
+ }
+
+ /**
+ * Register the tab being moved to the request in ordert to be used by other participants
+ *
+ * @param tables
+ */
+ public void addMovedTabToRequest(List<EObject> tables) {
+ @SuppressWarnings("unchecked")
+ Collection<EObject> openables = (Collection<EObject>)request.getParameter(ControlModeRequestParameters.MOVED_OPENABLES);
+ if(openables == null) {
+ openables = new ArrayList<EObject>();
+ }
+ openables.addAll(tables);
+ request.addParameters(Collections.singletonMap(ControlModeRequestParameters.MOVED_OPENABLES, openables));
+ }
+
+ /**
+ * Get all the tab that need to be moved
+ *
+ * @return
+ * @throws ExecutionException
+ */
+ protected List<EObject> getTables() throws ExecutionException {
+ return Lists.newArrayList(TableContentsUtils.createDescendantTablesIterable(request.getTargetObject()));
+ }
+
+ /**
+ * Retreive the URI of the old di resource
+ *
+ * @return
+ * @throws ExecutionException
+ */
+ public URI getOldNotationURI() throws ExecutionException {
+ URI uri = request.getSourceURI();
+ if(uri != null) {
+ return uri.trimFileExtension().appendFileExtension(SashModel.MODEL_FILE_EXTENSION);
+ }
+ throw new ExecutionException("Unable to retreive URI of the old di model");
+ }
+
+} \ No newline at end of file
diff --git a/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/TableControlParticipant.java b/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/TableControlParticipant.java
new file mode 100644
index 00000000000..c7254614441
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.controlmode/src/org/eclipse/papyrus/infra/table/controlmode/TableControlParticipant.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Atos.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Arthur Daussy (Atos) arthur.daussy@atos.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.controlmode;
+
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant;
+import org.eclipse.papyrus.infra.table.instance.util.TableContentsUtils;
+
+
+/**
+ * Participant used to move tab in correct resources
+ *
+ * @author adaussy
+ *
+ */
+public class TableControlParticipant implements IControlCommandParticipant, IUncontrolCommandParticipant {
+
+ public String getID() {
+ return "org.eclipse.papyrus.infra.table.controlmode.TableControlParticipant";////$NON-NLS-0$
+ }
+
+ public int getPriority() {
+ return 40;
+ }
+
+ public boolean provideControlCommand(ControlModeRequest request) {
+ EObject objectToControl = request.getTargetObject();
+ //If the element is a package then it should be openable in stand alone
+ if(objectToControl == null) {
+ return false;
+ }
+ //Only do something if there is some table inside
+ Iterable<EObject> ite = TableContentsUtils.createDescendantTablesIterable(objectToControl);
+ return ite.iterator().hasNext();
+
+ }
+
+ public ICommand getPreControlCommand(ControlModeRequest request) {
+ // don't create the di resource since it is handled by the sash participant
+ return null;
+ }
+
+ public ICommand getPostControlCommand(ControlModeRequest request) {
+ return new ControlTableCommand(request);
+ }
+
+ public boolean provideUnControlCommand(ControlModeRequest request) {
+ return provideControlCommand(request);
+ }
+
+ public ICommand getPreUncontrolCommand(ControlModeRequest request) {
+ return new ControlTableCommand(request);
+ }
+
+ public ICommand getPostUncontrolCommand(ControlModeRequest request) {
+ // don't remove the di resource since it is handled by the sash participant
+ return null;
+ }
+}

Back to the top