Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-08-03 10:06:22 +0000
committervlorenzo2012-08-03 10:06:22 +0000
commit092fe24a1b487ba375714e9e862de4118c33f368 (patch)
tree476e642ab7951ba2e49f6b82ee0a0867605d5944 /incoming
parent12a0752d811b41eb7505c8ba7e4be2d439738f13 (diff)
downloadorg.eclipse.papyrus-092fe24a1b487ba375714e9e862de4118c33f368.tar.gz
org.eclipse.papyrus-092fe24a1b487ba375714e9e862de4118c33f368.tar.xz
org.eclipse.papyrus-092fe24a1b487ba375714e9e862de4118c33f368.zip
Share the new projects for the new tables in Papyrus
Diffstat (limited to 'incoming')
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/META-INF/MANIFEST.MF11
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/build.properties3
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/plugin.xml12
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/AbstractTableEFacetHandler.java58
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DeleteTableEFacetHandler.java79
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DuplicateTableEFacetHandler.java80
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/RenameTableEFacetHandler.java84
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/Messages.java21
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/messages.properties3
9 files changed, 347 insertions, 4 deletions
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/META-INF/MANIFEST.MF b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/META-INF/MANIFEST.MF
index a97d4002477..a815ce5b89a 100644
--- a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/META-INF/MANIFEST.MF
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/META-INF/MANIFEST.MF
@@ -1,11 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Table Modelexplorer (Incubation)
-Bundle-SymbolicName: org.eclipse.papyrus.infra.table.efacet.modelexplorer
+Bundle-Name: EFacetTable Modelexplorer (Incubation)
+Bundle-SymbolicName: org.eclipse.papyrus.infra.table.efacet.modelexplorer;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Activator: org.eclipse.papyrus.infra.table.efacet.modelexplorer.Activator
Bundle-Vendor: Eclipse Modeling Project
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.papyrus.views.modelexplorer,
+ org.eclipse.papyrus.infra.table.efacet.metamodel;bundle-version="0.9.0",
+ org.eclipse.emf.transaction,
+ org.eclipse.gmf.runtime.emf.type.core
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/build.properties b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/build.properties
index 41eb6ade2b4..6f20375d6c7 100644
--- a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/build.properties
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/build.properties
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/plugin.xml b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/plugin.xml
new file mode 100644
index 00000000000..73413a251b4
--- /dev/null
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/plugin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+<extension point="org.eclipse.ui.handlers">
+ <handler class="org.eclipse.papyrus.infra.table.efacet.modelexplorer.handlers.DeleteTableEFacetHandler" commandId="org.eclipse.ui.edit.delete">
+ </handler>
+ <handler class="org.eclipse.papyrus.infra.table.efacet.modelexplorer.handlers.DuplicateTableEFacetHandler" commandId="org.eclipse.papyrus.views.modelexplorer.duplicate.command">
+ </handler>
+ <handler class="org.eclipse.papyrus.infra.table.efacet.modelexplorer.handlers.RenameTableEFacetHandler" commandId="org.eclipse.ui.edit.rename">
+ </handler>
+ </extension>
+</plugin>
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/AbstractTableEFacetHandler.java b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/AbstractTableEFacetHandler.java
new file mode 100644
index 00000000000..9814e0cb650
--- /dev/null
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/AbstractTableEFacetHandler.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.efacet.modelexplorer.handlers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler;
+import org.eclipse.ui.PlatformUI;
+
+
+public abstract class AbstractTableEFacetHandler extends AbstractCommandHandler {
+
+ /**
+ * Returns the list of selected tables
+ *
+ * @return
+ * the list of selected tables
+ */
+ protected List<PapyrusTable> getSelectedTables() {
+ final List<PapyrusTable> tables = new ArrayList<PapyrusTable>();
+ final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+
+ // Get first element if the selection is an IStructuredSelection
+ if(selection instanceof IStructuredSelection) {
+ final IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ final Iterator<?> iter = structuredSelection.iterator();
+ while(iter.hasNext()) {
+ final Object current = iter.next();
+ if(current instanceof IAdaptable) {
+ final EObject table = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(table instanceof PapyrusTable) {
+ tables.add((PapyrusTable)table);
+ }
+ }
+ }
+ }
+ return tables;
+ }
+
+}
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DeleteTableEFacetHandler.java b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DeleteTableEFacetHandler.java
new file mode 100644
index 00000000000..1d41b87c524
--- /dev/null
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DeleteTableEFacetHandler.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.efacet.modelexplorer.handlers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.commands.DestroyElementPapyrusCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
+
+/**
+ * Handler for the delete Table action
+ *
+ *
+ *
+ */
+public class DeleteTableEFacetHandler extends AbstractTableEFacetHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ final TransactionalEditingDomain editingDomain = getEditingDomain();
+ final IPageMngr pageMngr = getPageManager();
+ final List<PapyrusTable> tables = getSelectedTables();
+
+ if(editingDomain != null && pageMngr != null && !tables.isEmpty()) {
+ final CompoundCommand command = new CompoundCommand();
+
+ for(final PapyrusTable table : tables) {
+ final ECrossReferenceAdapter cross = ECrossReferenceAdapter.getCrossReferenceAdapter(table);
+ final Collection<Setting> ref = cross.getInverseReferences(table);
+ final Command sashRemoveComd = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ if(pageMngr.allPages().contains(table)) {
+ if(pageMngr.isOpen(table)) {
+ pageMngr.closePage(table);
+ }
+ pageMngr.removePage(table);
+ }
+ }
+ };
+ // the destroy element command is a good way to destroy the cross reference
+ command.append(sashRemoveComd);
+ command.append(new GMFtoEMFCommandWrapper(new DestroyElementPapyrusCommand(new DestroyElementRequest(table, false))));
+ }
+ return command.isEmpty() ? UnexecutableCommand.INSTANCE : command;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DuplicateTableEFacetHandler.java b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DuplicateTableEFacetHandler.java
new file mode 100644
index 00000000000..20ef92a07a9
--- /dev/null
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/DuplicateTableEFacetHandler.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.efacet.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.infra.table.efacet.modelexplorer.messages.Messages;
+
+/**
+ * This handler provides the duplicate action for the tables
+ *
+ *
+ *
+ */
+public class DuplicateTableEFacetHandler extends AbstractTableEFacetHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ final TransactionalEditingDomain editingDomain = getEditingDomain();
+ final IPageMngr pageManager = getPageManager();
+ final List<PapyrusTable> tables = getSelectedTables();
+
+ if(editingDomain != null && pageManager != null && !tables.isEmpty()) {
+ final CompoundCommand command = new CompoundCommand();
+ for(final PapyrusTable table : tables) {
+
+ // Clone the current diagram
+ final PapyrusTable newTable = EcoreUtil.copy(table);
+ // Give a new name
+ newTable.setName(NLS.bind(Messages.DuplicateTableEFacetHandler_CopyOf, table.getName()));
+ final Command addGmfDiagramCmd = new AddCommand(editingDomain, table.eResource().getContents(), newTable);
+ // EMFCommandOperation operation = new
+ // EMFCommandOperation(editingDomain,
+ // addGmfDiagramCmd);
+
+ final Command sashOpenComd = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ pageManager.openPage(newTable);
+ }
+ };
+
+ // TODO : synchronize with Cedric
+ // command.append(operation.getCommand());
+ command.append(addGmfDiagramCmd);
+ command.append(sashOpenComd);
+ }
+ return command.isEmpty() ? UnexecutableCommand.INSTANCE : command;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/RenameTableEFacetHandler.java b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/RenameTableEFacetHandler.java
new file mode 100644
index 00000000000..c3b09ef2540
--- /dev/null
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/handlers/RenameTableEFacetHandler.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.efacet.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.infra.table.efacet.modelexplorer.messages.Messages;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * This handler provides the method to rename a Table
+ *
+ *
+ *
+ */
+public class RenameTableEFacetHandler extends AbstractTableEFacetHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ final TransactionalEditingDomain editingDomain = getEditingDomain();
+ final List<PapyrusTable> tables = getSelectedTables();
+ if(editingDomain != null && tables.size() == 1) {
+
+ final PapyrusTable table = tables.get(0);
+ final String currentName = table.getName();
+
+ if(currentName != null) {
+
+ final AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "Rename EFacetTable", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) {
+ final InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.RenameTableEFacetHandler_RenameAnExistingTable, Messages.RenameTableEFacetHandler_NewName, currentName, null);
+ if(dialog.open() == Window.OK) {
+ final String name = dialog.getValue();
+ if(name != null && name.length() > 0) {
+ table.setName(name);
+ }
+ return CommandResult.newOKCommandResult();
+ } else {
+ return CommandResult.newCancelledCommandResult();
+ }
+ }
+ };
+ return new GMFtoEMFCommandWrapper(cmd);
+ }
+
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+
+
+
+}
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/Messages.java b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/Messages.java
new file mode 100644
index 00000000000..f572ea6465a
--- /dev/null
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/Messages.java
@@ -0,0 +1,21 @@
+package org.eclipse.papyrus.infra.table.efacet.modelexplorer.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.table.efacet.modelexplorer.messages.messages"; //$NON-NLS-1$
+
+ public static String DuplicateTableEFacetHandler_CopyOf;
+
+ public static String RenameTableEFacetHandler_NewName;
+
+ public static String RenameTableEFacetHandler_RenameAnExistingTable;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/messages.properties b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/messages.properties
new file mode 100644
index 00000000000..cb67e73a298
--- /dev/null
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.modelexplorer/src/org/eclipse/papyrus/infra/table/efacet/modelexplorer/messages/messages.properties
@@ -0,0 +1,3 @@
+DuplicateTableEFacetHandler_CopyOf=Copy_Of
+RenameTableEFacetHandler_NewName=New name
+RenameTableEFacetHandler_RenameAnExistingTable=Rename an existing table

Back to the top