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.tocea.scertify.eclipse.scertifycode.ui.stats.views.internal.ScertifyMarkerFilterDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) *///from w w w . jav a 2 s .c o m protected void createButtonsForButtonBar(Composite parent) { this.mBtnDefault = this.createButton(parent, IDialogConstants.BACK_ID, Messages.ScertifyMarkerFilterDialog_btnRestoreDefault, false); this.mBtnDefault.addSelectionListener(this.mController); // create OK and Cancel buttons by default this.createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); this.createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:com.toubassi.jface.ObjectChooserDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, okLabel, false); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); }
From source file:com.twinsoft.convertigo.eclipse.dialogs.MultipleDeletionDialog.java
License:Open Source License
public MultipleDeletionDialog(Shell shell, String title, boolean hasMultiple) { this.title = title; this.shell = shell; this.hasMultiple = hasMultiple; if (hasMultiple) { buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; } else {//from w w w. j av a 2 s. co m buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; } }
From source file:com.twinsoft.convertigo.eclipse.popup.actions.CicsTransactionImportCopybookAction.java
License:Open Source License
public void run() { Display display = Display.getDefault(); Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT); Shell shell = getParentShell();//from w w w. j a va 2 s . c o m shell.setCursor(waitCursor); try { boolean bInputMap = true; CustomDialog customDialog = new CustomDialog(shell, "Import a copybook", "Do you want to import the copybook into the transaction input map or output map?", 500, 150, new ButtonSpec("Input map", true), new ButtonSpec("Outut map", false), new ButtonSpec(IDialogConstants.CANCEL_LABEL, false)); int index = customDialog.open(); switch (index) { case 0: bInputMap = true; break; case 1: bInputMap = false; break; case 2: return; } String filePath = null; FileDialog fileDialog = new FileDialog(shell); fileDialog.setText("Import a copybook"); fileDialog.setFilterPath(Engine.PROJECTS_PATH); filePath = fileDialog.open(); if (filePath != null) { ConvertigoPlugin.logDebug("Import copybook from file \"" + filePath + "\""); ProjectExplorerView explorerView = getProjectExplorerView(); if (explorerView != null) { TreeObject treeObject = explorerView.getFirstSelectedTreeObject(); Object databaseObject = treeObject.getObject(); if ((databaseObject != null) && (databaseObject instanceof CicsTransaction)) { CicsTransaction transaction = (CicsTransaction) databaseObject; FileReader reader = null; try { reader = new FileReader(filePath); transaction.importCopyBook(bInputMap, reader); } finally { if (reader != null) { reader.close(); } } explorerView.updateFirstSelectedTreeObject(); StructuredSelection structuredSelection = new StructuredSelection(treeObject); ConvertigoPlugin.getDefault().getPropertiesView().selectionChanged(explorerView, structuredSelection); } } } } catch (Throwable e) { ConvertigoPlugin.logException(e, "Unable to import the copybook!"); } finally { shell.setCursor(null); waitCursor.dispose(); } }
From source file:com.twinsoft.convertigo.eclipse.popup.actions.ClipboardAction.java
License:Open Source License
public void paste(String source, Shell shell, ProjectExplorerView explorerView, TreeObject selectedTreeObject, boolean isDND) throws ConvertigoException, IOException, ParserConfigurationException, SAXException, CoreException { if ((explorerView != null) && (selectedTreeObject != null)) { TreeObject targetTreeObject = null; Object targetObject = null; if (selectedTreeObject instanceof FolderTreeObject) { if (selectedTreeObject.getParent() instanceof IDesignTreeObject) { selectedTreeObject = selectedTreeObject.getParent(); }//from w ww . j ava2 s .c o m } if (selectedTreeObject instanceof IPropertyTreeObject) { targetTreeObject = selectedTreeObject; targetObject = selectedTreeObject; } else if (selectedTreeObject instanceof IDesignTreeObject) { targetTreeObject = selectedTreeObject; targetObject = selectedTreeObject; if (clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_DOCUMENT) { targetTreeObject = ((IDesignTreeObject) selectedTreeObject).getTreeObjectOwner(); targetObject = (DatabaseObject) targetTreeObject.getObject(); } } else { targetTreeObject = explorerView.getFirstSelectedDatabaseObjectTreeObject(selectedTreeObject); // case of folder, retrieve owner object targetObject = (DatabaseObject) targetTreeObject.getObject(); // This is for enabling copy/paste inside the same data directory, // i.e. without having to select the parent database object. if (clipboardManager.objectsType == ProjectExplorerView .getTreeObjectType(new TreePath(targetTreeObject))) { // Exception: if the copied object is a screen class, // it must be different from the currently selected object. if (clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_SCREEN_CLASS) { CustomDialog customDialog = new CustomDialog(shell, "Paste a Screenclass", "Do you want to paste the Screenclass as a sibling or as an inherited ScreenClass?", 500, 150, new ButtonSpec("As a sibling", true), new ButtonSpec("As an iherited", false), new ButtonSpec(IDialogConstants.CANCEL_LABEL, false)); int response = customDialog.open(); if (response == 0) targetObject = ((DatabaseObject) targetObject).getParent(); else if (response == 2) return; } else if (clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_STATEMENT_WITH_EXPRESSIONS) { if (clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_FUNCTION) { targetObject = ((DatabaseObject) targetObject).getParent(); } else { CustomDialog customDialog = new CustomDialog(shell, "Paste a statement", "Do you want to paste the statement as a sibling or a child statement?", 500, 150, new ButtonSpec("As a sibling", true), new ButtonSpec("As a child", false), new ButtonSpec(IDialogConstants.CANCEL_LABEL, false)); int response = customDialog.open(); if (response == 0) { targetObject = ((DatabaseObject) targetObject).getParent(); } else if (response == 2) { return; } } } else if (clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_STEP_WITH_EXPRESSIONS || clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_STEP) { targetObject = pasteStep(shell, source, (DatabaseObject) targetObject); if (targetObject == null) return; } else if (isDND && clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_SEQUENCE) { // Do not change target to parent } else { targetObject = ((DatabaseObject) targetObject).getParent(); } targetTreeObject = explorerView.findTreeObjectByUserObject(((DatabaseObject) targetObject)); } else { if (clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_STEP_WITH_EXPRESSIONS || clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_STEP) { targetObject = pasteStep(shell, source, (DatabaseObject) targetObject); if (targetObject == null) return; } } } if (clipboardManager.isCut) { TreeParent targetTreeParent = null; String targetPath = targetTreeObject.getPath(); if (targetTreeObject instanceof DatabaseObjectTreeObject) { targetTreeParent = ((DatabaseObjectTreeObject) targetTreeObject) .getOwnerDatabaseObjectTreeObject(); } else if (targetTreeObject instanceof IPropertyTreeObject) { targetTreeParent = ((IPropertyTreeObject) targetTreeObject).getTreeObjectOwner(); } else if (targetTreeObject instanceof IDesignTreeObject) { targetTreeParent = ((IDesignTreeObject) targetTreeObject).getTreeObjectOwner(); } for (int i = 0; i < clipboardManager.objects.length; i++) { // Cut & paste clipboardManager.cutAndPaste(clipboardManager.objects[i], targetTreeObject); // Updating the tree // Report 4.5: fix #401 //explorerView.reloadTreeObject(clipboardManager.parentTreeNodeOfCutObjects[i]); TreeObject parentTreeNodeOfCutObjects = clipboardManager.parentTreeNodeOfCutObjects[i]; parentTreeNodeOfCutObjects.getProjectTreeObject().hasBeenModified(true); if (!(parentTreeNodeOfCutObjects instanceof IDesignTreeObject)) { explorerView.reloadTreeObject(parentTreeNodeOfCutObjects); } } if (targetTreeObject != null) { if (targetTreeObject.getParent() == null) targetTreeObject = explorerView.findTreeObjectByPath(targetTreeParent, targetPath); if (targetTreeObject != null) targetTreeObject.getProjectTreeObject().hasBeenModified(true);// Report 4.5: fix #401 } clipboardManager.reset(); } else if (clipboardManager.isCopy) { if (source != null) { // Paste clipboardManager.paste(source, targetObject, true); // Case of project copy if (clipboardManager.objectsType == ProjectExplorerView.TREE_OBJECT_TYPE_DBO_PROJECT) { Object[] pastedObjects = clipboardManager.pastedObjects; for (int i = 0; i < pastedObjects.length; i++) { Object object = pastedObjects[i]; if ((object != null) && (object instanceof Project)) { Project project = (Project) object; String oldName = project.getName(); try { Project importedProject = importProjectTempArchive(oldName, explorerView); if (importedProject != null) { String newName = importedProject.getName(); explorerView.importProjectTreeObject(newName, true, oldName); } else throw new EngineException("Unable to import project temporary archive"); } catch (Exception e) { throw new EngineException("Unable to paste project", e); } } } } } } // Updating the tree if (targetTreeObject != null) { TreeObject treeObjectToReload = targetTreeObject; TreeObject treeObjectToSelect = targetTreeObject; if (targetTreeObject instanceof IPropertyTreeObject) { treeObjectToSelect = ((IPropertyTreeObject) targetTreeObject).getTreeObjectOwner(); treeObjectToReload = treeObjectToSelect; if (treeObjectToReload instanceof DatabaseObjectTreeObject) { treeObjectToReload = treeObjectToReload.getParent(); if (treeObjectToReload instanceof FolderTreeObject) treeObjectToReload = treeObjectToReload.getParent(); } } if (targetTreeObject instanceof IDesignTreeObject) { treeObjectToSelect = ((IDesignTreeObject) targetTreeObject).getTreeObjectOwner(); treeObjectToReload = treeObjectToSelect; if (treeObjectToReload instanceof DatabaseObjectTreeObject) { treeObjectToReload = treeObjectToReload.getParent(); if (treeObjectToReload instanceof FolderTreeObject) treeObjectToReload = treeObjectToReload.getParent(); } } if (treeObjectToReload != null) { //explorerView.reloadTreeObject(targetTreeObject); //explorerView.setSelectedTreeObject(targetTreeObject); explorerView.objectChanged( new CompositeEvent(treeObjectToReload.getObject(), treeObjectToSelect.getPath())); } } } }
From source file:com.twinsoft.convertigo.eclipse.popup.actions.ClipboardAction.java
License:Open Source License
private Object pasteStep(Shell shell, String source, DatabaseObject targetObject) throws ParserConfigurationException, SAXException, IOException { // Can only paste on Sequence or Step if (targetObject instanceof Sequence) return targetObject; else if (!(targetObject instanceof Step)) return null; // cannot paste to IThenElseContainer if (targetObject instanceof IThenElseContainer) return null; else {//w w w . j a v a 2 s. c o m List<Object> objects = clipboardManager.read(source); int size = objects.size(); for (Object ob : objects) { // Can only paste step objects if (!(ob instanceof Step)) return null; // Can paste only on step which may contain children if ((ob instanceof StepWithExpressions) && (!(targetObject instanceof StepWithExpressions))) return null; // cannot paste a ThenStep if (ob instanceof ThenStep) return null; // cannot paste a ElseStep if (ob instanceof ElseStep) return null; // cannot paste a ThenStatement if (ob instanceof ThenStatement) return null; // cannot paste a ElseStatement if (ob instanceof ElseStatement) return null; // Special case of XMLElementStep, ElementStep if ((targetObject instanceof XMLElementStep) || (targetObject instanceof ElementStep)) { // Case paste on itself -> target is changed to parent if ((size == 1) && ((ob instanceof XMLElementStep) || (ob instanceof ElementStep))) { if (((Step) ob).getName().equals(targetObject.getName())) { return targetObject.getParent(); } return null; } // Else, only accept paste of XMLAttributeStep else if (!(ob instanceof XMLAttributeStep)) { return null; } } // Case of step which may contain children else if (targetObject instanceof StepWithExpressions) { // Case paste on itself -> ask user what to do if ((size == 1) && (ob.getClass().equals(targetObject.getClass()))) { if (((Step) ob).getName().equals(targetObject.getName())) { CustomDialog customDialog = new CustomDialog(shell, "Paste a step", "Do you want to paste the step as a sibling or a child step?", 500, 150, new ButtonSpec("As a sibling", true), new ButtonSpec("As a child", false), new ButtonSpec(IDialogConstants.CANCEL_LABEL, false)); int response = customDialog.open(); if (response == 0) { return targetObject.getParent(); } else if (response == 2) { return null; } else break; } } // Else, paste break; } // Other case else { // Case paste on itself -> target is changed to parent if ((size == 1) && (ob.getClass().equals(targetObject.getClass()))) { if (((Step) ob).getName().equals(targetObject.getName())) { return targetObject.getParent(); } return null; } // Else, not permitted return null; } } } return targetObject; }
From source file:com.vectrace.MercurialEclipse.dialogs.CommitDialog.java
License:Open Source License
private boolean confirmHistoryRewrite() { if (HgFeatures.PHASES.isEnabled()) { // For secret or draft silently allow amend if (Phase.PUBLIC == currentChangeset.getPhase()) { if (!MessageDialog.openConfirm(getShell(), Messages.getString("CommitDialog.amendPublic.title"), Messages.getString("CommitDialog.amendPublic.message"))) { return false; }//w w w . jav a 2 s .c om currentChangeset.setDraft(); } return true; } // Always prompt if phases are not supported MessageDialog dialog = new MessageDialog(getShell(), Messages.getString("CommitDialog.reallyAmendAndRewriteHistory"), //$NON-NLS-1$ null, Messages.getString("CommitDialog.amendWarning1") //$NON-NLS-1$ + Messages.getString("CommitDialog.amendWarning2") //$NON-NLS-1$ + Messages.getString("CommitDialog.amendWarning3"), //$NON-NLS-1$ MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 1 // default index - cancel ); dialog.setBlockOnOpen(true); // if false then may show in background return dialog.open() == 0; // 0 means yes }
From source file:com.vectrace.MercurialEclipse.menu.UpdateJob.java
License:Open Source License
/** * Call from the UI thread.//from w ww. j a va 2s . c o m * @return True if loss was confirmed. */ private static boolean showConfirmDataLoss(Shell shell) { MessageDialog dialog = new MessageDialog(shell, Messages.getString("UpdateJob.uncommittedChanges1"), null, Messages.getString("UpdateJob.uncommittedChanges2"), MessageDialog.CONFIRM, new String[] { Messages.getString("UpdateJob.continueAndDiscard"), IDialogConstants.CANCEL_LABEL }, 1 // default index - cancel ); dialog.setBlockOnOpen(true); return dialog.open() == 0; }
From source file:com.vectrace.MercurialEclipse.wizards.ProjectsImportPage.java
License:Open Source License
/** * The <code>WizardDataTransfer</code> implementation of this * <code>IOverwriteQuery</code> method asks the user whether the existing * resource at the given path should be overwritten. * * @param pathString/*from w w w. j a v a 2s.c o m*/ * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, * <code>"ALL"</code>, or <code>"CANCEL"</code> */ public String queryOverwrite(String pathString) { Path path = new Path(pathString); String messageString; // Break the message up if there is a file name and a directory // and there are at least 2 segments. if (path.getFileExtension() == null || path.segmentCount() < 2) { messageString = "'" + pathString + "' already exists. Would you like to overwrite it?"; } else { messageString = "Overwrite '" + path.lastSegment() + "' in folder '" + path.removeLastSegments(1).toOSString() + "'?"; } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), "Question", null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { @Override protected int getShellStyle() { // TODO add "| SWT.SHEET" flag as soon as we drop Eclipse 3.4 support return super.getShellStyle()/* | SWT.SHEET*/; } }; String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL }; // run in syncExec because callback is from an operation, // which is probably not running in the UI thread. getControl().getDisplay().syncExec(new Runnable() { public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()]; }
From source file:com.vmware.vfabric.ide.eclipse.tcserver.insight.internal.ui.TcServerInsightSection.java
License:Open Source License
@Override public void createSection(Composite parent) { super.createSection(parent); FormToolkit toolkit = getFormToolkit(parent.getDisplay()); Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE | ExpandableComposite.EXPANDED); section.setText("Overview"); section.setDescription("Enable collection of performance metrics for deployed applications."); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); Composite composite = toolkit.createComposite(section); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 8;/* ww w . j av a 2s . c o m*/ layout.marginWidth = 8; composite.setLayout(layout); toolkit.paintBordersFor(composite); section.setClient(composite); button = toolkit.createButton(composite, "Enable gathering of metrics", SWT.CHECK); button.addSelectionListener(new SelectionAdapter() { private boolean ignoreEvents; @Override public void widgetSelected(SelectionEvent e) { if (ignoreEvents) { return; } if (button.getSelection() && server.getOriginal() != null && !TcServerInsightUtil.isInsightCompatible(server.getOriginal())) { MessageDialog dialog = new MessageDialog(getShell(), "Enable Spring Insight", null, "This version of Spring Insight is not compatible with tc Server instances that are installed on a path that contains spaces. Enabling Spring Insight may cause tc Server to fail to startup.\n\n" + "Are you sure you want to enable Spring Insight?", MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 1); if (dialog.open() != 0) { try { ignoreEvents = true; button.setSelection(false); } finally { ignoreEvents = false; } return; } } execute(new ModifyInsightVmArgsCommand(serverInstance, button.getSelection())); } }); GridDataFactory.fillDefaults().span(2, 1).applyTo(button); initialize(); }