List of usage examples for org.eclipse.jface.preference StringFieldEditor UNLIMITED
int UNLIMITED
To view the source code for org.eclipse.jface.preference StringFieldEditor UNLIMITED.
Click Source Link
-1
) indicating unlimited text limit and width. From source file:com.ebmwebsourcing.petals.services.preferences.MavenPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout);//ww w. j a v a2 s .c o m container.setLayoutData(new GridData(GridData.FILL_BOTH)); // Petals Maven plug-in Group group = new Group(container, SWT.NONE); group.setLayout(new GridLayout(3, false)); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 4; group.setLayoutData(layoutData); group.setText("Petals Maven plug-in"); Composite subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.pluginVersionField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_PLUGIN_VERSION, "Plugin Version:", StringFieldEditor.UNLIMITED, subContainer); this.pluginVersionField.fillIntoGrid(subContainer, 3); this.pluginVersionField.setPage(this); this.pluginVersionField.setPreferenceStore(getPreferenceStore()); this.pluginVersionField.load(); this.groupIdField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_GROUP_ID, "Group ID:", StringFieldEditor.UNLIMITED, subContainer); this.groupIdField.fillIntoGrid(subContainer, 3); this.groupIdField.setPage(this); this.groupIdField.setPreferenceStore(getPreferenceStore()); this.groupIdField.load(); this.pomParentField = new FileUrlFieldEditor(PreferencesManager.PREFS_MAVEN_POM_PARENT, "POM Parent:", true, StringFieldEditor.VALIDATE_ON_KEY_STROKE, subContainer); this.pomParentField.setFileExtensions(new String[] { "*.xml" }); this.pomParentField.setPage(this); this.pomParentField.setPreferenceStore(getPreferenceStore()); this.pomParentField.load(); // Work with customized POM group = new Group(container, SWT.NONE); group.setLayout(new GridLayout(4, false)); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 10; group.setLayoutData(layoutData); group.setText("POM customization"); subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.defaultButton = new Button(subContainer, SWT.RADIO); this.defaultButton.setText("Use default POM"); layoutData = new GridData(); layoutData.horizontalSpan = 3; this.defaultButton.setLayoutData(layoutData); this.customizedButton = new Button(subContainer, SWT.RADIO); this.customizedButton.setText("Use customized POM"); layoutData = new GridData(); layoutData.horizontalSpan = 3; this.customizedButton.setLayoutData(layoutData); // The next field must only validate the location if it is enabled this.customizedPomLocationField = new DirectoryFieldEditor(PreferencesManager.PREFS_CUSTOMIZED_POM_LOCATION, "POM templates:", subContainer) { @Override protected boolean checkState() { boolean result = true; if (MavenPreferencePage.this.useCustomizedPom) result = super.checkState(); else clearErrorMessage(); return result; } @Override public void setEnabled(boolean enabled, Composite parent) { super.setEnabled(enabled, parent); valueChanged(); } }; this.customizedPomLocationField.setErrorMessage("The POM templates location is not a valid directory."); this.customizedPomLocationField.setPage(this); this.customizedPomLocationField.setPreferenceStore(getPreferenceStore()); this.customizedPomLocationField.load(); // Add a hyper link to generate the default POM final Link hyperlink = new Link(subContainer, SWT.NONE); hyperlink.setText("<A>Generate the default POM templates</A>"); layoutData = new GridData(SWT.TRAIL, SWT.DEFAULT, true, false); layoutData.horizontalSpan = 2; hyperlink.setLayoutData(layoutData); // Add the listeners this.customizedPomLocationField.setPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (FieldEditor.VALUE.equals(event.getProperty())) { boolean valid = MavenPreferencePage.this.customizedPomLocationField.isValid(); hyperlink.setEnabled(valid); setValid(valid); } } }); SelectionListener selectionListener = new SelectionListener() { public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } public void widgetDefaultSelected(SelectionEvent e) { MavenPreferencePage.this.useCustomizedPom = MavenPreferencePage.this.customizedButton .getSelection(); MavenPreferencePage.this.customizedPomLocationField.setEnabled( MavenPreferencePage.this.useCustomizedPom, MavenPreferencePage.this.customizedButton.getParent()); if (MavenPreferencePage.this.useCustomizedPom) hyperlink.setEnabled(MavenPreferencePage.this.customizedPomLocationField.isValid()); else hyperlink.setEnabled(false); } }; this.defaultButton.addSelectionListener(selectionListener); this.customizedButton.addSelectionListener(selectionListener); this.defaultButton.setSelection(!this.useCustomizedPom); this.customizedButton.setSelection(this.useCustomizedPom); this.customizedButton.notifyListeners(SWT.Selection, new Event()); hyperlink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Get the situation File rootDirectory = new File(MavenPreferencePage.this.customizedPomLocationField.getStringValue()); File suPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SU_POM); File saPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SA_POM); boolean overwrite = false; if (suPom.exists() || saPom.exists()) { String msg = "Some of the default POM templates already exist.\nDo you want to overwrite them?"; overwrite = MessageDialog.openQuestion(hyperlink.getShell(), "Overwrite Templates", msg); } // Create the SU template boolean ok = true; if (!suPom.exists() || overwrite) { File tpl = getBundledTemplateFile(true); try { IoUtils.copyStream(tpl, suPom); } catch (IOException e1) { ok = false; PetalsServicesPlugin.log(e1, IStatus.ERROR); } } // Create the SA template if (!saPom.exists() || overwrite) { File tpl = getBundledTemplateFile(false); try { IoUtils.copyStream(tpl, saPom); } catch (IOException e1) { ok = false; PetalsServicesPlugin.log(e1, IStatus.ERROR); } } // Report the result if (ok) { MessageDialog.openInformation(hyperlink.getShell(), "Successful Creation", "The default POM templates were successfully created."); } else { MessageDialog.openError(hyperlink.getShell(), "Error during the Creation", "The default POM templates could not be created correctly.\nCheck the log for more details."); } } }); // Update POM dependencies automatically group = new Group(container, SWT.NONE); group.setLayout(new GridLayout()); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 10; group.setLayoutData(layoutData); group.setText("POM dependencies"); subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); this.autoPomUpdateField = new BooleanFieldEditor(PreferencesManager.PREFS_UPDATE_MAVEN_POM, "Update POM dependencies automatically (SA projects)", subContainer); this.autoPomUpdateField.setPage(this); this.autoPomUpdateField.setPreferenceStore(getPreferenceStore()); this.autoPomUpdateField.load(); return container; }
From source file:com.mind_era.knime_rapidminer.knime.nodes.preferences.SubPreferencePage.java
License:Open Source License
/** * Creates the field editors. Field editors are abstractions of the common * GUI blocks needed to manipulate various types of preferences. Each field * editor knows how to save and restore itself. *//*from ww w . j a v a 2 s. com*/ @Override public void createFieldEditors() { for (final String parameterKey : ParameterService.getParameterKeys()) { final ParameterType type = ParameterService.getParameterType(parameterKey); final String value = ParameterService.getParameterValue(parameterKey); final String key = PreferenceInitializer.getRapidminerPreferenceKey(parameterKey); if (type instanceof ParameterTypeInt) { final ParameterTypeInt intType = (ParameterTypeInt) type; final IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor(key, intType.getDescription(), getFieldEditorParent()); integerFieldEditor.setValidRange(intType.getMinValueInt(), intType.getMaxValueInt()); integerFieldEditor.setStringValue(value); addField(integerFieldEditor); } else if (type instanceof ParameterTypeDouble) { final ParameterTypeDouble doubleType = (ParameterTypeDouble) type; final StringFieldEditor stringFieldEditor = new StringFieldEditor(key, doubleType.getDescription(), getFieldEditorParent()); addField(stringFieldEditor); } else if (type instanceof ParameterTypeStringCategory) { final ParameterTypeStringCategory catType = (ParameterTypeStringCategory) type; final String[] vals = catType.getValues(); final String[][] labelAndValues = new String[vals.length][2]; for (int i = labelAndValues.length; i-- > 0;) { labelAndValues[i][0] = vals[i]; labelAndValues[i][1] = Integer.toString(i); } final RadioGroupFieldEditor stringFieldEditor = new RadioGroupFieldEditor(key, catType.getDescription(), 2, labelAndValues, getFieldEditorParent(), true); addField(stringFieldEditor); } else if (type instanceof ParameterTypeFile) { final ParameterTypeFile fileType = (ParameterTypeFile) type; final FileFieldEditor fileFieldEditor = new FileFieldEditor(key, fileType.getDescription(), getFieldEditorParent()); addField(fileFieldEditor); } else if (type instanceof ParameterTypeDirectory) { final ParameterTypeDirectory dirType = (ParameterTypeDirectory) type; final DirectoryFieldEditor directoryFieldEditor = new DirectoryFieldEditor(key, dirType.getDescription(), getFieldEditorParent()); addField(directoryFieldEditor); } else if (type instanceof ParameterTypeBoolean) { final ParameterTypeBoolean boolType = (ParameterTypeBoolean) type; final BooleanFieldEditor booleanFieldEditor = new BooleanFieldEditor(key, boolType.getDescription(), getFieldEditorParent()); addField(booleanFieldEditor); } else if (type instanceof ParameterTypeColor) { final ParameterTypeColor colorType = (ParameterTypeColor) type; final ColorFieldEditor colorFieldEditor = new ColorFieldEditor(key, colorType.getDescription(), getFieldEditorParent()); addField(colorFieldEditor); } else if (type instanceof ParameterTypeChar) { final ParameterTypeChar charType = (ParameterTypeChar) type; final StringFieldEditor charFieldEditor = new StringFieldEditor(key, charType.getDescription(), 1, getFieldEditorParent()); addField(charFieldEditor); } else if (type != null)/* if (type instanceof ParameterTypeString) */ { // final ParameterTypeString stringType = (ParameterTypeString) // type; final StringFieldEditor stringFieldEditor = new StringFieldEditor(key, type.getDescription(), StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_FOCUS_LOST, getFieldEditorParent()); addField(stringFieldEditor); } // else Password should be important } // addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, // "&Directory preference:", getFieldEditorParent())); // addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN, // "&An example of a boolean preference", getFieldEditorParent())); // // addField(new RadioGroupFieldEditor(PreferenceConstants.P_CHOICE, // "An example of a multiple-choice preference", 1, // new String[][] { { "&Choice 1", "choice1" }, // { "C&hoice 2", "choice2" } }, getFieldEditorParent())); // addField(new StringFieldEditor(PreferenceConstants.P_STRING, // "A &text preference:", getFieldEditorParent())); }
From source file:com.nokia.tracebuilder.preferences.GeneralPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { String formatGroupTitle = Messages.getString("GeneralPreferencePage.TraceFormatTitle"); //$NON-NLS-1$ TraceProjectAPIList apilist = TraceBuilderGlobals.getTraceModel().getExtension(TraceProjectAPIList.class); if (apilist != null) { Iterator<TraceProjectAPI> apis = apilist.getAPIs(); ArrayList<String[]> list = new ArrayList<String[]>(); while (apis.hasNext()) { TraceProjectAPI api = apis.next(); if (api.isVisibleInConfiguration()) { String name = api.getName(); String title = api.getTitle(); list.add(new String[] { title, name }); }// w ww .j av a 2 s .co m } if (list.size() > 1) { String[][] formatters = new String[list.size()][]; list.toArray(formatters); addField(new RadioGroupFieldEditor(TraceBuilderConfiguration.FORMATTER_NAME, formatGroupTitle, FORMAT_COLUMNS, formatters, getFieldEditorParent(), true)); } } addField(new BooleanFieldEditor(TraceBuilderConfiguration.PRINTF_SUPPORT, Messages.getString("GeneralPreferencePage.PrintfParserSupportTitle"), //$NON-NLS-1$ getFieldEditorParent())); addField(new StringFieldEditor(TraceBuilderConfiguration.PRINTF_EXTENSION, Messages.getString("GeneralPreferencePage.PrintfMacroTitle"), //$NON-NLS-1$ StringFieldEditor.UNLIMITED, getFieldEditorParent())); }
From source file:org.eclipse.ajdt.internal.ui.preferences.AJCompilerPreferencePage.java
License:Open Source License
private Composite createCompilerPreferencesContent(Composite parent) { String[] errorWarningIgnore = new String[] { AspectJPreferences.VALUE_ERROR, AspectJPreferences.VALUE_WARNING, AspectJPreferences.VALUE_IGNORE }; String[] errorWarningIgnoreLabels = new String[] { UIMessages.CompilerConfigurationBlock_error, UIMessages.CompilerConfigurationBlock_warning, UIMessages.CompilerConfigurationBlock_ignore }; String[] enableDisableValues = new String[] { AspectJPreferences.VALUE_ENABLED, AspectJPreferences.VALUE_DISABLED }; int nColumns = 3; final ScrolledPageContent pageContent = new ScrolledPageContent(parent); GridLayout layout = new GridLayout(); layout.numColumns = nColumns;//from ww w .j a v a 2 s . com Composite composite = pageContent.getBody(); composite.setLayout(layout); Composite othersComposite; ExpandableComposite excomposite; String label; if (!isProjectPreferencePage()) { label = UIMessages.CompilerConfigurationBlock_aj_builder_settings; excomposite = createStyleSection(composite, label, nColumns); othersComposite = new Composite(excomposite, SWT.NONE); excomposite.setClient(othersComposite); othersComposite.setLayout(new GridLayout(nColumns, false)); Preferences prefs = getAspectJCorePLuginPreferences(); // incremental compiler optimizations label = UIMessages.CompilerConfigurationBlock_aj_incrementalCompilerOptimizations; Button b = addCheckBox(othersComposite, label, AspectJCorePreferences.OPTION_IncrementalCompilationOptimizations, enableDisableValues, 0, false); useAspectJCorePreferences(b); // a little kludgy, but here we re-set the selection to be what is stored in AJ core preferences. // ignoring the original value. b.setSelection(prefs.getBoolean(AspectJCorePreferences.OPTION_IncrementalCompilationOptimizations)); // default is true } label = UIMessages.CompilerConfigurationBlock_aj_messages_matching; excomposite = createStyleSection(composite, label, nColumns); othersComposite = new Composite(excomposite, SWT.NONE); excomposite.setClient(othersComposite); othersComposite.setLayout(new GridLayout(nColumns, false)); label = UIMessages.CompilerConfigurationBlock_aj_invalid_absolute_type_name_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportInvalidAbsoluteTypeName, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_invalid_wildcard_type_name_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportInvalidWildcardTypeName, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_type_not_exposed_to_weaver_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportTypeNotExposedToWeaver, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_unmatched_super_type_in_call_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportUnmatchedSuperTypeInCall, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_no_interface_ctor_joinpoint_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportNoInterfaceCtorJoinpoint, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_cant_find_type; addComboBox(othersComposite, label, AspectJPreferences.OPTION_cantFindType, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_cant_find_type_affecting_jp_match; addComboBox(othersComposite, label, AspectJPreferences.OPTION_cantFindTypeAffectingJPMatch, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aspect_excluded_by_configuration; addComboBox(othersComposite, label, AspectJPreferences.OPTION_aspectExcludedByConfiguration, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_messages_optimization; excomposite = createStyleSection(composite, label, nColumns); othersComposite = new Composite(excomposite, SWT.NONE); excomposite.setClient(othersComposite); othersComposite.setLayout(new GridLayout(nColumns, false)); label = UIMessages.CompilerConfigurationBlock_aj_cannot_implement_lazy_tjp_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportCannotImplementLazyTJP, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_multiple_advice_stopping_lazy_tjp; addComboBox(othersComposite, label, AspectJPreferences.OPTION_multipleAdviceStoppingLazyTJP, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_no_guard_for_lazy_tjp; addComboBox(othersComposite, label, AspectJPreferences.OPTION_noGuardForLazyTjp, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_x_no_inline_label; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_XNoInline, enableDisableValues, 0, true); label = UIMessages.CompilerConfigurationBlock_aj_messages_java5; excomposite = createStyleSection(composite, label, nColumns); othersComposite = new Composite(excomposite, SWT.NONE); excomposite.setClient(othersComposite); othersComposite.setLayout(new GridLayout(nColumns, false)); Text description = new Text(othersComposite, SWT.WRAP | SWT.READ_ONLY); description.setText(UIMessages.CompilerConfigurationBlock_aj_messages_java5_label); GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gd.horizontalSpan = nColumns; description.setLayoutData(gd); label = UIMessages.CompilerConfigurationBlock_adviceDidNotMatch; addComboBox(othersComposite, label, AspectJPreferences.OPTION_adviceDidNotMatch, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_unmatchedTargetKind; addComboBox(othersComposite, label, AspectJPreferences.OPTION_unmatchedTargetKind, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_noJoinpointsForBridgeMethods; addComboBox(othersComposite, label, AspectJPreferences.OPTION_noJoinpointsForBridgeMethods, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_enumAsTargetForDecpIgnored; addComboBox(othersComposite, label, AspectJPreferences.OPTION_enumAsTargetForDecpIgnored, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_annotationAsTargetForDecpIgnored; addComboBox(othersComposite, label, AspectJPreferences.OPTION_annotationAsTargetForDecpIgnored, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_cantMatchArrayTypeOnVarargs; addComboBox(othersComposite, label, AspectJPreferences.OPTION_cantMatchArrayTypeOnVarargs, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_invalidTargetForAnnotation; addComboBox(othersComposite, label, AspectJPreferences.OPTION_invalidTargetForAnnotation, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_elementAlreadyAnnotated; addComboBox(othersComposite, label, AspectJPreferences.OPTION_elementAlreadyAnnotated, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_uncheckedArgument; addComboBox(othersComposite, label, AspectJPreferences.OPTION_uncheckedArgument, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_uncheckedAdviceConversion; addComboBox(othersComposite, label, AspectJPreferences.OPTION_uncheckedAdviceConversion, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_messages_programming; excomposite = createStyleSection(composite, label, nColumns); othersComposite = new Composite(excomposite, SWT.NONE); excomposite.setClient(othersComposite); othersComposite.setLayout(new GridLayout(nColumns, false)); label = UIMessages.CompilerConfigurationBlock_aj_need_serial_version_uid_field_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportNeedSerialVersionUIDField, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_incompatible_serial_version_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportIncompatibleSerialVersion, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_no_explicit_constructor_call; addComboBox(othersComposite, label, AspectJPreferences.OPTION_noExplicitConstructorCall, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_runtimeExceptionNotSoftened; addComboBox(othersComposite, label, AspectJPreferences.OPTION_runtimeExceptionNotSoftened, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_unordered_advice_at_shadow; addComboBox(othersComposite, label, AspectJPreferences.OPTION_unorderedAdviceAtShadow, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_swallowed_exception_in_catch_block; addComboBox(othersComposite, label, AspectJPreferences.OPTION_swallowedExceptionInCatchBlock, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_messages_information; excomposite = createStyleSection(composite, label, nColumns); othersComposite = new Composite(excomposite, SWT.NONE); excomposite.setClient(othersComposite); othersComposite.setLayout(new GridLayout(nColumns, false)); label = UIMessages.CompilerConfigurationBlock_aj_unresolvable_member_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportUnresolvableMember, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_shadow_not_in_structure_label; addComboBox(othersComposite, label, AspectJPreferences.OPTION_ReportShadowNotInStructure, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_calculating_serial_version_UID; addComboBox(othersComposite, label, AspectJPreferences.OPTION_calculatingSerialVersionUID, errorWarningIgnore, errorWarningIgnoreLabels, 0); label = UIMessages.CompilerConfigurationBlock_aj_enable_weave_messages_label; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_WeaveMessages, enableDisableValues, 0, true); label = UIMessages.CompilerConfigurationBlock_aj_other_tabtitle; excomposite = createStyleSection(composite, label, nColumns); othersComposite = new Composite(excomposite, SWT.NONE); excomposite.setClient(othersComposite); othersComposite.setLayout(new GridLayout(nColumns, false)); label = UIMessages.CompilerConfigurationBlock_aj_x_serializable_aspects_label; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_XSerializableAspects, enableDisableValues, 0, true); label = UIMessages.CompilerConfigurationBlock_aj_x_not_reweavable_label; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_XNotReweavable, enableDisableValues, 0, true); label = UIMessages.CompilerConfigurationBlock_aj_x_has_member_label; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_XHasMember, enableDisableValues, 0, true); label = UIMessages.CompilerConfigurationBlock_aj_out_xml; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_Outxml, enableDisableValues, 0, true); label = "Verbose-Send extra information to the AJDT Event Trace view.\nMust use with 'Compiler / Task List Messages'\nfilter enabled."; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_verbose, enableDisableValues, 0, true); label = "Pointcut matching timers-Show timing information to the AJDT Event Trace view \n(use with the 'Verbose' option)"; addCheckBox(othersComposite, label, AspectJPreferences.OPTION_timers, enableDisableValues, 0, true); Composite row3Comp = createRowComposite(othersComposite, 2); //fills the editor with the stored preference if there is one. String currValue = ""; //$NON-NLS-1$ if (isProjectPreferencePage()) { if (hasProjectSpecificOptions(getProject())) { currValue = AspectJPreferences.getStringPrefValue(getProject(), AspectJPreferences.COMPILER_OPTIONS); } else { currValue = getPreferenceStore().getString(AspectJPreferences.COMPILER_OPTIONS); } } else { currValue = getPreferenceStore().getString(AspectJPreferences.COMPILER_OPTIONS); } nonStandardOptionsEditor = new StringFieldEditor(currValue, UIMessages.compilerPropsPage_nonStandardOptions, StringFieldEditor.UNLIMITED, row3Comp); nonStandardOptionsEditor.setStringValue(currValue); IDialogSettings section = JavaPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME); restoreSectionExpansionStates(section); return pageContent; }
From source file:org.eclipse.egit.ui.internal.preferences.DateFormatPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { String[][] values = new String[DATA.size()][2]; int i = 0;/*from ww w.j a va 2 s . c o m*/ for (Map.Entry<GitDateFormatter.Format, FormatInfo> entry : DATA.entrySet()) { values[i][0] = entry.getValue().name; values[i][1] = entry.getKey() == null ? UIPreferences.DATE_FORMAT_CUSTOM : entry.getKey().name(); i++; } final Composite pane = getFieldEditorParent(); formatChooser = new ComboFieldEditor(UIPreferences.DATE_FORMAT_CHOICE, UIText.DateFormatPreferencePage_formatChooser_label, values, pane); addField(formatChooser); dateFormat = new StringFieldEditor(UIPreferences.DATE_FORMAT, UIText.DateFormatPreferencePage_formatInput_label, StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_KEY_STROKE, pane) { @Override protected boolean doCheckState() { // Validate the contents. If we're disabled, we're showing some // built-in format string, which we always consider as valid. if (!getTextControl(pane).isEnabled()) { return true; } try { updatePreview(new SimpleDateFormat(getStringValue().trim())); return true; } catch (IllegalArgumentException e) { dateFormatPreview.setText(""); //$NON-NLS-1$ return false; } } @Override protected void doLoad() { // Set explicitly below } @Override protected void doStore() { // Never store invalid values, or built-in values if (getTextControl(pane).isEnabled() && doCheckState()) { super.doStore(); } } @Override public void setStringValue(String value) { super.setStringValue(value); refreshValidState(); } }; dateFormat.setEmptyStringAllowed(false); dateFormat.setErrorMessage(UIText.DateFormatPreferencePage_invalidDateFormat_message); addField(dateFormat); // We know that the layout will have two columns Label dpLabel = SWTUtils.createLabel(pane, UIText.DateFormatPreferencePage_datePreview_label); dpLabel.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false)); dateFormatPreview = SWTUtils.createLabel(pane, null, 1); Label dummyLabel = SWTUtils.createLabel(pane, ""); //$NON-NLS-1$ dummyLabel.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false)); formatExplanation = new Label(pane, SWT.LEFT | SWT.WRAP); GridData layout = SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, true); formatExplanation.setLayoutData(layout); // Setup based on initial values. We don't get any events by the editors // on initial load! lastCustomValue = getPreferenceStore().getString(UIPreferences.DATE_FORMAT); String initialValue = getPreferenceStore().getString(UIPreferences.DATE_FORMAT_CHOICE); updateFields(initialValue); }
From source file:org.eclipse.jet.internal.ui.prefs.CompilePreferencePage.java
License:Open Source License
protected void createFieldEditors() { // determine whether the page is showing the workspace scope (Windows > Preferences) // or in project scope (Project properties) final boolean projectSettings = element != null; if (projectSettings) { setPreferenceStore(new ScopedPreferenceStore(new ProjectScope(element), JET2Platform.PLUGIN_ID)); } else {//from w w w . java 2 s. c o m setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(), JET2Platform.PLUGIN_ID)); } if (projectSettings) { // add a check box to use project specific settings projectSpecificSettingsEditor = new BooleanFieldEditor(JETPreferences.PROJECT_SPECIFIC_SETTINGS, Messages.CompilePreferencePage_EnableProjectSettings, getFieldEditorParent()); addField(projectSpecificSettingsEditor); Label horizontalLine = new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL); horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); horizontalLine.setFont(getFieldEditorParent().getFont()); } // create "global" option editors... jetVersionFieldEditor = new RadioGroupFieldEditor(JETCompilerOptions.OPTION_JET_SPECIFICATION_VERSION, Messages.CompilePreferencePage_JETComformanceGroupLabel, 1, new String[][] { { Messages.CompilePreferencePage_JET1_OPTION, String.valueOf(JETAST.JET_SPEC_V1) }, { Messages.CompilePreferencePage_JET2_Option, String.valueOf(JETAST.JET_SPEC_V2) }, }, getFieldEditorParent(), true); addField(jetVersionFieldEditor); v1OptionsEnabled = getPreferenceStore() .getInt(JETCompilerOptions.OPTION_JET_SPECIFICATION_VERSION) == JETAST.JET_SPEC_V1; // common generation group javaGenerationGroup = createGroup(Messages.CompilePreferencePage_JavaGenerationGroupLabel); srcFolderFieldEditor = new StringFieldEditor(JETCompilerOptions.OPTION_COMPILED_TEMPLATE_SRC_DIR, Messages.CompilePreferencePage_SourceFolder, javaGenerationGroup); addField(srcFolderFieldEditor); derivedJavaFieldEditor = new BooleanFieldEditor(JETCompilerOptions.OPTION_SET_JAVA_FILES_AS_DERIVED, Messages.CompilePreferencePage_DeriveJavaFiles, javaGenerationGroup); addField(derivedJavaFieldEditor); useJava5FieldEditor = new BooleanFieldEditor(JETCompilerOptions.OPTION_USE_JAVA5, Messages.CompilePreferencePage_use_java5, javaGenerationGroup); addField(useJava5FieldEditor); // v1 options group v1OptionsGroup = createGroup(Messages.CompilePreferencePage_JET1OptionsGroupLabel); templatesFolderFieldEditor = new StringFieldEditor(JETCompilerOptions.OPTION_V1_TEMPLATES_DIR, Messages.CompilePreferencePage_TemplatesDirLabel, v1OptionsGroup); addField(templatesFolderFieldEditor); if (projectSettings) { baseTransformationFieldEditor = new StringFieldEditor(JETCompilerOptions.OPTION_V1_BASE_TRANSFORMATION, Messages.CompilePreferencePage_BaseLocationsLabel, StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_KEY_STROKE, v1OptionsGroup) { protected boolean doCheckState() { String trimmedValue = getStringValue().trim(); return trimmedValue.length() == 0 || isValidURIList(trimmedValue); } }; baseTransformationFieldEditor.setErrorMessage(Messages.CompilePreferencePage_InvalidBaseLocations); addField(baseTransformationFieldEditor); compileBaseTemplatesFieldEditor = new BooleanFieldEditor( JETCompilerOptions.OPTION_V1_COMPILE_BASE_TEMPLATES, Messages.CompilePreferencePage_CompileBaseTemplates, v1OptionsGroup); addField(compileBaseTemplatesFieldEditor); } // v2 options group v2OptionsGroup = createGroup(Messages.CompilePreferencePage_JET2_OPTIONS_GROUP_LABEL); extFieldEditor = new ExtensionListEditor(JETCompilerOptions.OPTION_TEMPLATE_EXT, Messages.CompilePreferencePage_FileExtensions, v2OptionsGroup); addField(extFieldEditor); packageFieldEditor = new StringFieldEditor(JETCompilerOptions.OPTION_COMPILED_TEMPLATE_PACKAGE, Messages.CompilePreferencePage_JavaPackage, v2OptionsGroup); addField(packageFieldEditor); }
From source file:org.eclipse.mylyn.reviews.ldap.internal.preferences.R4ELdapPreferencePage.java
License:Open Source License
/** * Create the Server information GUI//from w ww .j av a2 s. c o m * * @param Composite * aPrefsContainer */ private void createServerInformation(Composite aPrefsContainer) { // Create a Group to hold LDAP user preferences final Group r4ELdapHoostPrefsGroup = new Group(aPrefsContainer, SWT.BORDER_SOLID); final GridData r4eLdapHostPrefsGroupData = new GridData(GridData.FILL, GridData.FILL, true, false); r4eLdapHostPrefsGroupData.horizontalSpan = R4E_GROUP_PREFS_SERVER_DATA_SPAN; r4ELdapHoostPrefsGroup.setText(PreferenceConstants.FP_SERVER_GROUP); r4ELdapHoostPrefsGroup.setLayoutData(r4eLdapHostPrefsGroupData); r4ELdapHoostPrefsGroup.setLayout(new GridLayout(R4E_GROUP_PREFS_SERVER_DATA_SPAN, false)); // dummy spacer label final Label r4ELdapPrefsSpacer = new Label(r4ELdapHoostPrefsGroup, SWT.FILL); final GridData r4EUserPrefsSpacerData = new GridData(GridData.FILL, GridData.FILL, true, false); r4EUserPrefsSpacerData.horizontalSpan = R4E_GROUP_PREFS_SERVER_DATA_SPAN; r4ELdapPrefsSpacer.setLayoutData(r4EUserPrefsSpacerData); // Create Radio buttons to define the type of Server int numberRadio = 2; fLdapSelectBtn = new RadioGroupFieldEditor(PreferenceConstants.FP_SERVER_TYPE_ID, PreferenceConstants.FP_SERVER_TYPE_LABEL, numberRadio, PreferenceConstants.FP_SERVER_TYPE_VALUES, r4ELdapHoostPrefsGroup, false); fLdapSelectBtn.setPreferenceStore(getPreferenceStore()); fLdapSelectBtn.load(); // Test fields definitions fHostFieldEditor = new StringFieldEditor(PreferenceConstants.FP_HOST_ID, PreferenceConstants.FP_HOST_LABEL, StringFieldEditor.UNLIMITED, r4ELdapHoostPrefsGroup); fHostFieldEditor.getTextControl(r4ELdapHoostPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", R4EString.getString("fhostTooltip"))); addField(fHostFieldEditor); fPortFieldEditor = new StringFieldEditor(PreferenceConstants.FP_PORT_ID, PreferenceConstants.FP_PORT_LABEL, StringFieldEditor.UNLIMITED, r4ELdapHoostPrefsGroup); fPortFieldEditor.getTextControl(r4ELdapHoostPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", R4EString.getString("fPortTooltip"))); addField(fPortFieldEditor); fBaseFieldEditor = new StringFieldEditor(PreferenceConstants.FP_BASE_ID, PreferenceConstants.FP_BASE_LABEL, StringFieldEditor.UNLIMITED, r4ELdapHoostPrefsGroup); fBaseFieldEditor.getTextControl(r4ELdapHoostPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", R4EString.getString("fBaseTooltip"))); addField(fBaseFieldEditor); }
From source file:org.eclipse.mylyn.reviews.ldap.internal.preferences.R4ELdapPreferencePage.java
License:Open Source License
/** * Create the Security information GUI// w w w .j a va 2 s . co m * * @param Composite * aPrefsContainer */ private void createSecurityInformation(Composite aPrefsContainer) { // Create a Group to hold R4E Security preferences final Group r4ESecurityPrefsGroup = new Group(aPrefsContainer, SWT.BORDER_SOLID); final GridData r4EGroupPrefsGroupData = new GridData(GridData.FILL, GridData.FILL, true, false); r4EGroupPrefsGroupData.horizontalSpan = R4E_GROUP_PREFS_SECURITY_DATA_SPAN; r4ESecurityPrefsGroup.setText(PreferenceConstants.FP_SECURITY_GROUP); r4ESecurityPrefsGroup.setLayoutData(r4EGroupPrefsGroupData); r4ESecurityPrefsGroup.setLayout(new GridLayout(R4E_GROUP_PREFS_SECURITY_DATA_SPAN, false)); // dummy spacer label Label r4ESecurityGroupPrefsSpacer = new Label(r4ESecurityPrefsGroup, SWT.FILL); // Create Radio buttons to define the type of AUTHENTICATION int numberRadio = 3; fAuthenficationBtn = new RadioGroupFieldEditor(PreferenceConstants.FP_SECURITY_AUTHENTICATION_ID, PreferenceConstants.FP_SECURITY_AUTHENTICATION_LABEL, numberRadio, PreferenceConstants.FP_AUTHENTICATION_RADIO_VALUES, r4ESecurityPrefsGroup, false); fAuthenficationBtn.setPreferenceStore(getPreferenceStore()); fAuthenficationBtn.load(); // dummy spacer label Label r4EFieldPrefsSpacer = new Label(r4ESecurityPrefsGroup, SWT.FILL); final GridData r4EFieldPrefsSpacerData = new GridData(GridData.FILL, GridData.FILL, true, false); r4EFieldPrefsSpacerData.horizontalSpan = R4E_GROUP_PREFS_SECURITY_DATA_SPAN; r4EFieldPrefsSpacer.setLayoutData(r4EFieldPrefsSpacerData); final GridData r4EGroupPrefsSpacerData = new GridData(GridData.FILL, GridData.FILL, true, false); r4EGroupPrefsSpacerData.horizontalSpan = R4E_GROUP_PREFS_SECURITY_DATA_SPAN; r4ESecurityGroupPrefsSpacer.setLayoutData(r4EGroupPrefsSpacerData); // Test fields definitions fUserNamedEditor = new StringFieldEditor(PreferenceConstants.FP_SECURITY_USER_NAME_ID, PreferenceConstants.FP_SECURITY_USER_NAME_LABEL, StringFieldEditor.UNLIMITED, r4ESecurityPrefsGroup); fUserNamedEditor.getTextControl(r4ESecurityPrefsGroup) .setToolTipText(R4EString.getString("fUserNameTooltip")); addField(fUserNamedEditor); fPasswordEditor = new StringFieldEditor(PreferenceConstants.FP_SECURITY_PASSWORD_ID, PreferenceConstants.FP_SECURITY_PASSWORD_LABEL, StringFieldEditor.UNLIMITED, r4ESecurityPrefsGroup); addField(fPasswordEditor); fPasswordEditor.getTextControl(r4ESecurityPrefsGroup).addModifyListener(new ModifyListener() { // Echo * when typing a new password public void modifyText(ModifyEvent e) { fPasswordEditor.getTextControl(r4ESecurityPrefsGroup).setEchoChar('*'); } }); }
From source file:org.eclipse.mylyn.reviews.ldap.internal.preferences.R4ELdapPreferencePage.java
License:Open Source License
/** * Create the LDAP fields description information GUI * //from w w w . j a v a 2 s. c o m * @param Composite * aPrefsContainer */ private void createFieldDefinitionInformation(Composite aPrefsContainer) { // Create a Group to hold R4E LDAP Field preferences final Group r4EFieldPrefsGroup = new Group(aPrefsContainer, SWT.BORDER_SOLID); final GridData r4EFieldPrefsGroupData = new GridData(GridData.FILL, GridData.FILL, true, false); r4EFieldPrefsGroupData.horizontalSpan = R4E_GROUP_MANDATORY_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS; r4EFieldPrefsGroup.setText(PreferenceConstants.FP_FIELD_GROUP); r4EFieldPrefsGroup.setLayoutData(r4EFieldPrefsGroupData); r4EFieldPrefsGroup.setLayout(new GridLayout(R4E_GROUP_MANDATORY_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS, false)); // dummy spacer label Label r4EFieldPrefsSpacer = new Label(r4EFieldPrefsGroup, SWT.FILL); final GridData r4EFieldPrefsSpacerData = new GridData(GridData.FILL, GridData.FILL, true, false); r4EFieldPrefsSpacerData.horizontalSpan = R4E_GROUP_MANDATORY_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS; r4EFieldPrefsSpacer.setLayoutData(r4EFieldPrefsSpacerData); // Create a Group to hold R4E LDAP Mandatory Field preferences final Group r4EFieldMandatoryPrefsGroup = new Group(r4EFieldPrefsGroup, SWT.BORDER_SOLID); final GridData r4EFieldMandatoryPrefsGroupData = new GridData(GridData.FILL, GridData.FILL, true, false); r4EFieldMandatoryPrefsGroupData.horizontalSpan = R4E_GROUP_MANDATORY_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS; r4EFieldMandatoryPrefsGroup.setText(PreferenceConstants.FP_FIELD_MANDATORY_GROUP); r4EFieldMandatoryPrefsGroup.setLayoutData(r4EFieldMandatoryPrefsGroupData); r4EFieldMandatoryPrefsGroup .setLayout(new GridLayout(R4E_GROUP_MANDATORY_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS, false)); fUserIdEditor = new StringFieldEditor(PreferenceConstants.FP_UID_ID, PreferenceConstants.FP_UID_LABEL, StringFieldEditor.UNLIMITED, r4EFieldMandatoryPrefsGroup); fUserIdEditor.setEmptyStringAllowed(false); fUserIdEditor.getTextControl(r4EFieldMandatoryPrefsGroup) .setToolTipText(R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_UID_ID)); addField(fUserIdEditor); fUserNameEditor = new StringFieldEditor(PreferenceConstants.FP_NAME_ID, PreferenceConstants.FP_NAME_LABEL, StringFieldEditor.UNLIMITED, r4EFieldMandatoryPrefsGroup); fUserNameEditor.setEmptyStringAllowed(false); fUserNameEditor.getTextControl(r4EFieldMandatoryPrefsGroup) .setToolTipText(R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_NAME_ID)); addField(fUserNameEditor); fEmailEditor = new StringFieldEditor(PreferenceConstants.FP_EMAIL_ID, PreferenceConstants.FP_EMAIL_LABEL, StringFieldEditor.UNLIMITED, r4EFieldMandatoryPrefsGroup); fEmailEditor.setEmptyStringAllowed(false); fEmailEditor.getTextControl(r4EFieldMandatoryPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_EMAIL_ID)); addField(fEmailEditor); // dummy spacer label Label r4EFieldPrefsSpacer2 = new Label(r4EFieldPrefsGroup, SWT.FILL); final GridData r4EFieldPrefsSpacer2Data = new GridData(GridData.FILL, GridData.FILL, true, false); r4EFieldPrefsSpacer2Data.horizontalSpan = R4E_GROUP_MANDATORY_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS; r4EFieldPrefsSpacer2.setLayoutData(r4EFieldPrefsSpacer2Data); // Create a Group to hold R4E LDAP Optional Field preferences final Group r4EFieldOptionalPrefsGroup = new Group(r4EFieldPrefsGroup, SWT.BORDER_SOLID); final GridData r4EFieldOptionalPrefsGroupData = new GridData(SWT.FILL, SWT.FILL, true, false); r4EFieldOptionalPrefsGroupData.horizontalSpan = R4E_GROUP_OPTIONAL_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS; r4EFieldOptionalPrefsGroup.setText(PreferenceConstants.FP_FIELD_OPTIONAL_GROUP); r4EFieldOptionalPrefsGroup.setLayoutData(r4EFieldOptionalPrefsGroupData); r4EFieldOptionalPrefsGroup .setLayout(new GridLayout(R4E_GROUP_OPTIONAL_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS, false)); fTelephoneEditor = new StringFieldEditor(PreferenceConstants.FP_TELEPHONE_ID, PreferenceConstants.FP_TELEPHONE_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup); fTelephoneEditor.getTextControl(r4EFieldOptionalPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_TELEPHONE_ID)); addField(fTelephoneEditor); fMobileEditor = new StringFieldEditor(PreferenceConstants.FP_MOBILE_ID, PreferenceConstants.FP_MOBILE_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup); fMobileEditor.getTextControl(r4EFieldOptionalPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_MOBILE_ID)); addField(fMobileEditor); fEcnEditor = new StringFieldEditor(PreferenceConstants.FP_ECN_ID, PreferenceConstants.FP_ECN_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup); fEcnEditor.getTextControl(r4EFieldOptionalPrefsGroup) .setToolTipText(R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_ECN_ID)); addField(fEcnEditor); fCieEditor = new StringFieldEditor(PreferenceConstants.FP_COMPANY_ID, PreferenceConstants.FP_COMPANY_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup); fCieEditor.getTextControl(r4EFieldOptionalPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_COMPANY_ID)); addField(fCieEditor); fDeptEditor = new StringFieldEditor(PreferenceConstants.FP_DEPARTMENT_ID, PreferenceConstants.FP_DEPARTMENT_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup); fDeptEditor.getTextControl(r4EFieldOptionalPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_DEPARTMENT_ID)); addField(fDeptEditor); fDomainEditor = new StringFieldEditor(PreferenceConstants.FP_DOMAIN_ID, PreferenceConstants.FP_DOMAIN_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup); fDomainEditor.getTextControl(r4EFieldOptionalPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_DOMAIN_ID)); addField(fDomainEditor); fTitleEditor = new StringFieldEditor(PreferenceConstants.FP_TITLE_ID, PreferenceConstants.FP_TITLE_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup); fTitleEditor.getTextControl(r4EFieldOptionalPrefsGroup).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_TITLE_ID)); addField(fTitleEditor); // Create a second optional group to maintain the remaining LDAP fields definition final Group r4EFieldOptionalPrefsGroup2 = new Group(r4EFieldPrefsGroup, SWT.BORDER_SOLID); final GridData r4EFieldOptionalPrefsGroupRightData2 = new GridData(GridData.FILL, GridData.FILL, true, false); r4EFieldOptionalPrefsGroupRightData2.horizontalSpan = R4E_GROUP_OPTIONAL_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS; r4EFieldOptionalPrefsGroup2.setText(PreferenceConstants.FP_FIELD_OPTIONAL_GROUP); r4EFieldOptionalPrefsGroup2.setLayoutData(r4EFieldOptionalPrefsGroupRightData2); r4EFieldOptionalPrefsGroup2 .setLayout(new GridLayout(R4E_GROUP_OPTIONAL_PREFS_FIELDS_DEF_DATA_NUM_COLUMNS, false)); // Fields editor fOfficeEditor = new StringFieldEditor(PreferenceConstants.FP_OFFICE_NAME_ID, PreferenceConstants.FP_OFFICE_ROOM_Label, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup2); fOfficeEditor.getTextControl(r4EFieldOptionalPrefsGroup2).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_OFFICE_NAME_ID)); addField(fOfficeEditor); fRoomEditor = new StringFieldEditor(PreferenceConstants.FP_ROOM_NUMBER_ID, PreferenceConstants.FP_ROOM_NUMBER_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup2); fRoomEditor.getTextControl(r4EFieldOptionalPrefsGroup2).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_ROOM_NUMBER_ID)); addField(fRoomEditor); fStreetAddrEditor = new StringFieldEditor(PreferenceConstants.FP_STREET_ADDRESS_ID, PreferenceConstants.FP_STREET_ADDRESS_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup2); fStreetAddrEditor.getTextControl(r4EFieldOptionalPrefsGroup2).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_STREET_ADDRESS_ID)); addField(fStreetAddrEditor); fCityEditor = new StringFieldEditor(PreferenceConstants.FP_CITY_ID, PreferenceConstants.FP_CITY_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup2); fCityEditor.getTextControl(r4EFieldOptionalPrefsGroup2) .setToolTipText(R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_CITY_ID)); addField(fCityEditor); fCountryEditor = new StringFieldEditor(PreferenceConstants.FP_COUNTRY_ID, PreferenceConstants.FP_COUNTRY_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup2); fCountryEditor.getTextControl(r4EFieldOptionalPrefsGroup2).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_COUNTRY_ID)); addField(fCountryEditor); fPostalCodeEditor = new StringFieldEditor(PreferenceConstants.FP_POSTAL_CODE_ID, PreferenceConstants.FP_POSTAL_CODE_LABEL, StringFieldEditor.UNLIMITED, r4EFieldOptionalPrefsGroup2); fPostalCodeEditor.getTextControl(r4EFieldOptionalPrefsGroup2).setToolTipText( R4EString.getFormattedString("defaultDescription", PreferenceConstants.FP_POSTAL_CODE_ID)); addField(fPostalCodeEditor); }
From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.java
License:Open Source License
/** * @since 2.0//from w ww. ja va 2s . c o m */ @Override protected void createSettingControls(Composite parent) { compositeContainer = parent; initializeOldValues(); Label serverLabel = new Label(compositeContainer, SWT.NONE); serverLabel.setText(LABEL_SERVER); serverUrlCombo = new Combo(compositeContainer, SWT.DROP_DOWN); serverUrlCombo.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (getWizard() != null) { getWizard().getContainer().updateButtons(); } } }); serverUrlCombo.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { updateHyperlinks(); } }); serverUrlCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (getWizard() != null) { getWizard().getContainer().updateButtons(); } } }); GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).grab(true, false).span(2, SWT.DEFAULT) .applyTo(serverUrlCombo); repositoryLabelEditor = new StringFieldEditor("", LABEL_REPOSITORY_LABEL, StringFieldEditor.UNLIMITED, //$NON-NLS-1$ compositeContainer) { @Override protected boolean doCheckState() { return true; // return isValidUrl(getStringValue()); } @Override protected void valueChanged() { super.valueChanged(); if (getWizard() != null) { getWizard().getContainer().updateButtons(); } } @Override public int getNumberOfControls() { return 2; } }; disconnectedButton = new Button(compositeContainer, SWT.CHECK); disconnectedButton.setText(Messages.AbstractRepositorySettingsPage_Disconnected); disconnectedButton.setSelection(repository != null ? repository.isOffline() : false); disconnectedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetSelected(e); isPageComplete(); if (getWizard() != null) { getWizard().getContainer().updateButtons(); } } }); if (needsRepositoryCredentials()) { createRepositoryCredentialsSection(); } if (needsAdvanced() || needsEncoding()) { createAdvancedSection(); } if (needsCertAuth()) { createCertAuthSection(); } if (needsHttpAuth()) { createHttpAuthSection(); } if (needsProxy()) { createProxySection(); } createContributionControls(innerComposite); Composite managementComposite = new Composite(compositeContainer, SWT.NULL); GridLayout managementLayout = new GridLayout(4, false); managementLayout.marginHeight = 0; managementLayout.marginWidth = 0; managementLayout.horizontalSpacing = 10; managementComposite.setLayout(managementLayout); managementComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 2, 1)); createAccountHyperlink = toolkit.createHyperlink(managementComposite, Messages.AbstractRepositorySettingsPage_Create_new_account, SWT.NONE); createAccountHyperlink.setBackground(managementComposite.getBackground()); createAccountHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { // TaskRepository repository = getRepository(); TaskRepository repository = createTaskRepository(); // if (repository == null && getServerUrl() != null && getServerUrl().length() > 0) { // repository = createTaskRepository(); // } if (repository != null) { String accountCreationUrl = connectorUi.getAccountCreationUrl(repository); if (accountCreationUrl != null) { BrowserUtil.openUrl(accountCreationUrl, IWorkbenchBrowserSupport.AS_EXTERNAL); } } } }); manageAccountHyperlink = toolkit.createHyperlink(managementComposite, Messages.AbstractRepositorySettingsPage_Change_account_settings, SWT.NONE); manageAccountHyperlink.setBackground(managementComposite.getBackground()); manageAccountHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { TaskRepository repository = getRepository(); if (repository == null && getRepositoryUrl() != null && getRepositoryUrl().length() > 0) { repository = createTaskRepository(); } if (repository != null) { String accountManagementUrl = connectorUi.getAccountManagementUrl(repository); if (accountManagementUrl != null) { BrowserUtil.openUrl(accountManagementUrl, IWorkbenchBrowserSupport.AS_EXTERNAL); } } } }); if (needsRepositoryCredentials()) { // bug 131656: must set echo char after setting value on Mac ((RepositoryStringFieldEditor) repositoryPasswordEditor).getTextControl().setEchoChar('*'); if (needsAnonymousLogin()) { // do this after username and password widgets have been intialized if (repository != null) { setAnonymous(isAnonymousAccess()); } } } updateHyperlinks(); if (repository != null) { saveToValidatedProperties(createTaskRepository()); } GridLayout layout = new GridLayout(3, false); compositeContainer.setLayout(layout); }