Example usage for org.eclipse.jface.preference PreferenceDialog PreferenceDialog

List of usage examples for org.eclipse.jface.preference PreferenceDialog PreferenceDialog

Introduction

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

Prototype

public PreferenceDialog(Shell parentShell, PreferenceManager manager) 

Source Link

Document

Creates a new preference dialog under the control of the given preference manager.

Usage

From source file:aktie.gui.CocoaUIEnhancer.java

License:Open Source License

private static void showPreferences() {
    System.out.println("Preferences...");
    PreferenceManager manager = new PreferenceManager();
    PreferenceDialog dialog = new PreferenceDialog(null, manager);
    dialog.open();//w  ww .j  a v  a 2  s. com
    // delegate.runCommand(ActionFactory.PREFERENCES.getCommandId());
}

From source file:at.nucle.e4.preferences.example.handler.PreferenceHandler.java

License:Open Source License

@Execute
public void execute(Shell shell, EPreferenceService service) {
    final PreferenceDialog dlg = new PreferenceDialog(shell, service.getPreferenceManager());
    dlg.create();//w  ww  .j  a  v  a2 s .c om
    dlg.open();
}

From source file:at.spardat.xma.guidesign.preferences.AbstractPreferenceAndPropertyPage.java

License:Open Source License

/**
 * Show a single preference pages/*from   www . java2s.  c  om*/
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager);
    BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}

From source file:au.gov.ga.earthsci.application.handlers.ShowPreferencesHandler.java

License:Apache License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
        throws InvocationTargetException, InterruptedException {
    PreferenceManager pm = PreferenceUtil.createLegacyPreferenceManager(context, registry);
    PreferenceDialog dialog = new PreferenceDialog(shell, pm);
    dialog.setPreferenceStore(/*  w w w .j av a2 s  .c  o m*/
            new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.QUALIFIER_ID));
    dialog.create();
    dialog.getTreeViewer().setComparator(new ViewerComparator());
    dialog.getTreeViewer().expandAll();
    dialog.open();
}

From source file:com.agynamix.platform.frontend.preferences.ApplicationPreferenceDialog.java

License:Open Source License

public int open() {
    PreferenceConfigAdapterImpl configAdapter = new PreferenceConfigAdapterImpl();
    ApplicationPreferenceStore store = new ApplicationPreferenceStore(configAdapter); // AppConfigUtil.getPreferencesFile());

    store.addPropertyChangeListener(configAdapter);

    PreferenceManager manager = new PreferenceManager();

    GlobalPreferencePageDefaults defaultPage = new GlobalPreferencePageDefaults(configAdapter);
    defaultPage.addPreferenceDialogListener(this);
    PreferenceNode defaultsNode = new PreferenceNode("defaultsPage");
    GlobalPreferencePageNetwork networkPage = new GlobalPreferencePageNetwork(configAdapter);
    networkPage.addPreferenceDialogListener(this);
    PreferenceNode networkNode = new PreferenceNode("networkPage");
    defaultsNode.setPage(defaultPage);/*from  w  w  w.ja v  a 2  s.co m*/
    manager.addToRoot(defaultsNode);
    networkNode.setPage(networkPage);
    manager.addToRoot(networkNode);

    PreferenceDialog dialog = new PreferenceDialog(shell, manager);
    dialog.setPreferenceStore(store);
    int result = dialog.open();
    for (IPreferenceDialogListener l : preferenceDialogListeners) {
        l.dialogClosed(result);
    }
    return result;
}

From source file:com.aliyun.odps.eclipse.create.wizard.NewOdpsProjectWizardPage.java

License:Apache License

public void widgetSelected(SelectionEvent e) {
    if (e.getSource() == linkConfigDefaultConsoleLocation) {
        PreferenceManager manager = new PreferenceManager();
        manager.addToRoot(new PreferenceNode("ODPS Console Directory", new PreferencePageOdpsConsole()));
        PreferenceDialog dialog = new PreferenceDialog(this.getShell(), manager);
        dialog.create();//from  ww w  .  j a  v a  2 s . c  om
        dialog.setMessage(CONSOLE_LOCATION_TXT);
        dialog.setBlockOnOpen(true);
        dialog.open();
        updateHadoopDirLabelFromPreferences();
    } else if (e.getSource() == btnNewConsoleLocation) {
        DirectoryDialog dialog = new DirectoryDialog(this.getShell());
        dialog.setMessage(CONSOLE_LOCATION_TXT);
        dialog.setText(CONSOLE_LOCATION_TXT);
        String directory = dialog.open();

        if (directory != null) {
            txtNewConsoleLocation.setText(directory);

            if (!validateODPSConoleLocation()) {
                setErrorMessage("No ODPS SDK jar found in specified directory");
            } else {
                setErrorMessage(null);
            }
        }
    } else if (radioNewConsoleLocation.getSelection()) {
        txtNewConsoleLocation.setEnabled(true);
        btnNewConsoleLocation.setEnabled(true);
    } else {
        txtNewConsoleLocation.setEnabled(false);
        btnNewConsoleLocation.setEnabled(false);
    }
    getContainer().updateButtons();
}

From source file:com.android.ddms.PrefsDialog.java

License:Apache License

/**
 * Create and display the dialog.//  w w  w . jav  a2s .c om
 */
public static void run(Shell shell) {
    PreferenceStore prefStore = mStore.getPreferenceStore();
    assert prefStore != null;

    PreferenceManager prefMgr = new PreferenceManager();

    PreferenceNode node, subNode;

    // this didn't work -- got NPE, possibly from class lookup:
    //PreferenceNode app = new PreferenceNode("app", "Application", null,
    //    AppPrefs.class.getName());

    node = new PreferenceNode("debugger", new DebuggerPrefs());
    prefMgr.addToRoot(node);

    subNode = new PreferenceNode("panel", new PanelPrefs());
    //prefMgr.addTo(node.getId(), subNode);
    prefMgr.addToRoot(subNode);

    node = new PreferenceNode("LogCat", new LogCatPrefs());
    prefMgr.addToRoot(node);

    node = new PreferenceNode("misc", new MiscPrefs());
    prefMgr.addToRoot(node);

    node = new PreferenceNode("stats", new UsageStatsPrefs());
    prefMgr.addToRoot(node);

    PreferenceDialog dlg = new PreferenceDialog(shell, prefMgr);
    dlg.setPreferenceStore(prefStore);

    // run it
    try {
        dlg.open();
    } catch (Throwable t) {
        Log.e("ddms", t);
    }

    // save prefs
    try {
        prefStore.save();
    } catch (IOException ioe) {
    }

    // discard the stuff we created
    //prefMgr.dispose();
    //dlg.dispose();
}

From source file:com.aptana.formatter.ui.util.SWTUtil.java

License:Open Source License

/**
 * This method allows us to open the preference dialog on the specific page, in this case the perspective page
 * /* w  w  w  .  ja v  a  2  s  . c  o m*/
 * @param id
 *            the id of pref page to show
 * @param page
 *            the actual page to show Copied from org.eclipse.debug.internal.ui.SWTUtil
 */
public static void showPreferencePage(String id, IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(UIUtils.getActiveShell(), manager);
    BusyIndicator.showWhile(getStandardDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}

From source file:com.aptana.ide.debug.internal.ui.actions.DetailOptionsActionDelegate.java

License:Open Source License

/**
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 *///  w  w  w.  j a v  a  2s.  c  o m
public void run(IAction action) {
    final IPreferenceNode targetNode = new PreferenceNode(
            "com.aptana.ide.debug.ui.preferences.jsDetailFormatters", new JSDetailFormattersPreferencePage()); //$NON-NLS-1$

    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(DebugUiPlugin.getActiveWorkbenchShell(), manager);
    final boolean[] result = new boolean[] { false };
    BusyIndicator.showWhile(DebugUiPlugin.getStandardDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            result[0] = (dialog.open() == Window.OK);
        }
    });
}

From source file:com.aptana.js.debug.ui.internal.actions.DetailOptionsActionDelegate.java

License:Open Source License

/**
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 *//*from   w w w.  j a v a  2s  .  c om*/
public void run(IAction action) {
    final IPreferenceNode targetNode = new PreferenceNode("com.aptana.debug.ui.preferences.jsDetailFormatters", //$NON-NLS-1$
            new JSDetailFormattersPreferencePage());

    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(UIUtils.getActiveShell(), manager);
    final boolean[] result = new boolean[] { false };
    BusyIndicator.showWhile(DebugUiPlugin.getStandardDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            result[0] = (dialog.open() == Window.OK);
        }
    });
}