Example usage for org.eclipse.jface.databinding.swt SWTObservables getRealm

List of usage examples for org.eclipse.jface.databinding.swt SWTObservables getRealm

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.swt SWTObservables getRealm.

Prototype

@Deprecated
public static Realm getRealm(final Display display) 

Source Link

Document

Returns the realm representing the UI thread for the given display.

Usage

From source file:org.eclipse.riena.e4.launcher.rendering.RienaWBWRenderer.java

License:Open Source License

private void rienaActivateApplicationNode() {
    final Realm realm = SWTObservables.getRealm(Display.getCurrent());
    Realm.runWithDefault(realm, new Runnable() {

        public void run() {
            ApplicationNodeManager.getApplicationNode().activate();
        }//from ww w .j  ava2s.  c  om
    });
}

From source file:org.eclipse.riena.e4.launcher.security.LoginHelper.java

License:Open Source License

/**
 * Creates a new instance of {@link ILoginExecutor} for default login view without splash
 *//* w w w  .j a  v a  2s  .  c  o  m*/
private ILoginExecutor<Integer> loginExecutorForDialog(final IConfigurationElement iConfigurationElement)
        throws CoreException {
    final String attribute = iConfigurationElement.getAttribute(ATTRIBUTE_NON_ACTIVITY_DURATION);
    final ILoginDialogView loginDialogView = (ILoginDialogView) iConfigurationElement
            .createExecutableExtension("viewClass"); //$NON-NLS-1$

    return new LoginExecutor(eclipseContext, Integer.parseInt(attribute)) {
        public Integer performLogin() {
            final Realm realm = SWTObservables.getRealm(Display.getCurrent());
            do {
                Realm.runWithDefault(realm, new Runnable() {
                    public void run() {
                        loginDialogView.build();
                    }
                });
            } while (IApplication.EXIT_RESTART.equals(loginDialogView.getResult()));
            return loginDialogView.getResult();
        }
    };
}

From source file:org.eclipse.riena.e4.launcher.security.LoginHelper.java

License:Open Source License

/**
 * Creates a new instance of {@link ILoginExecutor} for splash views
 *///from  w  ww  .j ava 2  s  . co  m
private ILoginExecutor<Integer> loginExecutorForSplash(final IConfigurationElement iConfigurationElement)
        throws CoreException {
    final String attribute = iConfigurationElement.getAttribute(ATTRIBUTE_NON_ACTIVITY_DURATION);

    return new LoginExecutor(eclipseContext, Integer.parseInt(attribute)) {
        public Integer performLogin() {
            final AbstractLoginSplashHandler loginSplashHandler = getLoginSplashHandler();
            final Realm realm = SWTObservables.getRealm(Display.getCurrent());
            Realm.runWithDefault(realm, new Runnable() {
                public void run() {
                    final Shell shell = new Shell(getDisplay(), SWT.NO_TRIM | SWT.APPLICATION_MODAL);
                    initializeShellBackgroundImage(shell, getBackgroundImagePath());
                    loginSplashHandler.init(shell);
                    shell.setLocation((shell.getDisplay().getBounds().width - shell.getSize().x) / 2,
                            (shell.getDisplay().getBounds().height - shell.getSize().y) / 2);
                    shell.open();
                    while (!shell.isDisposed()) {
                        if (!getDisplay().readAndDispatch()) {
                            getDisplay().sleep();
                        }
                    }
                }
            });

            return loginSplashHandler.getResult();
        }

        private void initializeShellBackgroundImage(final Shell shell, final String imageName) {
            final ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
                    ((RegistryContributor) iConfigurationElement.getContributor()).getActualName(),
                    getBackgroundImagePath());
            final Image image = imageDescriptor.createImage();
            shell.setSize(image.getBounds().width, image.getBounds().height);
            shell.setBackgroundImage(image);
        }

        private AbstractLoginSplashHandler getLoginSplashHandler() {
            return new AbstractLoginSplashHandler() {
            };
        }

        private String getBackgroundImagePath() {
            return "splash.bmp"; //$NON-NLS-1$
        }

        private Display getDisplay() {
            return Display.getCurrent();
        }
    };
}

From source file:org.eclipse.riena.internal.navigation.ui.filter.AbstractUIFilterRuleRidgetMarkerTest.java

License:Open Source License

@Override
protected void setUp() throws Exception {

    final Display display = Display.getDefault();
    final Realm realm = SWTObservables.getRealm(display);
    assertNotNull(realm);/* w  w  w.  j a v  a 2 s .c  o  m*/
    ReflectionUtils.invokeHidden(realm, "setDefault", realm);

    rule = new MyUIFilterRule();
}

From source file:org.eclipse.riena.internal.navigation.ui.filter.MenuItemRidgetMatcherTest.java

License:Open Source License

@Override
protected void setUp() throws Exception {

    final Display display = Display.getDefault();

    final Realm realm = SWTObservables.getRealm(display);
    assertNotNull(realm);/*from w w  w  .jav  a2s . co m*/
    ReflectionUtils.invokeHidden(realm, "setDefault", realm);

    shell = new Shell();

}

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

License:Open Source License

@Override
protected void setUp() throws Exception {
    super.setUp();

    final Display display = Display.getDefault();

    final Realm realm = SWTObservables.getRealm(display);
    assertNotNull(realm);/* w  w  w.ja v a 2s .c  om*/
    ReflectionUtils.invokeHidden(realm, "setDefault", realm);

    shell = new Shell(SWT.SYSTEM_MODAL | SWT.ON_TOP);

    shell.setLayout(new RowLayout(SWT.VERTICAL));

    widget = createWidget(shell);

    shell.setSize(130, 100);
    shell.setLocation(0, 0);
    shell.open();
}

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

License:Open Source License

@Override
protected void setUp() throws Exception {
    super.setUp();

    final Display display = Display.getDefault();
    final Realm realm = SWTObservables.getRealm(display);
    assertNotNull(realm);//from  w ww.  ja  v a2s .  co m
    ReflectionUtils.invokeHidden(realm, "setDefault", realm);

    shell = new Shell(SWT.SYSTEM_MODAL | SWT.ON_TOP);

    shell.setLayout(new RowLayout(SWT.VERTICAL));

    widget = createWidget(shell);

    ridget = createRidget();
    ridget.setUIControl(widget);
    propertyChangeListenerMock = EasyMock.createMock(PropertyChangeListener.class);
    ridget.addPropertyChangeListener(propertyChangeListenerMock);

    otherControl = new Text(shell, SWT.SINGLE);
    otherControl.setText("other focusable widget");

    shell.setSize(130, 100);
    shell.setLocation(0, 0);
    shell.open();
}

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

License:Open Source License

@Override
protected ISWTObservableValue getUIControlSelectionObservable() {
    final CompletionCombo control = getUIControl();
    final Realm realm = SWTObservables.getRealm(control.getDisplay());
    return (ISWTObservableValue) new CompletionComboSelectionProperty().observe(realm, control);
}

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

License:Open Source License

@Override
protected void setUp() throws Exception {

    final Display display = Display.getDefault();
    final Realm realm = SWTObservables.getRealm(display);
    assertNotNull(realm);/*  w  w  w  .  ja  va  2 s .  co m*/
    ReflectionUtils.invokeHidden(realm, "setDefault", realm); //$NON-NLS-1$

    shell = new Shell(SWT.SYSTEM_MODAL | SWT.ON_TOP);
    table = new Table(shell, SWT.DEFAULT);
    ridget = new TableRidget();
    ridget.setUIControl(table);
    final List<PropHolder> rows = new ArrayList<PropHolder>();
    final PropHolder[] values = new PropHolder[] { new PropHolder(), new PropHolder() };
    for (final PropHolder value : values) {
        rows.add(value);
    }
    final String[] propNames = new String[] { "booleanValue", "intValue" };
    ridget.bindToModel(new WritableList(rows, PropHolder.class), PropHolder.class, propNames, propNames);

}

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

License:Open Source License

@Override
protected void setUp() throws Exception {
    final Display display = Display.getDefault();
    final Realm realm = SWTObservables.getRealm(display);
    ReflectionUtils.invokeHidden(realm, "setDefault", realm); //$NON-NLS-1$
    colorA = display.getSystemColor(SWT.COLOR_RED);
    colorB = display.getSystemColor(SWT.COLOR_GREEN);
    fontA = new Font(display, "Arial", 12, SWT.NORMAL); //$NON-NLS-1$
    fontB = new Font(display, "Courier", 12, SWT.NORMAL); //$NON-NLS-1$

    final IObservableSet elements = createElements();
    final String[] columnProperties = { "word", "upperCase" }; //$NON-NLS-1$ //$NON-NLS-2$
    attrMaps = BeansObservables.observeMaps(elements, WordNode.class, columnProperties);
    formatters = new IColumnFormatter[] { null, new TestColumnFormatter() };
    noFormatters = new IColumnFormatter[attrMaps.length];
}