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

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

Introduction

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

Prototype

public int open() 

Source Link

Document

Opens this window, creating it first if it has not yet been created.

Usage

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

License:Apache License

/**
 * Create and display the dialog.//  w w w .  j a  v  a2  s.  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.apicloud.navigator.ui.actions.AdvancedSettingsAction.java

License:Open Source License

@Override
public void run(IAction action) {
    String[] displayIds = { "com.aptana.theme.preferencePage" };
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(window.getShell(),
            "com.aptana.theme.preferencePage", displayIds, null);
    dialog.open();
}

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
 * /*from w  ww. j  ava  2 s  . co 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.core.ui.WindowActionDelegate.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) {
    String id = action.getId();
    if (id.equals(VIEW_LOG_ID)) {
        String logFile = getLogFile();

        try {
            WorkbenchHelper.openFile(new File(logFile), PlatformUI.getWorkbench().getActiveWorkbenchWindow());
        } catch (Exception e) {
            IdeLog.logError(CoreUIPlugin.getDefault(),
                    StringUtils.format(Messages.WindowActionDelegate_UnableToOpenLogFile, logFile), e);
        }
    } else if (id.equals(CLEAR_LOG_ID)) {
        if (!MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), Messages.ClearLogConfirmTitle,
                Messages.ClearLogConfirmDescription)) {
            return;
        }
        String logFile = getLogFile();

        try {
            File file = new File(logFile);
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            fileOutputStream.close();
        } catch (Exception e) {
            IdeLog.logError(CoreUIPlugin.getDefault(),
                    StringUtils.format(Messages.WindowActionDelegate_UnableToOpenLogFile, logFile), e);
        }
    } else if (id.equals("Overview.Action")) //$NON-NLS-1$
    {
        String currentPerspectiveID = WebPerspectiveFactory.PERSPECTIVE_ID;
        try {
            IPerspectiveDescriptor desc = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                    .getPerspective();
            // If it is not one of ours, then just show the default
            if (!WebPerspectiveFactory.isSameOrDescendantPerspective(desc)) {
                MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        Messages.WindowActionDelegate_AptanaOverviewErrorTitle,
                        Messages.WindowActionDelegate_AptanaOverviewErrorMessage);
                return;
            }
        } catch (Exception e) {
        }
    } else if (id.equals(CLEAN_CONFIG_ID)) {
        if (!MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                Messages.WindowActionDelegate_CleanConfigurationTitle,
                Messages.WindowActionDelegate_CleanConfigurationDescription)) {
            return;
        }

        IPreferenceStore prefs = CoreUIPlugin.getDefault().getPreferenceStore();
        prefs.setValue(IPreferenceConstants.PREF_CLEAN_RESTART, true);
        window.getWorkbench().restart();
    } else if (id.equals(LEARN_MORE_ID)) {
        PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                Display.getDefault().getActiveShell(), LICENSE_PREFERENCE_ID,
                new String[] { LICENSE_PREFERENCE_ID }, null);
        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)
 *///from  w  w  w . j a va  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.ide.editor.css.MultiPageCSSEditor.java

License:Open Source License

/**
 * @see org.eclipse.ui.part.MultiPageEditorPart#createPages()
 *///from  w ww  .  j  a  va  2 s  . co  m
protected void createPages() {

    getSite().setSelectionProvider(new MultiPageSelectionProvider(this));
    if (getContainer() instanceof CTabFolder) {
        final CTabFolder tabs = (CTabFolder) getContainer();

        tabs.addListener(SWT.Traverse, new Listener() {

            public void handleEvent(Event event) {
                if (tabs.getItemCount() == 1 && displayArea != null && !displayArea.isDisposed()) {
                    Composite parent = displayArea.getParent();
                    if (parent != null && parent.getParent() != null) {
                        if (event.keyCode == SWT.PAGE_UP) {
                            parent.getParent().traverse(SWT.TRAVERSE_PAGE_PREVIOUS);
                        } else if (event.keyCode == SWT.PAGE_DOWN) {
                            parent.getParent().traverse(SWT.TRAVERSE_PAGE_NEXT);
                        }
                    }
                }
            }

        });

        Composite toolbar = new Composite(tabs, SWT.NONE);
        toolbar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END, GridData.VERTICAL_ALIGN_BEGINNING));
        GridLayout layout = new GridLayout(1, true);
        final ToolBar tb = new ToolBar(toolbar, SWT.FLAT);
        GridData tbData = new GridData(GridData.HORIZONTAL_ALIGN_END);
        tabs.setTabHeight(21);
        tb.setLayoutData(tbData);
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        toolbar.setLayout(layout);
        tb.setLayout(layout);
        tb.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
        final ToolItem configure = new ToolItem(tb, SWT.DROP_DOWN);
        configure.setImage(CSSPlugin.getImage("icons/configure.gif")); //$NON-NLS-1$
        configure.setToolTipText(Messages.MultiPageCSSEditor_TTP_ConfigureCSSPreview);
        configure.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                if (e.detail != SWT.ARROW) {
                    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                            Display.getDefault().getActiveShell(),
                            "com.aptana.ide.editor.css.preferences.PreviewPreferencePage", //$NON-NLS-1$
                            new String[] { "com.aptana.ide.editor.css.preferences.PreviewPreferencePage" }, //$NON-NLS-1$
                            null);
                    dialog.open();
                }
            }

        });
        final Menu menu = new Menu(tabs.getShell(), SWT.POP_UP);
        MenuItem editTemplate = new MenuItem(menu, SWT.PUSH);
        editTemplate.setText(Messages.MultiPageCSSEditor_LBL_EditDefaultPreviewTemplate);
        editTemplate.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                        Display.getDefault().getActiveShell(),
                        "com.aptana.ide.editor.css.preferences.PreviewPreferencePage", //$NON-NLS-1$
                        new String[] { "com.aptana.ide.editor.css.preferences.PreviewPreferencePage" }, null); //$NON-NLS-1$
                dialog.open();
            }

        });
        MenuItem editFileSettings = new MenuItem(menu, SWT.PUSH);
        if (getEditorInput() instanceof IFileEditorInput) {
            editFileSettings.setText(Messages.MultiPageCSSEditor_LB_FilePreviewSettings);
            editFileSettings.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    if (getEditorInput() instanceof IFileEditorInput) {
                        IFile file = ((IFileEditorInput) getEditorInput()).getFile();
                        PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(
                                Display.getDefault().getActiveShell(), file,
                                "com.aptana.ide.editor.css.preview.cssPreviewPropertyPage", //$NON-NLS-1$
                                new String[] { "com.aptana.ide.editor.css.preview.cssPreviewPropertyPage" }, //$NON-NLS-1$
                                null);
                        dialog.open();
                    }
                }
            });
            MenuItem editProjectSettings = new MenuItem(menu, SWT.PUSH);
            editProjectSettings.setText(Messages.MultiPageCSSEditor_LBL_ProjectPreviewSettings);
            editProjectSettings.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    if (getEditorInput() instanceof IFileEditorInput) {
                        IFile file = ((IFileEditorInput) getEditorInput()).getFile();
                        PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(
                                Display.getDefault().getActiveShell(), file.getProject(),
                                "com.aptana.ide.editor.css.preview.cssPreviewPropertyPage", //$NON-NLS-1$
                                new String[] { "com.aptana.ide.editor.css.preview.cssPreviewPropertyPage" }, //$NON-NLS-1$
                                null);
                        dialog.open();
                    }
                }
            });
        }
        MenuItem editWorkspaceSettings = new MenuItem(menu, SWT.PUSH);
        editWorkspaceSettings.setText(Messages.MultiPageCSSEditor_LBL_WorkspacePreviewSettings);
        editWorkspaceSettings.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                        Display.getDefault().getActiveShell(),
                        "com.aptana.ide.editor.css.preferences.PreviewPreferencePage", //$NON-NLS-1$
                        new String[] { "com.aptana.ide.editor.css.preferences.PreviewPreferencePage" }, null); //$NON-NLS-1$
                dialog.open();
            }

        });
        configure.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                if (e.detail == SWT.ARROW) {
                    Rectangle rect = configure.getBounds();
                    Point pt = new Point(rect.x, rect.y + rect.height);
                    pt = tb.toDisplay(pt);
                    menu.setLocation(pt.x, pt.y);
                    menu.setVisible(true);
                } else {

                }
            }

        });

        tabs.setTopRight(toolbar, SWT.RIGHT);
    }
    createPage0();
    loadBrowsers();
}

From source file:com.aptana.ide.editor.css.preview.CSSPreviewPropertyPage.java

License:Open Source License

/**
 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
 *///  www. j  av a 2 s .  com
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, true);
    composite.setLayout(layout);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    composite.setLayoutData(data);

    Composite top = new Composite(composite, SWT.NONE);
    GridLayout topLayout = new GridLayout(2, false);
    topLayout.marginHeight = 0;
    topLayout.marginWidth = 0;
    top.setLayout(topLayout);
    top.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    override = new Button(top, SWT.CHECK);
    override.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    override.setSelection(false);
    override.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            boolean ov = override.getSelection();
            useProjectFile.setEnabled(ov);
            useURL.setEnabled(ov);
            if (ov) {
                if (useProjectFile.getSelection()) {
                    projectFiles.setEnabled(true);
                } else if (useURL.getSelection()) {
                    urlText.setEnabled(true);
                    browseButton.setEnabled(true);
                }
            } else {
                urlText.setEnabled(false);
                browseButton.setEnabled(false);
                projectFiles.setEnabled(false);
            }
        }

    });

    Link goToParent = new Link(top, SWT.NONE);
    goToParent.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (resource != null) {
                if (resource instanceof IProject) {
                    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                            Display.getDefault().getActiveShell(),
                            "com.aptana.ide.editor.css.preferences.PreviewPreferencePage", //$NON-NLS-1$
                            new String[] { "com.aptana.ide.editor.css.preferences.PreviewPreferencePage" }, //$NON-NLS-1$
                            null);
                    dialog.open();
                } else if (resource instanceof IFile) {
                    PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(
                            Display.getDefault().getActiveShell(), resource.getProject(),
                            "com.aptana.ide.editor.css.preview.cssPreviewPropertyPage", //$NON-NLS-1$
                            new String[] { "com.aptana.ide.editor.css.preview.cssPreviewPropertyPage" }, null); //$NON-NLS-1$
                    dialog.open();
                }
            }
        }

    });
    goToParent.setLayoutData(new GridData(SWT.END, SWT.FILL, true, false));

    preview = new Group(composite, SWT.NONE);
    preview.setText(Messages.CSSPreviewPropertyPage_PreviewText);
    GridLayout pLayout = new GridLayout(1, true);
    pLayout.marginHeight = 10;
    preview.setLayout(pLayout);
    preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    useProjectFile = new Button(preview, SWT.RADIO);
    useProjectFile.setText(Messages.CSSPreviewPropertyPage_UseProjectFileText);
    useProjectFile.setSelection(true);
    useProjectFile.setEnabled(false);
    useProjectFile.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            projectFiles.setEnabled(true);
            urlText.setEnabled(false);
            browseButton.setEnabled(false);
        }

    });

    Group projectGroup = new Group(preview, SWT.NONE);
    projectGroup.setText(Messages.CSSPreviewPropertyPage_ProjectFilesText);
    GridLayout pgLayout = new GridLayout(1, true);
    pgLayout.marginHeight = 0;
    pgLayout.marginWidth = 0;
    projectGroup.setLayout(pgLayout);
    GridData pgData = new GridData(SWT.FILL, SWT.FILL, true, true);
    pgData.horizontalIndent = 10;
    projectGroup.setLayoutData(pgData);
    projectFiles = new Table(projectGroup, SWT.CHECK | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
    projectFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.detail == SWT.CHECK) {
                TableItem[] items = projectFiles.getItems();
                for (int i = 0; i < items.length; i++) {
                    TableItem item = items[i];
                    if (item != e.item) {
                        item.setChecked(false);
                    }
                }
            }
        }

    });
    projectFiles.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    projectFiles.setLinesVisible(true);
    new TableColumn(projectFiles, SWT.LEFT);
    projectFiles.addControlListener(new ControlAdapter() {

        public void controlResized(ControlEvent e) {
            TableColumn c = projectFiles.getColumn(0);
            Point size = projectFiles.getSize();

            // Mac fix for always having a vertical scrollbar and not calculating it affects the horizontal scroll
            // bar
            if (Platform.getOS().equals(Platform.OS_MACOSX)) {
                ScrollBar vScrolls = projectFiles.getVerticalBar();
                if (vScrolls != null) {
                    size.x = size.x - vScrolls.getSize().x - 5;
                }
            }
            c.setWidth(size.x - 6);
        }

    });
    projectFiles.setEnabled(false);

    useURL = new Button(preview, SWT.RADIO);
    useURL.setText(Messages.CSSPreviewPropertyPage_UseURLText);
    useURL.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            projectFiles.setEnabled(false);
            urlText.setEnabled(true);
            browseButton.setEnabled(true);
        }

    });
    useURL.setSelection(false);
    useURL.setEnabled(false);

    Composite url = new Composite(preview, SWT.NONE);
    GridLayout urlLayout = new GridLayout(3, false);
    urlLayout.marginHeight = 0;
    urlLayout.marginWidth = 0;
    url.setLayout(urlLayout);
    GridData uData = new GridData(SWT.FILL, SWT.FILL, true, false);
    uData.horizontalIndent = 17;
    url.setLayoutData(uData);
    urlLabel = new Label(url, SWT.LEFT);
    urlLabel.setText(Messages.CSSPreviewPropertyPage_URLText);
    urlText = new Text(url, SWT.SINGLE | SWT.BORDER);
    urlText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    urlText.setEnabled(false);
    browseButton = new Button(url, SWT.PUSH);
    browseButton.setText(Messages.CSSPreviewPropertyPage_BrowseText);
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(browseButton.getShell(), SWT.OPEN);
            String file = dialog.open();
            if (file != null) {
                urlText.setText(file);
            }
        }

    });
    browseButton.setEnabled(false);

    try {
        resource = (IResource) getElement();
        String override = resource.getPersistentProperty(new QualifiedName("", CSS_PREVIEW_OVERRIDE)); //$NON-NLS-1$
        String previewPath = resource.getPersistentProperty(new QualifiedName("", CSS_PREVIEW_PATH)); //$NON-NLS-1$
        String previewType = resource.getPersistentProperty(new QualifiedName("", CSS_PREVIEW_TYPE)); //$NON-NLS-1$
        IProject project = null;
        if (resource instanceof IProject) {
            project = (IProject) resource;
            this.override.setText(Messages.CSSPreviewPropertyPage_OverrideWorkspaceText);
            goToParent.setText("<a>" + Messages.CSSPreviewPropertyPage_OverrideWorkspaceLinkText + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
        } else if (resource instanceof IFile) {
            project = resource.getProject();
            this.override.setText(Messages.CSSPreviewPropertyPage_OverrideProjectText);
            goToParent.setText("<a>" + Messages.CSSPreviewPropertyPage_OverrideProjectLinkText + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (project != null) {
            buildTable(project);
        }
        if (TRUE.equals(override)) {
            this.override.setSelection(true);
            useURL.setEnabled(true);
            useProjectFile.setEnabled(true);
            if (URL_TYPE.equals(previewType)) {
                useURL.setSelection(true);
                useProjectFile.setSelection(false);
                urlText.setEnabled(true);
                browseButton.setEnabled(true);
                urlText.setText(previewPath);
            } else {
                useURL.setSelection(false);
                useProjectFile.setSelection(true);
                projectFiles.setEnabled(true);
                if (project != null && previewPath != null) {
                    IFile[] candidates = ResourcesPlugin.getWorkspace().getRoot()
                            .findFilesForLocation(new Path(previewPath));
                    IResource resource = null;
                    for (int i = 0; i < candidates.length; i++) {
                        if (project.equals(candidates[i].getProject())) {
                            resource = candidates[i];
                            break;
                        }
                    }
                    if (resource != null && resource.exists()) {
                        TableItem[] items = projectFiles.getItems();
                        for (int i = 0; i < items.length; i++) {
                            IResource file = (IResource) items[i].getData();
                            if (resource.equals(file)) {
                                items[i].setChecked(true);
                                break;
                            }
                        }
                    }
                }
            }
        }
    } catch (CoreException e) {
        IdeLog.logError(CSSPlugin.getDefault(), "Error getting element", e); //$NON-NLS-1$
    }
    return composite;
}

From source file:com.aptana.ide.editor.js.actions.EnvironmentsAction.java

License:Open Source License

/**
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 *///w  w w  . j  av a 2 s . c o m
public void run(IAction action) {
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(Display.getDefault().getActiveShell(),
            "com.aptana.ide.editor.js.preferences.CodeAssistPreferencePage", //$NON-NLS-1$
            new String[] { "com.aptana.ide.editor.js.preferences.CodeAssistPreferencePage" }, null); //$NON-NLS-1$
    dialog.open();

}

From source file:com.aptana.ide.logging.view.LogView.java

License:Open Source License

/**
 * Tools action./*from   w  ww  . j a  v a  2 s. c  o m*/
 */
private void createToolsAction() {
    toolsAction = new Action() {
        public void run() {

            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell,
                    "com.aptana.ide.logging.preferences.LoggingColorizationPreferencePage", new String[] {}, //$NON-NLS-1$
                    1);
            dialog.open();
        }
    };

    toolsAction.setText(com.aptana.ide.logging.view.Messages.LogView_ToolsAction_Label);
    toolsAction.setToolTipText(com.aptana.ide.logging.view.Messages.LogView_ToolsAction_Tooltip);
    toolsAction.setImageDescriptor(fToolsActionDescriptor);
}

From source file:com.aptana.ide.server.jetty.PreferenceClient.java

License:Open Source License

/**
 * @see com.aptana.ide.server.jetty.comet.CometClient#getResponse(java.lang.String, java.lang.Object)
 *//*w  w w .ja v a  2s .co  m*/
protected Object getResponse(String toChannel, Object request) {
    if (PREFERENCE_CHANNEL.equals(toChannel) && request instanceof Map) {
        Map requestData = (Map) request;
        if (requestData.containsKey(CometConstants.REQUEST)) {
            String type = requestData.get(CometConstants.REQUEST).toString();
            if (SET_ACTION.equals(type) && requestData.containsKey(VALUE) && requestData.containsKey(NAME)) {
                String name = requestData.get(NAME).toString();
                String value = requestData.get(VALUE).toString();
                JettyPlugin.getDefault().getPreferenceStore().setValue(name, value);
            } else if (GET_ACTION.equals(type) && requestData.containsKey(NAME)) {
                String name = requestData.get(NAME).toString();
                Map<String, String> responseData = new HashMap<String, String>();
                responseData.put(CometConstants.RESPONSE, GET_ACTION);
                responseData.put(NAME, name);
                responseData.put(VALUE, JettyPlugin.getDefault().getPreferenceStore().getString(name));
                return responseData;
            } else if (SHOW_ACTION.equals(type)) {
                if (requestData.containsKey(CometConstants.ID)) {
                    final String pageId = requestData.get(CometConstants.ID).toString();
                    UIJob job = new UIJob(Messages.PreferenceClient_Job_RunJaxer) {

                        public IStatus runInUIThread(IProgressMonitor monitor) {
                            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                                    getDisplay().getActiveShell(), pageId, new String[] {}, null);
                            dialog.open();
                            return Status.OK_STATUS;
                        }

                    };
                    job.setSystem(true);
                    job.schedule();
                }
            }
        }
    }
    return null;
}