Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraradermache2012-02-17 16:07:26 -0500
committeraradermache2012-02-17 16:07:26 -0500
commit0519fec6ff3906d88533cce71aecdebbfdc26143 (patch)
tree5250cea13f01d6c037a9d71b3a36cfa20fa5aad5 /plugins
parent6706fb7cd1f11ae40a1e866dad9dd3493fc9e95f (diff)
downloadorg.eclipse.papyrus-0519fec6ff3906d88533cce71aecdebbfdc26143.tar.gz
org.eclipse.papyrus-0519fec6ff3906d88533cce71aecdebbfdc26143.tar.xz
org.eclipse.papyrus-0519fec6ff3906d88533cce71aecdebbfdc26143.zip
Fix for bug 371905
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml3
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml2
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java57
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProviderWTooltips.java92
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java121
5 files changed, 116 insertions, 159 deletions
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
index 7b2903e0f57..427a2f6421f 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
@@ -10,7 +10,8 @@
<modelqueryset file="resource/PapyrusBrowserQuery.querySet"/>
</extension>
<extension point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent activeByDefault="true" contentProvider="org.eclipse.papyrus.uml.modelexplorer.UMLContentProvider" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif" id="org.eclipse.papyrus.views.modelexplorer.UMLnavigatorContent" labelProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProviderWTooltips" name="UML Model Contents" priority="lower">
+ <navigatorContent activeByDefault="true" contentProvider="org.eclipse.papyrus.uml.modelexplorer.UMLContentProvider" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif" id="org.eclipse.papyrus.views.modelexplorer.UMLnavigatorContent"
+ labelProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider" name="UML Model Contents" priority="lower">
<triggerPoints>
<or>
<instanceof value="org.eclipse.emf.ecore.EObject">
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
index b13729d5a9a..5794c75162e 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
@@ -21,7 +21,7 @@
</dragAssistant>
</extension>
<extension point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent activeByDefault="false" contentProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoContentProvider" id="org.eclipse.papyrus.views.modelexplorer.navigatorContent" labelProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProviderWTooltips" name="Model Contents" priority="lowest">
+ <navigatorContent activeByDefault="false" contentProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoContentProvider" id="org.eclipse.papyrus.views.modelexplorer.navigatorContent" labelProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider" name="Model Contents" priority="lowest">
<triggerPoints>
<or>
<instanceof value="org.eclipse.emf.ecore.EObject">
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java
new file mode 100644
index 00000000000..ad8489d64a9
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ * History:
+ * Renamed from MoDiscoLabelProviderWTooltips - fix for bug 371905
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.views.modelexplorer;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.internal.navigator.NavigatorDecoratingLabelProvider;
+
+/**
+ * the label provider that inherits of modisco label provider
+ *
+ */
+public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelProvider {
+
+ private MoDiscoLabelProvider moDiscoLP;
+
+ public DecoratingLabelProviderWTooltips(ILabelProvider labelProvider) {
+ super(labelProvider);
+ if(labelProvider instanceof MoDiscoLabelProvider) {
+ moDiscoLP = (MoDiscoLabelProvider)labelProvider;
+ }
+ }
+
+ @Override
+ public String getToolTipText(Object element) {
+ return moDiscoLP.getMarkerMessage(element);
+ }
+
+ @Override
+ public Point getToolTipShift(Object object) {
+ return new Point(5, 5);
+ }
+
+ @Override
+ public int getToolTipDisplayDelayTime(Object object) {
+ return 1000;
+ }
+
+ @Override
+ public int getToolTipTimeDisplayed(Object object) {
+ return 10000;
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProviderWTooltips.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProviderWTooltips.java
deleted file mode 100644
index 5e248483b52..00000000000
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/MoDiscoLabelProviderWTooltips.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************
- * 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:
- * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.views.modelexplorer;
-
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * the label provider that inherits of modisco label provider
- *
- */
-public class MoDiscoLabelProviderWTooltips extends ColumnLabelProvider {
-
- private MoDiscoLabelProvider moDiscoLP;
-
- public MoDiscoLabelProviderWTooltips() {
- moDiscoLP = new MoDiscoLabelProvider ();
- }
-
- @Override
- public String getToolTipText(Object element) {
- return moDiscoLP.getMarkerMessage(element);
- }
-
- @Override
- public Point getToolTipShift(Object object) {
- return new Point(5, 5);
- }
-
- @Override
- public int getToolTipDisplayDelayTime(Object object) {
- return 1000;
- }
-
- @Override
- public int getToolTipTimeDisplayed(Object object) {
- return 10000;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
- */
- public Font getFont(Object element) {
- return moDiscoLP.getFont(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
- public Color getBackground(Object element) {
- return moDiscoLP.getBackground(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
- public Color getForeground(Object element) {
- return moDiscoLP.getForeground(element);
- }
-
-
- /**
- * return the image of an element in the model browser
- * evaluates error markers.
- */
- @Override
- public Image getImage(Object element) {
- return moDiscoLP.getImage(element);
- }
-
- /**
- * @see org.eclipse.gmt.modisco.infra.browser.uicore.CustomizableModelLabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(Object element) {
- return moDiscoLP.getText(element);
- }
-}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
index 2307d76fb85..9815ad77966 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
@@ -40,16 +40,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.ToolTip;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.lifecycleevents.IEditorInputChangedListener;
-import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveAndDirtyService;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.ui.IRevealSemanticElement;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.emf.providers.SemanticFromModelExplorer;
+import org.eclipse.papyrus.modelexplorer.DecoratingLabelProviderWTooltips;
import org.eclipse.papyrus.views.modelexplorer.listener.DoubleClickListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -66,7 +57,6 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.navigator.NavigatorContentService;
-import org.eclipse.ui.internal.navigator.NavigatorDecoratingLabelProvider;
import org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor;
import org.eclipse.ui.navigator.CommonNavigator;
import org.eclipse.ui.navigator.CommonViewer;
@@ -76,6 +66,7 @@ import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.osgi.framework.ServiceException;
/**
* Papyrus Model Explorer associated to one {@link IMultiDiagramEditor}.
@@ -85,20 +76,21 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
*/
public class ModelExplorerView extends CommonNavigator implements IRevealSemanticElement, IEditingDomainProvider {
- /** The associated EditorPart
+ /**
+ * The associated EditorPart
* The View is associated to the ServicesRegistry rather than to an editor.
- * */
-// private IMultiDiagramEditor editorPart;
-
+ * */
+ // private IMultiDiagramEditor editorPart;
+
/**
- * The {@link ServicesRegistry} associated to the Editor. This view is associated to the
+ * The {@link ServicesRegistry} associated to the Editor. This view is associated to the
* ServicesRegistry rather than to the EditorPart.
*/
private ServicesRegistry serviceRegistry;
/** The save aservice associated to the editor. */
private ISaveAndDirtyService saveAndDirtyService;
-
+
/** {@link IUndoContext} used to tag command in the commandStack. */
private IUndoContext undoContext;
@@ -109,7 +101,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
private AtomicBoolean isRefreshing = new AtomicBoolean(false);
/**
- * A listener on page (all editors) selection change. This listener is set
+ * A listener on page (all editors) selection change. This listener is set
* in {@link ModelExplorerView#init(IViewSite)}. It should be dispose to remove
* hook to the Eclipse page.
*/
@@ -119,7 +111,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
handleSelectionChangedFromDiagramEditor(part, selection);
}
};
-
+
/**
* Listener on {@link ISaveAndDirtyService#addInputChangedListener(IEditorInputChangedListener)}
*/
@@ -168,16 +160,16 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
*/
public ModelExplorerView(IMultiDiagramEditor part) {
- if( part == null) {
+ if(part == null) {
throw new IllegalArgumentException("A part should be provided.");
}
-
+
// Try to get the ServicesRegistry
serviceRegistry = part.getServicesRegistry();
- if( serviceRegistry == null) {
+ if(serviceRegistry == null) {
throw new IllegalArgumentException("The part should have a ServiceRegistry.");
}
-
+
setLinkingEnabled(true);
// Get required services from ServicesRegistry
@@ -233,7 +225,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
SemanticFromModelExplorer semanticGetter = new SemanticFromModelExplorer();
List<Object> path = new ArrayList<Object>();
ITreeContentProvider contentProvider = (ITreeContentProvider)getCommonViewer().getContentProvider();
-// IPageMngr iPageMngr = EditorUtils.getIPageMngr();
+ // IPageMngr iPageMngr = EditorUtils.getIPageMngr();
IPageMngr iPageMngr;
try {
iPageMngr = ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
@@ -244,11 +236,11 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
Object[] result = iPageMngr.allPages().toArray();
List<Object> editors = Arrays.asList(result);
-
+
for(Object o : objects) {
// Search matches in this level
-// if(!(o instanceof Diagram) && o instanceof IAdaptable) {
- if(!editors.contains(o) && o instanceof IAdaptable){
+ // if(!(o instanceof Diagram) && o instanceof IAdaptable) {
+ if(!editors.contains(o) && o instanceof IAdaptable) {
if(eobject.equals(((IAdaptable)o).getAdapter(EObject.class))) {
path.add(o);
return path;
@@ -316,8 +308,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
if(descriptor instanceof NavigatorContentDescriptor) {
try {
ILabelProvider labelProvider = ((NavigatorContentDescriptor)descriptor).createLabelProvider();
- //viewer.setLabelProvider(labelProvider);
- viewer.setLabelProvider(new NavigatorDecoratingLabelProvider(labelProvider)); /* added for decorator support */
+ viewer.setLabelProvider(new DecoratingLabelProviderWTooltips(labelProvider)); // add for decorator and tooltip support
} catch (CoreException e) {
Activator.log.error(e);
}
@@ -381,15 +372,15 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
/**
* Hook the global undo/redi actions.
*/
-// private void hookGlobalHistoryHandler(IViewSite site) {
-// undoHandler = new UndoActionHandler(site, null);
-// redoHandler = new RedoActionHandler(site, null);
-//
-// IActionBars actionBars = site.getActionBars();
-//
-// actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoHandler);
-// actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoHandler);
-// }
+ // private void hookGlobalHistoryHandler(IViewSite site) {
+ // undoHandler = new UndoActionHandler(site, null);
+ // redoHandler = new RedoActionHandler(site, null);
+ //
+ // IActionBars actionBars = site.getActionBars();
+ //
+ // actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoHandler);
+ // actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoHandler);
+ // }
/**
* {@link ResourceSetListener} to listen and react to changes in the
@@ -475,29 +466,29 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
private void activate() {
- try {
- this.editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
- // this.editingDomain = EditorUtils.getTransactionalEditingDomain(editorPart.getServicesRegistry());
- // Set Viewer input if it already exist
- if(getCommonViewer() != null) {
- getCommonViewer().setInput(serviceRegistry);
- }
- editingDomain.addResourceSetListener(resourceSetListener);
- } catch (ServiceException e) {
- // Can't get EditingDomain, skip
+ try {
+ this.editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
+ // this.editingDomain = EditorUtils.getTransactionalEditingDomain(editorPart.getServicesRegistry());
+ // Set Viewer input if it already exist
+ if(getCommonViewer() != null) {
+ getCommonViewer().setInput(serviceRegistry);
}
+ editingDomain.addResourceSetListener(resourceSetListener);
+ } catch (ServiceException e) {
+ // Can't get EditingDomain, skip
+ }
- // Listen to isDirty flag
- saveAndDirtyService.addInputChangedListener(editorInputChangedListener);
-
- // Hook
- // if(undoHandler != null){
- // IUndoContext undoContext = getUndoContext(part);
- // undoHandler.setContext(undoContext);
- // undoHandler.update();
- // redoHandler.setContext(undoContext);
- // redoHandler.update();
- // }
+ // Listen to isDirty flag
+ saveAndDirtyService.addInputChangedListener(editorInputChangedListener);
+
+ // Hook
+ // if(undoHandler != null){
+ // IUndoContext undoContext = getUndoContext(part);
+ // undoHandler.setContext(undoContext);
+ // undoHandler.update();
+ // redoHandler.setContext(undoContext);
+ // redoHandler.update();
+ // }
if(this.getCommonViewer() != null) {
refresh();
}
@@ -510,7 +501,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
private void deactivate() {
// deactivate global handler
if(Activator.log.isDebugEnabled()) {
- Activator.log.debug("deactivate ModelExplorerView" ); //$NON-NLS-1$
+ Activator.log.debug("deactivate ModelExplorerView"); //$NON-NLS-1$
}
// Stop listening on change events
@@ -538,23 +529,23 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
*/
@Override
public void dispose() {
-
+
// Stop if we are already disposed
- if( isDisposed() ) {
+ if(isDisposed()) {
return;
}
-
+
deactivate();
saveAndDirtyService = null;
undoContext = null;
editingDomain = null;
serviceRegistry = null;
-
+
super.dispose();
// Clean up properties to help GC
-
+
}
/**

Back to the top