Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java')
-rw-r--r--sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java
new file mode 100644
index 00000000000..60684acc9ac
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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.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.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ *
+ */
+@Deprecated
+public abstract class AbstractTableModelExplorerHandler extends AbstractCommandHandler {
+
+ /**
+ * Returns the list of selected tables
+ *
+ * @return
+ * the list of selected tables
+ */
+ protected List<PapyrusTableInstance> getSelectedTables() {
+ List<PapyrusTableInstance> tables = new ArrayList<PapyrusTableInstance>();
+ ISelection selection = null;
+
+ // Get current selection
+ selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+
+ // Get first element if the selection is an IStructuredSelection
+ if(selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ Iterator<?> iter = structuredSelection.iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable){
+ EObject table = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(table instanceof PapyrusTableInstance){
+ tables.add((PapyrusTableInstance)table);
+ }
+ }
+ }
+ }
+ return tables;
+ }
+
+}

Back to the top