summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBrian de Alwis2012-02-22 16:33:36 (EST)
committer Oleg Besedin2012-02-22 16:34:18 (EST)
commit586f49b788803e509ec0e04368d036017f83bd82 (patch)
treeb02108455285f0b87632b266749712480ecfb173
parenta8bcf7b152aff4ce07f00499d9a60caabbccb1ee (diff)
downloadeclipse.platform.ui-586f49b788803e509ec0e04368d036017f83bd82.zip
eclipse.platform.ui-586f49b788803e509ec0e04368d036017f83bd82.tar.gz
eclipse.platform.ui-586f49b788803e509ec0e04368d036017f83bd82.tar.bz2
Bug 372077 - Context debug view not plumbed in properlyv20120222-2134I20120222-2200
-rw-r--r--bundles/org.eclipse.e4.core.contexts.debug/plugin.xml10
-rw-r--r--bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/FindTargetAction.java54
-rw-r--r--bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/legacy/ContextTraceLegacyView.java7
3 files changed, 41 insertions, 30 deletions
diff --git a/bundles/org.eclipse.e4.core.contexts.debug/plugin.xml b/bundles/org.eclipse.e4.core.contexts.debug/plugin.xml
index 8038d71..4198b73 100644
--- a/bundles/org.eclipse.e4.core.contexts.debug/plugin.xml
+++ b/bundles/org.eclipse.e4.core.contexts.debug/plugin.xml
@@ -10,4 +10,14 @@
class="org.eclipse.e4.core.internal.contexts.debug.ui.e4.ContextsDebugProcessor">
</processor>
</extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.eclipse.debug.ui"
+ class="org.eclipse.e4.core.internal.contexts.debug.ui.legacy.ContextTraceLegacyView"
+ id="org.eclipse.e4.core.contexts.debug.view.legacy"
+ name="%traceView"
+ restorable="true">
+ </view>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/FindTargetAction.java b/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/FindTargetAction.java
index 663cf9a..d1233a2 100644
--- a/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/FindTargetAction.java
+++ b/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/FindTargetAction.java
@@ -12,6 +12,7 @@ package org.eclipse.e4.core.internal.contexts.debug.ui;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
@@ -20,16 +21,14 @@ import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.extensions.EventUtils;
import org.eclipse.e4.core.internal.contexts.EclipseContext;
import org.eclipse.e4.ui.model.application.ui.MContext;
-import org.eclipse.e4.ui.model.application.ui.menu.MItem;
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import org.osgi.service.event.EventAdmin;
public class FindTargetAction {
@@ -58,29 +57,22 @@ public class FindTargetAction {
}
@Execute
- public void doFindTarget(IEclipseContext context) {
- MItem item = context.get(MItem.class);
- ToolItem toolItem = (ToolItem) item.getWidget();
- final ToolBar toolBar = toolItem.getParent();
- final Display display = toolItem.getDisplay();
+ public void doFindTarget(MWindow win) {
+ final Control windowWidget = (Control) win.getWidget();
+ final Display display = windowWidget.getDisplay();
- displayCursor = toolBar.getCursor();
- toolBar.setCursor(targetCursor);
- toolBar.setCapture(true);
+ displayCursor = windowWidget.getCursor();
+ windowWidget.setCursor(targetCursor);
+ windowWidget.setCapture(true);
- toolBar.addMouseListener(new MouseListener() {
- public void mouseDoubleClick(MouseEvent e) {
- // nothing
- }
-
- public void mouseDown(MouseEvent e) {
- // nothing
- }
-
- public void mouseUp(MouseEvent e) {
+ // This filter list is necessary to avoid not-initialized-errors within the
+ // actual listener. The filter approach is required as some platforms (e.g.,
+ // MacOS X) don't support setCapture().
+ // FIXME: should possible set this up for MouseUp, not MouseDown?
+ final LinkedList<Listener> filters = new LinkedList<Listener>();
+ filters.add(new Listener() {
+ public void handleEvent(Event event) {
Control control = display.getCursorControl();
- if (toolBar == control) // ignore click on the trigger button
- return;
IEclipseContext targetContext = null;
while (control != null) {
Object data = control.getData(OWNING_ME);
@@ -101,11 +93,17 @@ public class FindTargetAction {
TreePath path = new TreePath(contexts.toArray());
EventUtils.send(eventAdmin, ContextsView.SELECT_EVENT, path);
}
- toolBar.setCapture(false);
- toolBar.removeMouseListener(this);
- toolBar.setCursor(displayCursor);
+ windowWidget.setCapture(false);
+ windowWidget.setCursor(displayCursor);
+ for (Listener f : filters) {
+ display.removeFilter(SWT.MouseDown, f);
+ }
+ filters.clear();
}
});
+ for (Listener f : filters) {
+ display.addFilter(SWT.MouseDown, f);
+ }
}
}
diff --git a/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/legacy/ContextTraceLegacyView.java b/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/legacy/ContextTraceLegacyView.java
index 443196d..8f3228b 100644
--- a/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/legacy/ContextTraceLegacyView.java
+++ b/bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/legacy/ContextTraceLegacyView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 IBM Corporation and others.
* 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.e4.core.internal.contexts.debug.ui.legacy;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.internal.contexts.debug.ui.ContextsView;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
@@ -35,7 +37,8 @@ public class ContextTraceLegacyView extends ViewPart {
}
public void createPartControl(Composite parent) {
- viewer = new ContextsView(parent, null);
+ IEclipseContext context = (IEclipseContext) getSite().getService(IEclipseContext.class);
+ viewer = ContextInjectionFactory.make(ContextsView.class, context);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.eclipse.e4.core.contexts.debug.view");
}