List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_ID
int NO_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_ID.
Click Source Link
From source file:com.clustercontrol.approval.dialog.ApprovalDetailDialog.java
License:Open Source License
private void createButtonsForApprovalButtonBar(Composite parent) { //?/*from www. j av a2 s . c om*/ createButton(parent, IDialogConstants.YES_ID, Messages.getString("approval.approve"), false); //?? createButton(parent, IDialogConstants.NO_ID, Messages.getString("approval.deny"), false); // createButton(parent, IDialogConstants.OK_ID, Messages.getString("approval.comment.registration"), false); // createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("cancel"), false); }
From source file:com.clustercontrol.approval.dialog.ApprovalDetailDialog.java
License:Open Source License
@Override protected void buttonPressed(int buttonId) { if (IDialogConstants.YES_ID == buttonId) { OperationApprove(true);//from w w w . j av a 2 s.c om } else if (IDialogConstants.NO_ID == buttonId) { OperationApprove(false); } else if (IDialogConstants.OK_ID == buttonId) { okPressed(); } else if (IDialogConstants.CANCEL_ID == buttonId) { cancelPressed(); } else if (IDialogConstants.STOP_ID == buttonId) { OperationStop(approvalInfo); } }
From source file:com.heroku.eclipse.ui.git.HerokuCredentialsProvider.java
License:Open Source License
/** * Opens a dialog for a single non-user, non-password type item. * @param shell the shell to use/*from w ww. j a v a 2 s .c o m*/ * @param uri the uri of the get request * @param item the item to handle * @return <code>true</code> if the request was successful and values were supplied; * <code>false</code> if the user canceled the request and did not supply all requested values. */ private boolean getSingleSpecial(Shell shell, URIish uri, CredentialItem item) { if (item instanceof CredentialItem.InformationalMessage) { MessageDialog.openInformation(shell, UIText.EGitCredentialsProvider_information, item.getPromptText()); return true; } else if (item instanceof CredentialItem.YesNoType) { CredentialItem.YesNoType v = (CredentialItem.YesNoType) item; String[] labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; int[] resultIDs = new int[] { IDialogConstants.YES_ID, IDialogConstants.NO_ID, IDialogConstants.CANCEL_ID }; MessageDialog dialog = new MessageDialog(shell, UIText.EGitCredentialsProvider_question, null, item.getPromptText(), MessageDialog.QUESTION_WITH_CANCEL, labels, 0); dialog.setBlockOnOpen(true); int r = dialog.open(); if (r < 0) { return false; } switch (resultIDs[r]) { case IDialogConstants.YES_ID: { v.setValue(true); return true; } case IDialogConstants.NO_ID: { v.setValue(false); return true; } default: // abort return false; } } else { // generically handles all other types of items return getMultiSpecial(shell, uri, item); } }
From source file:com.mentor.nucleus.bp.core.CorePlugin.java
License:Open Source License
/** * Determine if parse should be done. The user may be prompted to * do the parse, so this method must be executed in the UI thread. * * @return true if parse should be done//from ww w .j a v a 2 s. c o m */ public boolean getParseAllOnResourceChange() { IPreferenceStore store = getPreferenceStore(); String option = store.getString(BridgePointPreferencesStore.PARSE_ALL_ON_RESOURCE_CHANGE); if (option.equals(MessageDialogWithToggle.ALWAYS)) { return true; } else if (option.equals(MessageDialogWithToggle.NEVER)) { return false; } MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Parse All Activities", "Import Complete, parse all action language?", "&Remember my decision", false, store, BridgePointPreferencesStore.PARSE_ALL_ON_RESOURCE_CHANGE); int result = m.getReturnCode(); switch (result) { // yes, ok case IDialogConstants.YES_ID: case IDialogConstants.OK_ID: return true; // no case IDialogConstants.NO_ID: return false; } // default is to parse return true; }
From source file:com.motorola.studio.android.common.utilities.EclipseUtils.java
License:Apache License
/** * Show a question message using the given title and message * /* w w w . j av a 2 s . c o m*/ * @param title * of the dialog * @param message * to be displayed in the dialog. */ public static int showQuestionYesAllCancelDialog(final String title, final String message) { class IntWrapper { public int diagReturn = 0; } final IntWrapper intWrapper = new IntWrapper(); Display.getDefault().syncExec(new Runnable() { public void run() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow ww = workbench.getActiveWorkbenchWindow(); Shell shell = ww.getShell(); MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL }, 0); int diagResults = dialog.open(); switch (diagResults) { case 0: intWrapper.diagReturn = IDialogConstants.YES_ID; break; case 1: intWrapper.diagReturn = IDialogConstants.YES_TO_ALL_ID; break; case 2: default: intWrapper.diagReturn = IDialogConstants.NO_ID; break; } } }); return intWrapper.diagReturn; }
From source file:com.nokia.s60tools.creator.job.ConfirmFileReplaceDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { GridLayout gdl = new GridLayout(1, false); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); parent.setLayout(gdl);/* w w w . j av a 2 s. c o m*/ parent.setLayoutData(gd); createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); }
From source file:com.nokia.s60tools.creator.job.ConfirmFileReplaceDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite dialogAreaComposite = (Composite) super.createDialogArea(parent); Label label = new Label(dialogAreaComposite, SWT.NONE); label.setText(Messages.getString("ConfirmFileReplaceDialog.Confirm_Replace_DlgMsg_Prefix") //$NON-NLS-1$ + "'" //$NON-NLS-1$ + filePath + "'" //$NON-NLS-1$ + ". " //$NON-NLS-1$ + Messages.getString("ConfirmFileReplaceDialog.Confirm_Replace_DlgMsg_Postfix")); //$NON-NLS-1$); // "Don't ask again" check box confirmReplaceRadioCB = new Button(dialogAreaComposite, SWT.CHECK); confirmReplaceRadioCB.setText(Messages.getString("ConfirmFileReplaceDialog.DontAskAgainFileReplace_Txt")); //$NON-NLS-1$ confirmReplaceRadioCB.setSelection(CreatorPreferences.getDontAskFileReplaceInDevice()); // Disable "No" button when check box is selected confirmReplaceRadioCB.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { getButton(IDialogConstants.NO_ID).setEnabled(!confirmReplaceRadioCB.getSelection()); }/* w w w. j a v a2s . com*/ public void widgetDefaultSelected(SelectionEvent arg0) { // Not implemented } }); return dialogAreaComposite; }
From source file:com.nokia.s60tools.hticonnection.ui.dialogs.ErrorDialogWithHelp.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // Creating Ok button. if ((style & SWT.OK) == SWT.OK) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); okButton.addSelectionListener(this); PlatformUI.getWorkbench().getHelpSystem().setHelp(okButton, DEFAULT_CONTEXT_HELP); }//from w w w .j a v a 2 s. c om // Creating Yes button if ((style & SWT.YES) == SWT.YES) { yesButton = createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); yesButton.addSelectionListener(this); PlatformUI.getWorkbench().getHelpSystem().setHelp(yesButton, DEFAULT_CONTEXT_HELP); } //Creating No button if ((style & SWT.NO) == SWT.NO) { noButton = createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); noButton.addSelectionListener(this); PlatformUI.getWorkbench().getHelpSystem().setHelp(noButton, DEFAULT_CONTEXT_HELP); } }
From source file:com.nokia.s60tools.remotecontrol.ftp.ui.view.FtpUtils.java
License:Open Source License
/** * Download file and change it's name/*from w w w . ja v a2 s. co m*/ * @param viewer Viewer * @param contentProvider Content provider */ static public void downloadFileAs(TableViewer viewer, ViewContentProvider contentProvider) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); Object selectedObject = selection.getFirstElement(); if (selectedObject == null || !FtpFileObject.class.isInstance(selectedObject)) { // Nothing selected or selection is not file return; } FtpFileObject ftpObject = (FtpFileObject) selectedObject; // Show Save as dialog to user Shell sh = RemoteControlActivator.getCurrentlyActiveWbWindowShell(); FileDialog fileDialog = new FileDialog(sh, SWT.SAVE); fileDialog.setFileName(ftpObject.getName()); fileDialog.setText(Messages.getString("FtpUtils.DownloadAs_DialogText")); //$NON-NLS-1$ // Get user selected folder String destFile = fileDialog.open(); if (destFile == null) { // User is canceled dialog return; } // Full path for remote file String currentDirectory = getCurrentPath(contentProvider); String remoteFile = currentDirectory + ftpObject.getName(); String destFileName = destFile.substring(destFile.lastIndexOf(File.separator) + File.separator.length()); // Remember last used folder String destFolder = destFile.substring(0, destFile.lastIndexOf(File.separator)); RCPreferences.setDownloadLocation(destFolder); destFolder = addFileSepatorToEnd(destFolder); FileDownloadJob job = null; boolean canWrite = true; if (RCPreferences.getDownloadConfirm()) { // Confirm replace from user if file already exists File file = new File(destFile); if (file.exists()) { // Show confirmation dialog ConfirmReplaceDialog dlg = new ConfirmReplaceDialog(sh, destFileName, false, ConfirmReplaceDialog.Operation.DOWNLOAD); dlg.open(); int sel = dlg.getSelection(); switch (sel) { case ConfirmReplaceDialog.RENAME_ID: // Rename this file RenameDialog renameDlg = new RenameDialog(sh, destFileName, true, RENAME_FILE_DLG_NAME); if (renameDlg.open() == Dialog.CANCEL) { // User canceled dialog return; } // Get new file name from dialog. If user canceled dialog the original // filename is returned destFile = destFolder + renameDlg.getFileName(); canWrite = true; break; case IDialogConstants.YES_ID: // Replace this file canWrite = true; break; case IDialogConstants.NO_ID: // Do not replace this file canWrite = false; break; case IDialogConstants.CANCEL_ID: // Cancel operation return; default: break; } } } if (canWrite) { job = new FileDownloadJob(Messages.getString("FtpUtils.Download_File_Job_Name") + ftpObject.getName(), //$NON-NLS-1$ remoteFile, destFile); job.setPriority(Job.DECORATE); job.schedule(); } }
From source file:com.nokia.s60tools.remotecontrol.ftp.ui.view.FtpUtils.java
License:Open Source License
/** * Download all selected files/*from w w w . j av a 2 s .c o m*/ * @param viewer Viewer * @param contentProvider Content provider */ @SuppressWarnings("unchecked") static public void downloadFiles(TableViewer viewer, ViewContentProvider contentProvider) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); Object selectedObject = selection.getFirstElement(); if (selectedObject == null || !FtpFileObject.class.isInstance(selectedObject)) { // Nothing selected or selection is not file return; } // Show select folder dialog to user Shell sh = RemoteControlActivator.getCurrentlyActiveWbWindowShell(); DirectoryDialog dirDialog = new DirectoryDialog(sh, SWT.OPEN); dirDialog.setText(Messages.getString("FtpUtils.Select_Folder_DlgText")); //$NON-NLS-1$ dirDialog.setMessage(Messages.getString("FtpUtils.Select_Folder_DlgMsg")); //$NON-NLS-1$ String downloadFilterPath = RCPreferences.getDownloadLocation(); if (downloadFilterPath == "") { //$NON-NLS-1$ // Workspace root is used as default folder IPath location = ResourcesPlugin.getWorkspace().getRoot().getLocation(); dirDialog.setFilterPath(location.toString()); } else { // use last used folder dirDialog.setFilterPath(downloadFilterPath); } // Get user selected folder String destPath = dirDialog.open(); if (destPath == null) { // User is canceled dialog return; } // Remember last used folder RCPreferences.setDownloadLocation(destPath); destPath = addFileSepatorToEnd(destPath); // Full path for remote file String currentDirectory = getCurrentPath(contentProvider); IFtpObject ftpObject = null; String remoteFile = null; String destFile = null; FileDownloadJob job = null; // Download files Iterator iter = selection.iterator(); boolean canWrite; boolean replaceAll = false; while (iter.hasNext()) { canWrite = true; ftpObject = (IFtpObject) iter.next(); if (FtpFileObject.class.isInstance(ftpObject)) { // Folders are not downloaded // Full path for destination file destFile = destPath + ftpObject.getName(); remoteFile = currentDirectory + ftpObject.getName(); if (RCPreferences.getDownloadConfirm()) { // Confirm replace from user if file already exists File file = new File(destFile); if (file.exists() && !replaceAll) { // Show confirmation dialog ConfirmReplaceDialog dlg = new ConfirmReplaceDialog(sh, ftpObject.getName(), iter.hasNext(), ConfirmReplaceDialog.Operation.DOWNLOAD); dlg.open(); int sel = dlg.getSelection(); switch (sel) { case ConfirmReplaceDialog.RENAME_ID: // Rename this file RenameDialog renameDlg = new RenameDialog(sh, ftpObject.getName(), true, RENAME_FILE_DLG_NAME); if (renameDlg.open() == Dialog.CANCEL) { // User canceled dialog return; } // Get new file name from dialog. If user canceled dialog the original // filename is returned destFile = destPath + renameDlg.getFileName(); canWrite = true; break; case IDialogConstants.YES_ID: // Replace this file canWrite = true; break; case IDialogConstants.YES_TO_ALL_ID: // Replace all files replaceAll = true; break; case IDialogConstants.NO_ID: // Do not replace this file canWrite = false; break; case IDialogConstants.CANCEL_ID: // Cancel operation return; default: break; } } } if (canWrite) { job = new FileDownloadJob( Messages.getString("FtpUtils.Download_File_Job_Name") + ftpObject.getName(), //$NON-NLS-1$ remoteFile, destFile, false); job.setPriority(Job.DECORATE); job.schedule(); } } } }