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.nokia.carbide.cpp.internal.news.reader.editor.NewsPage.java

License:Open Source License

/**
 * Handle opening the Carbide.c++ news preference page.
 *//*from  w  w  w . ja  v  a2 s.c o m*/
private void handleOpenNewsPreferencePage() {
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getSite().getShell(),
            NewsPreferenceConstants.PREFERENCE_PAGE_ID, null, null);
    dialog.open();
    newsBrowser.setText(createNewsContents());
}

From source file:com.nokia.carbide.cpp.internal.news.reader.editor.NewsPage.java

License:Open Source License

/**
 * Handle opening the Eclipse network connections preference page.
 *//*from ww w  .jav a  2  s .co  m*/
private void handleOpenNetworkPreferencePage() {
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getSite().getShell(),
            ECLIPSE_NETWORK_PREFERENCES_ID, null, null);
    dialog.open();
    newsBrowser.setText(createNewsContents());
    CarbideNewsReaderPlugin.loadFeeds();
}

From source file:com.nokia.carbide.internal.bugdatacollector.ui.preferences.BugDataCollectorPreferencePage.java

License:Open Source License

/**
 * Shows the preference dialog with only this preference page 
 * available in the tree//from w ww  .  ja v  a 2s. c  om
 * @param shell 
 */
public static void showYourself(Shell shell) {
    IPreferencePage page = new BugDataCollectorPreferencePage();
    PreferenceManager mgr = new PreferenceManager();
    IPreferenceNode node = new PreferenceNode("1", page); //$NON-NLS-1$
    mgr.addToRoot(node);
    PreferenceDialog dialog = new PreferenceDialog(shell, mgr);
    dialog.create();
    dialog.setMessage(page.getTitle());
    dialog.open();
}

From source file:com.nokia.carbide.internal.discovery.ui.extension.OpenPreferencePageAction.java

License:Open Source License

@Override
public void run() {
    Shell shell = WorkbenchUtils.getSafeShell();

    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, preferencePageId, null, null);

    dialog.open();
}

From source file:com.nokia.s60tools.analyzetool.ui.MainView.java

License:Open Source License

/**
 * Construct all the actions.//from w  w w. j av a 2  s  .c o m
 */
private void makeActions() {

    // listens click actions
    clickAction = new Action() {
        @Override
        public void run() {
            // get selection
            ISelection selection = runView.getSelection();

            // get selection object
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            // if object exists
            if (obj == null) {
                copyAction.setEnabled(false);
                return;
            }

            // get call stack addresses to view
            if (obj instanceof TreeObject) {
                lastSelectedObject = obj;

                // get callstack items
                Object resultObject = getCallStack((TreeObject) obj);

                // if results not found
                if (resultObject == null) {
                    copyAction.setEnabled(false);
                } else {
                    callstackView.setInput(resultObject);
                    copyAction.setEnabled(true);
                }
            }

            // expand all the trees on call stack view
            callstackView.expandAll();

            setTextToInformationLabel();
        }
    };

    // listens double click actions
    doubleClickAction = new Action() {
        @Override
        public void run() {
            // get selection
            ISelection selection = callstackView.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            // open file in editor
            if (obj instanceof TreeObject) {
                openEditor((TreeObject) obj);
            }
        }
    };

    // data capture
    traceAction = new Action() {
        @Override
        public void run() {

            // if trace is active => stop the trace
            if (traceActive) {
                stop(true);
            }
            // if trace is not active => start the trace
            else {
                start();
            }
        }
    };
    traceAction.setText(Constants.ACTION_START_TRACE);
    traceAction.setToolTipText(Constants.ACTION_START_TRACE);
    traceAction.setImageDescriptor(Activator.getImageDescriptor((Constants.BUTTON_RUN)));

    // if trace actions are disabled
    if (!enableTrace) {
        traceAction.setEnabled(false);
        traceAction.setToolTipText(Constants.TRACE_NOT_FOUND);
    }

    // build with atool
    buildWithAtool = new Action() {
        @Override
        public void run() {
            activateAnalysisBuild();
        }
    };
    buildWithAtool.setText(Constants.ACTION_AT_BUILD_ACTIVE);
    buildWithAtool.setToolTipText(Constants.ACTION_AT_BUILD_ACTIVE);
    buildWithAtool.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_BUILD));

    // clean atool changes
    cleanAtoolChanges = new Action() {
        @Override
        public void run() {
            clean();
        }
    };
    cleanAtoolChanges.setText(Constants.ACTION_CLEAR_CHANGES);
    cleanAtoolChanges.setToolTipText(Constants.ACTION_CLEAR_CHANGES_TOOLTIP);
    cleanAtoolChanges.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_CLEAN));

    // change detail level
    changeDetails = new Action() {
        @Override
        public void run() {
            changeDetailLevel();
        }
    };
    changeDetails.setText(Constants.ACTION_CHANGE_REPORT_LEVEL);

    // save report( xml ) file
    saveReportAction = new Action() {
        @Override
        public void run() {
            saveReportFile(Constants.SAVE_REPORT_FILE_XML);
        }
    };
    saveReportAction.setText(Constants.ACTION_SAVE_REPORT);
    saveReportAction.setToolTipText(Constants.ACTION_SAVE_REPORT);

    // save data file
    saveDataFileAction = new Action() {
        @Override
        public void run() {
            saveReportFile(Constants.SAVE_REPORT_FILE_DATA);

        }
    };
    saveDataFileAction.setText(Constants.ACTION_SAVE_DATA);
    saveDataFileAction.setToolTipText(Constants.ACTION_SAVE_DATA);

    // start subtest
    startSubtest = new Action() {
        @Override
        public void run() {
            startSubTest();
        }
    };
    startSubtest.setText(Constants.ACTION_START_SUBTEST);
    startSubtest.setToolTipText(Constants.ACTION_START_SUBTEST);
    startSubtest.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_START_SUBTEST));

    // stop subtest
    stopSubtest = new Action() {
        @Override
        public void run() {
            stopSubTest();
        }
    };
    stopSubtest.setText(Constants.ACTION_STOP_SUBTEST);
    stopSubtest.setToolTipText(Constants.ACTION_STOP_SUBTEST);
    stopSubtest.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_STOP_SUBTEST));
    stopSubtest.setDescription(Constants.ACTION_STOP_SUBTEST);

    // set start and stop subtest not visible at the beginning
    startSubtest.setEnabled(false);
    stopSubtest.setEnabled(false);

    analyzeResults = new Action() {
        @Override
        public void run() {
            analyzeDataFile(Constants.ANALYZE_ASK_FOR_USER, null, true);
        }
    };

    analyzeResults.setText(Constants.ACTION_OPEN);
    analyzeResults.setToolTipText(Constants.ACTION_OPEN);
    analyzeResults.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_OPEN));

    clearProjectResults = new Action() {
        @Override
        public void run() {
            cleanAnalyzeData(project);
            if (statisticView != null) {
                statisticView.clean(project);
            }
            updateChangeDetailState(project);
        }
    };
    clearProjectResults.setText(Constants.ACTION_CLEAR_RESULTS);
    clearProjectResults.setToolTipText(Constants.ACTION_CLEAR_RESULTS);

    refreshResults = new Action() {
        @Override
        public void run() {
            if (project != null && project.isOpen() && projectResults != null) {
                String dataFile = projectResults.getDataFileName(project);
                if (dataFile != null || !("").equals(dataFile)) {
                    analyzeDataFile(Constants.ANALYZE_USE_DATA_FILE, dataFile, true);
                } else {
                    // some internal error occurred => disable this action
                    refreshResults.setEnabled(false);
                }

            }
        }
    };
    refreshResults.setText(Constants.ACTION_RE_ANALYZE);
    refreshResults.setToolTipText(Constants.ACTION_RE_ANALYZE_TOOLTIP);
    refreshResults.setEnabled(false);

    // copy active item contents to clipboard
    copyAction = new Action() {
        @Override
        public void run() {
            // copy active item contents to clipboard

            // Create new clipboard object
            Clipboard cp = new Clipboard(runView.getControl().getDisplay());

            // Create new TextTransfer object
            // TextTransfer converts plain text represented as a java String
            // to a platform specific representation of the data and vice
            // versa
            TextTransfer tt = TextTransfer.getInstance();

            // new StringBuffer which contains the copied text
            StringBuffer sb = new StringBuffer(64);

            // chech that project contains results
            if (projectResults == null || !projectResults.contains(project) || activeTreeItem == null) {
                return;
            }
            // get active item info (also callstack info)
            AnalysisItem item = null;

            // if selected item is subtest
            if (activeTreeItem.isSubTest()) {
                item = projectResults.getSubtestItem(project, activeTreeItem.getRunID(),
                        activeTreeItem.getMemLeakID(), activeTreeItem.getSubtestID());
            } else {
                item = projectResults.getSpecific(project, activeTreeItem.getRunID(),
                        activeTreeItem.getMemLeakID());
            }

            // check that item found
            if (item == null) {
                return;
            }

            sb.append(activeTreeItem.getName());
            String separator = System.getProperty("line.separator");
            sb.append(separator);
            char space = ' ';
            AbstractList<CallstackItem> callstackItems = item.getCallstackItems();
            Iterator<CallstackItem> iterCallstack = callstackItems.iterator();
            while (iterCallstack.hasNext()) {
                CallstackItem oneItem = iterCallstack.next();
                sb.append("      ");
                sb.append(oneItem.getMemoryAddress());
                sb.append(space);
                sb.append(oneItem.getModuleName());
                sb.append(space);
                sb.append(oneItem.getFunctionName());
                sb.append(space);
                sb.append(oneItem.getFileName());
                sb.append(space);
                int lineNbr = oneItem.getLeakLineNumber();
                if (lineNbr > 0) {
                    sb.append(lineNbr);
                }
                sb.append(separator);
            }

            // info is ready => now copy info to clipboard
            cp.setContents(new Object[] { sb.toString() }, new Transfer[] { tt });
        }
    };
    copyAction.setText(Constants.ACTION_COPY);
    copyAction.setEnabled(false);

    // open preferences action
    openPrefs = new Action() {
        @Override
        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    Constants.ANALYZE_TOOL_PREFS_ID, null, null);

            if (dialog != null) {
                dialog.open();
            }
        }
    };
    openPrefs.setText(Constants.ACTION_OPEN_PREFS);
    openPrefs.setToolTipText(Constants.ACTION_OPEN_PREFS_TOOLTIP);
    openPrefs.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_OPEN_PREFS));

    changeReportActionTooltip();
    updateChangeDetailState(project);
    updateBuildState(project);
}

From source file:com.nokia.s60tools.hticonnection.actions.OpenPreferencePageAction.java

License:Open Source License

/**
 * Open HTI API preferences page preference page
 */// w  w  w .j  a va  2 s  .c o  m
private void openPreferencePage() {
    IPreferencePage page = new HtiApiPreferencePage();
    PreferenceManager mgr = new PreferenceManager();
    IPreferenceNode node = new PreferenceNode("1", page);//$NON-NLS-1$
    mgr.addToRoot(node);
    PreferenceDialog dialog = new PreferenceDialog(HtiApiActivator.getCurrentlyActiveWbWindowShell(), mgr);
    dialog.create();
    dialog.setMessage(page.getTitle());
    dialog.open();
}

From source file:com.nokia.s60tools.remotecontrol.actions.OpenPreferencePageAction.java

License:Open Source License

/**
 * Open Remote control preferences page/* w  ww . jav  a2s. c  o m*/
 */
private void openPreferencePage() {

    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
            RemoteControlActivator.getCurrentlyActiveWbWindowShell(), RCPreferencePage.PAGE_ID, null, null);

    Object object = dialog.getSelectedPage();
    if (object instanceof RCPreferencePage) {
        // Selecting correct tab.
        ((RCPreferencePage) object).openTab(selection);
    }

    dialog.open();
}

From source file:com.nokia.s60tools.remotecontrol.preferences.ScreenCapturePreferencesUI.java

License:Open Source License

/**
 * Constructor// www  . j  a v a 2 s. c  om
 * 
 * @param parent Parent widget
 * @param style Style parameters
 */
public ScreenCapturePreferencesUI(Composite parent, int style) {
    super(parent, style);

    // Create capture options group
    Group screenCaptureGroup = new Group(this, SWT.SHADOW_ETCHED_IN);
    screenCaptureGroup.setText(Messages.getString("ScreenCapturePreferencesUI.CaptureOptionGroup_Title")); //$NON-NLS-1$
    screenCaptureGroup.setLayout(new GridLayout(1, false));
    screenCaptureGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createCaptureOptions(screenCaptureGroup);

    // Create save screenshot group
    Group saveScreenshotGroup = new Group(this, SWT.SHADOW_ETCHED_IN);
    saveScreenshotGroup.setText(Messages.getString("ScreenCapturePreferencesUI.SaveScreenshotGroup_Title")); //$NON-NLS-1$
    saveScreenshotGroup.setLayout(new GridLayout(1, false));
    saveScreenshotGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createSaveScreenshot(saveScreenshotGroup);

    // Create link to Carbide's Keys preferences page.
    Link configureKeysLink = new Link(this, SWT.NULL);
    configureKeysLink.setText(Messages.getString("ScreenCapturePreferencesUI.CarbideKeysLink_Text")); //$NON-NLS-1$
    configureKeysLink.setToolTipText(Messages.getString("ScreenCapturePreferencesUI.CarbideKeysLink_Tooltip")); //$NON-NLS-1$

    //listener for configure keys link
    configureKeysLink.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            // Opens Carbide's Keys preferences page when selected.
            PreferenceDialog dialog = org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(
                    RemoteControlActivator.getCurrentlyActiveWbWindowShell(),
                    "org.eclipse.ui.preferencePages.Keys", //$NON-NLS-1$
                    null, null);
            dialog.open();
        }
    });

    getPrefsStoreValues();
}

From source file:com.nokia.s60tools.remotecontrol.screen.ui.view.ScreenSaverThread.java

License:Open Source License

/**
 * Open Remote control preferences page/*from  w  ww .j a  va  2s  .  c  o  m*/
 */
private void openPreferencePage() {

    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
            RemoteControlActivator.getCurrentlyActiveWbWindowShell(), RCPreferencePage.PAGE_ID, null, null);

    dialog.open();
}

From source file:com.nokia.s60tools.ui.preferences.PreferenceUtils.java

License:Open Source License

/**
 * Open a preference page by ID introduced in <code>plugin.xml</code>
 * // w w w .  j  av a 2s  . co  m
 * @param preferencePageID ID for preference page
 * @param shell {@link Shell}
 */
public static void openPreferencePage(String preferencePageID, Shell shell) {

    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, preferencePageID, null, null);

    dialog.open();
}