/* * (non-Javadoc) * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() */ protected void createFieldEditors() { StringFieldEditor elvinServer = new StringFieldEditor(Constants.ELVIN_SERVER, "Elvin:", getFieldEditorParent()); elvinServer.getTextControl(getFieldEditorParent()); addField(elvinServer); StringFieldEditor mysqlServer = new StringFieldEditor(Constants.MYSQL_SERVER, "Mysql:", getFieldEditorParent()); mysqlServer.getTextControl(getFieldEditorParent()); addField(mysqlServer); StringFieldEditor mysqlUsername = new StringFieldEditor(Constants.MYSQL_USERNAME, "Username:"******"Password:"******"Database:", getFieldEditorParent()); mysqlDatabase.getTextControl(getFieldEditorParent()); addField(mysqlDatabase); }
@Override protected void createFieldEditors() { Group group = SWTUtil.createGroup(getFieldEditorParent(), "FreeMarker Debugger", 1); // $NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); Composite composite = SWTUtil.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL); StringFieldEditor passwordEditor = new StringFieldEditor( LiferayDebugCore.PREF_FM_DEBUG_PASSWORD, "Password:"******"Password is invalid."); passwordEditor.setPreferenceStore(getPreferenceStore()); addField(passwordEditor); IntegerFieldEditor portEditor = new IntegerFieldEditor( LiferayDebugCore.PREF_FM_DEBUG_PORT, "Port:", composite); // $NON-NLS-1$ portEditor.setValidRange(1025, 65535); portEditor.setEmptyStringAllowed(false); portEditor.setPreferenceStore(getPreferenceStore()); portEditor.setErrorMessage("Port value ranges from integer 1025 to 65535."); // $NON-NLS-1$ portEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); addField(portEditor); }
@Override public void loadProperties(final IProject project) { try { String temp = project.getPersistentProperty( new QualifiedName( ProjectBuildPropertyData.QUALIFIER, COptimalizationOptionsData.OPTIMIZATION_LEVEL_PROPERTY)); if (temp != null && temp.length() != 0) { optimalizationLevel.setSelectedValue(temp); } else { optimalizationLevel.setSelectedValue("Common optimizations"); } temp = project.getPersistentProperty( new QualifiedName( ProjectBuildPropertyData.QUALIFIER, COptimalizationOptionsData.OTHER_OPTIMIZATION_FLAGS_PROPERTY)); otherFlags.setStringValue(temp); } catch (CoreException e) { optimalizationLevel.setSelectedValue("Common optimizations"); otherFlags.setStringValue(""); } }
@Override public void performDefaults() { if (mainComposite == null) { return; } optimalizationLevel.setEnabled(true, mainComposite); optimalizationLevel.setSelectedValue("Common optimizations"); otherFlags.setEnabled(true, mainComposite); otherFlags.setStringValue(""); }
private void updateFields(String newSelection) { GitDateFormatter.Format format = fromString(newSelection); FormatInfo info = DATA.get(format); formatExplanation.setText(info.explanation); if (format == null) { dateFormat.getTextControl(getFieldEditorParent()).setEnabled(true); dateFormat.setStringValue(lastCustomValue); } else { dateFormat.getTextControl(getFieldEditorParent()).setEnabled(false); dateFormat.setStringValue(info.format); updatePreview(format); } }
@Override public boolean saveProperties(final IProject project) { try { QualifiedName qualifiedName = new QualifiedName( ProjectBuildPropertyData.QUALIFIER, COptimalizationOptionsData.OPTIMIZATION_LEVEL_PROPERTY); String newValue = optimalizationLevel.getActualValue(); String oldValue = project.getPersistentProperty(qualifiedName); if (newValue != null && !newValue.equals(oldValue)) { project.setPersistentProperty(qualifiedName, newValue); } qualifiedName = new QualifiedName( ProjectBuildPropertyData.QUALIFIER, COptimalizationOptionsData.OTHER_OPTIMIZATION_FLAGS_PROPERTY); newValue = otherFlags.getStringValue(); oldValue = project.getPersistentProperty(qualifiedName); if (newValue != null && !newValue.equals(oldValue)) { project.setPersistentProperty(qualifiedName, newValue); } } catch (CoreException e) { ErrorReporter.logExceptionStackTrace(e); return false; } return true; }
@Override public void setEnabled(final boolean enabled) { if (mainComposite == null) { return; } optimalizationLevel.setEnabled(enabled, mainComposite); otherFlags.setEnabled(enabled, mainComposite); }
@Override protected void createFieldEditors() { Text text = null; StringFieldEditor databaseDriverNameField = new StringFieldEditor( CommonParameters.DATABASE_DRIVER_NAME, "&Driver Name:", getFieldEditorParent()); text = databaseDriverNameField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText( CommonParameters.get(CommonParameters.DATABASE_DRIVER_NAME) != null ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_NAME) : DatabasePreferencePage.N_A); addField(databaseDriverNameField); StringFieldEditor databaseMinorVersionField = new StringFieldEditor( CommonParameters.DATABASE_DRIVER_MINOR_VERSION, "&Minor Version:", getFieldEditorParent()); text = databaseMinorVersionField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText( CommonParameters.get(CommonParameters.DATABASE_DRIVER_MINOR_VERSION) != null ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_MINOR_VERSION) : DatabasePreferencePage.N_A); addField(databaseMinorVersionField); StringFieldEditor databaseMajorVersionField = new StringFieldEditor( CommonParameters.DATABASE_DRIVER_MAJOR_VERSION, "&Major Version:", getFieldEditorParent()); text = databaseMajorVersionField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText( CommonParameters.get(CommonParameters.DATABASE_DRIVER_MAJOR_VERSION) != null ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_MAJOR_VERSION) : DatabasePreferencePage.N_A); addField(databaseMajorVersionField); StringFieldEditor databaseConnectionClassNameField = new StringFieldEditor( CommonParameters.DATABASE_CONNECTION_CLASS_NAME, "&Connection Class Name:", getFieldEditorParent()); text = databaseConnectionClassNameField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText( CommonParameters.get(CommonParameters.DATABASE_CONNECTION_CLASS_NAME) != null ? CommonParameters.get(CommonParameters.DATABASE_CONNECTION_CLASS_NAME) : DatabasePreferencePage.N_A); addField(databaseConnectionClassNameField); }
/* * (non-Javadoc) * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() */ @Override protected void createFieldEditors() { // Load up the preference store super.createFieldEditors(); // Add a string editor to edit the tool command Composite parent = getFieldEditorParent(); FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent); commandStringField = new StringFieldEditor(fTool.getId(), Messages.BuildToolSettingsPage_tool_command, parent); commandStringField.setEmptyStringAllowed(false); GridData gd = ((GridData) commandStringField.getTextControl(parent).getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3); addField(commandStringField); // Add a field editor that displays overall build options Composite par = getFieldEditorParent(); allOptionFieldEditor = new MultiLineTextFieldEditor(ToolSettingsPrefStore.ALL_OPTIONS_ID, ALL_OPTIONS, par); allOptionFieldEditor.getTextControl(par).setEditable(false); // gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20); addField(allOptionFieldEditor); addField(createLabelEditor(getFieldEditorParent(), WHITESPACE)); addField( createLabelEditor( getFieldEditorParent(), Messages.BuildToolSettingsPage_tool_advancedSettings)); // Add a string editor to edit the tool command line pattern parent = getFieldEditorParent(); commandLinePatternField = new StringFieldEditor( fTool.getId() + ToolSettingsPrefStore.COMMAND_LINE_SUFFIX, Messages.BuildToolSettingsPage_tool_commandLinePattern, parent); gd = ((GridData) commandLinePatternField.getTextControl(parent).getLayoutData()); gd.grabExcessHorizontalSpace = true; gd.widthHint = Dialog.convertWidthInCharsToPixels(fm, 30); gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20); addField(commandLinePatternField); }
@Override public void dispose() { if (mainComposite != null) { mainComposite.dispose(); mainComposite = null; optimalizationLevel.dispose(); otherFlags.dispose(); } }
@Override public void propertyChange(PropertyChangeEvent event) { // allow superclass to handle as well super.propertyChange(event); if (fInfo instanceof MultiResourceInfo) { MultiResourceInfo mri = (MultiResourceInfo) fInfo; if (event.getSource() == commandStringField) { mri.setToolsCommand(fTool, commandStringField.getStringValue()); updateFields(); } else if (event.getSource() == commandLinePatternField) { mri.setCommandLinePattern(fTool, commandLinePatternField.getStringValue()); } } else { if (event.getSource() == commandStringField) { fTool.setToolCommand(commandStringField.getStringValue()); updateFields(); } else if (event.getSource() == commandLinePatternField) { fTool.setCommandLinePattern(commandLinePatternField.getStringValue()); } } }
public void createFieldEditors() { RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor( MOSKittRedminePreferenceConstants.RedmineAutentication, "Select autentication type on Redmine:", 1, new String[][] { {"Anonymous", MOSKittRedminePreferenceConstants.RedmineAutenticationAnonymous}, { "Personal API Access Key", MOSKittRedminePreferenceConstants.RedmineAutenticationUser } }, getFieldEditorParent()); addField(rgfe); StringFieldEditor sfe = new StringFieldEditor( MOSKittRedminePreferenceConstants.APIAccessKeyUser, "API Access Key", getFieldEditorParent()); sfe.setTextLimit(40); addField(sfe); }
private String getProfileValue() { String userNameValue = userName.getStringValue(); String passwordValue = password.getStringValue(); String urlValue = url.getStringValue(); return userNameValue + "," + passwordValue + "," + urlValue; }
@Override public void setValues() { commandStringField.load(); commandLinePatternField.load(); updateFields(); }
private String[] getProfileNameValue() { String profileNameValue = profileName.getStringValue(); return new String[] {profileNameValue, getProfileValue()}; }
@Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns); getTextControl().setEchoChar('*'); }
@Override protected void createFieldEditors() { String[][] values = new String[DATA.size()][2]; int i = 0; 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); }
private void setTooltip(Composite parent, StringFieldEditor fe, String tooltip) { fe.getLabelControl(parent).setToolTipText(tooltip); fe.getTextControl(parent).setToolTipText(tooltip); }
public void createControl(Composite parent) { setTitle( this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "title", "label", this.m_language)); setDescription( this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "description", "label", this.m_language)); final Composite c = new Composite(parent, SWT.NONE); c.setLayout(new GridLayout(1, false)); c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); BooleanFieldEditor bfe = new BooleanFieldEditor( "activemonitor", this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "activemonitor2", "label", this.m_language), c); bfe.setPropertyChangeListener( new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e != null && e.getNewValue() != null && e.getNewValue() instanceof Boolean) m_active = ((Boolean) e.getNewValue()).booleanValue(); setPageComplete(isComplete()); } }); new Label(c, SWT.LEFT); StringFieldEditor sfe = new StringFieldEditor( "boxip", this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "boxip", "label", this.m_language), c); sfe.setStringValue("fritz.box"); this.m_boxip = "fritz.box"; sfe.setPropertyChangeListener( new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String) m_boxip = (String) e.getNewValue(); setPageComplete(isComplete()); } }); ComboFieldEditor mode = new ComboFieldEditor( "boxloginmode", this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "boxloginmode", "label", this.m_language), new String[][] { { this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "userpassword", "label", this.m_language), "0" }, { this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "password_only", "label", this.m_language), "1" } }, c); final StringFieldEditor sfe1 = new StringFieldEditor( "boxuser", this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "boxuser", "label", this.m_language), c); sfe1.setStringValue(""); this.m_boxuser = ""; mode.setPropertyChangeListener( new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String) { String state = (String) e.getNewValue(); if (state.equalsIgnoreCase("1")) { sfe1.setEnabled(false, c); sfe1.setStringValue(""); sfe1.getTextControl(c) .setBackground(new Color(DisplayManager.getDefaultDisplay(), 190, 190, 190)); m_boxuser = ""; } else { sfe1.setEnabled(true, c); sfe1.getTextControl(c) .setBackground(new Color(DisplayManager.getDefaultDisplay(), 255, 255, 255)); } } } }); sfe1.setPropertyChangeListener( new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String) m_boxuser = (String) e.getNewValue(); setPageComplete(isComplete()); } }); sfe = new StringFieldEditor( "boxpassword", this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "boxpassword", "label", this.m_language), c); sfe.getTextControl(c).setEchoChar('*'); sfe.setStringValue(""); this.m_boxpassword = ""; sfe.setPropertyChangeListener( new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String) m_boxpassword = (String) e.getNewValue(); setPageComplete(isComplete()); } }); new Label(c, SWT.LEFT); Text l = new Text(c, SWT.LEFT | SWT.WRAP); l.setText( this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "openfb", "label", this.m_language)); l.setEditable(false); l.setBackground(parent.getBackground()); new Label(c, SWT.LEFT); HyperLink hl = new HyperLink(c, SWT.LEFT | SWT.WRAP); hl.setText( this.m_i18n.getString( "ui.jface.configuration.pages.FritzBoxVoip", "openfb2", "label", this.m_language)); hl.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) Program.launch("http://www.janrufmonitor.de/fritzbox-freischalten"); } }); setPageComplete(isComplete()); setControl(c); }