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.riena.internal.ui.ridgets.swt.MessageBoxRidgetTest.java

License:Open Source License

public void testSetType() throws Exception {

    // show message box to transfer values set
    getRidget().show();/*from  ww w  .  j av  a2  s  .  c  o m*/

    assertEquals(MessageDialog.NONE, getWidget().type);
    assertEquals(IMessageBoxRidget.Type.PLAIN, getRidget().getType());

    getRidget().setType(IMessageBoxRidget.Type.ERROR);
    // show message box to transfer values set
    getRidget().show();

    assertEquals(MessageDialog.ERROR, getWidget().type);
    assertEquals(IMessageBoxRidget.Type.ERROR, getRidget().getType());

    getRidget().setType(IMessageBoxRidget.Type.WARNING);
    // show message box to transfer values set
    getRidget().show();

    assertEquals(MessageDialog.WARNING, getWidget().type);
    assertEquals(IMessageBoxRidget.Type.WARNING, getRidget().getType());

    getRidget().setType(IMessageBoxRidget.Type.INFORMATION);
    // show message box to transfer values set
    getRidget().show();

    assertEquals(MessageDialog.INFORMATION, getWidget().type);
    assertEquals(IMessageBoxRidget.Type.INFORMATION, getRidget().getType());

    getRidget().setType(IMessageBoxRidget.Type.HELP);
    // show message box to transfer values set
    getRidget().show();

    assertEquals(MessageDialog.INFORMATION, getWidget().type);
    assertEquals(IMessageBoxRidget.Type.HELP, getRidget().getType());

    getRidget().setType(IMessageBoxRidget.Type.QUESTION);
    // show message box to transfer values set
    getRidget().show();

    assertEquals(MessageDialog.QUESTION, getWidget().type);
    assertEquals(IMessageBoxRidget.Type.QUESTION, getRidget().getType());

    getRidget().setType(null);
    // show message box to transfer values set
    getRidget().show();

    assertEquals(MessageDialog.NONE, getWidget().type);
    assertEquals(IMessageBoxRidget.Type.PLAIN, getRidget().getType());
}

From source file:org.eclipse.team.internal.ccvs.ui.repo.RefreshRemoteProjectWizard.java

License:Open Source License

private boolean promptForDeepRefresh(final ICVSRemoteResource[] folders) {
    final boolean[] prompt = new boolean[] { false };
    getShell().getDisplay().syncExec(new Runnable() {
        public void run() {
            MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.RefreshRemoteProjectWizard_0,
                    null, getNoTagsMessage(folders), MessageDialog.INFORMATION,
                    new String[] { CVSUIMessages.RefreshRemoteProjectWizard_1,
                            CVSUIMessages.RefreshRemoteProjectWizard_2 },
                    1);//w  w  w. jav a 2  s . c  om
            int code = dialog.open();
            if (code == 0) {
                prompt[0] = true;
            }

        }
    });
    return prompt[0];
}

From source file:org.eclipse.team.internal.ccvs.ui.tags.TagRefreshButtonArea.java

License:Open Source License

private boolean promptForBestEffort() {
    final boolean[] prompt = new boolean[] { false };
    shell.getDisplay().syncExec(new Runnable() {
        public void run() {
            MessageDialog dialog = new MessageDialog(shell, CVSUIMessages.TagRefreshButtonArea_0, null,
                    getNoTagsFoundMessage(), MessageDialog.INFORMATION,
                    new String[] { CVSUIMessages.TagRefreshButtonArea_1, CVSUIMessages.TagRefreshButtonArea_2,
                            CVSUIMessages.TagRefreshButtonArea_3 },
                    1);//from  w w w.  j  a  v a  2s .c  om
            int code = dialog.open();
            if (code == 0) {
                prompt[0] = true;
            } else if (code == 1) {
                TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
                d.open();
            }

        }
    });
    return prompt[0];
}

From source file:org.eclipse.team.svn.revision.graph.operation.CheckRepositoryConnectionOperation.java

License:Open Source License

protected void checkMergeInfo(IProgressMonitor monitor) {
    IRepositoryLocation location = this.resource.getRepositoryLocation();
    ISVNConnector proxy = location.acquireSVNProxy();
    try {//from   w w  w .  ja  va 2 s  .  c  o m
        proxy.listHistoryLog(SVNUtility.getEntryReference(location.getRepositoryRoot()),
                new SVNRevisionRange[] {
                        new SVNRevisionRange(this.lastRepositoryRevision, this.lastRepositoryRevision) },
                new String[0], 1, ISVNConnector.Options.INCLUDE_MERGED_REVISIONS,
                new SVNLogEntryCallbackWithMergeInfo(), new SVNProgressMonitor(this, monitor, null));

        this.isServerSupportsMergeInfo = true;
    } catch (SVNConnectorException e) {
        this.isServerSupportsMergeInfo = false;
    } finally {
        location.releaseSVNProxy(proxy);
    }

    if (!this.isServerSupportsMergeInfo) {
        UIMonitorUtility.getDisplay().syncExec(new Runnable() {
            public void run() {
                MessageDialog dlg = new MessageDialog(UIMonitorUtility.getShell(),
                        SVNRevisionGraphMessages.Dialog_GraphTitle, null,
                        SVNRevisionGraphMessages.CheckRepositoryConnectionOperation_MergeNotSupported,
                        MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
                dlg.open();
            }
        });
    }
}

From source file:org.eclipse.team.svn.revision.graph.operation.RevisionGraphUtility.java

License:Open Source License

public static MessageDialog getCacheCalculatingDialog(String[] reposRoots) {
    StringBuilder strRepos = new StringBuilder();
    for (int i = 0, n = reposRoots.length; i < n; i++) {
        String reposRoot = reposRoots[i];
        strRepos.append(reposRoot);//w  w w.  j  av  a  2s  .c  om
        if (i != n - 1) {
            strRepos.append(", "); //$NON-NLS-1$
        }
    }

    MessageDialog dlg = new MessageDialog(UIMonitorUtility.getShell(),
            SVNRevisionGraphMessages.Dialog_GraphTitle, null,
            SVNRevisionGraphMessages.format(SVNRevisionGraphMessages.CreateCacheDataOperation_DialogMessage,
                    strRepos.toString()),
            MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
    return dlg;
}

From source file:org.eclipse.team.svn.ui.compare.ThreeWayResourceCompareInput.java

License:Open Source License

protected void fillMenu(IMenuManager manager, TreeSelection selection) {
    final CompareNode selectedNode = (CompareNode) selection.getFirstElement();
    Action tAction = null;//from   w ww. jav  a  2s.  c  o m
    boolean propertyComparisonAllowed = true;
    if ((selectedNode.getKind() & Differencer.DIRECTION_MASK) == Differencer.CONFLICTING) {
        propertyComparisonAllowed = (selectedNode.getKind()
                & Differencer.CHANGE_TYPE_MASK) != Differencer.DELETION;
    } else {
        propertyComparisonAllowed = (selectedNode.getKind()
                & Differencer.CHANGE_TYPE_MASK) == Differencer.CHANGE;
    }
    manager.add(tAction = new Action(SVNUIMessages.SynchronizeActionGroup_CompareProperties) {
        public void run() {
            ResourceElement element = (ResourceElement) selectedNode.getLeft();
            SVNLocalResource local = (SVNLocalResource) element.getLocalResource();
            IResource left = local.getResource();
            element = (ResourceElement) selectedNode.getAncestor();
            SVNEntryRevisionReference baseReference = null;
            long baseRevNum = local.getBaseRevision();
            SVNRepositoryResource repoResource = (SVNRepositoryResource) element.getRepositoryResource();
            if (repoResource.getSelectedRevision().getKind() == SVNRevision.BASE.getKind()) {
                baseReference = new SVNEntryRevisionReference(
                        FileUtility.getWorkingCopyPath(local.getResource()), null, SVNRevision.BASE);
            } else {
                baseReference = new SVNEntryRevisionReference(repoResource.getUrl(),
                        repoResource.getPegRevision(), repoResource.getSelectedRevision());
            }
            element = (ResourceElement) selectedNode.getRight();
            SVNEntryRevisionReference rightReference = null;
            repoResource = (SVNRepositoryResource) element.getRepositoryResource();
            if (repoResource.getSelectedRevision().getKind() == SVNRevision.BASE.getKind()) {
                rightReference = new SVNEntryRevisionReference(
                        FileUtility.getWorkingCopyPath(local.getResource()), null, SVNRevision.BASE);
            } else {
                rightReference = new SVNEntryRevisionReference(repoResource.getUrl(),
                        repoResource.getPegRevision(), repoResource.getSelectedRevision());
            }
            ThreeWayPropertyCompareInput input = new ThreeWayPropertyCompareInput(new CompareConfiguration(),
                    left, rightReference, baseReference, repoResource.getRepositoryLocation(), baseRevNum);
            try {
                input.run(new NullProgressMonitor());
                if (input.getCompareResult() == null) {
                    MessageDialog dialog = new MessageDialog(UIMonitorUtility.getShell(),
                            SVNUIMessages.ComparePropsNoDiff_Title, null,
                            SVNUIMessages.ComparePropsNoDiff_Message, MessageDialog.INFORMATION,
                            new String[] { IDialogConstants.OK_LABEL }, 0);
                    dialog.open();
                } else {
                    PropertyComparePanel panel = new PropertyComparePanel(input, true);
                    DefaultDialog dlg = new DefaultDialog(UIMonitorUtility.getShell(), panel);
                    dlg.open();
                }
            } catch (Exception ex) {
                UILoggedOperation.reportError("Compare Properties Operation", ex);
            }
        }
    });
    tAction.setEnabled(propertyComparisonAllowed && selection.size() == 1);

    //external compare action      
    Action externalCompareAction = this.getOpenInExternalCompareEditorAction(selectedNode, selection);
    manager.add(externalCompareAction);
}

From source file:org.eclipse.team.svn.ui.compare.TwoWayResourceCompareInput.java

License:Open Source License

protected void fillMenu(IMenuManager manager, TreeSelection selection) {
    final CompareNode selectedNode = (CompareNode) selection.getFirstElement();
    Action tAction = null;//from  ww  w.j ava  2 s.c om
    manager.add(tAction = new Action(SVNUIMessages.SynchronizeActionGroup_CompareProperties) {
        public void run() {
            SVNRepositoryResource repoResource = (SVNRepositoryResource) ((ResourceElement) selectedNode
                    .getLeft()).getRepositoryResource();
            SVNEntryRevisionReference leftReference = new SVNEntryRevisionReference(repoResource.getUrl(),
                    repoResource.getPegRevision(), repoResource.getSelectedRevision());
            repoResource = (SVNRepositoryResource) ((ResourceElement) selectedNode.getRight())
                    .getRepositoryResource();
            SVNEntryRevisionReference rightReference = new SVNEntryRevisionReference(repoResource.getUrl(),
                    repoResource.getPegRevision(), repoResource.getSelectedRevision());
            TwoWayPropertyCompareInput input = new TwoWayPropertyCompareInput(new CompareConfiguration(),
                    leftReference, rightReference, repoResource.getRepositoryLocation());
            try {
                input.run(new NullProgressMonitor());
                if (input.getCompareResult() == null) {
                    MessageDialog dialog = new MessageDialog(UIMonitorUtility.getShell(),
                            SVNUIMessages.ComparePropsNoDiff_Title, null,
                            SVNUIMessages.ComparePropsNoDiff_Message, MessageDialog.INFORMATION,
                            new String[] { IDialogConstants.OK_LABEL }, 0);
                    dialog.open();
                } else {
                    PropertyComparePanel panel = new PropertyComparePanel(input, false);
                    DefaultDialog dlg = new DefaultDialog(UIMonitorUtility.getShell(), panel);
                    dlg.open();
                }
            } catch (Exception ex) {
                UILoggedOperation.reportError("Compare Properties Operation", ex);
            }
        }
    });
    tAction.setEnabled(selection.size() == 1
            && (selectedNode.getKind() & Differencer.CHANGE_TYPE_MASK) != Differencer.ADDITION
            && (selectedNode.getKind() & Differencer.CHANGE_TYPE_MASK) != Differencer.DELETION);

    //external compare action      
    Action externalCompareAction = this.getOpenInExternalCompareEditorAction(selectedNode, selection);
    manager.add(externalCompareAction);
}

From source file:org.eclipse.team.svn.ui.discovery.util.DiscoveryUiUtil.java

License:Open Source License

public static void displayStatus(Shell shell, final String title, final IStatus status,
        boolean showLinkToErrorLog) {
    if (shell == null) {
        shell = UIMonitorUtility.getShell();
    }//w w  w .  j a v a2  s. co  m
    String message = status.getMessage();
    if (showLinkToErrorLog) {
        message += SVNUIMessages.DiscoveryUi_seeErrorLog;
    }
    switch (status.getSeverity()) {
    case IStatus.CANCEL:
    case IStatus.INFO:
        createDialog(shell, title, message, MessageDialog.INFORMATION).open();
        break;
    case IStatus.WARNING:
        createDialog(shell, title, message, MessageDialog.WARNING).open();
        break;
    case IStatus.ERROR:
    default:
        createDialog(shell, title, message, MessageDialog.ERROR).open();
        break;
    }

}

From source file:org.eclipse.team.svn.ui.history.HistoryActionManager.java

License:Open Source License

protected void getContentAffected(IActionOperation preOp, IRepositoryResourceProvider provider,
        String remotePath) {// ww w. ja v  a 2 s  . c om
    String rootUrl = SVNRemoteStorage.instance().asRepositoryResource(this.view.getResource())
            .getRepositoryLocation().getRepositoryRootUrl();
    String remoteViewedResourceUrl = SVNRemoteStorage.instance().asRepositoryResource(this.view.getResource())
            .getUrl();
    String remoteFoundPath = this.traceUrlToRevision(rootUrl, remotePath, this.view.getCurrentRevision(),
            this.selectedRevision);
    if (!remoteFoundPath.startsWith(remoteViewedResourceUrl)) {
        MessageDialog dialog = new MessageDialog(UIMonitorUtility.getShell(),
                SVNUIMessages.AffectedPathsActions_CantGetContent_Title, null,
                SVNUIMessages.AffectedPathsActions_CantGetContent_Message, MessageDialog.INFORMATION,
                new String[] { IDialogConstants.OK_LABEL }, 0);
        dialog.open();
        return;
    }
    if (!this.confirmReplacement()) {
        return;
    }
    IPath resourcePath = new Path(remoteFoundPath.substring(remoteViewedResourceUrl.length()));
    IResource resourceToLock;
    HashMap<String, String> remote2local = new HashMap<String, String>();
    if (this.view.getResource() instanceof IContainer) {
        IContainer viewedResource = (IContainer) this.view.getResource();
        remote2local.put(SVNUtility.encodeURL(rootUrl + remotePath),
                FileUtility.getWorkingCopyPath(viewedResource).concat(resourcePath.toString()));
        resourceToLock = viewedResource.findMember(resourcePath);
        while (resourceToLock == null) {
            resourcePath = resourcePath.removeLastSegments(1);
            resourceToLock = viewedResource.findMember(resourcePath);
        }
    } else {
        IFile viewedResource = (IFile) this.view.getResource();
        remote2local.put(SVNUtility.encodeURL(rootUrl + remotePath),
                FileUtility.getWorkingCopyPath(viewedResource).concat(resourcePath.toString()));
        resourceToLock = viewedResource.getParent();
    }
    boolean ignoreExternals = SVNTeamPreferences.getBehaviourBoolean(
            SVNTeamUIPlugin.instance().getPreferenceStore(),
            SVNTeamPreferences.BEHAVIOUR_IGNORE_EXTERNALS_NAME);
    GetRemoteContentsOperation mainOp = new GetRemoteContentsOperation(new IResource[] { resourceToLock },
            provider, remote2local, ignoreExternals);
    CompositeOperation op = new CompositeOperation(mainOp.getId(), mainOp.getMessagesClass());
    op.add(preOp);
    op.add(mainOp, new IActionOperation[] { preOp });
    op.add(new RefreshResourcesOperation(new IResource[] { resourceToLock }));
    UIMonitorUtility.doTaskScheduledActive(op);
}

From source file:org.eclipse.team.svn.ui.operation.GetBranchesTagsOperation.java

License:Open Source License

protected void runImpl(IProgressMonitor monitor) throws Exception {
    boolean hasError = false;
    try {/*  w  w w  .j  a v a2s .c  o m*/
        this.children = this.parent.getChildren();
    } catch (SVNConnectorException se) {
        if (!(se instanceof SVNConnectorAuthenticationException || se instanceof SVNConnectorCancelException)) {
            hasError = true;
        }
    }
    if (hasError || this.getChildren().length == 0) {
        UIMonitorUtility.getDisplay().syncExec(new Runnable() {
            public void run() {
                MessageDialog dialog = new MessageDialog(UIMonitorUtility.getShell(),
                        SVNUIMessages.ComparePropsNoDiff_Title, null,
                        GetBranchesTagsOperation.this.isBranch
                                ? SVNUIMessages.BranchTagSelectionComposite_NoBranches
                                : SVNUIMessages.BranchTagSelectionComposite_NoTags,
                        MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
                dialog.open();
            }
        });
    }
}