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.team.svn.ui.wizard.CheckoutAsWizard.java

License:Open Source License

protected AbstractActionOperation getCheckoutProjectOperation(final IRepositoryResource[] resources,
        final ObtainProjectNameOperation obtainOperation, final SVNDepth depth,
        final SVNRevision revisionToCheckoutFrom) {
    return new AbstractActionOperation("Operation_CheckoutProjects", SVNUIMessages.class) { //$NON-NLS-1$
        protected void runImpl(IProgressMonitor monitor) throws Exception {
            UIMonitorUtility.getDisplay().syncExec(new Runnable() {
                public void run() {
                    HashMap name2resources = obtainOperation.getNames2Resources();
                    if (name2resources.isEmpty()) {
                        new MessageDialog(UIMonitorUtility.getShell(), getOperationResource("Title"), null, //$NON-NLS-1$
                                getOperationResource("Message"), MessageDialog.INFORMATION, //$NON-NLS-1$
                                new String[] { IDialogConstants.OK_LABEL }, 0).open();
                        return;
                    }/*from  w w  w  .j a v  a2  s.com*/
                    CheckoutProjectsWizard wizard = new CheckoutProjectsWizard(resources, name2resources);
                    WizardDialog dialog = new WizardDialog(UIMonitorUtility.getShell(), wizard);
                    dialog.create();
                    wizard.postInit();
                    dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
                            SIZING_WIZARD_HEIGHT);
                    if (dialog.open() == 0) {//finish button pressed
                        List selection = wizard.getResultSelections();
                        IActionOperation op;
                        final Set projectNames;
                        if (wizard.isCheckoutAsFoldersSelected()) {
                            projectNames = null;
                            Map resources2Names = new HashMap();
                            if (CheckoutAsWizard.this.names2resources != null) {
                                for (Iterator it = CheckoutAsWizard.this.names2resources.entrySet()
                                        .iterator(); it.hasNext();) {
                                    Map.Entry entry = (Map.Entry) it.next();
                                    resources2Names.put(entry.getValue(), entry.getKey());
                                }
                            }
                            Map mappings = CheckoutAsWizard.this.getExternalsFolderNames(resources,
                                    resources2Names);
                            op = CheckoutAsWizard.this
                                    .getCheckoutAsFolderOperation(wizard.getTargetFolder(),
                                            (IRepositoryResource[]) selection
                                                    .toArray(new IRepositoryResource[selection.size()]),
                                            mappings);
                        } else {
                            HashMap selectedMap = new HashMap();
                            List projects = new ArrayList();
                            projectNames = name2resources.keySet();
                            for (Iterator iter = projectNames.iterator(); iter.hasNext();) {
                                String projName = (String) iter.next();
                                if (wizard.getResultSelections().contains(name2resources.get(projName))) {
                                    selectedMap.put(projName, name2resources.get(projName));
                                    projects.add(name2resources.get(projName));
                                }
                            }
                            boolean ignoreExternals = SVNTeamPreferences.getBehaviourBoolean(
                                    SVNTeamUIPlugin.instance().getPreferenceStore(),
                                    SVNTeamPreferences.BEHAVIOUR_IGNORE_EXTERNALS_NAME);
                            op = ExtensionsManager.getInstance().getCurrentCheckoutFactory()
                                    .getCheckoutOperation(CheckoutAsWizard.this.getShell(),
                                            (IRepositoryResource[]) projects
                                                    .toArray(new IRepositoryResource[projects.size()]),
                                            selectedMap, wizard.isRespectHierarchy(), wizard.getLocation(),
                                            depth, ignoreExternals);
                        }
                        if (op != null) {
                            String wsName = wizard.getWorkingSetName();
                            if (CheckoutAsWizard.this.priorOp != null || wsName != null) {
                                CompositeOperation tmp = new CompositeOperation(op.getId(),
                                        op.getMessagesClass());
                                if (CheckoutAsWizard.this.priorOp != null) {
                                    tmp.add(CheckoutAsWizard.this.priorOp);
                                    tmp.add(op, new IActionOperation[] { CheckoutAsWizard.this.priorOp });
                                } else {
                                    tmp.add(op);
                                }
                                if (wsName != null) {
                                    tmp.add(new MoveProjectsToWorkingSetOperation(new IResourceProvider() {
                                        public IResource[] getResources() {
                                            List projects = new ArrayList();
                                            for (Iterator it = projectNames.iterator(); it.hasNext();) {
                                                String name = (String) it.next();
                                                IProject prj = ResourcesPlugin.getWorkspace().getRoot()
                                                        .getProject(name);
                                                if (prj != null) {
                                                    projects.add(prj);
                                                }
                                            }
                                            return (IProject[]) projects.toArray(new IProject[projects.size()]);
                                        }
                                    }, wsName));
                                }
                                op = tmp;
                            }
                            UIMonitorUtility.doTaskScheduledActive(op);
                        }
                    }
                }
            });
        }
    };
}

From source file:org.eclipse.titanium.error.GUIErrorHandler.java

License:Open Source License

@Override
public void reportInformation(final String text) {
    ErrorMessage.show("Information", text, MessageDialog.INFORMATION);
}

From source file:org.eclipse.ui.internal.ide.dialogs.LinkedResourceEditor.java

License:Open Source License

/**
 * @param selectedResources//www  .  j  a  va2s.  co m
 * @param report
 */
private void reportResult(IResource[] selectedResources, ArrayList/* <String> */ report, String title) {
    StringBuffer message = new StringBuffer();
    Iterator/* <String> */ stringIt = report.iterator();
    while (stringIt.hasNext()) {
        message.append(stringIt.next());
        if (stringIt.hasNext())
            message.append("\n"); //$NON-NLS-1$
    }
    final String resultMessage = message.toString();
    MessageDialog dialog = new MessageDialog(fConvertAbsoluteButton.getShell(), title, null,
            IDEWorkbenchMessages.LinkedResourceEditor_convertionResults, MessageDialog.INFORMATION,
            new String[] { IDEWorkbenchMessages.linkedResourceEditor_OK }, 0) {

        /* (non-Javadoc)
         * @see org.eclipse.jface.dialogs.Dialog#isResizable()
         */
        protected boolean isResizable() {
            return true;
        }

        protected Control createCustomArea(Composite comp) {
            setShellStyle(getShellStyle() | SWT.RESIZE);
            Composite parent = new Composite(comp, 0);
            GridLayout layout = new GridLayout();
            layout.marginHeight = 0;
            layout.marginWidth = 0;
            layout.marginLeft = 2;
            layout.numColumns = 1;
            layout.verticalSpacing = 9;
            parent.setLayout(layout);
            parent.setLayoutData(new GridData(GridData.FILL_BOTH));

            Text text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
            text.setText(resultMessage.toString());
            GridData data = new GridData(640, 300);
            text.setLayoutData(data);
            return parent;
        }

    };
    dialog.open();
    reparent(selectedResources);
}

From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java

License:Open Source License

private MessageDialog getInformationDialog(String title, String message) {
    return new MessageDialog(getShell(), title, null, message, MessageDialog.INFORMATION,
            new String[] { IDialogConstants.OK_LABEL }, 0);
}

From source file:org.eclipse.viatra.addon.querybyexample.ui.handlers.HelpHandler.java

License:Open Source License

public Object execute(ExecutionEvent event) throws ExecutionException {

    new HelpDialog(HandlerUtil.getActiveShell(event), HELP_TITLE, null, HELP_MAIN_TEXT,
            MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0).open();

    return null;/*from  w  w w  . j  a  v  a2 s.co m*/
}

From source file:org.eclipse.wst.jsdt.debug.internal.ui.eval.StepIntoSelectionHandler.java

License:Open Source License

/** 
 * Called when stepping returned from the original frame without entering the desired method.
 *//*from w  w  w. java2s . c o m*/
protected void missed() {
    cleanup();
    Runnable r = new Runnable() {
        public void run() {
            String methodName = null;
            try {
                methodName = org.eclipse.wst.jsdt.core.Signature.toString(getMethod().getSignature(),
                        getMethod().getElementName(), getMethod().getParameterNames(), false, false);
            } catch (JavaScriptModelException e) {
                methodName = getMethod().getElementName();
            }
            new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    Messages.step_into_selection, null,
                    NLS.bind(Messages.exe_did_not_enter__0__before_returning, new String[] { methodName }),
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0).open();
        }
    };
    JavaScriptDebugUIPlugin.getStandardDisplay().asyncExec(r);
}

From source file:org.eclipse.wst.jsdt.internal.ui.javadocexport.JavadocWizard.java

License:Open Source License

public boolean performFinish() {

    IJavaScriptProject[] checkedProjects = fJTWPage.getCheckedProjects();
    updateStore(checkedProjects);//from w ww.  j  av a  2s. com

    fStore.updateDialogSettings(getDialogSettings(), checkedProjects);

    // Wizard should not run with dirty editors
    if (!new RefactoringSaveHelper(RefactoringSaveHelper.SAVE_ALL_ALWAYS_ASK).saveEditors(getShell())) {
        return false;
    }

    fDestination = Path.fromOSString(fStore.getDestination());
    fDestination.toFile().mkdirs();

    fOpenInBrowser = fStore.doOpenInBrowser();

    //Ask if you wish to set the javadoc location for the projects (all) to 
    //the location of the newly generated javadoc 
    if (fStore.isFromStandard()) {
        try {

            URL newURL = fDestination.toFile().toURL();
            List projs = new ArrayList();
            //get javadoc locations for all projects
            for (int i = 0; i < checkedProjects.length; i++) {
                IJavaScriptProject curr = checkedProjects[i];
                URL currURL = JavaScriptUI.getProjectJSdocLocation(curr);
                if (!newURL.equals(currURL)) { // currURL can be null
                    //if not all projects have the same javadoc location ask if you want to change
                    //them to have the same javadoc location
                    projs.add(curr);
                }
            }
            if (!projs.isEmpty()) {
                setAllJavadocLocations(
                        (IJavaScriptProject[]) projs.toArray(new IJavaScriptProject[projs.size()]), newURL);
            }
        } catch (MalformedURLException e) {
            JavaScriptPlugin.log(e);
        }
    }

    if (fJSWPage.generateAnt()) {
        //@Improve: make a better message
        OptionalMessageDialog.open(JAVADOC_ANT_INFORMATION_DIALOG, getShell(),
                JavadocExportMessages.JavadocWizard_antInformationDialog_title, null,
                JavadocExportMessages.JavadocWizard_antInformationDialog_message, MessageDialog.INFORMATION,
                new String[] { IDialogConstants.OK_LABEL }, 0);
        try {
            File file = fStore.createXML(checkedProjects);
            if (file != null) {
                IFile[] files = fRoot.findFilesForLocation(Path.fromOSString(file.getPath()));
                if (files != null) {
                    for (int i = 0; i < files.length; i++) {
                        files[i].refreshLocal(IResource.DEPTH_ONE, null);
                    }
                }
            }

        } catch (CoreException e) {
            ExceptionHandler.handle(e, getShell(), JavadocExportMessages.JavadocWizard_error_writeANT_title,
                    JavadocExportMessages.JavadocWizard_error_writeANT_message);
        }
    }

    if (!executeJavadocGeneration())
        return false;

    return true;
}

From source file:org.eclipse.wst.jsdt.internal.ui.search.SearchUtil.java

License:Open Source License

public static void warnIfBinaryConstant(IJavaScriptElement element, Shell shell) {
    if (isBinaryPrimitiveConstantOrString(element))
        OptionalMessageDialog.open(BIN_PRIM_CONST_WARN_DIALOG_ID, shell,
                SearchMessages.Search_FindReferencesAction_BinPrimConstWarnDialog_title, null,
                SearchMessages.Search_FindReferencesAction_BinPrimConstWarnDialog_message,
                MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
}

From source file:org.eclipse.wst.jsdt.internal.ui.wizards.NewElementWizard.java

License:Open Source License

protected void warnAboutTypeCommentDeprecation() {
    String key = IUIConstants.DIALOGSTORE_TYPECOMMENT_DEPRECATED;
    if (OptionalMessageDialog.isDialogEnabled(key)) {
        TemplateStore templates = JavaScriptPlugin.getDefault().getTemplateStore();
        boolean isOldWorkspace = templates.findTemplate("filecomment") != null //$NON-NLS-1$
                && templates.findTemplate("typecomment") != null; //$NON-NLS-1$
        if (!isOldWorkspace) {
            OptionalMessageDialog.setDialogEnabled(key, false);
        }/*from  ww w. ja  v a  2 s  .c  om*/
        String title = NewWizardMessages.NewElementWizard_typecomment_deprecated_title;
        String message = NewWizardMessages.NewElementWizard_typecomment_deprecated_message;
        OptionalMessageDialog.open(key, getShell(), title, null, message, MessageDialog.INFORMATION,
                new String[] { IDialogConstants.OK_LABEL }, 0);
    }
}

From source file:org.eclipse.wst.server.ui.internal.editor.ServerEditor.java

License:Open Source License

void checkAndCloseEditorOnDeletedServer() {
    // check for deleted files
    if (resourceDeleted) {
        String title = Messages.editorResourceDeleteTitle;
        String message = null;// w w w  .  j a  v  a 2  s  .  c o m
        if (server != null)
            message = NLS.bind(Messages.editorResourceDeleteServerMessage, server.getName());
        String[] labels = new String[] { Messages.editorResourceDeleteSave, IDialogConstants.CLOSE_LABEL };
        MessageDialog dialog = new MessageDialog(getEditorSite().getShell(), title, null, message,
                MessageDialog.INFORMATION, labels, 0);

        if (dialog.open() == 0)
            doSave(new NullProgressMonitor());
        else
            closeEditor();
    }
    resourceDeleted = false;
}