Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2011-10-25 08:13:50 -0400
committercletavernie2011-10-25 08:13:50 -0400
commitb6498085b422c97948ada677aadf5bb547a94aa1 (patch)
tree6d8c1355f6b689b07ecda7d2e87b9a6eca593b14 /plugins/views/documentation
parent53e1f7c9887b09735e633233b454580dc8a6a40c (diff)
downloadorg.eclipse.papyrus-b6498085b422c97948ada677aadf5bb547a94aa1.tar.gz
org.eclipse.papyrus-b6498085b422c97948ada677aadf5bb547a94aa1.tar.xz
org.eclipse.papyrus-b6498085b422c97948ada677aadf5bb547a94aa1.zip
359057: [Architecture - SVN - Build] The Papyrus architecture should be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359057
Diffstat (limited to 'plugins/views/documentation')
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.classpath7
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.project28
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/META-INF/MANIFEST.MF12
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/about.html28
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/build.properties7
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.properties12
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.xml11
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java166
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java93
9 files changed, 364 insertions, 0 deletions
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.classpath b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.classpath
new file mode 100644
index 00000000000..9d5026e8ffd
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.project b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.project
new file mode 100644
index 00000000000..28756425437
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.documentation.view.papyrus</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/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/META-INF/MANIFEST.MF b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..c16dadec4cf
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.documentation.view.papyrus;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.papyrus.documentation.view;bundle-version="0.7.3",
+ org.eclipse.papyrus.modelexplorer;bundle-version="0.7.3",
+ org.eclipse.papyrus.core.adaptor.gmf;bundle-version="0.7.3",
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.1.0"
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/about.html b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/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/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/build.properties b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/build.properties
new file mode 100644
index 00000000000..4aee4b2146a
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:51 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,about.html,plugin.properties
+output..=bin/
+src.includes=about.html,META-INF/,.,plugin.xml,plugin.properties
+source..=src/
+bin..=bin/
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.properties b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.properties
new file mode 100644
index 00000000000..ef2d995ea65
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2010 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
+#
+# Contributors:
+# Atos Origin - Initial API and Implementation
+##################################################################################
+pluginName=Papyrus integration of the documentation view (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.xml b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.xml
new file mode 100644
index 00000000000..14936603acd
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.documentation.view.documentationPartHandler">
+ <documentationPartHandler
+ documentationPartHandler="org.eclipse.papyrus.documentation.view.papyrus.PapyrusDocumentationPartHandler">
+ </documentationPartHandler>
+ </extension>
+
+</plugin>
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
new file mode 100644
index 00000000000..ceb1f03dd50
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
@@ -0,0 +1,166 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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
+ *
+ * Contributors:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.documentation.view.papyrus;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.core.adaptor.gmf.DiagramsUtil;
+import org.eclipse.papyrus.core.editor.CoreMultiDiagramEditor;
+import org.eclipse.papyrus.documentation.DocumentationManager;
+import org.eclipse.papyrus.documentation.IDocumentationManager;
+import org.eclipse.papyrus.documentation.view.IDocumentationPartHandler;
+import org.eclipse.papyrus.documentation.view.SelectResourceDialog;
+import org.eclipse.papyrus.modelexplorer.MoDiscoContentProvider;
+import org.eclipse.papyrus.modelexplorer.MoDiscoLabelProvider;
+import org.eclipse.papyrus.modelexplorer.ModelExplorerPageBookView;
+import org.eclipse.papyrus.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+
+
+public class PapyrusDocumentationPartHandler implements IDocumentationPartHandler {
+
+ public boolean canHandlePart(IWorkbenchPart part) {
+ return part instanceof CoreMultiDiagramEditor || part instanceof ModelExplorerPageBookView;
+ }
+
+ public IDocumentationManager getDocumentationManager() {
+ return DocumentationManager.getInstance();
+ }
+
+ public void executeCommand(IWorkbenchPart part, Command cmd) {
+ CoreMultiDiagramEditor editor = getPapyrusEditor(part);
+ if(editor != null && cmd != null) {
+ TransactionalEditingDomain domain = (TransactionalEditingDomain)editor.getEditingDomain();
+ domain.getCommandStack().execute(cmd);
+ }
+ }
+
+ public EObject getAssociatedDiagram(IWorkbenchPart part, EObject eObject) {
+ if(eObject instanceof Diagram) {
+ return null;
+ }
+
+ if(eObject != null) {
+ if(part instanceof IDiagramWorkbenchPart) {
+ Diagram currentDiagram = ((IDiagramWorkbenchPart)part).getDiagram();
+ if(currentDiagram != null && eObject.equals(currentDiagram.getElement())) {
+ return currentDiagram;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void openElement(IWorkbenchPart part, URI elementUri) {
+ try {
+ CoreMultiDiagramEditor editor = getPapyrusEditor(part);
+ if(editor != null) {
+ EditingDomain ed = editor.getEditingDomain();
+ if(ed != null) {
+ EObject eObject = ed.getResourceSet().getEObject(elementUri, false);
+ Diagram diagram = null;
+ if(eObject instanceof Diagram) {
+ diagram = (Diagram)eObject;
+ } else {
+ List<Diagram> diagrams = DiagramsUtil.getAssociatedDiagrams(eObject, null);
+ if(!diagrams.isEmpty()) {
+ diagram = diagrams.get(0);
+ }
+ }
+ if(diagram != null) {
+ IPageMngr pageMngr = (IPageMngr)editor.getAdapter(IPageMngr.class);
+ if(pageMngr != null) {
+ if(pageMngr.isOpen(diagram)) {
+ pageMngr.closePage(diagram);
+ }
+ pageMngr.openPage(diagram);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ public EObject openElementSelectionDialog(IWorkbenchPart part) {
+ Object selectedElement = null;
+ CoreMultiDiagramEditor editor = getPapyrusEditor(part);
+ if(editor != null) {
+ ISelectionStatusValidator validator = new ISelectionStatusValidator() {
+
+ public IStatus validate(Object[] selectedElements) {
+ boolean enableOK = false;
+ if(selectedElements.length == 1) {
+ Object selectedElement = selectedElements[0];
+ if(adapt(selectedElement) != null) {
+ enableOK = true;
+ }
+ }
+
+ String msg = "";
+ if(enableOK == false) {
+ msg = "Only one EObject can be selected";
+ }
+ return enableOK ? new Status(IStatus.OK, "org.eclipse.emf.common.ui", 0, msg, null) : new Status(IStatus.ERROR, "org.eclipse.emf.common.ui", 0, msg, null);
+ }
+ };
+ selectedElement = SelectResourceDialog.openElementSelection(editor.getServicesRegistry(), new MoDiscoLabelProvider(), new MoDiscoContentProvider(), validator, null, true);
+ }
+ return adapt(selectedElement);
+ }
+
+ public boolean isReadOnly(IWorkbenchPart part, EObject eObject) {
+ CoreMultiDiagramEditor editor = getPapyrusEditor(part);
+ if(editor != null && eObject != null) {
+ TransactionalEditingDomain domain = (TransactionalEditingDomain)editor.getEditingDomain();
+ return domain.isReadOnly(eObject.eResource());
+ }
+ return false;
+ }
+
+ private static EObject adapt(Object obj) {
+ if(obj instanceof EObject) {
+ return (EObject)obj;
+ } else if(obj instanceof IAdaptable) {
+ EObject adapted = (EObject)((IAdaptable)obj).getAdapter(EObject.class);
+ return adapted;
+ }
+ return null;
+ }
+
+ private static CoreMultiDiagramEditor getPapyrusEditor(IWorkbenchPart part) {
+ if(part instanceof CoreMultiDiagramEditor) {
+ return (CoreMultiDiagramEditor)part;
+ }
+ IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(activeEditor instanceof CoreMultiDiagramEditor) {
+ return (CoreMultiDiagramEditor)activeEditor;
+ }
+ return null;
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java
new file mode 100644
index 00000000000..167ec8f1381
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view.papyrus/src/org/eclipse/papyrus/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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
+ *
+ * Contributors:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.documentation.view.papyrus;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
+
+
+public class TransactionalUncheckedCommandProxy extends AbstractTransactionalCommand {
+
+ /** The wrapped command */
+ private Command command;
+
+ public TransactionalUncheckedCommandProxy(TransactionalEditingDomain editingDomain, Command command) {
+ super(editingDomain, (command.getLabel() == null) ? StringStatics.BLANK : command.getLabel(), null);
+ Assert.isNotNull(command);
+ this.command = command;
+ addContext(new EditingDomainUndoContext(editingDomain));
+ }
+
+ protected CommandResult doExecuteWithResult(
+ IProgressMonitor progressMonitor, IAdaptable info)
+ throws ExecutionException {
+
+ command.execute();
+ return CommandResult.newOKCommandResult();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ command.undo();
+ setResult(CommandResult.newOKCommandResult());
+
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus doRedo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ command.redo();
+ setResult(CommandResult.newOKCommandResult());
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Returns the wrapped command.
+ *
+ * @return Command
+ */
+ public Command getCommand() {
+ return command;
+ }
+
+ public boolean canUndo() {
+ return command.canUndo();
+ }
+
+ public boolean canExecute() {
+ return command.canExecute();
+ }
+
+ public boolean canRedo() {
+ return canExecute() && canUndo();
+ }
+
+ public void dispose() {
+ super.dispose();
+ command.dispose();
+ }
+}

Back to the top