Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2011-05-03 09:02:30 +0000
committervlorenzo2011-05-03 09:02:30 +0000
commite9efb6ca85188a207ef4f83afc8b15ea602b8d58 (patch)
tree675e6b5d157ac4908c31e3ce63fe857127749dcf /incoming
parent73ea046e74078dc9ffb98c2e15653edf9e96ef98 (diff)
downloadorg.eclipse.papyrus-e9efb6ca85188a207ef4f83afc8b15ea602b8d58.tar.gz
org.eclipse.papyrus-e9efb6ca85188a207ef4f83afc8b15ea602b8d58.tar.xz
org.eclipse.papyrus-e9efb6ca85188a207ef4f83afc8b15ea602b8d58.zip
NEW - bug 334240: [Enhancement] [TableEditor] Papyrus shall support Tabular Editors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334240 Remove the deprecated action AddToCurrentTable
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.table.menu/META-INF/MANIFEST.MF1
-rw-r--r--incoming/org.eclipse.papyrus.table.menu/plugin.xml12
-rw-r--r--incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/actions/AddToCurrentTableAction.java200
-rw-r--r--incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/handler/AddToCurrentTableHandler.java88
-rw-r--r--incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/providers/HandlerStateSourceProvider.java114
5 files changed, 0 insertions, 415 deletions
diff --git a/incoming/org.eclipse.papyrus.table.menu/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.table.menu/META-INF/MANIFEST.MF
index d65619c5504..2ee76c11a18 100644
--- a/incoming/org.eclipse.papyrus.table.menu/META-INF/MANIFEST.MF
+++ b/incoming/org.eclipse.papyrus.table.menu/META-INF/MANIFEST.MF
@@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.core.expressions,
org.eclipse.emf.facet.widgets.nattable.instance;bundle-version="0.1.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.table.menu,
- org.eclipse.papyrus.table.menu.actions,
org.eclipse.papyrus.table.menu.handler,
org.eclipse.papyrus.table.menu.providers
Bundle-Vendor: %providerName
diff --git a/incoming/org.eclipse.papyrus.table.menu/plugin.xml b/incoming/org.eclipse.papyrus.table.menu/plugin.xml
index ac2c5fd81c3..f35cf67cecb 100644
--- a/incoming/org.eclipse.papyrus.table.menu/plugin.xml
+++ b/incoming/org.eclipse.papyrus.table.menu/plugin.xml
@@ -4,11 +4,6 @@
<extension
point="org.eclipse.ui.commands">
<command
- categoryId="org.eclipse.papyrus.editor.category"
- id="org.eclipse.papyrus.table.menu.add.in.table"
- name="Add in current table">
- </command>
- <command
categoryId="org.eclipse.emf.facet.widgets.nattable.command.category"
defaultHandler="org.eclipse.papyrus.table.menu.handler.CommonColumnHandler"
description="Show only the common columns"
@@ -31,13 +26,6 @@
</state>
</command>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.table.menu.handler.AddToCurrentTableHandler"
- commandId="org.eclipse.papyrus.table.menu.add.in.table">
- </handler>
- </extension>
<!-- We remove this action, between, now we have the Drag&Drop -->
<!--
<extension
diff --git a/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/actions/AddToCurrentTableAction.java b/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/actions/AddToCurrentTableAction.java
deleted file mode 100644
index 47f83c3dc05..00000000000
--- a/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/actions/AddToCurrentTableAction.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*****************************************************************************
- * 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.table.menu.actions;
-
-
-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.ecore.EObject;
-import org.eclipse.emf.facet.widgets.nattable.INatTableWidget;
-import org.eclipse.emf.facet.widgets.nattable.INatTableWidgetProvider;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.sasheditor.editor.ISashWindowsContainer;
-import org.eclipse.papyrus.table.common.editor.AbstractNattableEditor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This action allows to add selected elements in the model explorer in the last opened table
- *
- *
- * @deprecated : the drag&drop replaces this action
- */
-@Deprecated
-public class AddToCurrentTableAction {
-
- /**
- * The selected elements
- */
- private List<EObject> selectedElements;
-
- /**
- *
- * Constructor.
- *
- * @param selectedElements
- * the selected elements
- */
- public AddToCurrentTableAction(List<EObject> selectedElements) {
- this.selectedElements = selectedElements;
- }
-
- /**
- *
- * @return
- * the builded command
- */
- protected Command getBuildedCommand() {
- return new ICommandProxy(new MyAddCommand(getEditingDomain()));
- }
-
- /**
- * The command to add selected elements into the table
- *
- *
- *
- */
- public class MyAddCommand extends AbstractTransactionalCommand {
-
- /**
- *
- * Constructor.
- *
- * @param domain
- * the domain for this command
- */
- public MyAddCommand(TransactionalEditingDomain domain) {
- super(domain, "", null); //$NON-NLS-1$
- }
-
- /**
- *
- * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.core.runtime.IAdaptable)
- *
- * @param monitor
- * @param info
- * @return
- * @throws ExecutionException
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- //we add the rows to the widget, which owns the Table!
- AbstractNattableEditor editor = getCurrentTableEditor();
- INatTableWidgetProvider provider = (INatTableWidgetProvider)editor.getAdapter(INatTableWidgetProvider.class);
- if(provider != null) {
- INatTableWidget natTableWidget = provider.getNatTableWidget();
-
- natTableWidget.addRows(getSelection());
- }
- return CommandResult.newOKCommandResult();
- }
-
- }
-
- /**
- *
- * @return
- */
- public Command getCommand() {
- if(isEnabled()) {
- return getBuildedCommand();
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- protected boolean isEnabled() {
- if(getSelection().isEmpty() || getCurrentTableEditor() == null) {
- return false;
- }
- return true;
- }
-
- private List<EObject> getSelection() {
- // for(EObject current : selectedElements) {
- // AbstractNattableEditor editor = getCurrentTableEditor();
- // NatTableWidget natTableWidget = editor.getNatTableWidget();
- // //TODO : managed with the query!
- // boolean accept = natTableWidget.acceptsElement(current);
- // int dummy = 0;
- // dummy++;
- // }
- return this.selectedElements;
- }
-
- /**
- *
- * @return
- * the current table editor
- */
- protected AbstractNattableEditor getCurrentTableEditor() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if(workbench != null) {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IWorkbenchPage activePage = workbenchWindow.getActivePage();
- if(activePage != null) {
- IEditorPart activeEditor = activePage.getActiveEditor();
- ISashWindowsContainer container = (ISashWindowsContainer)activeEditor.getAdapter(ISashWindowsContainer.class);
- if(container != null) {
- IEditorPart currentEditor = container.getActiveEditor();
- if(currentEditor instanceof AbstractNattableEditor) {
- return (AbstractNattableEditor)currentEditor;
- }
- }
- }
- }
-
-
- return null;
- }
-
- /**
- *
- * @return
- */
- protected ISashWindowsContainer getISashWindowsContainer() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if(workbench != null) {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IWorkbenchPage activePage = workbenchWindow.getActivePage();
- if(activePage != null) {
- IEditorPart activeEditor = activePage.getActiveEditor();
- return (ISashWindowsContainer)activeEditor.getAdapter(ISashWindowsContainer.class);
- }
- }
- return null;
- }
-
- /**
- * Retrieves the TransactionalEditingDomain
- *
- * @return the editing domain (can be null)
- */
- protected TransactionalEditingDomain getEditingDomain() {
- TransactionalEditingDomain editingDomain = null;
- editingDomain = (TransactionalEditingDomain)getCurrentTableEditor().getEditingDomain();
- return editingDomain;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/handler/AddToCurrentTableHandler.java b/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/handler/AddToCurrentTableHandler.java
deleted file mode 100644
index d96be0441e0..00000000000
--- a/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/handler/AddToCurrentTableHandler.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*****************************************************************************
- * 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.table.menu.handler;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.table.menu.actions.AddToCurrentTableAction;
-import org.eclipse.ui.PlatformUI;
-
-/**
- *
- *
- * This handler is used to add element in a open table
- *
- * @deprecated : a drop action provided by the Model Explorer replaces this action
- */
-@Deprecated
-public class AddToCurrentTableHandler extends org.eclipse.papyrus.diagram.menu.actions.handlers.AbstractGraphicalCommandHandler {
-
- /**
- *
- * Constructor.
- *
- */
- public AddToCurrentTableHandler() {
- super(""); //$NON-NLS-1$
- }
-
- /**
- *
- * @see org.eclipse.papyrus.diagram.menu.actions.handlers.AbstractGraphicalCommandHandler#getCommand()
- *
- * @return
- * @throws ExecutionException
- */
- @Override
- protected Command getCommand() throws ExecutionException {
- AddToCurrentTableAction action = new AddToCurrentTableAction(getSelection());
- return action.getCommand();
- }
-
- /**
- *
- * @return
- * the selected element
- */
- protected List<EObject> getSelection() {
- List<EObject> selectedElements = new ArrayList<EObject>();
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if(selection instanceof IStructuredSelection) {
-
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
-
- Iterator<?> it = structuredSelection.iterator();
- while(it.hasNext()) {
- Object object = it.next();
- if(object instanceof IAdaptable) {
- EObject currentEObject = (EObject)((IAdaptable)object).getAdapter(EObject.class);
-
- if(currentEObject != null) {
- selectedElements.add(currentEObject);
- }
- }
-
- }
- }
- return selectedElements;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/providers/HandlerStateSourceProvider.java b/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/providers/HandlerStateSourceProvider.java
deleted file mode 100644
index 2764644e545..00000000000
--- a/incoming/org.eclipse.papyrus.table.menu/src/org/eclipse/papyrus/table/menu/providers/HandlerStateSourceProvider.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*****************************************************************************
- * 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.table.menu.providers;
-
-/*****************************************************************************
- * Copyright (c) 2010 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
- *
- *****************************************************************************/
-
-
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.papyrus.diagram.common.providers.AbstractActionStateSourceProvider;
-import org.eclipse.papyrus.table.menu.handler.AddToCurrentTableHandler;
-import org.eclipse.ui.ISources;
-
-/**
- * This class provides the state of the Handlers. It's used to refresh
- * the status of these Handlers in the menu. (in toolbar and popup, it's not needed)
- *
- * To get the status, we listen the selection service AND the part service!
- * The part service is used to know if the selection is in the Model Explorer or not!
- * When the selection is not in the model explorer, the handlers listening the variable need to be disabled
- */
-public class HandlerStateSourceProvider extends AbstractActionStateSourceProvider {
-
- /**
- * The names of the variable to check.
- */
- public static final String ADD_TO_TABLE = "addToOpenedTable"; //$NON-NLS-1$
-
- /**
- *
- * Constructor.
- *
- */
- public HandlerStateSourceProvider() {
- super();
- currentState.put(ADD_TO_TABLE, DISABLED);
- }
-
-
- /**
- *
- * @see org.eclipse.ui.ISourceProvider#getProvidedSourceNames()
- *
- * @return
- */
- @Override
- public String[] getProvidedSourceNames() {
- return new String[]{ ADD_TO_TABLE };
-
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.diagram.common.providers.AbstractActionStateSourceProvider#refreshActions()
- *
- */
- @Override
- protected void refreshActions() {
- refresh(ADD_TO_TABLE, new AddToCurrentTableHandler());
- }
-
- /**
- * Refresh the state of the handlers
- *
- * @param key
- * the key used to refresh the handler status
- * @param handler
- * the handler to refresh
- */
- protected void refresh(String key, AbstractHandler handler) {
- String oldState = currentState.get(key);
- String newState = (test(handler) ? ENABLED : DISABLED);
-
- if(oldState != newState) {
- currentState.put(key, newState);
- fireSourceChanged(ISources.WORKBENCH, key, newState);
- }
- }
-
- /**
- *
- * @param handler
- * the handler to refresh
- * @return
- * <code>true</code> if the status of the handler is enabled
- */
- protected boolean test(AbstractHandler handler) {
- return handler.isEnabled();
- }
-}

Back to the top