public static void checkXugglerInstallation(FieldEditorPreferencePage page) { if (!XugglerEncoder.isInstalled()) { page.setErrorMessage(XUGGLER_NOT_INSTALLED_MESSAGE); } else { page.setErrorMessage(null); } }
@Override protected void checkState() { super.checkState(); if (!isValid()) { return; } }
@Override public void dispose() { super.dispose(); if (listener != null) { EditorUtil.getPreferences().removePropertyChangeListener(listener); } }
/** * Applies changes (if any) * * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ public boolean performOk() { // IMPORTANT: we must call the perform before restoring the modules because this // info is going to be used when restoring them. super.performOk(); // we need to update the tree so that the environment variables stay correct. pathEditor.updateTree(); IInterpreterManager interpreterManager = getInterpreterManager(); String newStringToPersist = AbstractInterpreterManager.getStringToPersist(pathEditor.getExesList()); String oldStringToPersist = AbstractInterpreterManager.getStringToPersist(interpreterManager.getInterpreterInfos()); boolean changed; if (!newStringToPersist.equals(oldStringToPersist)) { changed = true; } else { changed = false; } if (changed || inApply) { // If the user just presses 'apply' and nothing changed, he'll be asked to restore information // on one of // the current interpreters. restoreInterpreterInfos(changed); } return true; }
@Override protected void performDefaults() { super.performDefaults(); // We don't get property changed events when the default values are // restored... lastCustomValue = getPreferenceStore().getDefaultString(UIPreferences.DATE_FORMAT); updateFields(getPreferenceStore().getDefaultString(UIPreferences.DATE_FORMAT_CHOICE)); }
@Override public void propertyChange(PropertyChangeEvent event) { super.propertyChange(event); if (event.getSource().equals(checkbox)) { boolean useDefault = ((Boolean) event.getNewValue()).booleanValue(); editor.setEnabled(!useDefault, getFieldEditorParent()); } }
@Override protected void performDefaults() { super.performDefaults(); updateFieldEnablement( getPreferenceStore().getBoolean(EMFCompareUIPreferences.DISABLE_RESOLVERS_PREFERENCE)); updateScopeDescription( getPreferenceStore().getString(EMFCompareUIPreferences.RESOLUTION_SCOPE_PREFERENCE)); }
@Override public void createControl(Composite parent) { super.createControl(parent); if (autoConfigureOnCreate) { // HACK warning: when editor is created, automatically do the auto-configure... this.pathEditor.autoConfigPressed(); } }
/** * Applies changes (if any) * * @see org.eclipse.jface.preference.PreferencePage#performApply() */ protected void performApply() { this.inApply = true; try { super.performApply(); // calls performOk() } finally { this.inApply = false; } }
/* * (non-Javadoc) * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performDefaults() */ @Override protected void performDefaults() { super.performDefaults(); if (scriptTxt != null && !scriptTxt.isDisposed()) { isDefaultPresentedForScriptTxt = true; scriptTxt.setText(getPreferenceStore().getDefaultString(getPreferenceKey())); } }
@Override public void propertyChange(final PropertyChangeEvent event) { super.propertyChange(event); final Object source = event.getSource(); if (source == this.projectComboList) { this.workingJavaProject = (String) event.getNewValue(); } }
@Override public void propertyChange(PropertyChangeEvent event) { if (event.getSource() == disableResolvers) { updateFieldEnablement(disableResolvers.getBooleanValue()); } else if (event.getSource() == resolutionScope) { updateScopeDescription((String) event.getNewValue()); } super.propertyChange(event); }
/** {@inheritDoc} */ @Override public void propertyChange(PropertyChangeEvent event) { super.propertyChange(event); isDirty = true; setAutoDownloadEnabled(fieldEnableAutoDownload.getBooleanValue()); // We need to do this check, when some property change, to refresh the valid state fieldDownloadPath.isValid(); }
@Override public void createControl(Composite parent) { super.createControl(parent); PlatformUI.getWorkbench() .getHelpSystem() .setHelp( getControl(), TraditionalRenderingPlugin.getUniqueIdentifier() + ".TraditionalRenderingPreferencePage_context"); //$NON-NLS-1$ }
/** * @see * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { boolean newValue = ((Boolean) event.getNewValue()).booleanValue(); // If the new value is true then we must check all field editors. // If it is false, then the page is invalid in any case. if (newValue) { // if (fClientComPortEditor != null && event.getSource() != fClientComPortEditor) { // // fClientComPortEditor.refreshValidState(); // } checkState(); } else { super.propertyChange(event); } } else { super.propertyChange(event); } }
@Override public void propertyChange(PropertyChangeEvent event) { super.propertyChange(event); if (event.getProperty().equals(FieldEditor.VALUE)) { checkState(); } if (event.getSource() == localTemplateEditor) { Activator.getDefault() .getIReportTemplateDirectoryService() .setDirectory((String) event.getNewValue()); } }
@Override protected void performDefaults() { IEclipsePreferences prefs = LiferayDebugCore.getPrefs(); prefs.remove(LiferayDebugCore.PREF_FM_DEBUG_PASSWORD); prefs.remove(LiferayDebugCore.PREF_FM_DEBUG_PORT); try { prefs.flush(); } catch (BackingStoreException e) { LiferayDebugUI.logError(e); } super.performDefaults(); }
@Override protected void checkState() { super.checkState(); File gradleHome = new File(gradleHomeField.getStringValue()); // should I perform validations here? if (!GradlePluginUtils.isFileValidGradleInstallation(gradleHome) && shouldUseGradleHome) { setValid(false); setErrorMessage(gradleHomeField.getErrorMessage()); return; } setErrorMessage(null); setValid(true); }
@Override public void propertyChange(PropertyChangeEvent event) { super.propertyChange(event); if (event.getSource() != versionsEditor) { checkState(); return; } shouldUseGradleHome = event.getNewValue().equals(GradlePluginConstants.USE_GRADLE_HOME_VERSION_VALUE); gradleHomeField.setEmptyStringAllowed(!shouldUseGradleHome); checkState(); }
public static void checkXugglerInstallationOnPropertyChange( FieldEditorPreferencePage page, PropertyChangeEvent event) { if (event.getSource() instanceof FieldEditor) { FieldEditor field = (FieldEditor) event.getSource(); if (field.getPreferenceName().equals(PreferenceConstants.ENCODING_CODEC)) { if (event.getNewValue() instanceof String) { String newValue = (String) event.getNewValue(); if (newValue.equals(Codec.XUGGLER.name())) { checkXugglerInstallation(page); } else { page.setErrorMessage(null); } } } } }
/** Adjust the layout of the field editors so that they are properly aligned. */ protected void adjustGridLayout() { if (folder != null) { TabItem[] items = folder.getItems(); for (int j = 0; j < items.length; j++) { GridLayout layout = ((GridLayout) ((Composite) items[j].getControl()).getLayout()); layout.numColumns = 3; layout.marginHeight = 5; layout.marginWidth = 5; } } // need to call super.adjustGridLayout() since fieldEditor.adjustForNumColumns() is protected super.adjustGridLayout(); // reset the main container to a single column ((GridLayout) super.getFieldEditorParent().getLayout()).numColumns = 1; }
protected void init() { prefs = ConfigurationScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus"); IEclipsePreferences defaultpref = DefaultScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus"); default_visibility = prefs.get(BTSCorpusConstants.PREF_LEMMA_DEFAULT_VISIBILITY, null); default_reviewState = prefs.get(BTSCorpusConstants.PREF_LEMMA_DEFAULT_REVIEWSTATE, null); object = BtsCorpusModelFactory.eINSTANCE.createBTSTCObject(); object.setVisibility(default_visibility); object.setRevisionState(default_reviewState); DataBindingContext bindingContext = new DataBindingContext(); // visibility EMFUpdateValueStrategy targetToModel_vis = new EMFUpdateValueStrategy(); targetToModel_vis.setConverter(new BTSConfigItemToStringConverter()); EMFUpdateValueStrategy modelToTarget_vis = new EMFUpdateValueStrategy(); modelToTarget_vis.setConverter(new BTSStringToConfigItemConverter(visibility_viewer)); IObservableValue target_vis_viewer = ViewersObservables.observeSingleSelection(visibility_viewer); Binding binding_vis = bindingContext.bindValue( target_vis_viewer, EMFProperties.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__VISIBILITY) .observe(object), targetToModel_vis, modelToTarget_vis); // review status EMFUpdateValueStrategy targetToModel_rev = new EMFUpdateValueStrategy(); targetToModel_rev.setConverter(new BTSConfigItemToStringConverter()); EMFUpdateValueStrategy modelToTarget_rev = new EMFUpdateValueStrategy(); modelToTarget_rev.setConverter(new BTSStringToConfigItemConverter(reviewState_viewer)); IObservableValue target_rev_viewer = ViewersObservables.observeSingleSelection(reviewState_viewer); Binding binding_rev = bindingContext.bindValue( target_rev_viewer, EMFProperties.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__REVISION_STATE) .observe(object), targetToModel_rev, modelToTarget_rev); super.initialize(); }
@Override protected void initialize() { super.initialize(); // When the chooser's selection changes, update the dateFormat & // enablement formatChooser.setPropertyChangeListener( new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (FieldEditor.VALUE.equals(event.getProperty())) { GitDateFormatter.Format format = fromString((String) event.getOldValue()); if (format == null) { lastCustomValue = dateFormat.getStringValue(); } updateFields((String) event.getNewValue()); } } }); }
@Override public void propertyChange(final PropertyChangeEvent event) { super.propertyChange(event); final Object source = event.getSource(); if (source == this.repositoryName) { final String newValue = (String) event.getNewValue(); this.currentValueOfRepoName = newValue; /*this.repositoryBaseLocation.setStringValue(this.currentValueOfRepoName.toLowerCase() + COLON + FORWARD_SLASH + FORWARD_SLASH + LOCAL_HOST);*/ } // this.currentValueOfRepoLoc = this.repositoryLocation.getStringValue(); -- uncomment this // after enabling browse in Rep Dialog // this.currentValueOfRepoUrl = this.repositoryUrl.getStringValue(); this.currentValueOfUserName = this.userName.getStringValue(); this.currentValueOfPassWord = this.passWord.getStringValue(); if (isEmpty(this.currentValueOfUserName) || isEmpty(this.currentValueOfPassWord)) { this.addButton.setEnabled(false); this.editButton.setEnabled(false); } else { this.addButton.setEnabled(true); this.editButton.setEnabled(true); } if (source == this.enableAutoCheckin) { enableFields((Boolean) event.getNewValue()); /*final IEvaluationService service = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class); service.requestEvaluation("org.fastcode.menus.versioncontrol");*/ } /*if (source == this.repositoryUrl) { final String prj = this.preferenceStore.getString(P_REPOSITORY_PROJECT); if (isEmpty(prj)) { resetProjectName(); if (!resetProjectName()) { //return false; - to check this line } } }*/ }
@Override protected void performDefaults() { super.performDefaults(); bracketMatching.loadDefault(); IPreferenceStore store = EditorsUI.getPreferenceStore(); matchingBrackets.setSelection(store.getDefaultBoolean(SELECTED_BRACKET)); enclosingBrackets.setSelection(store.getDefaultBoolean(ENCLOSING_BRACKETS)); oppositeBracket.setSelection(false); smartCaret.loadDefault(); pasteCorrectIndent.loadDefault(); pasteEscapeQuoted.loadDefault(); pasteImports.loadDefault(); autoFoldImports.loadDefault(); autoFoldComments.loadDefault(); closeAngles.loadDefault(); closeBackticks.loadDefault(); closeBraces.loadDefault(); closeBrackets.loadDefault(); closeParens.loadDefault(); closeQuotes.loadDefault(); enableFolding.store(); }
@Override protected void performApply() { super.performApply(); PROSActions actions; try { actions = Activator.getPROSActions(); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); try { actions.setLocalKernelRepository( Paths.get(store.getString(PreferenceConstants.P_LOCAL_REPOSITORY))); } catch (IOException e) { showErrorDialog( "Error saving settings", "There was an error saving the settings. Try again later.", IStatus.ERROR, e); } try { actions.setUpdateSite(new URL(store.getString(PreferenceConstants.P_UPDATE_SITE))); } catch (MalformedURLException e) { showErrorDialog("Bad URL input", "The provided URL is invalid.", IStatus.ERROR, e); } catch (IOException e) { showErrorDialog( "Error saving settings", "There was an error saving the settings. Try again later.", IStatus.ERROR, e); } kernelListEditor.doLoad(); } catch (IOException e) { showErrorDialog( "PROS Error", "There was an error creating the PROS Updater interface.", IStatus.ERROR, e); } }
@Override public void applyData(Object data) { // copy resources to the new directory super.applyData(data); }
@Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); updateButtons(page.isValid()); }
public void propertyChange(PropertyChangeEvent event) { super.propertyChange(event); }
/** @param event */ @Override public void propertyChange(final PropertyChangeEvent event) { super.propertyChange(event); final Object source = event.getSource(); final Object newValue = event.getNewValue(); this.classSelected = false; this.fileSelected = false; this.pkgSelected = false; this.fldrSelected = false; this.enumSelected = false; final GlobalSettings globalSettings = GlobalSettings.getInstance(); for (int i = 0; i < this.TEMPLATES_LIST.length; i++) { this.prefValueOf1stTemplateItem = getPreferenceStore() .getString( getTemplatePreferenceKey( this.templatePreferenceParts[i].templateName, P_TEMPLATE_FIRST_TEMPLATE_ITEM)); this.prefValueOf2ndTempalteItem = getPreferenceStore() .getString( getTemplatePreferenceKey( this.templatePreferenceParts[i].templateName, P_TEMPLATE_SECOND_TEMPLATE_ITEM)); if (source == this.templatePreferenceParts[i].enableTemplateCheckBox) { final boolean enbale = (Boolean) newValue; enableFields(this.templatePreferenceParts[i], enbale); break; } else if (source == this.templatePreferenceParts[i].allowMultipleVariationCheckBox) { this.templatePreferenceParts[i].templateVariationField.setEmptyStringAllowed( !(Boolean) newValue); if (FALSE_STR.equalsIgnoreCase( globalSettings.getPropertyValue(DEFAULT_TEMPLATE_VARIATION_FIELD, TRUE_STR))) { this.templatePreferenceParts[i].templateVariationFieldNameField.setEmptyStringAllowed( !(Boolean) newValue); } break; } else if (source == this.templatePreferenceParts[i].templateVariationField) { if (FALSE_STR.equalsIgnoreCase( globalSettings.getPropertyValue(DEFAULT_TEMPLATE_VARIATION_FIELD, TRUE_STR))) { this.templatePreferenceParts[i].templateVariationFieldNameField.setEmptyStringAllowed( isEmpty((String) newValue)); } break; } else if (source == this.templatePreferenceParts[i].templateVariationFieldNameField) { final boolean isErr = ((String) newValue).endsWith(" ") || ((String) newValue).endsWith("\t"); setErrorMessage(isErr ? "Variation Field cannot end with whitespace" : null); this.templatePreferenceParts[i].templateVariationField.setEmptyStringAllowed( isEmpty((String) newValue)); break; } else if (source == this.templatePreferenceParts[i].firstTemplateRadioButton) { setErrorMessage(null); this.currentValueOf1stTemplateItem = (String) newValue; enableTemplateItems(this.templatePreferenceParts[i], newValue); validateSecondTemplateItem(this.currentValueOf2ndTemplateItem); break; } else if (source == this.templatePreferenceParts[i].secondTemplateRadioButton) { this.currentValueOf2ndTemplateItem = (String) newValue; if (newValue.equals(SECOND_TEMPLATE.field.getValue()) || newValue.equals(SECOND_TEMPLATE.both.getValue()) || newValue.equals(SECOND_TEMPLATE.custom.getValue())) { this.templatePreferenceParts[i].getterSetterRadioButton.setEnabled( true, getFieldEditorParent()); } else if (newValue.equals(SECOND_TEMPLATE.method.getValue()) || newValue.equals(SECOND_TEMPLATE.none.getValue())) { getPreferenceStore() .setValue( getTemplatePreferenceKey( this.templatePreferenceParts[i].templateName, P_TEMPLATE_GETTER_SETTER), GETTER_SETTER.NONE.getValue()); this.templatePreferenceParts[i].getterSetterRadioButton.setEnabled( false, getFieldEditorParent()); } if (isEmpty(this.currentValueOf1stTemplateItem)) { this.currentValueOf1stTemplateItem = this.prefValueOf1stTemplateItem; } this.classSelected = this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Class.getValue()); this.fileSelected = this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.File.getValue()); this.pkgSelected = this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Package.getValue()); this.fldrSelected = this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Folder.getValue()); this.enumSelected = this.currentValueOf1stTemplateItem.equals(FIRST_TEMPLATE.Enumeration.getValue()); validateSecondTemplateItem(newValue); break; } else if (source == this.templatePreferenceParts[i].additionalParametersField) { if (!isEmpty(newValue.toString())) { try { parseAdditonalParam(newValue.toString()); } catch (final FastCodeException ex) { // throw new Exception(ex); } /*final String addtnlParams[] = newValue.toString().split("\\s+"); final Map<String, String> addtnParamMap = new HashMap<String, String>(); for (final String params : addtnlParams) { if (params.contains(COLON)) { final String parseParam[] = params.split(COLON); if (parseParam.length == 2) { final String type = parseParam[1].trim().toLowerCase(); if (isEmpty(type) || !(type.equalsIgnoreCase(FIRST_TEMPLATE.Class.getValue()) || type.equalsIgnoreCase(FIRST_TEMPLATE.File.getValue()) || type.equalsIgnoreCase(FIRST_TEMPLATE.Package.getValue()) || type.equalsIgnoreCase(FIRST_TEMPLATE.Folder.getValue()) || type.equalsIgnoreCase(RETURN_TYPES.JAVAPROJECT.getValue()) || type.equalsIgnoreCase(RETURN_TYPES.PROJECT.getValue()) || type.equalsIgnoreCase(RETURN_TYPES.LOCALVAR.getValue()) || type .equalsIgnoreCase(RETURN_TYPES.BOOLEAN.getValue()))) { setErrorMessage("Additional Parameter type can be only class/file/package/folder/project/javaProject/localvar/boolean."); } else { setErrorMessage(null); } if (addtnParamMap.containsKey(parseParam[0])) { setErrorMessage("Duplicate place holder name " + parseParam[0]); } addtnParamMap.put(parseParam[0], type); } else if (parseParam.length == 1) { setErrorMessage("Additional Parameter must have type class/file/package/folder/project/javaProject/localvar/boolean."); } } }*/ } } } }