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:hydrograph.ui.propertywindow.widgets.customwidgets.lookupproperty.ELTLookupConfigGrid.java
License:Apache License
/** * Create contents of the button bar./* w ww . jav a2s . c o m*/ * * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.OperationClassDialog.java
License:Apache License
/** * Create contents of the button bar.// www. j av a2 s . co m * * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); createApplyButton(parent); operationClassDialogButtonBar.setPropertyDialogButtonBar(okButton, applyButton, cancelButton); alphanumericDecorator.hide(); parameterDecorator.hide(); isParameterCheckBox.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { if (isParameterCheckBox.getSelection()) { hasTextBoxAlphanumericCharactorsOnly(fileName.getText()); if (StringUtils.isNotBlank(fileName.getText()) && !fileName.getText().startsWith("@{") && !fileName.getText().endsWith("}")) { fileName.setText("@{" + fileName.getText() + "}"); fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); } } else { if (StringUtils.isNotBlank(fileName.getText()) && fileName.getText().startsWith("@{")) { fileName.setText(fileName.getText().substring(2, fileName.getText().length() - 1)); fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); } okButton.setEnabled(true); applyButton.setEnabled(true); alphanumericDecorator.hide(); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); fileName.addVerifyListener(new VerifyListener() { @Override public void verifyText(VerifyEvent e) { String currentText = ((Text) e.widget).getText(); String textBoxValue = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end)) .trim(); if (isParameterCheckBox.getSelection()) { if (StringUtils.isNotBlank(textBoxValue) && (!textBoxValue.startsWith("@{") || !textBoxValue.endsWith("}"))) { ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); parameterDecorator.show(); emptyDecorator.hide(); okButton.setEnabled(false); applyButton.setEnabled(false); } else { ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204)); emptyDecorator.show(); parameterDecorator.hide(); okButton.setEnabled(true); hasTextBoxAlphanumericCharactorsOnly(textBoxValue); } } else { if (StringUtils.isNotBlank(textBoxValue)) { ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); applyButton.setEnabled(true); isParameterCheckBox.setEnabled(true); emptyDecorator.hide(); } else { ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204)); isParameterCheckBox.setEnabled(false); emptyDecorator.show(); } } } }); }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.TransformDialog.java
License:Apache License
/** * Create contents of the button bar.//ww w.j a v a 2 s . com * * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); propertyDialogButtonBar.setPropertyDialogButtonBar(okButton, null, cancelButton); }
From source file:hydrograph.ui.propertywindow.widgets.dialog.hiveInput.HivePartitionKeyValueDialog.java
License:Apache License
/** * Create contents of the button bar./*from ww w. ja v a2s . com*/ * * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { parent.setLayout(new GridLayout(1, false)); parent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); addErrorLabel(composite); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:hydrograph.ui.propertywindow.widgets.dialogs.ELTOperationClassDialog.java
License:Apache License
/** * Create contents of the button bar./*from ww w .j a v a 2 s . c o m*/ * * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); createApplyButton(parent); operationClassDialogButtonBar.setPropertyDialogButtonBar(okButton, applyButton, cancelButton); alphanumericDecorator.hide(); parameterDecorator.hide(); isParameterCheckBox.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { if (isParameterCheckBox.getSelection()) { hasTextBoxAlphanumericCharactorsOnly(fileName.getText()); if (StringUtils.isNotBlank(fileName.getText()) && !fileName.getText().startsWith("@{") && !fileName.getText().endsWith("}")) { fileName.setText("@{" + fileName.getText() + "}"); fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); } } else { if (StringUtils.isNotBlank(fileName.getText()) && fileName.getText().startsWith("@{")) { fileName.setText(fileName.getText().substring(2, fileName.getText().length() - 1)); fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); } okButton.setEnabled(true); applyButton.setEnabled(true); alphanumericDecorator.hide(); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); fileName.addVerifyListener(new VerifyListener() { @Override public void verifyText(VerifyEvent e) { String currentText = ((Text) e.widget).getText(); String textBoxValue = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end)) .trim(); if (isParameterCheckBox.getSelection()) { classNotPresentDecorator.hide(); if (StringUtils.isNotBlank(textBoxValue) && (!textBoxValue.startsWith("@{") || !textBoxValue.endsWith("}"))) { ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); parameterDecorator.show(); emptyDecorator.hide(); okButton.setEnabled(false); applyButton.setEnabled(false); } else { ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204)); emptyDecorator.show(); parameterDecorator.hide(); okButton.setEnabled(true); hasTextBoxAlphanumericCharactorsOnly(textBoxValue); } } else { if (StringUtils.isBlank(textBoxValue)) { ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204)); isParameterCheckBox.setEnabled(false); classNotPresentDecorator.hide(); emptyDecorator.show(); } else { emptyDecorator.hide(); if (!(ValidatorUtility.INSTANCE.isClassFilePresentOnBuildPath(textBoxValue))) { classNotPresentDecorator.show(); } else { classNotPresentDecorator.hide(); } ((Text) e.widget) .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255)); applyButton.setEnabled(true); isParameterCheckBox.setEnabled(true); } } } }); }
From source file:icecaptools.launching.arduino.PasswordDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { // create OK and Cancel buttons by default this.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//from w w w . j a v a 2s . co m this.text.setFocus(); if (this.value != null) { this.text.setText(this.value); this.text.selectAll(); } }
From source file:it.eng.spagobi.studio.console.dialogs.LiveLinesSettingsDialog.java
License:Open Source License
/** * Create contents of the button bar./*w w w . j a v a 2 s .c o m*/ * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { Button buttonOK = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:it.uniba.di.cdg.xcore.ui.dialogs.CompletableInputDialog.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/*ww w. ja v a 2 s . c o m*/ text.setFocus(); if (value != null) { text.setText(value); text.select(0); } }
From source file:msi.gama.application.workspace.PickWorkspaceDialog.java
@Override protected void createButtonsForButtonBar(final Composite parent) { /* Clone workspace needs a lot of checks */ final Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone existing workspace", false); clone.addListener(SWT.Selection, arg0 -> cloneCurrentWorkspace()); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:msi.gama.gui.swt.dialogs.PickWorkspaceDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { /* Clone workspace needs a lot of checks */ Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone current workspace", false); clone.addListener(SWT.Selection, new Listener() { @Override//w w w . j a v a2s.c om public void handleEvent(final Event arg0) { cloneCurrentWorkspace(); // try { // String txt = workspacePathCombo.getText(); // File workspaceDirectory = new File(txt); // if ( !workspaceDirectory.exists() ) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "The path entered does not exist. Please enter a valid path."); // return; // } // // if ( !workspaceDirectory.canRead() ) { // MessageDialog // .openError(Display.getDefault().getActiveShell(), "Error", // "The currently entered workspace path is not readable. Please check file system permissions."); // return; // } // // // check for workspace file (empty indicator that it's a workspace) // File wsFile = new File(txt + File.separator + WS_IDENTIFIER); // if ( !wsFile.exists() ) { // boolean b = // MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Confirm cloning", // "A new workspace will be created at location " + txt + // " and the current workspace contents will be copied to it. Confirm ?"); // if ( !b ) { return; } // if ( !checkAndCreateWorkspaceRoot(txt) ) { return; } // } else { // boolean b = // MessageDialog // .openConfirm( // Display.getDefault().getActiveShell(), // "Existing workspace", // "The path entered is a path to an existing workspace. All its contents will be erased and replaced by the current workspace contents. Proceed anyway ?"); // if ( !b ) { return; } // } // // DirectoryDialog dd = new DirectoryDialog(Display.getDefault().getActiveShell()); // dd.setFilterPath(txt); // String directory = dd.open(); // if ( directory == null ) { return; } // // File targetDirectory = new File(directory); // if ( targetDirectory.getAbsolutePath().equals(workspaceDirectory.getAbsolutePath()) ) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "Source and target workspaces are the same"); // return; // } // // // recursive check, if new directory is a subdirectory of // // our workspace, that's a big no-no or we'll // // create directories forever // if ( isTargetSubdirOfDir(workspaceDirectory, targetDirectory) ) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "The path entered is a subdirectory of the current workspace"); // return; // } // // try { // copyFiles(workspaceDirectory, targetDirectory); // } catch (Exception err) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "There was an error cloning the workspace: " + err.getMessage()); // return; // } // // boolean setActive = // MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Workspace Cloned", // "Would you like to set the newly cloned workspace to be the active one?"); // if ( setActive ) { // workspacePathCombo.setText(directory); // } // } catch (Exception err) { // MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", // "There was an internal error, please check the logs"); // err.printStackTrace(); // } } }); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }