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

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

Introduction

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

Prototype

int WARNING

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

Click Source Link

Document

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

Usage

From source file:org.eclipse.team.svn.ui.crashrecovery.InaccessibleLocationDataHelper.java

License:Open Source License

public boolean acquireResolution(ErrorDescription description) {
    if (description.code == ErrorDescription.CANNOT_READ_LOCATION_DATA) {
        final Object[] context = (Object[]) description.context;
        // resource URL is inaccessible, project should be disconnected
        if (context[1] == null) {
            return false;
        }/*  w w w . j  a v a  2 s  .c o  m*/

        final IProject project = (IProject) context[0];

        final boolean[] solved = new boolean[] { false };
        final IActionOperation[] op = new IActionOperation[1];
        final IRepositoryLocation[] location = new IRepositoryLocation[1];
        UIMonitorUtility.parallelSyncExec(new Runnable() {
            public void run() {
                MessageDialog dlg = new MessageDialog(UIMonitorUtility.getShell(),
                        SVNUIMessages.InaccessibleLocationDataHelper_Dialog_Title, null,
                        SVNUIMessages.format(SVNUIMessages.InaccessibleLocationDataHelper_Dialog_Message,
                                new String[] { project.getName() }),
                        MessageDialog.WARNING,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
                solved[0] = dlg.open() == 0;
                if (solved[0]) {
                    location[0] = SVNRemoteStorage.instance().newRepositoryLocation();
                    location[0].setUrl((String) context[1]);

                    NewRepositoryLocationWizard wizard = new NewRepositoryLocationWizard(location[0], false);
                    WizardDialog dialog = new WizardDialog(UIMonitorUtility.getShell(), wizard);
                    solved[0] = dialog.open() == 0;
                    if (solved[0]) {
                        solved[0] = (op[0] = wizard.getOperationToPerform()) != null;
                    }
                }
            }
        });

        if (solved[0]) {
            ProgressMonitorUtility.doTaskExternal(op[0], new NullProgressMonitor());
            if (op[0].getExecutionState() == IActionOperation.OK) {
                IRepositoryContainer container = location[0].asRepositoryContainer((String) context[1], true);
                if (container == null) {
                    return false;
                }
                SVNTeamProvider provider = (SVNTeamProvider) RepositoryProvider.getProvider(project,
                        SVNTeamPlugin.NATURE_ID);
                try {
                    provider.switchResource(container);
                } catch (CoreException ex) {
                    // recovery action failed
                    return false;
                }
            } else {
                return false;
            }
        }

        return solved[0];
    }
    return false;
}

From source file:org.eclipse.team.svn.ui.dialog.NotifyNodeKindChangedDialog.java

License:Open Source License

public NotifyNodeKindChangedDialog(Shell parentShell, IResource[] resources) {
    super(parentShell, SVNUIMessages.NotifyNodeKindChangedDialog_Title, null,
            SVNUIMessages.format(SVNUIMessages.NotifyNodeKindChangedDialog_Message,
                    new String[] { NotifyNodeKindChangedDialog.enumerateParents(resources) }),
            MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0);
}

From source file:org.eclipse.team.svn.ui.dialog.NotifyUnresolvedConflictDialog.java

License:Open Source License

public NotifyUnresolvedConflictDialog(Shell parentShell, String message) {
    super(parentShell, SVNUIMessages.NotifyUnresolvedConflictDialog_Title, null,
            message != null ? message : SVNUIMessages.NotifyUnresolvedConflictDialog_Message,
            MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0);
}

From source file:org.eclipse.team.svn.ui.dialog.OperationErrorDialog.java

License:Open Source License

public OperationErrorDialog(Shell parentShell, String title, String errorMessage) {
    super(parentShell, title, null, errorMessage, MessageDialog.WARNING,
            new String[] { IDialogConstants.OK_LABEL }, 0);
}

From source file:org.eclipse.team.svn.ui.dialog.ShowPostCommitErrorsDialog.java

License:Open Source License

public ShowPostCommitErrorsDialog(Shell parentShell, String message) {
    super(parentShell, SVNUIMessages.ShowPostCommitErrorsDialog_Title, null, message, MessageDialog.WARNING,
            new String[] { IDialogConstants.OK_LABEL }, 0);
}

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();
    }//ww  w  .j  a v  a 2s  . com
    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.operation.CorrectRevisionOperation.java

License:Open Source License

protected void runImpl(final IProgressMonitor monitor) throws Exception {
    for (int i = 0; i < this.repositoryResources.length; i++) {
        if (!this.repositoryResources[i].exists() && this.resources != null && this.resources[i] != null
                && this.resources[i].getType() != IResource.PROJECT) {
            // calculate peg revision for the repository resource
            ILocalResource parent = SVNRemoteStorage.instance()
                    .asLocalResourceAccessible(this.resources[i].getParent());
            ILocalResource self = SVNRemoteStorage.instance().asLocalResourceAccessible(this.resources[i]);
            boolean switchedStateEquals = (parent.getChangeMask()
                    & ILocalResource.IS_SWITCHED) == (self.getChangeMask() & ILocalResource.IS_SWITCHED);
            if (switchedStateEquals) {
                long parentRevision = parent.getRevision();
                long selfRevision = self.getRevision();
                long revision = parentRevision > selfRevision ? parentRevision : selfRevision;
                if (revision != SVNRevision.INVALID_REVISION_NUMBER) {
                    this.repositoryResources[i].setPegRevision(SVNRevision.fromNumber(revision));
                }//from www  .  j a va 2s  .  c o m
            } else {
                this.repositoryResources[i].setPegRevision(SVNRevision.fromNumber(self.getRevision()));
            }
        }
        if (!this.repositoryResources[i].exists()
                && this.knownRevisions[i] != SVNRevision.INVALID_REVISION_NUMBER) {
            this.hasWarning = true;
            SVNRevision rev = SVNRevision.fromNumber(this.knownRevisions[i]);
            this.repositoryResources[i].setSelectedRevision(rev);
            this.repositoryResources[i].setPegRevision(rev);
            if (this.msgsOps != null) {
                this.msgsOps[i].setStartRevision(rev);
            }
        }
    }
    if (this.hasWarning) {
        UIMonitorUtility.getDisplay().syncExec(new Runnable() {
            public void run() {
                boolean one = CorrectRevisionOperation.this.repositoryResources.length == 1;
                MessageDialog dlg = new MessageDialog(UIMonitorUtility.getShell(),
                        CorrectRevisionOperation.this
                                .getOperationResource(one ? "Title_Single" : "Title_Multi"), //$NON-NLS-1$ //$NON-NLS-2$
                        null,
                        CorrectRevisionOperation.this
                                .getOperationResource(one ? "Message_Single" : "Message_Multi"), //$NON-NLS-1$ //$NON-NLS-2$
                        MessageDialog.WARNING,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
                if (dlg.open() != 0) {
                    monitor.setCanceled(true);
                    CorrectRevisionOperation.this.isCancel = true;
                }
            }
        });
    }
}

From source file:org.eclipse.team.svn.ui.panel.local.CommitPanel.java

License:Open Source License

public boolean canClose() {
    final boolean[] commit = new boolean[] { true };
    if (this.bugtraqModel != null && this.bugtraqModel.getMessage() != null
            && this.bugtraqModel.isWarnIfNoIssue() && this.comment.getBugID() != null
            && this.comment.getBugID().trim().length() == 0) {
        UIMonitorUtility.getDisplay().syncExec(new Runnable() {
            public void run() {
                MessageDialog dlg = new MessageDialog(UIMonitorUtility.getShell(),
                        SVNUIMessages.CommitPanel_NoBugId_Title, null,
                        SVNUIMessages.CommitPanel_NoBugId_Message, MessageDialog.WARNING,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
                commit[0] = dlg.open() == 0;
            }//from  www . j av  a2s . co  m
        });
    }
    return commit[0];
}

From source file:org.eclipse.team.svn.ui.wizard.shareproject.AddRepositoryLocationPage.java

License:Open Source License

public boolean performFinish() {
    String newUrl = this.propertiesTabFolder.getLocationUrl();
    String oldUuid = null;//from w  w  w.  j av  a2s  .co m
    IProject[] projectsArray = new IProject[0];
    if (this.editable != null
            && SVNRemoteStorage.instance().getRepositoryLocation(this.editable.getId()) != null
            && !newUrl.equals(this.oldUrl)) {
        FindRelatedProjectsOperation op = new FindRelatedProjectsOperation(this.editable);
        UIMonitorUtility.doTaskBusyDefault(op);
        projectsArray = (IProject[]) op.getResources();

        if (projectsArray.length > 0) {
            SVNEntryInfo info = this.getLocationInfo(this.editable);
            oldUuid = info == null ? null : info.reposUUID;
        }
    }
    this.propertiesTabFolder.saveChanges();

    if (this.propertiesTabFolder.isStructureEnabled()) {
        String endsPart = SVNUtility.createPathForSVNUrl(newUrl).lastSegment();
        if (endsPart.equals(this.propertiesTabFolder.getRepositoryLocation().getTrunkLocation())
                || endsPart.equals(this.propertiesTabFolder.getRepositoryLocation().getBranchesLocation())
                || endsPart.equals(this.propertiesTabFolder.getRepositoryLocation().getTagsLocation())) {
            final int[] result = new int[1];
            final MessageDialog dialog = new MessageDialog(this.getShell(),
                    SVNUIMessages.AddRepositoryLocationPage_Normalize_Title, null,
                    SVNUIMessages.AddRepositoryLocationPage_Normalize_Message, MessageDialog.WARNING,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
            UIMonitorUtility.getDisplay().syncExec(new Runnable() {
                public void run() {
                    result[0] = dialog.open();
                }
            });
            if (result[0] == IDialogConstants.OK_ID) {
                IRepositoryLocation location = this.editable == null ? this.getRepositoryLocation()
                        : this.editable;
                boolean useCustomLabel = false;
                useCustomLabel = !location.getUrl().equals(location.getLabel());
                newUrl = (SVNUtility.createPathForSVNUrl(newUrl)).removeLastSegments(1).toString();
                location.setUrl(newUrl);
                if (!useCustomLabel) {
                    location.setLabel(newUrl);
                }
                location.reconfigure();
            }
        }
    }

    ProjectListPanel panel = null;
    if (projectsArray.length > 0) {
        this.editable.reconfigure();
        SVNEntryInfo newInfo = this.getLocationInfo(this.editable);
        if (newInfo == null) {
            panel = new ProjectListPanel(projectsArray, false);
        } else if (oldUuid != null && !oldUuid.equals(newInfo.reposUUID)) {
            panel = new ProjectListPanel(projectsArray, true);
        }
        if (panel != null) {
            this.editable.setUrl(this.oldUrl);
            this.editable.setLabel(this.oldLabel);
            this.editable.reconfigure();
            new DefaultDialog(this.getShell(), panel).open();
        }
    }

    if (this.propertiesTabFolder.isValidateOnFinishRequested() && panel == null) {
        final Exception[] problem = new Exception[1];
        boolean cancelled = UIMonitorUtility.doTaskNowDefault(this.getShell(),
                new AbstractActionOperation("Operation_ValidateLocation", SVNUIMessages.class) { //$NON-NLS-1$
                    protected void runImpl(IProgressMonitor monitor) throws Exception {
                        problem[0] = SVNUtility.validateRepositoryLocation(
                                AddRepositoryLocationPage.this.propertiesTabFolder.getRepositoryLocation(),
                                new SVNProgressMonitor(this, monitor, null));
                    }
                }, true).isCancelled();
        if (cancelled) {
            return false;
        }
        if (problem[0] != null) {
            NonValidLocationErrorDialog dialog = new NonValidLocationErrorDialog(this.getShell(),
                    problem[0].getMessage());
            if (dialog.open() != 0) {
                return false;
            }
        }
    }

    boolean shouldntBeAdded = this.editable == null ? false
            : (SVNRemoteStorage.instance().getRepositoryLocation(this.editable.getId()) != null);

    AbstractActionOperation mainOp = shouldntBeAdded
            ? new AbstractActionOperation("Operation_CommitLocationChanges", SVNUIMessages.class) { //$NON-NLS-1$
                protected void runImpl(IProgressMonitor monitor) throws Exception {
                    AddRepositoryLocationPage.this.editable.reconfigure();
                }
            }
            : (AbstractActionOperation) new AddRepositoryLocationOperation(this.getRepositoryLocation());

    CompositeOperation op = new CompositeOperation(mainOp.getId(), mainOp.getMessagesClass());

    op.add(mainOp);
    op.add(new SaveRepositoryLocationsOperation());
    op.add(shouldntBeAdded
            ? new RefreshRepositoryLocationsOperation(new IRepositoryLocation[] { this.editable }, true)
            : new RefreshRepositoryLocationsOperation(false));

    this.operationToPerform = op;

    return true;
}

From source file:org.eclipse.team.svn.ui.wizard.ShareProjectWizard.java

License:Open Source License

protected IShareProjectWrapper getFreshConnectOperation() {
    IActionOperation addLocationOp = this.addLocation.getOperationToPeform();
    IRepositoryLocation location = null;
    if (addLocationOp != null) {
        location = this.addLocation.getRepositoryLocation();
    } else {//  w  ww  .  j ava 2s.  co m
        location = this.selectLocation.getRepositoryLocation();
    }

    final ShareProjectOperation mainOp = ExtensionsManager.getInstance().getCurrentShareProjectFactory()
            .getShareProjectOperation(this.getProjects(), location, this.selectName,
                    this.commentPage.getCommitComment());
    boolean ignoreExternals = SVNTeamPreferences.getBehaviourBoolean(
            SVNTeamUIPlugin.instance().getPreferenceStore(),
            SVNTeamPreferences.BEHAVIOUR_IGNORE_EXTERNALS_NAME);
    mainOp.setIngoreExternals(ignoreExternals);
    mainOp.setSharePrompt(new IShareProjectPrompt() {
        public boolean prompt(final IProject[] projects) {
            final int[] result = new int[1];
            UIMonitorUtility.getDisplay().syncExec(new Runnable() {
                public void run() {
                    String projectNames = FileUtility.getNamesListAsString(projects);
                    String message = SVNUIMessages.format(
                            projects.length == 1 ? SVNUIMessages.ShareProject_Confirmation_Description_Single
                                    : SVNUIMessages.ShareProject_Confirmation_Description_Multiple,
                            new String[] { projectNames });
                    MessageDialog dialog = new MessageDialog(UIMonitorUtility.getShell(),
                            projects.length == 1 ? SVNUIMessages.ShareProject_Confirmation_Title_Single
                                    : SVNUIMessages.ShareProject_Confirmation_Title_Multiple,
                            null, message, MessageDialog.WARNING,
                            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
                    result[0] = dialog.open();
                }
            });
            return result[0] == 0;
        }
    });
    CompositeOperationImpl op = new CompositeOperationImpl(mainOp.getId(), mainOp.getMessagesClass());

    //drop .svn folders if we want to do a fresh share
    IActionOperation predecessor = null;
    if (this.alreadyConnected()) {
        op.add(predecessor = new AbstractActionOperation("Operation_DropSVNMeta", SVNUIMessages.class) { //$NON-NLS-1$
            public ISchedulingRule getSchedulingRule() {
                return MultiRule.combine(ShareProjectWizard.this.getProjects());
            }

            protected void runImpl(IProgressMonitor monitor) throws Exception {
                IProject[] projects = ShareProjectWizard.this.getProjects();
                for (int i = 0; i < projects.length && !monitor.isCanceled(); i++) {
                    final IProject project = projects[i];
                    this.protectStep(new IUnprotectedOperation() {
                        public void run(IProgressMonitor monitor) throws Exception {
                            FileUtility.removeSVNMetaInformation(project, monitor);
                        }
                    }, monitor, projects.length);
                }
            }
        });
    }
    if (predecessor != null) {
        op.add(mainOp, new IActionOperation[] { predecessor });
    } else {
        op.add(mainOp);
    }

    return op;
}