Bug 563885: [Model2Doc] Remove old menu Generate ODT File (from a DocumentStructure)
Change-Id: I3974eae70532f97ec215952dbd129d5dca270329
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
diff --git a/plugins/emf/org.eclipse.papyrus.model2doc.emf.structure2document/src/org/eclipse/papyrus/model2doc/emf/structure2document/internal/messages/messages.properties b/plugins/emf/org.eclipse.papyrus.model2doc.emf.structure2document/src/org/eclipse/papyrus/model2doc/emf/structure2document/internal/messages/messages.properties
index c488cb2..1de186f 100755
--- a/plugins/emf/org.eclipse.papyrus.model2doc.emf.structure2document/src/org/eclipse/papyrus/model2doc/emf/structure2document/internal/messages/messages.properties
+++ b/plugins/emf/org.eclipse.papyrus.model2doc.emf.structure2document/src/org/eclipse/papyrus/model2doc/emf/structure2document/internal/messages/messages.properties
@@ -1,2 +1,2 @@
-FileGenerationMenuContributionItem_GenerateDocument=Generate Document (NEW)
-FileGenerationMenuContributionItem_GenerateDocumentWithLabel=Generate Document ({0}) (NEW)
+FileGenerationMenuContributionItem_GenerateDocument=Generate Document
+FileGenerationMenuContributionItem_GenerateDocumentWithLabel=Generate Document ({0})
diff --git a/plugins/odt/org.eclipse.papyrus.model2doc.odt.emf.structure2document/plugin.xml b/plugins/odt/org.eclipse.papyrus.model2doc.odt.emf.structure2document/plugin.xml
index dd13161..dcd9af6 100755
--- a/plugins/odt/org.eclipse.papyrus.model2doc.odt.emf.structure2document/plugin.xml
+++ b/plugins/odt/org.eclipse.papyrus.model2doc.odt.emf.structure2document/plugin.xml
@@ -2,70 +2,6 @@
<?eclipse version="3.4"?>
<plugin>
<extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.ui.popup.any">
- <command
- commandId="org.eclipse.papyrus.model2doc.odt.emf.structure2document.generate.file"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <and>
- <count
- value="1">
- </count>
- <iterate
- ifEmpty="false">
- <adapt
- type="org.eclipse.emf.ecore.EObject">
- <instanceof
- value="org.eclipse.papyrus.model2doc.emf.documentstructure.TextDocument">
- </instanceof>
- </adapt>
- </iterate>
- </and>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- id="org.eclipse.papyrus.model2doc.odt.emf.structure2document.generate.file"
- name="Generate ODT File">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.model2doc.odt.emf.structure2document.internal.handler.GenerateODTFileHandler"
- commandId="org.eclipse.papyrus.model2doc.odt.emf.structure2document.generate.file">
- <activeWhen>
- <with
- variable="selection">
- <and>
- <count
- value="1">
- </count>
- <iterate
- ifEmpty="false">
- <adapt
- type="org.eclipse.emf.ecore.EObject">
- <instanceof
- value="org.eclipse.papyrus.model2doc.emf.documentstructure.TextDocument">
- </instanceof>
- </adapt>
- </iterate>
- </and>
- </with>
- </activeWhen>
- </handler>
- </extension>
- <extension
point="org.eclipse.papyrus.model2doc.emf.structure2document.documentgenerator">
<generator
class="org.eclipse.papyrus.model2doc.odt.emf.structure2document.internal.generators.TextDocumentToODTGenerator"
diff --git a/plugins/odt/org.eclipse.papyrus.model2doc.odt.emf.structure2document/src/org/eclipse/papyrus/model2doc/odt/emf/structure2document/internal/handler/GenerateODTFileHandler.java b/plugins/odt/org.eclipse.papyrus.model2doc.odt.emf.structure2document/src/org/eclipse/papyrus/model2doc/odt/emf/structure2document/internal/handler/GenerateODTFileHandler.java
deleted file mode 100755
index 4a4a628..0000000
--- a/plugins/odt/org.eclipse.papyrus.model2doc.odt.emf.structure2document/src/org/eclipse/papyrus/model2doc/odt/emf/structure2document/internal/handler/GenerateODTFileHandler.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2019 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 548896
- *****************************************************************************/
-package org.eclipse.papyrus.model2doc.odt.emf.structure2document.internal.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.model2doc.emf.documentstructure.TextDocument;
-import org.eclipse.papyrus.model2doc.emf.template2structure.utils.GenerateDocumentStructureUtils;
-import org.eclipse.papyrus.model2doc.odt.emf.structure2document.internal.utils.GenerateODTFileUtils;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This handler allows to generate the LibreOffice odt file from a DocumentStructure
- */
-public class GenerateODTFileHandler extends AbstractHandler {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final TextDocument docTemplate = getSelectedTextDocument();
- if (null != docTemplate) {
- GenerateODTFileUtils.generateODTFile(docTemplate);
-
- // open a dialog add the end of the generation
- MessageDialog.openInformation(Display.getDefault().getActiveShell(), GenerateDocumentStructureUtils.DIALOG_TITLE, "The odt file has been generated."); //$NON-NLS-1$
- }
-
- return null;
- }
-
-
-
-
- // TODO : duplicated from GenerateDocumentStructureHandler
- // TODO : check it is a TextDocumentStructure
-
- /**
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- // super.setEnabled(evaluationContext);
- // if (isEnabled()) {
- setBaseEnabled(null != getSelectedTextDocument());
- // }
- }
-
-
- /**
- *
- * @return
- * the first selected document template
- */
- private TextDocument getSelectedTextDocument() {
- Object firstSelectedElement = null;
- final IWorkbench wb = PlatformUI.getWorkbench();
- if (null != wb) {
- final IWorkbenchWindow wW = wb.getActiveWorkbenchWindow();
- if (null != wW) {
- final ISelectionService ss = wW.getSelectionService();
- if (null != ss) {
- final ISelection selection = ss.getSelection();
- if (selection instanceof IStructuredSelection && false == selection.isEmpty()) {
- firstSelectedElement = ((IStructuredSelection) selection).getFirstElement();
- }
- }
- }
- }
- if (firstSelectedElement instanceof IAdaptable) {
- firstSelectedElement = ((IAdaptable) firstSelectedElement).getAdapter(EObject.class);
- }
- if (firstSelectedElement instanceof TextDocument) {
- return (TextDocument) firstSelectedElement;
- }
-
- return null;
- }
-}