Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorHyperLinkEditorShell.java56
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java13
2 files changed, 24 insertions, 45 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorHyperLinkEditorShell.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorHyperLinkEditorShell.java
index a5dd2ebf566..184e6a23a7c 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorHyperLinkEditorShell.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorHyperLinkEditorShell.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 431397
*
*****************************************************************************/
package org.eclipse.papyrus.infra.hyperlink.ui;
@@ -26,8 +27,8 @@ import org.eclipse.papyrus.infra.hyperlink.helper.EditorHyperLinkHelper;
import org.eclipse.papyrus.infra.hyperlink.messages.Messages;
import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Display;
/**
@@ -89,9 +90,9 @@ public class EditorHyperLinkEditorShell extends AbstractEditHyperlinkDocumentShe
getTooltipInputText().setText(getObjectLabeltext().getText());
}
// add listener "use default button"
- getUseDefaultCheckBox().addMouseListener(new MouseListener() {
-
- public void mouseUp(MouseEvent e) {
+ getUseDefaultCheckBox().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
usedefaultTooltip = getUseDefaultCheckBox().getSelection();
if(usedefaultTooltip) {
getTooltipInputText().setEditable(false);
@@ -100,21 +101,12 @@ public class EditorHyperLinkEditorShell extends AbstractEditHyperlinkDocumentShe
getTooltipInputText().setEditable(true);
}
}
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- }
});
// launch a new editor to choose or create diagrams
- getChooseDiagramButton().addMouseListener(new MouseListener() {
-
- public void mouseUp(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
+ getChooseDiagramButton().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
EditorLookForEditorShell editorLookForDiagram = new EditorLookForEditorShell(editorRegistry, amodel);
editorLookForDiagram.open();
Object selection = editorLookForDiagram.getSelectedEditor();
@@ -141,33 +133,20 @@ public class EditorHyperLinkEditorShell extends AbstractEditHyperlinkDocumentShe
}
}
}
-
- public void mouseDoubleClick(MouseEvent e) {
- }
});
// listener to cancel
- this.getCancelButton().addMouseListener(new MouseListener() {
-
- public void mouseUp(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
+ this.getCancelButton().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
hyperLinkEditor = null;
getEditHyperlinkShell().close();
}
-
- public void mouseDoubleClick(MouseEvent e) {
- }
});
// listener to click on OK
- this.getOkButton().addMouseListener(new MouseListener() {
-
- public void mouseUp(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
-
+ this.getOkButton().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
if(hyperLinkEditor != null) {
hyperLinkEditor.setTooltipText(getTooltipInputText().getText().trim());
// if diagram is null, maybe bad selection or other it
@@ -178,9 +157,6 @@ public class EditorHyperLinkEditorShell extends AbstractEditHyperlinkDocumentShe
}
getEditHyperlinkShell().close();
}
-
- public void mouseDoubleClick(MouseEvent e) {
- }
});
}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
index 45fb62f2e4f..69616e81bbe 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.hyperlink/src/org/eclipse/papyrus/infra/hyperlink/ui/EditorLookForEditorShell.java
@@ -10,18 +10,21 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 410346
+ * Christian W. Damus (CEA) - bug 431397
*
*****************************************************************************/
package org.eclipse.papyrus.infra.hyperlink.ui;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Set;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -238,7 +241,7 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
// SemanticEMFContentProvider(amodel)); //This content provider will
// only display the selected element, instead of the root element
// FIXME: Use a standard, non-deprecated content
- treeViewer.setContentProvider(new SemanticEMFContentProvider() {
+ treeViewer.setContentProvider(new SemanticEMFContentProvider(null, null, new EObject[] {EcoreUtil.getRootContainer(amodel)}) {
@Override
public boolean hasChildren(Object element) {
@@ -256,12 +259,12 @@ public class EditorLookForEditorShell extends AbstractLookForEditorShell {
//TODO the best correction we be able to manage applied facet, because if we get diagram twice it is probably because there are 2 facets with the same behavior applied
@Override
public Object[] getChildren(Object parentElement) {
- List<Object> alreadyVisited = new ArrayList<Object>();
+ Set<Object> alreadyVisited = new HashSet<Object>();
List<Object> returnedChildren = new ArrayList<Object>();
Object[] children = super.getChildren(parentElement);
for(Object current : children) {
- if(current instanceof IAdaptable) {
- EObject el = EMFHelper.getEObject(current);
+ EObject el = EMFHelper.getEObject(current);
+ if(el != null) {
if(!alreadyVisited.contains(el)) {
returnedChildren.add(current);
alreadyVisited.add(el);

Back to the top