Example usage for org.eclipse.jface.dialogs IDialogConstants NO_LABEL

List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_LABEL

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants NO_LABEL.

Prototype

String NO_LABEL

To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_LABEL.

Click Source Link

Document

The label for no buttons.

Usage

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 w  w w.  jav  a  2  s .  com
            } 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.callback.AskTrustSSLServerPanel.java

License:Open Source License

public AskTrustSSLServerPanel(String location, SSLServerCertificateFailures failures,
        SSLServerCertificateInfo info, boolean allowPermanently) {
    super(allowPermanently
            ? new String[] { SVNUIMessages.AskTrustSSLServerPanel_Trust,
                    SVNUIMessages.AskTrustSSLServerPanel_TrustAlways, IDialogConstants.NO_LABEL }
            : new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL });
    this.dialogTitle = SVNUIMessages.AskTrustSSLServerPanel_Title;
    this.dialogDescription = SVNUIMessages.AskTrustSSLServerPanel_Description;
    this.defaultMessage = SVNUIMessages.format(SVNUIMessages.AskTrustSSLServerPanel_Message,
            new String[] { location });
    this.failures = failures;
    this.info = info;
}

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 w w  w. j av a2s. c o  m
        });
    }
    return commit[0];
}

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

License:Open Source License

public OverrideResourcesPanel(IResource[] resources, IResource[] userSelectedResources, int msgId,
        IResource[] affectedResources) {
    super(resources, userSelectedResources,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL });
    this.allowTreatAsEditColumn = msgId == OverrideResourcesPanel.MSG_COMMIT;
    this.dialogTitle = SVNUIMessages.OverrideResourcesPanel_Title;
    this.dialogDescription = SVNUIMessages.getString(OverrideResourcesPanel.MESSAGES[msgId]);
    boolean isParticipantPane = this.paneParticipantHelper.isParticipantPane();
    this.defaultMessage = isParticipantPane ? SVNUIMessages.OverrideResourcesPanel_Pane_Message
            : SVNUIMessages.OverrideResourcesPanel_Message;
    this.affectedResource = affectedResources;
}

From source file:org.eclipse.team.svn.ui.properties.RemovePropertyDialog.java

License:Open Source License

public RemovePropertyDialog(Shell parentShell, boolean oneProperty, boolean isFile) {
    super(parentShell,
            oneProperty ? SVNUIMessages.RemoveProperty_Title_Single : SVNUIMessages.RemoveProperty_Title_Multi,
            null,// w ww . j a  v  a2  s.com
            oneProperty ? SVNUIMessages.RemoveProperty_Message_Single
                    : SVNUIMessages.RemoveProperty_Message_Multi,
            MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);

    this.recursive = false;
    this.isFile = isFile;
}

From source file:org.eclipse.team.svn.ui.synchronize.merge.action.UpdateAction.java

License:Open Source License

protected IActionOperation getOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    IResource[] allResources = this.syncInfoSelector.getSelectedResources();
    if (this.advancedMode) {
        String message;/*from   ww w.ja v  a  2s .  c o  m*/
        if (allResources.length == 1) {
            message = SVNUIMessages.AcceptAll_Message_Single;
        } else {
            message = SVNUIMessages.format(SVNUIMessages.AcceptAll_Message_Multi,
                    new String[] { String.valueOf(allResources.length) });
        }
        MessageDialog dlg = new MessageDialog(configuration.getSite().getShell(), SVNUIMessages.AcceptAll_Title,
                null, message, MessageDialog.QUESTION,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
        if (dlg.open() != 0) {
            return null;
        }
    }

    AbstractSVNSyncInfo[] infos = this.getSVNSyncInfos();
    HashMap<String, String> remote2local = new HashMap<String, String>();
    ArrayList<IRepositoryResource> remoteSet = new ArrayList<IRepositoryResource>();
    ArrayList<IResource> localSet = new ArrayList<IResource>();
    for (int i = 0; i < infos.length; i++) {
        ILocalResource remote = infos[i].getRemoteChangeResource();
        if (remote instanceof IResourceChange && ISyncStateFilter.SF_ONREPOSITORY
                .acceptRemote(remote.getResource(), remote.getStatus(), remote.getChangeMask())) {
            IResource resource = infos[i].getLocal();
            localSet.add(resource);
            IRepositoryResource remoteResource = ((IResourceChange) infos[i].getRemoteChangeResource())
                    .getOriginator();
            remoteSet.add(remoteResource);
            remote2local.put(SVNUtility.encodeURL(remoteResource.getUrl()),
                    FileUtility.getWorkingCopyPath(resource));
        }
    }

    IResource[] resources = localSet.toArray(new IResource[localSet.size()]);
    if (resources.length > 0) {
        boolean ignoreExternals = SVNTeamPreferences.getBehaviourBoolean(
                SVNTeamUIPlugin.instance().getPreferenceStore(),
                SVNTeamPreferences.BEHAVIOUR_IGNORE_EXTERNALS_NAME);
        GetRemoteContentsOperation mainOp = new GetRemoteContentsOperation(resources,
                remoteSet.toArray(new IRepositoryResource[remoteSet.size()]), remote2local, ignoreExternals);
        CompositeOperation op = new CompositeOperation(mainOp.getId(), mainOp.getMessagesClass());
        SaveProjectMetaOperation saveOp = new SaveProjectMetaOperation(resources);
        op.add(saveOp);
        op.add(mainOp);
        op.add(new RestoreProjectMetaOperation(saveOp));
        op.add(new RefreshResourcesOperation(resources));
        op.add(new ClearMergeStatusesOperation(allResources));
        return op;
    }
    return new ClearMergeStatusesOperation(allResources);
}

From source file:org.eclipse.team.svn.ui.synchronize.update.action.UpdateAction.java

License:Open Source License

protected IActionOperation getOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
    // IStateFilter.SF_NONVERSIONED not versioned locally
    IResource[] resources = UnacceptableOperationNotificator.shrinkResourcesWithNotOnRespositoryParents(
            configuration.getSite().getShell(), this.syncInfoSelector.getSelectedResources());
    if (resources == null || resources.length == 0) {
        return null;
    }//ww  w.  j a  va  2  s.c o m

    resources = FileUtility.addOperableParents(resources, IStateFilter.SF_UNVERSIONED);

    final IResource[] missing = FileUtility.getResourcesRecursive(resources,
            org.eclipse.team.svn.ui.action.local.UpdateAction.SF_MISSING_RESOURCES);//, IResource.DEPTH_ZERO
    if (missing.length > 0) {
        if (!org.eclipse.team.svn.ui.action.local.UpdateAction.updateMissing(configuration.getSite().getShell(),
                missing)) {
            return null;
        }
    }
    if (this.advancedMode) {
        String message;
        if (resources.length == 1) {
            message = SVNUIMessages.UpdateAll_Message_Single;
        } else {
            message = SVNUIMessages.format(SVNUIMessages.UpdateAll_Message_Multi,
                    new String[] { String.valueOf(resources.length) });
        }
        MessageDialog dlg = new MessageDialog(configuration.getSite().getShell(), SVNUIMessages.UpdateAll_Title,
                null, message, MessageDialog.QUESTION,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
        if (dlg.open() != 0) {
            return null;
        }
    }

    CompositeOperation op = new CompositeOperation("Operation_Update", SVNMessages.class); //$NON-NLS-1$

    SaveProjectMetaOperation saveOp = new SaveProjectMetaOperation(resources);
    op.add(saveOp);

    Map<SVNRevision, Set<IResource>> splitted = UpdateAction.splitByPegRevision(this, resources);

    for (Map.Entry<SVNRevision, Set<IResource>> entry : splitted.entrySet()) {
        boolean ignoreExternals = SVNTeamPreferences.getBehaviourBoolean(
                SVNTeamUIPlugin.instance().getPreferenceStore(),
                SVNTeamPreferences.BEHAVIOUR_IGNORE_EXTERNALS_NAME);
        UpdateOperation mainOp = new UpdateOperation(entry.getValue().toArray(new IResource[0]), entry.getKey(),
                ignoreExternals);
        op.add(mainOp);
        op.add(new ClearUpdateStatusesOperation(mainOp), new IActionOperation[] { mainOp });
        op.add(new NotifyUnresolvedConflictOperation(mainOp));
    }

    op.add(new RestoreProjectMetaOperation(saveOp));
    op.add(new RefreshResourcesOperation(resources));

    return op;
}

From source file:org.eclipse.team.svn.ui.utility.UnacceptableOperationNotificator.java

License:Open Source License

public static IResource[] shrinkResourcesWithNotOnRespositoryParents(final Shell shell, IResource[] resources) {
    HashSet resultResources = new HashSet();
    final Map unsupportedResources = new HashMap();
    if (resources == null) {
        return null;
    }//from   w w w  . j  a v  a  2s  . co m
    for (int i = 0; i < resources.length; i++) {
        IResource[] parents = FileUtility.getOperableParents(new IResource[] { resources[i] },
                IStateFilter.SF_NOTONREPOSITORY, true);

        ILocalResource local = SVNRemoteStorage.instance().asLocalResourceAccessible(resources[i]);
        if (parents.length > 0 && IStateFilter.SF_ONREPOSITORY.accept(local)) {
            unsupportedResources.put(resources[i], parents);
        } else {
            resultResources.add(resources[i]);
        }
    }
    //delete from unsupported set resources which parents already exist in resultResources
    if (!resultResources.isEmpty() && !unsupportedResources.isEmpty()) {
        for (Iterator iter = unsupportedResources.keySet().iterator(); iter.hasNext();) {
            IResource res = (IResource) iter.next();
            List listOfParents = Arrays.asList((IResource[]) unsupportedResources.get(res));
            if (resultResources.containsAll(listOfParents)) {
                iter.remove();
            }
        }
    }
    final boolean[] isCanceled = new boolean[] { false };
    if (!unsupportedResources.isEmpty()) {
        final HashSet parents = new HashSet();
        for (Iterator iter = unsupportedResources.keySet().iterator(); iter.hasNext();) {
            IResource res = (IResource) iter.next();
            parents.addAll(Arrays.asList((IResource[]) unsupportedResources.get(res)));
        }
        shell.getDisplay().syncExec(new Runnable() {
            public void run() {
                boolean oneParent = parents.size() == 1;
                boolean oneResource = unsupportedResources.size() == 1;
                String description;
                String defaultMessage;
                if (oneParent && oneResource) {
                    description = SVNUIMessages.UnacceptableOperation_Description_1;
                    defaultMessage = SVNUIMessages.UnacceptableOperation_Message_1;
                } else if (!oneParent && oneResource) {
                    description = SVNUIMessages.UnacceptableOperation_Description_2;
                    defaultMessage = SVNUIMessages.UnacceptableOperation_Message_2;
                } else if (oneParent && !oneResource) {
                    description = SVNUIMessages.UnacceptableOperation_Description_3;
                    defaultMessage = SVNUIMessages.UnacceptableOperation_Message_3;
                } else {
                    description = SVNUIMessages.UnacceptableOperation_Description_4;
                    defaultMessage = SVNUIMessages.UnacceptableOperation_Message_4;
                }
                ResourceListPanel panel = new ResourceListPanel(
                        (IResource[]) unsupportedResources.keySet()
                                .toArray(new IResource[unsupportedResources.keySet().size()]),
                        SVNUIMessages.UnacceptableOperation_Title, description, defaultMessage,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL });
                DefaultDialog dialog = new DefaultDialog(shell, panel);
                if (dialog.open() != 0) {
                    isCanceled[0] = true;
                }
            }
        });
        if (isCanceled[0]) {
            return null;
        }
        resultResources.addAll(parents);
    }
    return (IResource[]) resultResources.toArray(new IResource[resultResources.size()]);
}

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  ww .  jav a 2 s.  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 {//from  w  w  w.j  a  v a 2s  . c  o 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;
}