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.vectrace.MercurialEclipse.dialogs.CommitDialog.java
License:Open Source License
/** * Override the OK button pressed to capture the info we want first and then call super. *//*from w w w. j a v a2 s . c om*/ @Override protected void okPressed() { IProgressMonitor pm = monitor; monitor.setVisible(true); monitor.attachToCancelComponent(getButton(IDialogConstants.CANCEL_ID)); pm.beginTask("Committing...", 20); // get checked resources and add them to the maps to be used by hg pm.subTask("Determining resources to add, remove and to commit."); resourcesToAdd = commitFilesList.getCheckedResources(FILE_UNTRACKED); resourcesToCommit = commitFilesList.getCheckedResources(); resourcesToRemove = commitFilesList.getCheckedResources(FILE_DELETED); pm.worked(3); // get commit message String commitMessage = getCommitMessage(); // get commit username user = userTextField.getText(); if (user == null || user.length() == 0) { user = getInitialCommitUserName(); } boolean closeBranchSelected = isCloseBranchSelected(); boolean amend = isAmend() && currentChangeset != null; try { // amend changeset if (amend) { if (closeBranchSelected) { setErrorMessage(Messages.getString("Cannot close branch while amending")); return; } // only one root allowed when amending Map<HgRoot, List<IResource>> map = ResourceUtils.groupByRoot(resourcesToCommit); if (map.size() > 1) { setErrorMessage(Messages.getString("CommitDialog.amendingOnlyForOneRoot")); return; } // only proceed if files are present if (currentChangeset.getChangedFiles().isEmpty()) { setErrorMessage(Messages.getString("CommitDialog.noChangesetToAmend")); return; } if (currentChangeset.isMerge()) { setErrorMessage(Messages.getString("CommitDialog.noAmendForMerge")); return; } if (HgQAppliedClient.getAppliedPatches(root).size() > 0) { setErrorMessage("Cannot amend when there are applied MQ patches"); return; } pm.worked(1); if (!confirmHistoryRewrite()) { setErrorMessage(Messages.getString("CommitDialog.abortedAmending")); return; } } // add new resources pm.subTask("Adding selected untracked resources to repository."); HgAddClient.addResources(resourcesToAdd, pm); pm.worked(1); // remove deleted resources pm.subTask("Removing selected deleted resources from repository."); HgRemoveClient.removeResources(resourcesToRemove); pm.worked(1); // perform commit pm.subTask("Committing resources to repository."); if (amend && !HgFeatures.COMMIT_AMEND.isEnabled()) { performAmendMQ(commitMessage, currentChangeset); } else { performCommit(commitMessage, closeBranchSelected, amend); } pm.worked(1); /* Store commit message in the database if not a default message */ if (!commitMessage.equals(options.defaultCommitMessage) || (// Covers the case of changesets of which the msg has not been edited between // the dialog opening and the user clicking the OK button. options.committingChangeset && !commitMessage.startsWith(UncommittedChangesetGroup.DEFAULT_NAME))) { pm.subTask("Storing the commit message for later use."); MercurialEclipsePlugin.getCommitMessageManager().saveCommitMessage(commitMessage); } pm.worked(1); // revertCheckBox can be null if this is a merge dialog if (isRevertSelected()) { revertResources(); } } catch (HgException e) { setErrorMessage(e.getConciseMessage()); MercurialEclipsePlugin.logError(e); return; } catch (CoreException e) { setErrorMessage(e.getLocalizedMessage()); MercurialEclipsePlugin.logError(e); return; } finally { monitor.done(); monitor.removeFromCancelComponent(getButton(IDialogConstants.CANCEL_ID)); monitor.setVisible(false); } super.okPressed(); if (closeBranchSelected) { // open "switch to" dialog as the user decided to close the branch and will // go to the switch dialog anyway try { new SwitchHandler().run(root); } catch (CoreException e) { MercurialEclipsePlugin.logError(e); } } }
From source file:com.vectrace.MercurialEclipse.dialogs.NewHeadsDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { if (moreThanTwoHeads) { // createButton(parent, SWITCH_ID, Messages.getString("NewHeadsDialog.manyHeads.Switch"), false); createButton(parent, REBASE_ID, Messages.getString("NewHeadsDialog.manyHeads.Rebase"), false); createButton(parent, MERGE_ID, Messages.getString("NewHeadsDialog.manyHeads.Merge"), false); } else {// w w w . j a v a 2 s . c o m // createButton(parent, SWITCH_ID, Messages.getString("NewHeadsDialog.twoHeads.Switch"), false); createButton(parent, REBASE_ID, Messages.getString("NewHeadsDialog.twoHeads.Rebase"), false); createButton(parent, MERGE_ID, Messages.getString("NewHeadsDialog.twoHeads.Merge"), false); } createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("NewHeadsDialog.CancelUpdate"), false); }
From source file:com.vectrace.MercurialEclipse.dialogs.TransplantRejectsDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("TransplantRejectsDialog.tryAnotherTransplant"), false); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); }
From source file:com.windowtester.swt.codegen.dialogs.SubclassSelectionDialog.java
License:Open Source License
public String getSelection() { //TODO: improve exception handling String result = ""; try {/*from w w w. java 2 s .c o m*/ IType[] subtypes = SearchScopeHelper.forSubclasses(type).inProject(getJavaProject()); SelectionDialog dialog = null; Object[] types; IJavaSearchScope scope; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); scope = getSearchScope(); dialog = JavaUI.createTypeDialog(window.getShell(), new ProgressMonitorDialog(window.getShell()), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, /*type.getFullyQualifiedName()*/ "", FilteredTypeSelectionExtension.forTypes(subtypes)); dialog.setTitle("Superclass Selection"); dialog.setMessage("Choose a type:"); if (dialog.open() == IDialogConstants.CANCEL_ID) { return null; } types = dialog.getResult(); if (types != null && types.length > 0) { result = ((IType) types[0]).getFullyQualifiedName(); } } catch (JavaModelException e) { LogHandler.log(e); } catch (Exception e) { LogHandler.log(e); } return result; }
From source file:com.zeus.eclipsePlugin.swt.dialogs.PasswordDialog.java
License:Open Source License
/** * Create the dialog's buttons: An OK button and a disconnect button. *///ww w . j ava 2s .com /* Override */ protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, DialogOption.OK.getText(), true) .addSelectionListener(new ButtonListener(DialogOption.OK)); createButton(parent, IDialogConstants.CANCEL_ID, DialogOption.DISCONNECT.getText(), false) .addSelectionListener(new ButtonListener(DialogOption.DISCONNECT)); listener.update(); }
From source file:conspecedit.editors.ReactionEdit.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { // Add buttons for OK and Cancel to the dialogue box. createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:de.anbos.eclipse.logviewer.plugin.ui.EncodingDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, 3, LogViewerPlugin.getResourceString("dialog.encoding.defaults.button"), false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); //do this here because setting the text will set enablement on the ok // button//from w w w . j a v a2 s .c o m encodingCombo.setFocus(); if (value != null) { encodingCombo.setText(value); } }
From source file:de.anbos.eclipse.logviewer.plugin.ui.LogFileTypeDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); // button//from ww w . j ava 2 s . c om typeCombo.setFocus(); if (value != null) { typeCombo.setText(value); } }
From source file:de.anbos.eclipse.logviewer.plugin.ui.TabRenameDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); //do this here because setting the text will set enablement on the ok // button/*from w w w . j av a 2 s. c o m*/ nameField.setFocus(); if (value != null) { nameField.setText(value); } }
From source file:de.babe.eclipse.plugins.quickREx.dialogs.OrganizeREsDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, DELETE_BUTTON_ID, Messages.getString("dialogs.OrganizeREsDialog.button.delete"), //$NON-NLS-1$ false);/*from www .j a v a 2 s . c om*/ createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("dialogs.OrganizeREsDialog.button.close"), true); //$NON-NLS-1$ }