Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2011-11-17 13:08:09 +0000
committerBrian de Alwis2011-11-17 13:08:09 +0000
commit3c0f67c7842331512a34de462632159ba6d5e16d (patch)
tree7ce8fefe16d673e4f9918b4cf8d9b997ca80d709
parent1676183f68b009425aca18499b28eefdc7a2b19a (diff)
downloadorg.eclipse.e4.tools-3c0f67c7842331512a34de462632159ba6d5e16d.tar.gz
org.eclipse.e4.tools-3c0f67c7842331512a34de462632159ba6d5e16d.tar.xz
org.eclipse.e4.tools-3c0f67c7842331512a34de462632159ba6d5e16d.zip
Some minor rearrangements of the interesting-details dump,
fix highlighting for shells (already in display coordinates), and avoid querying CSS selector for empty string.
-rw-r--r--bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CssSpyDialog.java53
1 files changed, 41 insertions, 12 deletions
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 c9224572..239c5607 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
@@ -180,26 +180,48 @@ public class CssSpyDialog extends Dialog {
StringBuilder sb = new StringBuilder();
sb.append("CSS Element: ").append(element.getClass().getName());
- sb.append("\nStatic Pseudoinstances: ");
- Activator.join(sb, element.getStaticPseudoInstances(), ", ");
+ if (element.getCSSStyle() != null) {
+ sb.append("\nCSS Inline Style(s):\n ");
+ Activator.join(sb, element.getCSSStyle().split(";"), ";\n ");
+ }
- sb.append("\n\nCSS Rules:\n");
- CSSStyleDeclaration decl = element.getDefaultStyleDeclaration(""); // engine.getViewCSS().getComputedStyle(element, null);
- try {
- if (decl != null) {
- sb.append(decl.getCssText());
+ if (element.getStaticPseudoInstances().length > 0) {
+ sb.append("\nStatic Pseudoinstances:\n ");
+ Activator.join(sb, element.getStaticPseudoInstances(), "\n ");
+ }
+
+ if (element.getCSSClass() != null) {
+ sb.append("\n\nCSS Classes:\n ");
+ Activator.join(sb, element.getCSSClass().split(" +"), "\n ");
+ }
+
+ // FIXME: shouldn't this be getCSSStyle?
+ if (element.getAttribute("style") != null) {
+ sb.append("\n\nSWT Style Bits:\n ");
+ Activator.join(sb, element.getAttribute("style").split(" +"), "\n ");
+ }
+
+ CSSEngine engine = getCSSEngine(element);
+ CSSStyleDeclaration decl = engine.getViewCSS().getComputedStyle(element, null);
+ if (decl != null) {
+ sb.append("\n\nCSS Rules:\n");
+ try {
+ if (decl != null) {
+ sb.append(decl.getCssText());
+ }
+ } catch (Throwable e) {
+ sb.append(e);
}
- } catch (Throwable e) {
- sb.append(e);
}
cssRules.setText(sb.toString());
- //cssRules.setText(cssE)
disposeHighlights();
highlightWidget(selected);
}
private void highlightWidget(Widget selected) {
+ widgetTreeViewer.reveal(selected);
+
Rectangle bounds = getBounds(selected); // relative to absolute display, not the widget
if (bounds == null /*|| bounds.height == 0 || bounds.width == 0*/) {
return;
@@ -244,7 +266,10 @@ public class CssSpyDialog extends Dialog {
}
private Rectangle getBounds(Widget widget) {
- if (widget instanceof Control) {
+ if (widget instanceof Shell) {
+ // Shell bounds are already in display coordinates
+ return ((Shell) widget).getBounds();
+ } else if (widget instanceof Control) {
Control control = (Control) widget;
Rectangle bounds = control.getBounds();
return control.getDisplay().map(control.getParent(), null, bounds);
@@ -356,7 +381,7 @@ public class CssSpyDialog extends Dialog {
propsComposite.setLayout(propsTableLayout);
/// THE CSS RULES
- cssRules = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
+ cssRules = new Text(container, SWT.BORDER | /*SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | */SWT.MULTI);
cssRules.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
/// THE CSS PROPERTIES TABLE (again)
@@ -451,6 +476,10 @@ public class CssSpyDialog extends Dialog {
private String searchInProgress;
private void performCSSSearch(String text) {
disposeHighlights();
+ widgetTreeViewer.collapseAll();
+ if (text.trim().isEmpty()) {
+ return;
+ }
searchInProgress = text;
CSSStylableElement element = getCSSElement(getShell(shown));
if (element == null) {

Back to the top