Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2019-04-30 05:31:33 -0400
committervincent lorenzo2019-08-22 10:22:54 -0400
commit22e3ae08156aaaed0a1a3767a95e70f7bb9ec0f0 (patch)
tree69d9f64ea0ab354fef6bd7f1b23d35a273f04fef /plugins
parent5c5a7ce5063b1a82749b8cbca2b38c03a7934641 (diff)
downloadorg.eclipse.papyrus-22e3ae08156aaaed0a1a3767a95e70f7bb9ec0f0.tar.gz
org.eclipse.papyrus-22e3ae08156aaaed0a1a3767a95e70f7bb9ec0f0.tar.xz
org.eclipse.papyrus-22e3ae08156aaaed0a1a3767a95e70f7bb9ec0f0.zip
Bug 546686: [SashEditor] Remove internal dependencies
* Remove dependence to ErrorEditorPart ** Use the EMF ProblemEditorPart instead ** Override it to have the ShowErrorLogView button Depend on EMF patch https://git.eclipse.org/r/#/c/141391/ Change-Id: I29f2d4fb196c9f1fbde2974367dd243afe0ab001 Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/pom.xml2
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/EditorPart.java19
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/Messages.java33
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PapyrusProblemEditorPart.java74
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/messages.properties1
6 files changed, 124 insertions, 10 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF
index 7e99193a84d..4fddb646cfe 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF
@@ -18,9 +18,10 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.107.0,4.0.0)";visibility:=reex
org.eclipse.e4.core.contexts;bundle-version="[1.5.0,2.0.0)";resolution:=optional,
org.eclipse.e4.ui.model.workbench;bundle-version="[1.2.0,3.0.0)";resolution:=optional,
org.eclipse.core.expressions;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.papyrus.infra.tools;bundle-version="[3.1.0,4.0.0)"
+ org.eclipse.papyrus.infra.tools;bundle-version="[3.1.0,4.0.0)",
+ org.eclipse.emf.common.ui;bundle-version="[2.18.0,3.0.0)"
Bundle-Vendor: %providerName
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.1.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.infra.core.sasheditor.Activator
Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor;singleton:=true
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/pom.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/pom.xml
index e6061cf1644..1eda4c3667f 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/pom.xml
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/pom.xml
@@ -9,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.core.sasheditor</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>2.1.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/EditorPart.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/EditorPart.java
index 26363b3e95f..5d58681b68b 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/EditorPart.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/EditorPart.java
@@ -12,7 +12,7 @@
* Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
* Christian W. Damus - bugs 469188, 474467, 494543
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 546686
- *
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 546686
*****************************************************************************/
package org.eclipse.papyrus.infra.core.sasheditor.internal;
@@ -24,11 +24,14 @@ import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.core.sasheditor.Activator;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.AbstractPageModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.AbstractPart.GarbageState;
import org.eclipse.papyrus.infra.core.sasheditor.internal.dnd.IDropTarget;
import org.eclipse.papyrus.infra.core.sasheditor.internal.eclipsecopy.IMultiPageEditorSite;
import org.eclipse.papyrus.infra.core.sasheditor.internal.eclipsecopy.MultiPageEditorSite;
@@ -51,7 +54,6 @@ import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.ErrorEditorPart;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.ui.part.IWorkbenchPartOrientation;
@@ -63,7 +65,6 @@ import org.eclipse.ui.part.IWorkbenchPartOrientation;
* @author dumoulin
* @author <a href="mailto:thomas.szadel@atosorigin.com">Thomas SZADEL</a> Improve the error text (avoid NPE)
*/
-@SuppressWarnings("restriction")
public class EditorPart extends PagePart implements IEditorPage {
/**
@@ -211,11 +212,15 @@ public class EditorPart extends PagePart implements IEditorPage {
private void createErrorEditorPart(Composite parent, Exception e) {
try {
- PartInitException partInitException = new PartInitException(StatusUtils.getLocalizedMessage(e), StatusUtils.getCause(e));
- editorPart = new ErrorEditorPart(partInitException.getStatus());
- // Initialize it and create its controls.
+ BasicDiagnostic basicDiagnostic = new BasicDiagnostic();
+ basicDiagnostic.add(new BasicDiagnostic(Diagnostic.ERROR,
+ Activator.PLUGIN_ID,
+ 0,
+ StatusUtils.getLocalizedMessage(e),
+ new Object[] { e }));
+ editorPart = new PapyrusProblemEditorPart();
+ ((PapyrusProblemEditorPart) editorPart).setDiagnostic(basicDiagnostic);
editorControl = createEditorPartControl(parent, editorPart);
-
} catch (Exception ex) {
// Even the ErrorEditorPart creation fail.
// Use a more simple renderer.
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/Messages.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/Messages.java
new file mode 100644
index 00000000000..ec22677d4ea
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/Messages.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST and others.
+ *
+ * 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
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.core.sasheditor.internal.messages"; //$NON-NLS-1$
+ public static String PapyrusProblemEditorPart_ShowErrorLogView;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PapyrusProblemEditorPart.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PapyrusProblemEditorPart.java
new file mode 100644
index 00000000000..ab68f073041
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PapyrusProblemEditorPart.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST and others.
+ *
+ * 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
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.internal;
+
+import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
+import org.eclipse.papyrus.infra.core.sasheditor.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.IViewDescriptor;
+
+/**
+ * The class add a button to the {@link ProblemEditorPart} to be able to open the Error Log View
+ */
+public class PapyrusProblemEditorPart extends ProblemEditorPart {
+
+ private static final String LOG_VIEW_ID = "org.eclipse.pde.runtime.LogView"; //$NON-NLS-1$
+
+ /**
+ * @see org.eclipse.emf.common.ui.editor.ProblemEditorPart#createButtons(org.eclipse.swt.widgets.Composite)
+ *
+ * @param buttonComposite
+ */
+ @Override
+ protected void createButtons(Composite buttonComposite) {
+ editorToOpen = null; // this allow to remove the OpenInEditor button since we don't know which file to open
+ super.createButtons(buttonComposite);
+ createShowLogButton(buttonComposite);
+ }
+
+ /**
+ * Create the show log button
+ *
+ * @param parent
+ * the parent composite of the button
+ */
+ private void createShowLogButton(Composite parent) {
+ IViewDescriptor descriptor = PlatformUI.getWorkbench().getViewRegistry().find(LOG_VIEW_ID);
+ if (descriptor == null) {
+ return;
+ }
+ Button button = new Button(parent, SWT.PUSH);
+ button.addSelectionListener(widgetSelectedAdapter(e -> {
+ try {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(LOG_VIEW_ID);
+ } catch (CoreException ce) {
+ Activator.log.error(ce);
+ }
+ }));
+ final Image image = descriptor.getImageDescriptor().createImage();
+ button.setImage(image);
+ button.setToolTipText(Messages.PapyrusProblemEditorPart_ShowErrorLogView);
+ button.addDisposeListener(e -> image.dispose());
+ }
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/messages.properties b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/messages.properties
new file mode 100644
index 00000000000..df882a03569
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/messages.properties
@@ -0,0 +1 @@
+PapyrusProblemEditorPart_ShowErrorLogView=Show the Error Log View

Back to the top