Example usage for org.eclipse.jface.dialogs MessageDialog INFORMATION

List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog INFORMATION.

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.

Click Source Link

Document

Constant for the info image, or a simple dialog with the info image and a single OK button (value 2).

Usage

From source file:org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.BranchCreationHandler.java

License:Open Source License

@Override
public Object executeWithException(ExecutionEvent event, IStructuredSelection selection)
        throws OseeCoreException {
    Object backingData = selection.getFirstElement();

    final TransactionRecord parentTransactionId;
    if (backingData instanceof Branch) {
        Branch branch = (Branch) backingData;
        parentTransactionId = TransactionManager.getHeadTransaction(branch);
    } else if (backingData instanceof TransactionRecord) {
        parentTransactionId = (TransactionRecord) backingData;
    } else {/*from  w  ww  .  j  av a  2s.  com*/
        throw new OseeStateException(
                "Backing data for the jobbed node in the branchview was not of the expected type");
    }
    final EntryCheckDialog dialog = new EntryCheckDialog(Displays.getActiveShell(), "Branch", null,
            "Enter the name of the new branch:", "Include a copy of the chosen transaction on the new branch",
            MessageDialog.INFORMATION, new String[] { "OK", "Cancel" }, 0);
    int result = dialog.open();

    if (result == 0 && dialog.getEntry() != null) {

        IExceptionableRunnable runnable = new IExceptionableRunnable() {
            @Override
            public IStatus run(IProgressMonitor monitor) throws Exception {
                IOseeBranch branch = parentTransactionId.getBranch();
                if (branch.equals(CoreBranches.SYSTEM_ROOT)) {
                    BranchManager.createTopLevelBranch(dialog.getEntry());
                } else {
                    if (dialog.isChecked()) {
                        BranchManager.createWorkingBranchFromTx(parentTransactionId, dialog.getEntry(), null);
                    } else {
                        BranchManager.createWorkingBranch(parentTransactionId, dialog.getEntry(), null);
                    }

                }
                return Status.OK_STATUS;
            }
        };

        Jobs.runInJob("Create Branch", runnable, Activator.class, Activator.PLUGIN_ID);
    }

    return null;
}

From source file:org.eclipse.papyrus.infra.widgets.toolbox.dialog.InformationDialog.java

License:Open Source License

/**
 * The Constructor.//from  www . ja  v  a  2 s.  c  o  m
 * 
 * @param parentShell
 *            the parent shell
 * @param dialogTitle
 *            the dialog title
 * @param message
 *            the message
 * @param pso
 *            the preference store
 * @param preference
 *            the preference
 */
public InformationDialog(Shell parentShell, String dialogTitle, String message, IPreferenceStore ps,
        String preference) {
    this(parentShell, dialogTitle, message, ps, preference, SWT.OK, MessageDialog.INFORMATION,
            new String[] { IDialogConstants.OK_LABEL });
}

From source file:org.eclipse.papyrus.modelexplorer.actions.GenericTransformAction.java

License:Open Source License

/**
 * Transform the element and update referencing diagrams.
 * //from w  w  w  .j  a va 2  s  .  c om
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    GenericTransformer transformer = new GenericTransformer(element);
    MultiStatus messages = transformer.isTransformationPossible(targetEClass);
    if (messages != null && messages.getChildren().length == 0) {
        String message = String.format(WARNING_MESSAGE, this.element.eClass().getName(),
                targetEClass.getName());
        InformationDialog dialog = new InformationDialog(Display.getDefault().getActiveShell(), WARNING_TITLE,
                message, Activator.getDefault().getPreferenceStore(),
                INavigatorPreferenceConstants.PREF_NAVIGATOR_TRANSFORM_INTO_SHOW_POPUP, SWT.YES | SWT.NO,
                MessageDialog.INFORMATION,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL });
        int result = dialog.open();
        if (result == SWT.YES || result == Window.OK) {
            transformer.transform(targetEClass);
        }
    } else {
        ErrorDialog errorDialog = new ErrorDialog(Display.getDefault().getActiveShell(), ERROR_TITLE,
                ERROR_MESSAGE, messages, IStatus.WARNING);
        errorDialog.open();
    }
}

From source file:org.eclipse.php.internal.debug.core.zend.debugger.ConfigureHostsDialog.java

License:Open Source License

/**
 * Opens configure IPs dialog./*  ww  w. j a v a 2s .co m*/
 * 
 * @param inputIPs
 */
public ConfigureHostsDialog(List<Inet4Address> inputIPs, List<Inet4Address> detectedIPs) {
    super(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
            PHPDebugCoreMessages.ConfigureHostsDialog_Configure_client_IPs, null,
            PHPDebugCoreMessages.ConfigureHostsDialog_Select_addresses, MessageDialog.INFORMATION,
            new String[] { PHPDebugCoreMessages.ConfigureHostsDialog_OK_button,
                    PHPDebugCoreMessages.ConfigureHostsDialog_Cancel_button },
            0);
    mergeAddresses(inputIPs, detectedIPs);
}

From source file:org.eclipse.php.internal.debug.ui.preferences.phps.PHPsSearchResultDialog.java

License:Open Source License

protected PHPsSearchResultDialog(List<PHPexeItem> results, String message) {
    super(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
            Messages.PHPsSearchResultDialog_PHP_executables_search, null, message, MessageDialog.INFORMATION,
            new String[] { Messages.PHPsSearchResultDialog_Add, Messages.PHPsSearchResultDialog_Cancel }, 0);
    this.results = results;
}

From source file:org.eclipse.php.internal.ui.util.PHPManual.java

License:Open Source License

/**
 * This function launches browser and shows PHP manual page for the
 * specified URL/*from   ww w . j  av a  2  s  .  c  o m*/
 */
public void showFunctionHelp(String url) {
    IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
    IWebBrowser browser;
    try {
        IPreferenceStore store = PHPUiPlugin.getDefault().getPreferenceStore();
        if (store.getBoolean(PreferenceConstants.PHP_MANUAL_OPEN_IN_NEW_BROWSER)) {
            browser = browserSupport.createBrowser(BROWSER_ID + ++browserCount);
        } else {
            browser = browserSupport.createBrowser(BROWSER_ID);
        }

        if (url.startsWith("mk:")) { //$NON-NLS-1$
            browser.openURL(new URL(null, url, new MkHandler()));
        } else if (url.startsWith("help://")) { //$NON-NLS-1$
            // convert to help system URL
            String helpURL = url.substring("help://".length()); //$NON-NLS-1$
            // open in Help System
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpURL);

        } else {
            URL url2 = validateUrlExists(url);
            if (null == url2) {

                // need to open some kind of err dialog and return
                MessageDialog d = new MessageDialog(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        PHPUIMessages.PHPManual_title, null, PHPUIMessages.PHPManual_noManual_msg,
                        MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
                d.open();
                return;
            }
            browser.openURL(url2);
        }

    } catch (PartInitException e) {
        Logger.logException(e);
    } catch (MalformedURLException e) {
        Logger.logException(e);
    }
}

From source file:org.eclipse.php.internal.ui.wizards.types.NewPHPTypeWizard.java

License:Open Source License

public void showWarningsDialog(String[] warnings) {
    StringBuilder buffer = new StringBuilder();
    String elementType = ""; //$NON-NLS-1$
    switch (page.fTypeKind) {
    case NewPHPTypePage.CLASS_TYPE:
        elementType = Messages.NewPHPTypeWizard_class;
        break;/*from   w w  w  .j  a va2 s  .  co m*/
    case NewPHPTypePage.INTERFACE_TYPE:
        elementType = Messages.NewPHPTypeWizard_interface;
        break;
    case NewPHPTypePage.TRAIT_TYPE:
        elementType = Messages.NewPHPTypeWizard_trait;
        break;
    }
    buffer.append(elementType + Messages.NewPHPTypeWizard_creationWasSuccessful);
    for (String element : warnings) {
        buffer.append(element + "\n"); //$NON-NLS-1$
    }
    MessageDialog dialog = new MessageDialog(getShell(), "PHP Code Generator Warnings", null, buffer.toString(), //$NON-NLS-1$
            MessageDialog.INFORMATION, new String[] { "OK" }, 0); //$NON-NLS-1$
    dialog.open();
}

From source file:org.eclipse.rap.examples.pages.MessageDialogUtil.java

License:Open Source License

private static String[] getButtonLabels(int kind) {
    String[] dialogButtonLabels;//  w ww. j a  v  a  2  s. c o m
    switch (kind) {
    case MessageDialog.ERROR:
    case MessageDialog.INFORMATION:
    case MessageDialog.WARNING: {
        dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL };
        break;
    }
    case MessageDialog.CONFIRM: {
        dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL,
                IDialogConstants.get().CANCEL_LABEL };
        break;
    }
    case MessageDialog.QUESTION: {
        dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL };
        break;
    }
    case MessageDialog.QUESTION_WITH_CANCEL: {
        dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL,
                IDialogConstants.get().CANCEL_LABEL };
        break;
    }
    default: {
        throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()");
    }
    }
    return dialogButtonLabels;
}

From source file:org.eclipse.rcptt.ui.preferences.Q7PreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    textLaunchTimeout = createText(composite, Messages.Q7PreferencePage_LaunchTimeoutLabel,
            Integer.toString(Q7Launcher.getLaunchTimeout()));
    textCommandsDelay = createText(composite, Messages.Q7PreferencePage_CommandDelayLabel,
            Integer.toString(Q7.INSTANCE.getCommandsExecutionDelay()));

    // Advanced configuration
    Section advancedExpander = new Section(composite, Section.TWISTIE);
    advancedExpander.setText(Messages.Q7PreferencePage_AdvancedSectionLabel);
    advancedExpander.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    Composite advancedComposite = new Composite(advancedExpander, SWT.NONE);

    advancedComposite.setLayout(new GridLayout(1, false));
    advancedExpander.setClient(advancedComposite);

    Link runnerArg = new Link(advancedComposite, SWT.NONE);
    runnerArg.setLayoutData(new GridData(SWT.RIGHT, SWT.DEFAULT, true, false, 2, 1));
    runnerArg.setText(Messages.Q7PreferencePage_AdvancedRunnerArgLink);
    runnerArg.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            new MessageDialog(getShell(), "-testOptions arg for RCPTT Runner", null, buildTestOptionsLine(),
                    MessageDialog.INFORMATION, new String[] { "Copy to Clipboard", "Close" }, 1) {
                protected void buttonPressed(int buttonId) {
                    switch (buttonId) {
                    case 0:
                        Clipboard cb = new Clipboard(getShell().getDisplay());
                        cb.setContents(new Object[] { message }, new Transfer[] { TextTransfer.getInstance() });
                        cb.dispose();/*ww w  . j av a 2 s.c om*/
                        break;
                    default:
                        super.buttonPressed(buttonId);
                    }
                };
            }.open();
        }
    });

    final Control control = features.createOptions(advancedComposite, TeslaFeatures.ADV_OPTIONS, false, null);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(control);
    advancedExpander.addExpansionListener(new IExpansionListener() {
        public void expansionStateChanging(ExpansionEvent e) {
        }

        public void expansionStateChanged(ExpansionEvent e) {
            if (e.getState()) {
                control.setFocus();
            }
        }
    });

    return null;
}

From source file:org.eclipse.riena.internal.ui.ridgets.swt.MessageBoxRidget.java

License:Open Source License

private int getType(final Type type) {

    switch (type) {
    case PLAIN://from  w  w w .j a  v a  2s  .  co  m
        return MessageDialog.NONE;
    case INFORMATION:
        return MessageDialog.INFORMATION;
    case WARNING:
        return MessageDialog.WARNING;
    case ERROR:
        return MessageDialog.ERROR;
    case HELP:
        return MessageDialog.INFORMATION;
    case QUESTION:
        return MessageDialog.QUESTION;
    default:
        return MessageDialog.NONE;
    }
}