List of usage examples for org.eclipse.jface.dialogs IDialogConstants CANCEL_LABEL
String CANCEL_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants CANCEL_LABEL.
Click Source Link
From source file:com.salesforce.ide.core.model.ProjectPackageList.java
License:Open Source License
private void handleSaveException(Exception exception, Component component) throws InterruptedException { String message = ForceExceptionUtils.getStrippedExceptionMessage(exception.getMessage()); logger.warn("Unable to save " + component.getFullDisplayName() + " to file - " + message); StringBuffer strBuff = new StringBuffer(Messages.getString("Components.SaveResourceError.message")); strBuff.append(":\n\n").append(message).append("\n\n") .append(Messages.getString("Components.SaveResourceError.ContinueWithSaving.message")); MessageDialogRunnable messageDialogRunnable = new MessageDialogRunnable("Cannot Write to File", null, strBuff.toString(), MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); Display.getDefault().syncExec(messageDialogRunnable); if (messageDialogRunnable.getAction() == 1) { throw new InterruptedException("Save components to project canceled"); }//ww w .j a v a2 s.c o m }
From source file:com.salesforce.ide.ui.actions.RefreshResourceActionController.java
License:Open Source License
protected void handleSourceComponentFolderRefresh(IProgressMonitor monitor) throws InterruptedException, ForceConnectionException, ForceRemoteException, FactoryException, CoreException, IOException, InvocationTargetException, ServiceException, Exception { monitorCheck(monitor);//from w ww.j a v a 2 s . co m List<IResource> folders = getProjectService().getResourcesByType(selectedResources, IResource.FOLDER); List<String> componentTypes = new ArrayList<String>(); if (Utils.isNotEmpty(folders)) { for (IResource folder : folders) { if (getProjectService().isComponentFolder(folder)) { Component component = getComponentFactory().getComponentByFolderName(folder.getName()); componentTypes.add(component.getComponentType()); } else if (getProjectService().isSubComponentFolder(folder)) { Component component = getComponentFactory().getComponentFromSubFolder((IFolder) folder, false); componentTypes.add(component.getSecondaryComponentType()); } // reference package folders is handled in methods specific for reference packages. } if (Utils.isNotEmpty(componentTypes)) { // Bug #206315: In package project, prompt user that refresh on component folder is not support, and // either cancel or refresh from src. Package packageManifest = getPackageManifestFactory().getPackageManifest(getProject()); if (Utils.isEmpty(packageManifest)) { throw new FactoryException(Messages.getString( "Retrieve.PackageProject.RefreshComponentFolder.MissPackageManifest.Exception.message", new String[] { getProject().getName() })); } if (Utils.isNotEmpty(packageManifest.getFullName())) { String dialogMsg = Messages .getString("Retrieve.PackageProject.RefreshComponentFolder.Dialog.message"); MessageDialogRunnable messageDialogRunnable = new MessageDialogRunnable("Refresh from server", null, dialogMsg, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); Display.getDefault().syncExec(messageDialogRunnable); if (messageDialogRunnable.getAction() == Window.CANCEL) { String cancelMsg = Messages .getString("Retrieve.PackageProject.RefreshComponentFolder.Cancel.message"); logger.info(cancelMsg); throw new InterruptedException(cancelMsg); } } // refresh component dirs ProjectPackageList projectPackageList = getProjectPackageFactory() .getProjectPackageListInstance(project); // only save these types String[] saveComponentTypes = componentTypes.toArray(new String[componentTypes.size()]); // perform retrieve RetrieveResultExt retrieveResultHandler = null; try { retrieveResultHandler = getServiceLocator().getPackageRetrieveService() .retrieveSelective(projectPackageList, saveComponentTypes, monitor); } catch (ServiceTimeoutException ex) { retrieveResultHandler = getServiceLocator().getPackageRetrieveService() .handleRetrieveServiceTimeoutException(ex, OPERATION, monitor); } if (retrieveResultHandler == null || !getProjectService().handleRetrieveResult(projectPackageList, retrieveResultHandler, true, saveComponentTypes, monitor)) { logger.warn("Unable to refresh component folders"); failRefreshResult(); } } } }
From source file:com.salesforce.ide.ui.dialogs.HyperLinkMessageDialog.java
License:Open Source License
/** * Convenience method to open a simple confirm (OK/Cancel) dialog. * /*from w ww . j a v a 2 s . c om*/ * @param parent * the parent shell of the dialog, or <code>null</code> if none * @param title * the dialog's title, or <code>null</code> if none * @param message * the message * @return <code>true</code> if the user presses the OK button, <code>false</code> otherwise */ public static boolean openConfirm(Shell parent, String title, String message) { HyperLinkMessageDialog dialog = new HyperLinkMessageDialog(parent, title, null, // accept // the // default // window // icon message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); // OK is the // default return dialog.open() == 0; }
From source file:com.salesforce.ide.ui.refactoring.BaseRefactorController.java
License:Open Source License
protected void testDeploy(IProgressMonitor monitor) throws OperationCanceledException, InterruptedException, ServiceException, ForceRemoteException { DeployResultExt deployResultExt = null; ProjectPackageList projectPackageList = refactorModel.getProjectPackageList(); monitorCheck(monitor);/*from w w w . jav a2 s. co m*/ try { try { deployResultExt = ContainerDelegate.getInstance().getServiceLocator().getPackageDeployService() .deployDelete(projectPackageList, true, monitor); } catch (ServiceTimeoutException ex) { deployResultExt = ContainerDelegate.getInstance().getServiceLocator().getPackageDeployService() .handleDeployServiceTimeoutException(ex, "test deploy", monitor); } if (!deployResultExt.isSuccess()) { deployResultExt.getMessageHandler().sort(DeployMessageExt.SORT_RESULT); DeployMessage[] deployMessages = deployResultExt.getMessageHandler().getMessages(); for (DeployMessage deployMessage : deployMessages) { if (!deployMessage.isSuccess()) { logger.warn("Component '" + deployMessage.getFullName() + "' failed test delete: '" + deployMessage.getProblem() + "'. will be deleted locally only."); projectPackageList.removeComponentByFilePath(deployMessage.getFileName(), true, true); monitorCheck(monitor); MessageDialogRunnable messageDialogRunnable = new MessageDialogRunnable( "Remote Delete Error", null, UIMessages.getString("Refactor.Delete.Complete.CannotDelete.message", new String[] { deployMessage.getFileName(), deployMessage.getProblem() }), MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); Display.getDefault().syncExec(messageDialogRunnable); if (messageDialogRunnable.getAction() == 1) { logger.warn("Canceling delete operation"); throw new OperationCanceledException("Delete operation canceled"); } } } } } catch (InterruptedException e) { throw new OperationCanceledException(e.getMessage()); } catch (DeployException e) { logger.error("Unable to perform server delete", e); } catch (ForceConnectionException e) { logger.warn("Unable to perform server delete", e); } }
From source file:com.sap.netweaver.porta.ide.eclipse.server.ui.dialogs.LoginDialog.java
License:Open Source License
public LoginDialog(Shell parentShell, String title, String message, String defaultUser) { super(parentShell, title, null, message, MessageDialog.QUESTION, new String[] { "Login", IDialogConstants.CANCEL_LABEL }, 0); this.defaultUser = defaultUser; }
From source file:com.schmeedy.relaxng.eclipse.ui.internal.preferences.EditRngSchemaBindingDialog.java
License:Open Source License
@Override protected Control createContents(Composite parent) { errorReportColor = new Color(parent.getDisplay(), 200, 0, 0); warningReportColor = new Color(parent.getDisplay(), 204, 102, 0); browseImage = RngUiPlugin.getDefault().getIcon("file_expand.gif").createImage(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(GridLayoutFactory.createFrom(new GridLayout(3, false)).margins(10, 7).create()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label labelNamespace = new Label(composite, SWT.NONE); labelNamespace.setText("Namespace: "); GridData inputLayoutData = new GridData(GridData.FILL_HORIZONTAL); inputLayoutData.widthHint = 270;//from www . j a v a2 s .c o m namespaceText = new Text(composite, SWT.SINGLE | SWT.BORDER); namespaceText.setLayoutData(GridDataFactory.createFrom(inputLayoutData).span(2, 1).create()); Label labelSchemaLocation = new Label(composite, SWT.NONE); labelSchemaLocation.setText("Schema Location: "); schemaLocationText = new Text(composite, SWT.SINGLE | SWT.BORDER); schemaLocationText.setLayoutData(inputLayoutData); Button browseControl = createBrowseButton(composite); browseControl.addSelectionListener(new DropDownSelectionListener(schemaLocationText)); Label labelSchemaType = new Label(composite, SWT.NONE); labelSchemaType.setText("Schema Syntax: "); schemaTypeCombo = new Combo(composite, SWT.READ_ONLY); schemaTypeCombo.setLayoutData(GridDataFactory.createFrom(inputLayoutData).span(2, 1).create()); schemaTypeCombo.add("XML", SCHEMA_TYPE_XML_COMBO_IDX); schemaTypeCombo.add("Compact", SCHEMA_TYPE_COMPACT_COMBO_IDX); errorReportArea = new Label(composite, SWT.NONE); errorReportArea.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(3, 1).create()); Composite buttonComposite = new Composite(composite, SWT.NONE); buttonComposite.setLayout(new GridLayout(2, false)); buttonComposite .setLayoutData(GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(3, 1).create()); okButton = createButton(buttonComposite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); okButton.setEnabled(false); createButton(buttonComposite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); if (binding != null) { initEditedValues(); } revalidate(); ModifyListener validationListener = new ModifyListener() { public void modifyText(ModifyEvent e) { revalidate(); } }; namespaceText.addModifyListener(validationListener); schemaLocationText.addModifyListener(validationListener); schemaTypeCombo.addModifyListener(validationListener); return composite; }
From source file:com.servoy.eclipse.docgenerator.ui.handler.DocumentationGenerationRequestFromUI.java
License:Open Source License
public boolean confirmResourceOverwrite(final IPath path) { // If the settings say to not ask for confirmation, then just say yes. boolean mustAsk = Activator.getDefault().getPreferenceStore() .getBoolean(Activator.ASK_FOR_FILE_OVERWRITE_PREFERENCE); if (!mustAsk) { return true; }//from ww w .j a v a 2 s. c o m // If the user already clicked "Confirm All" then just say yes. if (confirmAll) { return true; } // Ask the user if it's OK to overwrite. final boolean choice[] = new boolean[1]; Display.getDefault().syncExec(new Runnable() { public void run() { MessageDialog dlg = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Confirm file overwrite", null, "The following file already exists and will be overwritten: '" + path.toOSString() + "'. Are you sure you want the file to be overwritten?" + "\n\n" + "You can disable this confirmation dialog from the plugin preferences page.", MessageDialog.CONFIRM, new String[] { IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 3); int result = dlg.open(); if (result == 2) // the "Yes to All" button { confirmAll = true; } if (result == 3) // the "Cancel" button { canceled = true; } choice[0] = result == 1 || result == 2; // The "Yes" or "Yes to All" buttons were pressed. } }); return choice[0]; }
From source file:com.simplifide.core.ui.wizard.other.NewFilePage.java
License:Open Source License
/** * Creates a new file resource in the selected container and with the * selected name. Creates any missing resource containers along the path; * does nothing if the container resources already exist. * <p>/*w w w.ja v a2 s. co m*/ * In normal usage, this method is invoked after the user has pressed Finish * on the wizard; the enablement of the Finish button implies that all * controls on on this page currently contain valid values. * </p> * <p> * Note that this page caches the new file once it has been successfully * created; subsequent invocations of this method will answer the same file * resource without attempting to create it again. * </p> * <p> * This method should be called within a workspace modify operation since it * creates resources. * </p> * * @return the created file resource, or <code>null</code> if the file was * not created */ public IFile createNewFile() { if (newFile != null) { return newFile; } // create the new file and cache it if successful final IPath containerPath = resourceGroup.getContainerFullPath(); IPath newFilePath = containerPath.append(resourceGroup.getResource()); final IFile newFileHandle = createFileHandle(newFilePath); final InputStream initialContents = getInitialContents(); createLinkTarget(); if (linkTargetPath != null) { // Not compatible with 3.5 URI resolvedPath = linkTargetPath;//newFileHandle.getPathVariableManager().resolveURI(linkTargetPath); try { if (resolvedPath.getScheme() != null && resolvedPath.getSchemeSpecificPart() != null) { IFileStore store = EFS.getStore(resolvedPath); if (!store.fetchInfo().exists()) { MessageDialog dlg = new MessageDialog(getContainer().getShell(), LINK_TITLE, null, NLS.bind(LINK_NOTSURE, linkTargetPath), MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int result = dlg.open(); if (result == Window.OK) { store.getParent().mkdir(0, new NullProgressMonitor()); OutputStream stream = store.openOutputStream(0, new NullProgressMonitor()); stream.close(); } if (result == 2) return null; } } } catch (CoreException e) { MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle, NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage, e.getMessage()), SWT.SHEET); return null; } catch (IOException e) { MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle, NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage, e.getMessage()), SWT.SHEET); return null; } } IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { CreateFileOperation op = new CreateFileOperation(newFileHandle, linkTargetPath, initialContents, IDEWorkbenchMessages.WizardNewFileCreationPage_title); try { // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=219901 // directly execute the operation so that the undo state is // not preserved. Making this undoable resulted in too many // accidental file deletions. op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); } catch (final ExecutionException e) { getContainer().getShell().getDisplay().syncExec(new Runnable() { public void run() { if (e.getCause() instanceof CoreException) { ErrorDialog.openError(getContainer().getShell(), // Was // Utilities.getFocusShell() IDEWorkbenchMessages.WizardNewFileCreationPage_errorTitle, null, // no special // message ((CoreException) e.getCause()).getStatus()); } else { IDEWorkbenchPlugin.log(getClass(), "createNewFile()", e.getCause()); //$NON-NLS-1$ MessageDialog.openError(getContainer().getShell(), IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle, NLS.bind( IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage, e.getCause().getMessage())); } } }); } } }; try { getContainer().run(true, true, op); } catch (InterruptedException e) { return null; } catch (InvocationTargetException e) { // Execution Exceptions are handled above but we may still get // unexpected runtime errors. IDEWorkbenchPlugin.log(getClass(), "createNewFile()", e.getTargetException()); //$NON-NLS-1$ MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle, NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage, e.getTargetException().getMessage()), SWT.SHEET); return null; } newFile = newFileHandle; return newFile; }
From source file:com.siteview.ecc.rcp.cnf.ui.SecureLoginDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { Button removeCurrentUser = createButton(parent, IDialogConstants.CLIENT_ID, "&Delete User", false); removeCurrentUser.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { savedDetails.remove(userIdText.getText()); initializeUsers(""); // ISecurePreferences preferences = SecurePreferencesFactory.getDefault(); // ISecurePreferences connections = preferences.node(SAVED); // connections.remove(userIdText.getText()); // preferences.removeNode(); // try { // preferences.flush(); // } catch (IOException e1) { // // TODO Auto-generated catch block // e1.printStackTrace(); // } }// ww w . j a v a2 s . c o m }); createButton(parent, IDialogConstants.OK_ID, "&Login", true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:com.siteview.mde.internal.ui.editor.feature.PortabilityChoicesDialog.java
License:Open Source 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); }