List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID
int OK_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.
Click Source Link
From source file:com.aptana.php.debug.ui.pathmapper.PathMapperDialog.java
License:Open Source License
protected Control createContents(Composite parent) { Control c = super.createContents(parent); Button button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(false);//from w w w . jav a2s . c o m } return c; }
From source file:com.aptana.php.debug.ui.pathmapper.PathMapperDialog.java
License:Open Source License
public void propertyChanged(Object source, int propId) { // Make sure that we enable the ok button only when something is really changed in the path mapping. // We sort and compare the old mappings and the new ones before we enable the button. PathMapper currentServerMapping = PathMapperRegistry.getByServer(server); Button button = getButton(IDialogConstants.OK_ID); if (button != null) { if (currentServerMapping != null) { Mapping[] currentMappings = currentServerMapping.getMapping(); Mapping[] newMappings = pathMapperCompositeFragment.getMappings(); Arrays.sort(currentMappings); Arrays.sort(newMappings); if (!Arrays.equals(currentMappings, newMappings)) { button.setEnabled(true); return; }/*www . jav a 2s .com*/ } button.setEnabled(false); } }
From source file:com.aptana.php.debug.ui.phpini.NewPHPIniEntryDialog.java
License:Open Source License
/** * Disables or enables the OK button.//from w w w. ja v a 2 s . co m */ private void setOKButtonEnabled(boolean enabled) { Button button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(enabled); } }
From source file:com.aptana.php.debug.ui.phpini.NewPHPIniSectionDialog.java
License:Open Source License
/** * Validates values.// w ww .ja v a2s .c o m */ private void validate() { String nameText = nameEdit.getText(); if (nameText.length() == 0) { disableOKButton(); setErrorMessage(Messages.NewPHPIniSectionDialog_sectionNameMissingError); return; } String trimmedName = nameText.trim(); if (forbiddenNames != null) { for (String forbiddenName : forbiddenNames) { if (forbiddenName.equalsIgnoreCase(trimmedName)) { disableOKButton(); setErrorMessage(Messages.NewPHPIniSectionDialog_sectionDuplicateError); return; } } } setErrorMessage(null); Button button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(true); } }
From source file:com.aptana.portal.ui.dispatch.configurationProcessors.installer.InstallerOptionsDialog.java
License:Open Source License
@Override public void setErrorMessage(String newErrorMessage) { super.setErrorMessage(newErrorMessage); Button button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(newErrorMessage == null); }// w ww .j a v a 2 s. c o m }
From source file:com.aptana.portal.ui.dispatch.configurationProcessors.installer.JavaScriptImporterOptionsDialog.java
License:Open Source License
/** * Create the area for user entry./*w w w . j ava 2 s . c om*/ * * @param composite * @param defaultEnabled */ private void createUserPathArea(Composite composite, boolean defaultEnabled) { locationLb = new Label(composite, SWT.NONE); locationLb.setText(Messages.ImportJavaScriptLibraryDialog_locationLabel); path = new Text(composite, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 250; path.setLayoutData(data); // browse button browseBt = new Button(composite, SWT.PUSH); browseBt.setText(StringUtil.ellipsify(CoreStrings.BROWSE)); browseBt.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setBlockOnOpen(true); dialog.setAllowMultiple(false); dialog.setHelpAvailable(false); dialog.setTitle(Messages.ImportJavaScriptLibraryDialog_folderSelectionDialogTitle); dialog.setMessage(Messages.ImportJavaScriptLibraryDialog_folderSelectionDialogMessage); final IProject project = (IProject) attributes.get(ACTIVE_PROJECT_ATTR); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); // Filter out files and other projects dialog.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (parentElement instanceof IResource) { if (element instanceof IProject) { return element.equals(project); } IProject parentProject = ((IResource) parentElement).getProject(); if (!parentProject.equals(project)) { return false; } if (element instanceof IResource) { IResource resource = (IResource) element; if (resource.isHidden()) { return false; } if (resource.getLocation().toFile().isDirectory()) { return true; } } } return false; } }); int buttonId = dialog.open(); if (buttonId == IDialogConstants.OK_ID) { IResource resource = (IResource) dialog.getFirstResult(); path.setText(TextProcessor .process(project.getName() + '/' + resource.getProjectRelativePath().toString())); } } }); path.setText(TextProcessor.process(getDefaultPath())); // Validate any user-input changes path.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validatePath(); } }); }
From source file:com.aptana.radrails.cloud.internal.EndpointDialog.java
License:Open Source License
/** * Create contents of the button bar//from w w w. j a v a2 s . c om * * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); getButton(IDialogConstants.OK_ID).setText(Messages.EndpointDialog_LBL_Deploy_button); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:com.aptana.rcp.IDEWorkbenchWindowAdvisor.java
License:Open Source License
/** * Asks the user whether the workbench should really be closed. Only asks if the preference is enabled. * /* w w w . ja va 2s. c o m*/ * @param parentShell * the parent shell to use for the confirmation dialog * @return <code>true</code> if OK to exit, <code>false</code> if the user canceled * @since 3.6 */ static boolean promptOnExit(Shell parentShell) { IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); boolean promptOnExit = store.getBoolean(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW); if (promptOnExit) { if (parentShell == null) { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbenchWindow != null) { parentShell = workbenchWindow.getShell(); } } if (parentShell != null) { parentShell.setMinimized(false); parentShell.forceActive(); } String message; String productName = null; IProduct product = Platform.getProduct(); if (product != null) { productName = product.getName(); } if (productName == null) { message = IDEWorkbenchMessages.PromptOnExitDialog_message0; } else { message = NLS.bind(IDEWorkbenchMessages.PromptOnExitDialog_message1, productName); } MessageDialogWithToggle dlg = MessageDialogWithToggle.openOkCancelConfirm(parentShell, IDEWorkbenchMessages.PromptOnExitDialog_shellTitle, message, IDEWorkbenchMessages.PromptOnExitDialog_choice, false, null, null); if (dlg.getReturnCode() != IDialogConstants.OK_ID) { return false; } if (dlg.getToggleState()) { store.setValue(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, false); } } return true; }
From source file:com.aptana.ui.dialogs.DiagnosticDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // creates the Copy to Clipboard and Close buttons createButton(parent, COPY_ID, Messages.DiagnosticDialog_copy_clipboard_label, false); createButton(parent, IDialogConstants.OK_ID, Messages.DiagnosticDialog_close_label, true); }
From source file:com.aptana.ui.dialogs.InputURLDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default okButton = 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 loadList();//w w w .jav a 2 s . c o m combo.setFocus(); if (value != null) { combo.setText(value); setErrorMessage(null); if (validator.isValid(value) != null) { Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(false); } } } }