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.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigEditDialog.java
License:Open Source License
private void validateOk() { // check the device name if (mDeviceName == null || mDeviceName.length() == 0) { setError("Device name must not be empty"); return;/* w ww . j av a 2s . co m*/ } // check the config name if (mConfigName == null || mConfigName.length() == 0) { setError("Configuration name must not be empty"); return; } // and check the config itself ConfigurationState state = mConfigSelector.getState(); switch (state) { case INVALID_CONFIG: ResourceQualifier invalidQualifier = mConfigSelector.getInvalidQualifier(); setError(String.format("Invalid Configuration: %1$s has no filter set.", invalidQualifier.getName())); return; case REGION_WITHOUT_LANGUAGE: setError("The Region qualifier requires the Language qualifier."); return; } // no error mStatusImage.setImage(null); resetStatus(); getButton(IDialogConstants.OK_ID).setEnabled(true); // need to relayout, because of the change in size in mErrorImage. mStatusComposite.layout(); }
From source file:com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigManagerDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // we only want an OK button. createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); }
From source file:com.android.ide.eclipse.adt.internal.editors.layout.configuration.LayoutCreatorDialog.java
License:Open Source License
@Override public void createDialogContent(Composite parent) { new Label(parent, SWT.NONE) .setText(String.format("Configuration for the alternate version of %1$s", mFileName)); mSelector = new ConfigurationSelector(parent, SelectorMode.CONFIG_ONLY); mSelector.setConfiguration(mConfig); // because the ConfigSelector is running in CONFIG_ONLY mode, the current config // displayed by it is not mConfig anymore, so get the current config. mSelector.getConfiguration(mConfig); // parent's layout is a GridLayout as specified in the javadoc. GridData gd = new GridData(); gd.widthHint = ConfigurationSelector.WIDTH_HINT; gd.heightHint = ConfigurationSelector.HEIGHT_HINT; mSelector.setLayoutData(gd);/*from ww w. j av a 2 s . com*/ // add a listener to check on the validity of the FolderConfiguration as // they are built. mSelector.setOnChangeListener(new Runnable() { @Override public void run() { ConfigurationState state = mSelector.getState(); switch (state) { case OK: mSelector.getConfiguration(mConfig); resetStatus(); mStatusImage.setImage(null); getButton(IDialogConstants.OK_ID).setEnabled(true); break; case INVALID_CONFIG: ResourceQualifier invalidQualifier = mSelector.getInvalidQualifier(); mStatusLabel.setText(String.format("Invalid Configuration: %1$s has no filter set.", invalidQualifier.getName())); mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$ getButton(IDialogConstants.OK_ID).setEnabled(false); break; case REGION_WITHOUT_LANGUAGE: mStatusLabel.setText("The Region qualifier requires the Language qualifier."); mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$ getButton(IDialogConstants.OK_ID).setEnabled(false); break; } // need to relayout, because of the change in size in mErrorImage. mStatusComposite.layout(); } }); mStatusComposite = new Composite(parent, SWT.NONE); mStatusComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout gl = new GridLayout(2, false); mStatusComposite.setLayout(gl); gl.marginHeight = gl.marginWidth = 0; mStatusImage = new Label(mStatusComposite, SWT.NONE); mStatusLabel = new Label(mStatusComposite, SWT.NONE); mStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); resetStatus(); }
From source file:com.android.ide.eclipse.adt.internal.editors.layout.LayoutCreatorDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite top = new Composite(parent, SWT.NONE); top.setLayoutData(new GridData()); top.setLayout(new GridLayout(1, false)); new Label(top, SWT.NONE) .setText(String.format("Configuration for the alternate version of %1$s", mFileName)); mSelector = new ConfigurationSelector(top); mSelector.setConfiguration(mConfig); // parent's layout is a GridLayout as specified in the javadoc. GridData gd = new GridData(); gd.widthHint = ConfigurationSelector.WIDTH_HINT; gd.heightHint = ConfigurationSelector.HEIGHT_HINT; mSelector.setLayoutData(gd);/*from w w w. j av a 2 s . co m*/ // add a listener to check on the validity of the FolderConfiguration as // they are built. mSelector.setOnChangeListener(new Runnable() { public void run() { ConfigurationState state = mSelector.getState(); switch (state) { case OK: mSelector.getConfiguration(mConfig); resetStatus(); mStatusImage.setImage(null); getButton(IDialogConstants.OK_ID).setEnabled(true); break; case INVALID_CONFIG: ResourceQualifier invalidQualifier = mSelector.getInvalidQualifier(); mStatusLabel.setText(String.format("Invalid Configuration: %1$s has no filter set.", invalidQualifier.getName())); mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$ getButton(IDialogConstants.OK_ID).setEnabled(false); break; case REGION_WITHOUT_LANGUAGE: mStatusLabel.setText("The Region qualifier requires the Language qualifier."); mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$ getButton(IDialogConstants.OK_ID).setEnabled(false); break; } // need to relayout, because of the change in size in mErrorImage. mStatusComposite.layout(); } }); mStatusComposite = new Composite(top, SWT.NONE); mStatusComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout gl = new GridLayout(2, false); mStatusComposite.setLayout(gl); gl.marginHeight = gl.marginWidth = 0; mStatusImage = new Label(mStatusComposite, SWT.NONE); mStatusLabel = new Label(mStatusComposite, SWT.NONE); mStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); resetStatus(); return top; }
From source file:com.android.ide.eclipse.adt.internal.launch.DeviceChooserDialog.java
License:Open Source License
/** * Create the button bar: We override the Dialog implementation of this method * so that we can create the checkbox at the same level as the 'Cancel' and 'OK' buttons. *//*from w w w . j av a2 s . co m*/ @Override protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mUseDeviceForFutureLaunchesCheckbox = new Button(composite, SWT.CHECK); mUseDeviceForFutureLaunchesCheckbox.setSelection(mUseDeviceForFutureLaunches); mResponse.setUseDeviceForFutureLaunches(mUseDeviceForFutureLaunches); mUseDeviceForFutureLaunchesCheckbox.setText("Use same device for future launches"); mUseDeviceForFutureLaunchesCheckbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mUseDeviceForFutureLaunches = mUseDeviceForFutureLaunchesCheckbox.getSelection(); mResponse.setUseDeviceForFutureLaunches(mUseDeviceForFutureLaunches); } }); mUseDeviceForFutureLaunchesCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(composite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); return composite; }
From source file:com.android.ide.eclipse.adt.internal.launch.DeviceChooserDialog.java
License:Open Source License
/** * Enables or disables the OK button of the dialog based on various selections in the dialog. *//*www . ja va 2 s .c o m*/ private void enableOkButton() { Button okButton = getButton(IDialogConstants.OK_ID); if (isDeviceMode()) { okButton.setEnabled(mResponse.getDeviceToUse() != null && mResponse.getDeviceToUse().isOnline()); } else { okButton.setEnabled(mResponse.getAvdToLaunch() != null); } }
From source file:com.android.ide.eclipse.adt.internal.launch.DeviceChooserDialog.java
License:Open Source License
/** * Returns true if the ok button is enabled. */// w w w . ja va2 s . c o m private boolean isOkButtonEnabled() { Button okButton = getButton(IDialogConstants.OK_ID); return okButton.isEnabled(); }
From source file:com.android.ide.eclipse.adt.internal.ui.ReferenceChooserDialog.java
License:Open Source License
protected void handleDoubleClick() { if (validateCurrentSelection()) { buttonPressed(IDialogConstants.OK_ID); } }
From source file:com.android.ide.eclipse.adt.internal.ui.ResourceChooser.java
License:Open Source License
private String createNewString() { ExtractStringRefactoring ref = new ExtractStringRefactoring(mProject, true /*enforceNew*/); RefactoringWizard wizard = new ExtractStringWizard(ref, mProject); RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard); try {// w ww. ja v a 2 s . c o m IWorkbench w = PlatformUI.getWorkbench(); if (op.run(w.getDisplay().getActiveShell(), wizard.getDefaultPageTitle()) == IDialogConstants.OK_ID) { return ref.getXmlStringId(); } } catch (InterruptedException ex) { // Interrupted. Pass. } return null; }
From source file:com.android.ide.eclipse.adt.internal.wizards.newxmlfile.AddTranslationDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { mOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, // Don't make the OK button default as in most dialogs, since when you press // Return thinking you might edit a value it dismisses the dialog instead false);/*from w ww. j ava 2 s .c o m*/ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); mOkButton.setEnabled(false); validatePage(); }