Example usage for org.eclipse.jface.fieldassist ControlDecoration isVisible

List of usage examples for org.eclipse.jface.fieldassist ControlDecoration isVisible

Introduction

In this page you can find the example usage for org.eclipse.jface.fieldassist ControlDecoration isVisible.

Prototype

public boolean isVisible() 

Source Link

Document

Return a boolean indicating whether the decoration is visible.

Usage

From source file:hydrograph.ui.propertywindow.widgets.listeners.ELTEmptyTextModifyListener.java

License:Apache License

private void setToolTipErrorMessage(ControlDecoration fieldNameDecorator) {
    String errmsg = null;// w w  w  . j a  v a  2s  .c om
    if (fieldNameDecorator.isVisible())
        errmsg = errmsg + "\n" + fieldNameDecorator.getDescriptionText();

    tootlTipErrorMessage.setErrorMessage(errmsg);

}

From source file:org.eclipse.rcptt.tesla.internal.ui.player.SWTModelMapper.java

License:Open Source License

public static void fillControl(Control ctrl, org.eclipse.swt.widgets.Control widget) {
    if (widget == null) {
        return;// Probable disposed control
    }// w  w  w  .j av  a 2s . c  om
    ctrl.setClassName(unify(widget.getClass().getName()));
    ctrl.setEnablement(widget.isEnabled());
    ctrl.setBounds(makeBounds(widget.getBounds()));
    ctrl.setContainMenu(widget.getMenu() != null);
    ctrl.setBorderWith(widget.getBorderWidth());
    ctrl.setBackgroundColor(makeColor(widget.getBackground()));
    ctrl.setForegroundColor(makeColor(widget.getForeground()));
    try {
        List<ControlDecoration> decorators = ControlDecoratorRecordingHolder.getDecorators(widget);
        for (ControlDecoration decor : decorators) {
            ControlDecorator decorator = UiFactory.eINSTANCE.createControlDecorator();
            decorator.setVisible(decor.isVisible());
            decorator.setDescription(decor.getDescriptionText());
            ctrl.getDecorators().add(decorator);
        }
    } catch (Throwable e) {

    }
}

From source file:org.eclipse.rcptt.tesla.internal.ui.processors.SWTUIProcessor.java

License:Open Source License

private void processChildren(SWTUIElement uiElement, Node root, Set<SWTUIElement> processed) {
    if (processed.contains(uiElement)) {
        return;//from  w  w w  .  j  ava  2 s . co m
    }
    processed.add(uiElement);
    if (uiElement.isDisposed()) {
        return;
    }
    String text = uiElement.getText();
    Node nde = root;
    if (!uiElement.getKind().is(ElementKind.Unknown)) {
        nde = root.child(uiElement.getKind().name() + "(" + (text != null ? text.trim() : "") + ")");
        // Adds decorators
        for (ControlDecoration decorator : uiElement.getDecorators()) {
            if (decorator.isVisible())
                nde.child("ControlDecoration(" + decorator.getDescriptionText() + ")");
        }
    }
    try {
        SWTUIElement[] children = getPlayer().children.collectFor(uiElement, null, false, null, null);
        for (SWTUIElement swtuiElement : children) {
            processChildren(swtuiElement, nde, processed);
        }
    } catch (Throwable e) {
        nde.property("ERROR", e.getMessage());
    }
}

From source file:org.eclipse.riena.ui.ridgets.swt.MarkerSupportTest.java

License:Open Source License

public void testClearAllMarkes() {

    final DefaultRealm realm = new DefaultRealm();
    try {/*  www.ja v a2 s.com*/

        final Text control = new Text(shell, SWT.NONE);
        shell.setVisible(true);
        final Color background = control.getBackground();
        final Color foreground = control.getForeground();

        final MyMarkerSupport markerSupport = new MyMarkerSupport();

        // the LNF creates a MarkerSupport for every Ridget, so we have to provide our custom MarkerSupport at this point
        final ITextRidget ridget = new TextRidget() {
            @Override
            protected org.eclipse.riena.ui.ridgets.AbstractMarkerSupport createMarkerSupport() {
                return markerSupport;
            }
        };
        ridget.setUIControl(control);
        markerSupport.init(ridget, new PropertyChangeSupport(new Object()));

        assertTrue(background.equals(control.getBackground()));

        ridget.addMarker(new MandatoryMarker());

        markerSupport.updateMarkers();
        assertFalse(background.equals(control.getBackground()));

        markerSupport.clearAllMarkers(control);
        assertEquals(background, control.getBackground());

        ridget.addMarker(new OutputMarker());
        markerSupport.updateMarkers();
        assertFalse(background.equals(control.getBackground()));

        markerSupport.clearAllMarkers(control);
        assertEquals(background, control.getBackground());

        ridget.addMarker(new NegativeMarker());
        markerSupport.updateMarkers();
        assertFalse(foreground.equals(control.getForeground()));

        markerSupport.clearAllMarkers(control);
        assertEquals(foreground, control.getForeground());

        ridget.addMarker(new ErrorMarker());
        markerSupport.updateMarkers();
        final ControlDecoration errorDecoration = ReflectionUtils.invokeHidden(markerSupport,
                "getErrorDecorationForControl", control);
        assertNotNull(errorDecoration);
        assertTrue(errorDecoration.isVisible());

        markerSupport.clearAllMarkers(control);
        assertFalse(errorDecoration.isVisible());

    } finally {
        realm.dispose();
    }

}