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

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

Introduction

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

Prototype

public void setMessage(String newMessage) 

Source Link

Document

Set the message text.

Usage

From source file:com.siteview.mde.internal.ui.samples.ShowTargetPlatformAction.java

License:Open Source License

public void run() {
    final IPreferenceNode targetNode = new TargetPlatformPreferenceNode();
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);//from  w  w  w. j  a va  2 s  .co  m
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    final PreferenceDialog dialog = new PreferenceDialog(shell, manager);
    BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}

From source file:com.siteview.mde.internal.ui.wizards.imports.PluginImportWizardFirstPage.java

License:Open Source License

private boolean showPreferencePage(final IPreferenceNode targetNode, Shell shell) {
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);//from  w w  w . j  a v  a  2s.c om
    final PreferenceDialog dialog = new PreferenceDialog(shell, manager);
    final boolean[] result = new boolean[] { false };
    BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            if (dialog.open() == Window.OK)
                result[0] = true;
        }
    });
    return result[0];
}

From source file:com.telink.tc32eclipse.ui.actions.TCDBPrefAction.java

License:Open Source License

/**
 * Start the TCDB UploadJob./*w  ww  . j  a v a  2 s  . co m*/
 * 
 * @param buildcfg
 *            The build configuration for resolving macros.
 * @param props
 *            The AVR properties for the project / the current configuration
 */
private void runTCDBPref(IConfiguration buildcfg, TC32ProjectProperties props) {

    TCDBProperties TCDBprops = props.getTCDBProperties();

    // get the list of normal (non-action) arguments
    //      List<String> optionargs = TCDBprops.getArguments();

    // get a list of actions
    List<String> actionargs = TCDBprops.getActionArguments(buildcfg, true);

    // Get the ProgrammerConfig in case we need to display an error
    // message
    //      ProgrammerConfig programmer = TCDBprops.getProgrammer();

    actionargs.add(props.getBinaryTargetName()); // + " " + programmer.getArg2String());

    // Set the working directory to the CWD of the active build config, so that
    // relative paths are resolved correctly.
    //      IPath cwdunresolved = buildcfg.getBuildData().getBuilderCWD();
    //      IPath cwd = new Path(BuildMacro.resolveMacros(buildcfg, cwdunresolved.toString()));

    IPreferencePage page = new MainPreferencePage();
    PreferenceManager mgr = new PreferenceManager();
    IPreferenceNode node = new PreferenceNode("1", page);
    mgr.addToRoot(node);
    PreferenceDialog dialog = new PreferenceDialog(getShell(), mgr);
    dialog.create();
    dialog.setMessage(page.getTitle());
    dialog.open();
    /*
    //ISelection sel = ... obtain the current selection
       PropertyPage page = new PageTCDB(); //MyPropertyPage();
       PreferenceManager mgr = new PreferenceManager();
       IPreferenceNode node = new PreferenceNode("1", page);
       mgr.addToRoot(node);
       @SuppressWarnings("restriction")
       ISelection sel = (ISelection) fProject;
       PropertyDialog dialog = new PropertyDialog(getShell(), mgr, sel);
       dialog.create();
       dialog.setMessage(page.getTitle());
       //PropertyDialog dialog = PropertyDialog.createDialogOn(getShell(), null, (ISelection) fProject);  
       dialog.open();
       */

}

From source file:de.jcup.egradle.eclipse.ide.IDEUtil.java

License:Apache License

private static void showPreferencePage(IPreferencePage page) {
    EclipseUtil.safeAsyncExec(new Runnable() {

        @Override//  w  ww .j a  v  a2 s  . co  m
        public void run() {
            Shell shell = getSafeDisplay().getActiveShell();

            PreferenceManager mgr = new PreferenceManager();
            IPreferenceNode node = new PreferenceNode("1", page);
            mgr.addToRoot(node);
            PreferenceDialog dialog = new PreferenceDialog(shell, mgr);
            dialog.create();
            dialog.setMessage(page.getTitle());
            dialog.open();
        }

    });

}

From source file:kieker.develop.rl.ui.preferences.AbstractFieldEditorOverlayPage.java

License:Apache License

/**
 * Show a single preference pages./*w  w w.  j av a 2  s.  co  m*/
 *
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(final String id, final IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    final PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);
    final PreferenceDialog dialog = new PreferenceDialog(this.getControl().getShell(), manager);
    BusyIndicator.showWhile(this.getControl().getDisplay(), new Runnable() {
        @Override
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}

From source file:net.openchrom.xxd.processor.supplier.tracecompare.ui.swt.EnhancedTraceCompareEditor.java

License:Open Source License

private Button createSettingsButton(Composite parent, GridData gridData) {

    Button button = new Button(parent, SWT.PUSH);
    button.setText("Settings");
    button.setImage(ApplicationImageFactory.getInstance().getImage(IApplicationImage.IMAGE_CONFIGURE,
            IApplicationImage.SIZE_16x16));
    button.setLayoutData(gridData);/*from   ww w .  jav a2 s .c o  m*/
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {

            IPreferencePage preferencePage = new PreferencePage();
            preferencePage.setTitle("TraceCompare Preferences");
            PreferenceManager preferenceManager = new PreferenceManager();
            preferenceManager.addToRoot(new PreferenceNode("1", preferencePage));
            //
            PreferenceDialog preferenceDialog = new PreferenceDialog(Display.getDefault().getActiveShell(),
                    preferenceManager);
            preferenceDialog.create();
            preferenceDialog.setMessage("Settings");
            if (preferenceDialog.open() == PreferenceDialog.OK) {
                MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Settings",
                        "The settings have been updated.");
            }
        }
    });
    return button;
}

From source file:org.cfeclipse.cfml.frameworks.views.FrameworksView.java

License:Open Source License

private void makeActions() {

    csAddBeanAction = new Action() {
        public void run() {
            //showMessage("Executing Add Bean");

            //CUT
            //try the JDOM in-situ

            TreeSelection sel = (TreeSelection) viewer.getSelection();
            if (sel.getFirstElement() instanceof TreeParentNode) {
                TreeParentNode selNode = (TreeParentNode) sel.getFirstElement();
                if (selNode.getType().equals(FrameworkManager.COLDSPRING)) {
                    CSAddBeanDialog addDialog = new CSAddBeanDialog(viewer.getControl().getShell());

                    if (addDialog.open() == IDialogConstants.OK_ID) {
                        String id = addDialog.getCfcName().getText();
                        String className = addDialog.getCfcExtends().getText();
                        System.out.println("Dialog says " + id + " " + className);
                        Document document = selNode.getDocument();
                        Element child = document.getRootElement();

                        //Bean Element
                        Element newBean = new Element("bean");
                        newBean.setAttribute("id", addDialog.getCfcName().getText());
                        newBean.setAttribute("class", addDialog.getCfcExtends().getText());

                        child.addContent(newBean);
                        XMLOutputter outputter = new XMLOutputter();
                        try {
                            outputter.output(child, System.out);
                        } catch (IOException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }/*w w  w.ja va2  s .  c  o m*/

                    }

                }

            }

            //CUT
        }
    };
    csAddBeanAction.setText("Add bean from CFC");
    csAddBeanAction.setToolTipText("Adds a bean to coldspring from a CFC");
    csAddBeanAction.setImageDescriptor(
            PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));

    action1 = new Action() {
        public void run() {
            showMessage("Action 1 executed");
        }
    };

    refreshAction = new Action() {
        public void run() {
            //showMessage("some refresh");

            refreshFrameworkTree();

        }
    };
    refreshAction.setImageDescriptor(FWXImages.getImageRegistry().getDescriptor(FWXImages.ICON_REFRESH));

    viewXMLAction = new Action() {
        public void run() {

            ViewXMLDialog vxd = new ViewXMLDialog(getSite().getShell(),
                    ((FrameworksContentProvider) viewer.getContentProvider()).getVirtualDocument());
            vxd.open();
            // open dialog with just an XML thing
        }
    };
    viewXMLAction.setImageDescriptor(FWXImages.getImageRegistry().getDescriptor(FWXImages.ICON_XML_VIEW));

    action1.setText("Action 1");
    action1.setToolTipText("Action 1 tooltip");
    action1.setImageDescriptor(
            PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));

    action2 = new Action() {
        public void run() {

            TreeSelection sel = (TreeSelection) viewer.getSelection();
            if (sel.getFirstElement() instanceof TreeParentNode) {
                TreeParentNode selNode = (TreeParentNode) sel.getFirstElement();
                ActionsPreferencePage page = new ActionsPreferencePage();
                page.setFilter(selNode);
                PreferenceManager mgr = new PreferenceManager();
                IPreferenceNode node = new PreferenceNode("1", page);
                mgr.addToRoot(node);
                PreferenceDialog dialog = new PreferenceDialog(viewer.getControl().getShell(), mgr);
                dialog.create();
                dialog.setMessage(page.getTitle());
                dialog.open();
            }

        }
    };
    action2.setText("Configure...");
    action2.setToolTipText("Configure the actions for this node");

    doubleClickAction = new Action() {
        public void run() {
            ISelection selection = viewer.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            showMessage("Double-click detected on " + obj.toString());
        }
    };
}

From source file:org.cfeclipse.cfml.snippets.views.snips.SnipTreeView.java

License:Open Source License

/**
 * creates all the default actions//from  www  .j a  v a2  s . com
 */
protected void createActions() {

    openSnipExPage = new Action("Edit SnipEx Servers",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIPEX)) {
        public void run() {
            IPreferencePage page = new SnipExPreferencePage();
            PreferenceManager mgr = new PreferenceManager();
            IPreferenceNode node = new PreferenceNode("1", page);
            mgr.addToRoot(node);
            PreferenceDialog dialog = new PreferenceDialog(getSite().getShell(), mgr);
            dialog.create();
            dialog.setMessage(page.getTitle());
            dialog.open();

        }

    };

    refreshSnipEx = new Action("Refresh SnipEx Server",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) {
        public void run() {

            System.out.println("Refreshing the snipex server");
        }
    };

    insertAction = new Action("Insert",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP)) {
        public void run() {
            insertItem();
        }
    };
    insertAction.setToolTipText("Insert the selected snip into the document");

    createFolderAction = new Action("Create Folder",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_PACKAGE)) {
        public void run() {
            createSnipFolder();
        }
    };
    createFolderAction.setToolTipText("Create a new snip package");

    createSnippetAction = new Action("Create Snippet",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_ADD)) {
        public void run() {
            createSnippet();
        }
    };
    createSnippetAction.setToolTipText("Create a new snip");

    editSnippetAction = new Action("Edit Snippet",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_EDIT)) {
        public void run() {
            editSnippet();
        }
    };
    editSnippetAction.setToolTipText("Edit the selected snip");

    refreshSnippetsAction = new Action("Refresh Snippets",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) {
        public void run() {
            reloadSnippets(true);
        }
    };
    refreshSnippetsAction.setToolTipText("Refresh snip view");

    deleteSnippetAction = new Action("Delete Snippet",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REMOVE)) {
        public void run() {
            deleteSnippet();
        }
    };
    deleteSnippetAction.setToolTipText("Delete selected snip");

    deleteFolderAction = new Action("Delete Folder",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_DELETE)) {
        public void run() {
            deleteSnipFolder();
        }
    };
    deleteFolderAction.setToolTipText("Delete selected snip package (must be empty)");

    exportToSnipEx = new Action("Export to SnipEx server",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP_EXPORT)) {
        public void run() {
            IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
            File selectedfile = (File) selection.getFirstElement();

            Shell shell = getSite().getShell();
            SnippetToSnipExWizard wizard = new SnippetToSnipExWizard(selectedfile); //TODO: pass in the object we have selected

            WizardDialog dialog = new WizardDialog(shell, wizard);
            dialog.open();

            //Run the wizard

        }
    };
    exportToSnipEx.setToolTipText("Export the selected snippet to a SnipX Server");
}

From source file:org.cfeclipse.cfml.views.snips.SnipTreeView.java

License:Open Source License

/**
 * creates all the default actions// ww  w. j av  a2  s.c o  m
 */
protected void createActions() {

    openSnipExPage = new Action("Edit SnipEx Servers",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIPEX)) {
        public void run() {
            IPreferencePage page = new SnipExPreferencePage();
            PreferenceManager mgr = new PreferenceManager();
            IPreferenceNode node = new PreferenceNode("1", page);
            mgr.addToRoot(node);
            PreferenceDialog dialog = new PreferenceDialog(getSite().getShell(), mgr);
            dialog.create();
            dialog.setMessage(page.getTitle());
            dialog.open();

        }

    };

    refreshSnipEx = new Action("Refresh SnipEx Server",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) {
        public void run() {

            System.out.println("Refreshing the snipex server");
        }
    };

    insertAction = new Action("Insert",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP)) {
        public void run() {
            insertItem();
        }
    };
    insertAction.setToolTipText("Insert the selected snip into the document");

    createFolderAction = new Action("Create Folder",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_PACKAGE)) {
        public void run() {
            createSnipFolder();
        }
    };
    createFolderAction.setToolTipText("Create a new snip package");

    createSnippetAction = new Action("Create Snippet",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_ADD)) {
        public void run() {
            createSnippet();
        }
    };
    createSnippetAction.setToolTipText("Create a new snip");

    editSnippetAction = new Action("Edit Snippet",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_EDIT)) {
        public void run() {
            editSnippet();
        }
    };
    editSnippetAction.setToolTipText("Edit the selected snip");

    refreshSnippetsAction = new Action("Refresh Snippets",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) {
        public void run() {
            reloadSnippets();
        }
    };
    refreshSnippetsAction.setToolTipText("Refresh snip view");

    deleteSnippetAction = new Action("Delete Snippet",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REMOVE)) {
        public void run() {
            deleteSnippet();
        }
    };
    deleteSnippetAction.setToolTipText("Delete selected snip");

    deleteFolderAction = new Action("Delete Folder",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_DELETE)) {
        public void run() {
            deleteSnipFolder();
        }
    };
    deleteFolderAction.setToolTipText("Delete selected snip package (must be empty)");

    exportToSnipEx = new Action("Export to SnipEx server",
            CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP_EXPORT)) {
        public void run() {
            IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
            File selectedfile = (File) selection.getFirstElement();

            Shell shell = getSite().getShell();
            SnippetToSnipExWizard wizard = new SnippetToSnipExWizard(selectedfile); //TODO: pass in the object we have selected

            WizardDialog dialog = new WizardDialog(shell, wizard);
            int result = dialog.open();

            //Run the wizard

        }
    };
    exportToSnipEx.setToolTipText("Export the selected snippet to a SnipX Server");
}

From source file:org.codehaus.groovy.eclipse.preferences.FieldEditorOverlayPage.java

License:Apache License

/**
 * Show a single preference pages/*from w  w  w.ja v a  2  s . co  m*/
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
private void showPreferencePage(final String id, final IPreferencePage page) {
    final IPreferenceNode targetNode = new PreferenceNode(id, page);
    final 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();
        }
    });
}