Example usage for org.eclipse.jface.preference PreferenceConverter getRectangle

List of usage examples for org.eclipse.jface.preference PreferenceConverter getRectangle

Introduction

In this page you can find the example usage for org.eclipse.jface.preference PreferenceConverter getRectangle.

Prototype

public static Rectangle getRectangle(IPreferenceStore store, String name) 

Source Link

Document

Returns the current value of the rectangle-valued preference with the given name in the given preference store.

Usage

From source file:net.mldonkey.g2gui.view.pref.PreferenceLoader.java

License:Open Source License

public static Rectangle loadRectangle( String preferenceString ) {
    if ( preferenceStore.contains( preferenceString ) )
        return PreferenceConverter.getRectangle( preferenceStore, preferenceString );
    return null;// w w w  . ja v a  2  s.co m
}

From source file:org.pwsafe.passwordsafeswt.preference.WidgetPreferences.java

License:Open Source License

/**
 * Restores width of a TableColumn and adds listener to make sure that
 * current width is saved// ww  w. j  a  va 2 s  . com
 * 
 * @param column a TableColumn
 * @param id an id for saving and restoring width of the column
 */
public static void tuneTableColumn(final TableColumn column, final String id) {
    final Rectangle rectangle = PreferenceConverter.getRectangle(ps, id);
    if (rectangle.width > 0) {
        column.setWidth(rectangle.width);
    }

    column.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(final DisposeEvent e) {
            log.debug("saving widget size, id=" + id);
            PreferenceConverter.setValue(ps, id, new Rectangle(0, 0, column.getWidth(), 0));
        }
    });

}

From source file:org.pwsafe.passwordsafeswt.preference.WidgetPreferences.java

License:Open Source License

/**
 * Restores width of a TreeColumn and adds listener to make sure that
 * current width is saved/*w w  w . j  a va  2s  .  com*/
 * 
 * @param column a TreeColumn
 * @param id an id for saving and restoring width of the column
 */
public static void tuneTreeColumn(final TreeColumn column, final String id) {
    final Rectangle rectangle = PreferenceConverter.getRectangle(ps, id);
    if (rectangle.width > 0) {
        column.setWidth(rectangle.width);
    }

    column.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(final DisposeEvent e) {
            log.debug("saving widget size, id=" + id);
            PreferenceConverter.setValue(ps, id, new Rectangle(0, 0, column.getWidth(), 0));
        }
    });

}

From source file:org.pwsafe.passwordsafeswt.preference.WidgetPreferences.java

License:Open Source License

/**
 * Restores location of a Shell//from   w w  w.  ja va 2s  .  c  o  m
 */
private static void restoreLocation(final Shell shell, final String id) {
    final Rectangle rectangle = PreferenceConverter.getRectangle(ps, id);
    if (rectangle.x != 0 || rectangle.y != 0) {
        shell.setLocation(rectangle.x, rectangle.y);
    }

    if (rectangle.width > 0 && rectangle.height > 0) {
        shell.setSize(rectangle.width, rectangle.height);
    }
}

From source file:raptor.pref.RaptorPreferenceStore.java

License:BSD License

public Rectangle getRectangle(String key) {
    return PreferenceConverter.getRectangle(this, key);
}