Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-05-29 14:18:56 +0000
committercletavernie2012-05-29 14:18:56 +0000
commit541c3f1fa411b8255cab873b8ce5d2dc278ec63b (patch)
tree3a50ad344c516fcd8c30093d1acb3375775ac715 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline
parentbe859ed5c2c696feba96635366b0be8cde662768 (diff)
downloadorg.eclipse.papyrus-541c3f1fa411b8255cab873b8ce5d2dc278ec63b.tar.gz
org.eclipse.papyrus-541c3f1fa411b8255cab873b8ce5d2dc278ec63b.tar.xz
org.eclipse.papyrus-541c3f1fa411b8255cab873b8ce5d2dc278ec63b.zip
380906: [Outline] The outline is broken on Eclipse 4.2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=380906
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java22
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/internal/Activator.java4
2 files changed, 21 insertions, 5 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
index 63663934ebf..1519fff317b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/DiagramOutline.java
@@ -53,6 +53,8 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
* @author <a href="mailto:yann.tanguy@cea.fr">Yann Tanguy</a>
*/
+//FIXME: The outline is broken in Eclipse 4.2. #createControl(Composite) is never called.
+//See #refresh()
public class DiagramOutline extends Page implements IPapyrusContentOutlinePage, ISelectionListener {
protected EditingDomain editingDomain;
@@ -92,14 +94,14 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
* {@inheritDoc}
*/
public void init(IMultiDiagramEditor multiEditor) throws BackboneException {
-
+
// Get TransactionalEditingDomain
try {
this.editingDomain = multiEditor.getServicesRegistry().getService(TransactionalEditingDomain.class);
} catch (ServiceException e) {
throw new BackboneException("Can't get TransactionalEditingDomain", e);
}
-
+
// Set multieditor.
this.multiEditor = multiEditor;
@@ -110,6 +112,8 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
/**
* {@inheritDoc}
*/
+ //FIXME: In Eclipse 4.2, this method is never called. This results in sashComp being null,
+ //and a NPE being thrown after each selectionChangedEvent
@Override
public void createControl(Composite parent) {
@@ -287,13 +291,12 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
if(multiEditor.getActiveEditor() != null) {
GraphicalViewer viewer = (GraphicalViewer)multiEditor.getActiveEditor().getAdapter(GraphicalViewer.class);
- if( viewer == null)
- { // In case of an editor that is not GEF based.
+ if(viewer == null) { // In case of an editor that is not GEF based.
root = null;
diagram = null;
return;
}
-
+
RootEditPart rootEditPart = viewer.getRootEditPart();
if(rootEditPart instanceof RenderedDiagramRootEditPart) {
@@ -318,6 +321,8 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
/**
* Refresh the outline view
*/
+ //FIXME: Sometimes, this method is called before #createControl(), which results in a NPE with sashComp
+ //Temporary fix : A non-null test has been added to avoid breaking the view
private void refresh() {
// Trash and re-Create Overview
@@ -325,6 +330,13 @@ public class DiagramOutline extends Page implements IPapyrusContentOutlinePage,
overview.dispose();
}
+ //If the view hasn't been created for any reason, we shouldn't do anything.
+ //However, this is still a (minor) problem.
+ if(sashComp == null) {
+ Activator.log.warn("Trying to refresh the Outline view before it is initialized");
+ return;
+ }
+
if(root != null) {
overview = createOverview(sashComp, root);
overview.setLayoutData(new GridData(GridData.FILL_BOTH));
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/internal/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/internal/Activator.java
index 8c5ab16ceae..7cae0f8f60f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/internal/Activator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.outline/src/org/eclipse/papyrus/infra/gmfdiag/outline/internal/Activator.java
@@ -16,6 +16,7 @@ import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -32,6 +33,8 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -47,6 +50,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*

Back to the top