List of usage examples for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID
int CANCEL_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID.
Click Source Link
From source file:com.microsoft.tfs.client.common.ui.framework.WindowSystemProperties.java
License:Open Source License
/** * Determines whether the native look and feel suggests that the * cancel/close/dismiss button or the ok button is the right-most button in * a dialog (in left-to-right languages.) * * @return {@link IDialogConstants#OK_ID} or * {@link IDialogConstants#CANCEL_ID} *///from w ww . j a v a 2 s. co m public final static int getDefaultButton() { if (WindowSystem.isCurrentWindowSystem(WindowSystem.AQUA)) { return IDialogConstants.OK_ID; } else { return IDialogConstants.CANCEL_ID; } }
From source file:com.microsoft.tfs.client.common.ui.helpers.ViewFileHelper.java
License:Open Source License
/** * Views a {@link TFSFile}, which describes an item which may already be at * its latest version in a working folder on disk. If the file is at its * latest version, the file is simply viewed with * {@link #viewLocalFileOrFolder(String, IWorkbenchPage, boolean)}. If the * file is not at its latest, the user is prompted whether to view the * existing local version or view the latest version from the server * (choosing the latter invokes/*from w w w. jav a2s . co m*/ * {@link #viewHistoricalFile(TFSRepository, String, VersionSpec, IWorkbenchPage, boolean)} * ). If there is no file on disk at all, the user is prompted whether to * download and view the given item. * * @param repository * the repository to use to get the historical file from (must not be * <code>null</code>) * @param file * the {@link TFSFile} to view (must not be <code>null</code>) * @param page * the active workbench page (must not be <code>null</code>) * @param inModalContext * true if the application is in a modal context and a viewer that * works inside a modal context must be used (for example, the viewer * is internal and opens a new top-level window, or the viewer is * external and opens its own application), false if the context is * non-modal and the viewer may open an editor in the workbench * * @warning this method must be called on the UI thread, because it may * raise dialogs */ public static void viewTFSFile(final TFSRepository repository, final TFSFile file, final IWorkbenchPage page, final boolean inModalContext) { Check.notNull(repository, "repository"); //$NON-NLS-1$ Check.notNull(file, "file"); //$NON-NLS-1$ Check.notNull(page, "page"); //$NON-NLS-1$ /* * Does the file exist locally? */ if (file.getExtendedItem() != null && file.getExtendedItem().getLocalItem() != null) { if (!file.isLatest()) { /* * If the file isn't at the latest version, prompt the user for * what they want to do. */ final PromptViewOldVersionDialog dlg = new PromptViewOldVersionDialog( page.getWorkbenchWindow().getShell()); if (dlg.open() == IDialogConstants.CANCEL_ID) { /* * Cancelled the prompt - abort the view file operation. */ return; } if (dlg.getSelectedOption() == PromptViewOldVersionDialog.SERVER_OPTION) { /* * User selected to view the latest (server) version. Query * on the server path at the local version. */ ViewFileHelper.viewVersionedFile(repository, file.getSourceServerPath(), new ChangesetVersionSpec(file.getLocalVersion()), LatestVersionSpec.INSTANCE, page, inModalContext); return; } } /* * Either file is at latest version, or user selected to view the * old (workspace) version. */ if (file.getLocalPath() != null) { ViewFileHelper.viewLocalFileOrFolder(file.getLocalPath(), page, inModalContext); } } else { /* * File is not local. */ if (MessageBoxHelpers.dialogConfirmPrompt(page.getWorkbenchWindow().getShell(), Messages.getString("ViewFileHelper.ConfirmViewDialogTitle"), //$NON-NLS-1$ Messages.getString("ViewFileHelper.ConfirmViewDialogText"))) //$NON-NLS-1$ { /* * Query on the server path and remote version, since there is * no local version. */ ViewFileHelper.viewVersionedFile(repository, file.getSourceServerPath(), new ChangesetVersionSpec(file.getRemoteVersion()), LatestVersionSpec.INSTANCE, page, inModalContext); } } }
From source file:com.microsoft.tfs.client.common.ui.tasks.vc.WorkingFolderTask.java
License:Open Source License
@Override public IStatus run() { if (getDialog().open() == IDialogConstants.CANCEL_ID) { return Status.CANCEL_STATUS; }/* ww w .ja v a2 s .c o m*/ final TFSCommand command = getCommand(); final IStatus status = getCommandExecutor().execute(command); if (status.isOK() && getLatestOnSuccess) { getLatest(); } return status; }
From source file:com.microsoft.tfs.client.common.ui.teambuild.dialogs.BuildStatusNotificationDialog.java
License:Open Source License
@Override protected void buttonPressed(final int buttonId) { if (buttonId == UNSHELVE_BUTTON_ID) { final UnshelveBuiltShelvesetTask unshelveTask = new UnshelveBuiltShelvesetTask(getShell(), TFSCommonUIClientPlugin.getDefault().getProductPlugin().getRepositoryManager() .getDefaultRepository(), buildDetail, true);/*from w w w .j a va 2s .co m*/ final IStatus unshelveStatus = unshelveTask.run(); /* On error or cancel, keep this dialog open. */ if (unshelveStatus.matches(IStatus.ERROR | IStatus.CANCEL)) { return; } setReturnCode(IDialogConstants.OK_ID); close(); } else if (buttonId == RECONCILE_BUTTON_ID) { final ReconcileGatedCheckinTask reconcileTask = new ReconcileGatedCheckinTask(getShell(), TFSCommonUIClientPlugin.getDefault().getProductPlugin().getRepositoryManager() .getDefaultRepository(), buildDetail); final IStatus reconcileStatus = reconcileTask.run(); /* On error or cancel, keep this dialog open. */ if (reconcileStatus.matches(IStatus.ERROR | IStatus.CANCEL)) { return; } setReturnCode(IDialogConstants.OK_ID); close(); } else { /* * Always return cancel when no action is performed. This allows * callers to know when a build should no longer be "watched" * (OK_ID) vs no action was performed (CANCEL_ID). */ setReturnCode(IDialogConstants.CANCEL_ID); close(); } }
From source file:com.microsoft.tfs.client.common.ui.teambuild.dialogs.QueueBuildDialog.java
License:Open Source License
public QueueBuildDialog(final Shell parentShell, final IBuildDefinition buildDefinition) { super(parentShell); selectedBuildDefinition = buildDefinition; buildServer = selectedBuildDefinition.getBuildServer(); teamProject = selectedBuildDefinition.getTeamProject(); final TeamBuildCache cache = TeamBuildCache.getInstance(buildServer, teamProject); buildDefinitions = cache.getBuildDefinitions(false); buildControllers = cache.getBuildControllers(false); defaultQueuePriorityText = buildServer.getDisplayText(QueuePriority.NORMAL); image = getSWTImage(SWT.ICON_INFORMATION); setOptionIncludeDefaultButtons(false); addButtonDescription(IDialogConstants.OK_ID, Messages.getString("QueueBuildDialog.QueueButtonText"), true); //$NON-NLS-1$ addButtonDescription(IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:com.microsoft.tfs.client.common.ui.teambuild.dialogs.QueueBuildDialog.java
License:Open Source License
public QueueBuildDialog(final Shell parentShell, final IBuildDefinition selectedBuildDefinition, final IBuildServer buildServer, final String teamProjectName, final IBuildDefinition[] buildDefinitions, final IBuildController[] buildControllers) { super(parentShell); this.selectedBuildDefinition = selectedBuildDefinition; this.buildServer = buildServer; teamProject = teamProjectName;/*from ww w.java2s . com*/ this.buildDefinitions = buildDefinitions; this.buildControllers = buildControllers; defaultQueuePriorityText = this.buildServer.getDisplayText(QueuePriority.NORMAL); image = getSWTImage(SWT.ICON_INFORMATION); setOptionIncludeDefaultButtons(false); addButtonDescription(IDialogConstants.OK_ID, Messages.getString("QueueBuildDialog.QueueButtonText"), true); //$NON-NLS-1$ addButtonDescription(IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:com.microsoft.tfs.client.common.ui.teambuild.teamexplorer.actions.QueueBuildAction.java
License:Open Source License
@Override public void doRun(final IAction action) { Check.notNull(selectedDefinition, "selectedDefinition"); //$NON-NLS-1$ final QueueBuildDialog dialog = new QueueBuildDialog(getShell(), selectedDefinition); if (dialog.getBuildDefinitionCount() == 0) { final String messageFormat = Messages.getString("QueueBuildAction.NoBuildDefAvailableFormat"); //$NON-NLS-1$ final String message = MessageFormat.format(messageFormat, selectedDefinition.getTeamProject()); MessageBoxHelpers.errorMessageBox(getShell(), null, message); return;/* ww w .j a v a 2 s. c o m*/ } if (IDialogConstants.CANCEL_ID == dialog.open()) { return; } final IBuildRequest request = dialog.getSelectedBuildRequest(); final QueueBuildCommand command = new QueueBuildCommand(request); // This is not executed async because we need to get the Queued Build // back to then display it in the build explorer. if (execute(command, false).getSeverity() == IStatus.OK) { TeamBuildHelper.openBuildExplorer(request.getBuildDefinition(), command.getQueuedBuild()); BuildHelpers.getBuildManager().fireBuildQueuedEvent(getTargetPart(), command.getQueuedBuild()); } }
From source file:com.microsoft.tfs.client.eclipse.ui.actions.vc.SwitchToBranchAction.java
License:Open Source License
@Override public void doRun(final IAction action) { final AdaptedSelectionInfo selectionInfo = ActionHelpers.adaptSelectionToStandardResources(getSelection(), PluginResourceFilters.STANDARD_FILTER, true); if (ActionHelpers.ensureNonZeroResourceCountAndSingleRepository(selectionInfo, getShell()) == false) { return;/*from ww w. j ava 2 s.com*/ } final IResource resource = selectionInfo.getResources()[0]; if (resource.getLocation() == null) { return; } /* * Error if there are pending changes. */ final PendingChange[] relatedChanges = selectionInfo.getPendingChanges(); if (relatedChanges != null && relatedChanges.length > 0) { MessageDialog.openWarning(getShell(), Messages.getString("SwitchToBranchAction.NotAllowedDialogTitle"), //$NON-NLS-1$ Messages.getString("SwitchToBranchAction.NotAllowedDialogText")); //$NON-NLS-1$ return; } /* * Get the project for the resource, since we only switch entire * projects. */ final IProject project = resource.getProject(); final Workspace workspace = selectionInfo.getRepositories()[0].getWorkspace(); final String localPath = project.getLocation().toOSString(); final String serverPath = workspace.getMappedServerPath(localPath); final SwitchToBranchDialog dialog = new SwitchToBranchDialog(getShell(), workspace, serverPath); if (IDialogConstants.CANCEL_ID == dialog.open() || ServerPath.equals(serverPath, dialog.getSwitchToServerPath())) { return; } final SwitchToBranchCommand command = new SwitchToBranchCommand(workspace, project, serverPath, dialog.getSwitchToServerPath()); UICommandExecutorFactory.newUICommandExecutor(getShell()).execute(new ResourceChangingCommand(command)); }
From source file:com.microsoft.tfs.client.eclipse.ui.dialogs.vc.FileModificationFailureDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { createButton(parent, IDialogConstants.OK_ID, Messages.getString("FileModificationFailureDialog.RevertButtonText"), //$NON-NLS-1$ true);//from w ww . j a v a2 s . co m createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("FileModificationFailureDialog.ContinueButtonText"), //$NON-NLS-1$ false); /* Not available in eclipse < 3.2, always included by default. */ if (SWT.getVersion() >= 3200) { createDetailsButton(parent); } }
From source file:com.microsoftopentechnologies.wacommon.startup.AcceptLicenseDlg.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { Control ctrl = super.createButtonBar(parent); getButton(IDialogConstants.OK_ID).setText("Yes"); getButton(IDialogConstants.CANCEL_ID).setText("No"); return ctrl;//from w w w . j a v a 2 s . c o m }