Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2012-03-24 07:19:13 -0400
committerBrian de Alwis2012-03-24 07:19:13 -0400
commit09446afd1c9ab4b158ace702d77aa13b4376aaaf (patch)
tree1c5b89ea749b9b94435553fd814377380cad1a9f
parente3c90216f53717c1381fb61a97cf4e2b2fd23884 (diff)
downloadorg.eclipse.e4.tools-09446afd1c9ab4b158ace702d77aa13b4376aaaf.tar.gz
org.eclipse.e4.tools-09446afd1c9ab4b158ace702d77aa13b4376aaaf.tar.xz
org.eclipse.e4.tools-09446afd1c9ab4b158ace702d77aa13b4376aaaf.zip
Bug 375233 - [CSS Spy] Cannot select CTabItems
Needed to add getParent() support. Also added in support for SWT CTab{Folder,Items}.
-rw-r--r--bundles/org.eclipse.e4.tools.css.spy/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CssSpyDialog.java11
-rw-r--r--bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/WidgetTreeProvider.java7
3 files changed, 20 insertions, 1 deletions
diff --git a/bundles/org.eclipse.e4.tools.css.spy/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.css.spy/META-INF/MANIFEST.MF
index 7df940f3..f747b15e 100644
--- a/bundles/org.eclipse.e4.tools.css.spy/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.tools.css.spy/META-INF/MANIFEST.MF
@@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0",
org.eclipse.swt;bundle-version="3.6.0",
org.eclipse.jface;bundle-version="3.8.0",
org.eclipse.e4.ui.css.swt;bundle-version="0.10.0",
- org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.1"
+ org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.1",
+ org.eclipse.e4.ui.widgets;bundle-version="0.11.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: javax.inject;version="1.0.0",
diff --git a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CssSpyDialog.java b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CssSpyDialog.java
index fb59f096..9c312f2a 100644
--- a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CssSpyDialog.java
+++ b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CssSpyDialog.java
@@ -73,6 +73,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Widget;
+import org.w3c.css.sac.CSSParseException;
import org.w3c.css.sac.SelectorList;
import org.w3c.dom.NodeList;
import org.w3c.dom.css.CSSStyleDeclaration;
@@ -321,6 +322,14 @@ public class CssSpyDialog extends Dialog {
ToolItem item = (ToolItem) widget;
Rectangle bounds = item.getBounds();
return item.getDisplay().map(item.getParent(), null, bounds);
+ } else if (widget instanceof org.eclipse.swt.custom.CTabItem) {
+ org.eclipse.swt.custom.CTabItem item = (org.eclipse.swt.custom.CTabItem) widget;
+ Rectangle bounds = item.getBounds();
+ return item.getDisplay().map(item.getParent(), null, bounds);
+ } else if (widget instanceof org.eclipse.e4.ui.widgets.CTabItem) {
+ org.eclipse.e4.ui.widgets.CTabItem item = (org.eclipse.e4.ui.widgets.CTabItem) widget;
+ Rectangle bounds = item.getBounds();
+ return item.getDisplay().map(item.getParent(), null, bounds);
}
// FIXME: figure out how to map items to a position
return null;
@@ -658,6 +667,8 @@ public class CssSpyDialog extends Dialog {
try {
SelectorList selectors = engine.parseSelectors(text);
processCSSSearch(text, null, engine, selectors, element);
+ } catch (CSSParseException e) {
+ // ignore: e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
diff --git a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/WidgetTreeProvider.java b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/WidgetTreeProvider.java
index 598d5fdc..9eb62d25 100644
--- a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/WidgetTreeProvider.java
+++ b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/WidgetTreeProvider.java
@@ -17,6 +17,7 @@ import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.ToolItem;
import org.w3c.dom.NodeList;
public class WidgetTreeProvider implements ITreeContentProvider {
@@ -51,6 +52,12 @@ public class WidgetTreeProvider implements ITreeContentProvider {
public Object getParent(Object element) {
if (element instanceof Control) {
return ((Control) element).getParent();
+ } else if (element instanceof org.eclipse.swt.custom.CTabItem) {
+ return ((org.eclipse.swt.custom.CTabItem) element).getParent();
+ } else if (element instanceof org.eclipse.e4.ui.widgets.CTabItem) {
+ return ((org.eclipse.e4.ui.widgets.CTabItem) element).getParent();
+ } else if (element instanceof ToolItem) {
+ return ((ToolItem) element).getParent();
}
return null;
}

Back to the top