List of usage examples for org.eclipse.jface.preference FontFieldEditor FontFieldEditor
public FontFieldEditor(String name, String labelText, Composite parent)
From source file:ca.mcgill.cs.swevo.qualyzer.QualyzerPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(IQualyzerPreferenceConstants.DEFAULT_INVESTIGATOR, Messages.getString("QualyzerPreferencePage.defaultName"), getFieldEditorParent())); //$NON-NLS-1$ addField(new ColorFieldEditor(IQualyzerPreferenceConstants.FRAGMENT_COLOR, Messages.getString("QualyzerPreferencePage.fragmentColor"), getFieldEditorParent())); //$NON-NLS-1$ addField(new IntegerFieldEditor(IQualyzerPreferenceConstants.SEEK_TIME, Messages.getString("QualyzerPreferencePage.seekTime"), getFieldEditorParent())); //$NON-NLS-1$ addField(new FontFieldEditor(IQualyzerPreferenceConstants.FONT, Messages.getString("QualyzerPreferencePage.font"), getFieldEditorParent())); //$NON-NLS-1$ }
From source file:com.android.ide.eclipse.ddms.preferences.LogCatPreferencePage.java
License:Apache License
@Override protected void createFieldEditors() { FontFieldEditor ffe = new FontFieldEditor(LogCatPanel.LOGCAT_VIEW_FONT_PREFKEY, Messages.LogCatPreferencePage_Display_Font, getFieldEditorParent()); addField(ffe);/*from w w w .j a v a 2 s. c o m*/ mMaxMessages = new IntegerFieldEditor(LogCatMessageList.MAX_MESSAGES_PREFKEY, Messages.LogCatPreferencePage_MaxMessages, getFieldEditorParent()); addField(mMaxMessages); mAutoScrollLock = new BooleanFieldEditor(LogCatPanel.AUTO_SCROLL_LOCK_PREFKEY, "Automatically enable/disable scroll lock based on the scrollbar position", getFieldEditorParent()); addField(mAutoScrollLock); createHorizontalSeparator(); if (InstallDetails.isAdtInstalled()) { createAdtSpecificFieldEditors(); } }
From source file:com.github.picologger.eclipse.syslogcat.preference.LogCatPreferencePage.java
License:Apache License
@Override protected void createFieldEditors() { FontFieldEditor ffe = new FontFieldEditor(PreferenceInitializer.ATTR_LOGCAT_FONT, "Display Font:", getFieldEditorParent());/* w ww .j a va 2 s.co m*/ addField(ffe); Preferences prefs = SyslogPlugin.getDefault().getPluginPreferences(); prefs.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { // get the name of the property that changed. String property = event.getProperty(); if (PreferenceInitializer.ATTR_LOGCAT_FONT.equals(property)) { try { FontData fdat = new FontData((String) event.getNewValue()); LogCatView.setFont(new Font(getFieldEditorParent().getDisplay(), fdat)); } catch (IllegalArgumentException e) { // Looks like the data from the store is not valid. // We do nothing (default font will be used). } catch (SWTError e2) { // Looks like the Font() constructor failed. // We do nothing in this case, the logcat view will use the default font. } } } }); }
From source file:com.safi.workshop.sqlexplorer.preferences.SQLPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { try {/* w w w .j av a 2 s. c o m*/ // Font picker fontFieldEditor = new FontFieldEditor(IConstants.FONT, Messages.getString("Text_Font__3"), getFieldEditorParent()); addField(fontFieldEditor); /* * Text Properties group */ Group colorGroup = new Group(getFieldEditorParent(), SWT.NULL); colorGroup.setLayout(new GridLayout()); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; colorGroup.setLayoutData(gd); colorGroup.setText(Messages.getString("Text_Properties_6")); Composite editorComposite = new Composite(colorGroup, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; editorComposite.setLayout(layout); gd = new GridData(GridData.FILL_BOTH); editorComposite.setLayoutData(gd); final List syntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = convertHeightInCharsToPixels(5); syntaxColorList.setLayoutData(gd); for (Highlight highlight : highlights) syntaxColorList.add(highlight.caption); Composite stylesComposite = new Composite(editorComposite, SWT.NONE); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.numColumns = 2; stylesComposite.setLayout(layout); stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label label = new Label(stylesComposite, SWT.LEFT); label.setText(Messages.getString("Color_9")); gd = new GridData(); gd.horizontalAlignment = GridData.BEGINNING; label.setLayoutData(gd); final ColorEditor syntaxForegroundColorEditor = new ColorEditor(stylesComposite); Button foregroundColorButton = syntaxForegroundColorEditor.getButton(); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; foregroundColorButton.setLayoutData(gd); foregroundColorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int i = syntaxColorList.getSelectionIndex(); PreferenceConverter.setValue(getPreferenceStore(), highlights[i].id, syntaxForegroundColorEditor.getColorValue()); } }); final Button boldCheckBox = new Button(stylesComposite, SWT.CHECK); boldCheckBox.setText(Messages.getString("Bold_10")); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 2; boldCheckBox.setLayoutData(gd); boldCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int i = syntaxColorList.getSelectionIndex(); getPreferenceStore().setValue(highlights[i].id + BOLD, boldCheckBox.getSelection()); } }); syntaxColorList.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int i = syntaxColorList.getSelectionIndex(); if (i > -1) { boldCheckBox.setSelection(getPreferenceStore().getBoolean(highlights[i].id + BOLD)); syntaxForegroundColorEditor.setColorValue( PreferenceConverter.getColor(getPreferenceStore(), highlights[i].id)); } } }); /* * Preview group */ Group previewGroup = new Group(getFieldEditorParent(), SWT.NULL); previewGroup.setLayout(new GridLayout()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; previewGroup.setLayoutData(gd); previewGroup.setText(Messages.getString("Preview_7")); Control previewer = createPreviewer(previewGroup); gd = new GridData(GridData.FILL_BOTH); previewer.setLayoutData(gd); /* * Export To Clipboard group */ Group exportGroup = new Group(getFieldEditorParent(), SWT.NULL); exportGroup.setLayout(new GridLayout()); exportGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); exportGroup.setText(Messages.getString("Export_to_Clipboard_1")); Label lbt1 = new Label(exportGroup, SWT.NULL); lbt1.setText("Separator"); final Button semiColon = new Button(exportGroup, SWT.RADIO); semiColon.setText(";"); final Button pipe = new Button(exportGroup, SWT.RADIO); pipe.setText("|"); final Button tab = new Button(exportGroup, SWT.RADIO); tab.setText("\\t [TAB]"); addAccessor(new Accessor() { public void load() { String value = getPreferenceStore().getString(IConstants.CLIP_EXPORT_SEPARATOR); if (value == null || value.length() < 1) value = ";"; loadValue(value.charAt(0)); } public void loadDefaults() { String value = getPreferenceStore().getDefaultString(IConstants.CLIP_EXPORT_SEPARATOR); if (value == null || value.length() < 1) value = ";"; loadValue(value.charAt(0)); } private void loadValue(char c) { semiColon.setSelection(c == ';'); pipe.setSelection(c == '|'); tab.setSelection(c == '\t'); } public void store() { String separator; if (semiColon.getSelection()) separator = ";"; else if (semiColon.getSelection()) separator = "|"; else separator = "\t"; getPreferenceStore().setValue(IConstants.CLIP_EXPORT_SEPARATOR, separator); } }); addField(new BooleanFieldEditor(IConstants.CLIP_EXPORT_COLUMNS, "Export column names", exportGroup)); } catch (Exception e) { SQLExplorerPlugin.error("Could not create SQL preference page", e); throw new RuntimeException(e); } }
From source file:com.vectrace.MercurialEclipse.ui.SWTWidgetHelper.java
License:Open Source License
/** * @param prefHistoryMergeChangesetFont//from ww w. ja v a2s . co m * @param string * @param g * @param historyPreferencePage * @param preferenceStore * @return */ public static FieldEditor createFontFieldEditor(String pref, String label, Composite parent, DialogPage page, IPreferenceStore preferenceStore) { FontFieldEditor editor = new FontFieldEditor(pref, label, parent); editor.setPage(page); editor.setPreferenceStore(preferenceStore); return editor; }
From source file:de.anbos.eclipse.logviewer.plugin.preferences.LogViewerPreferences.java
License:Apache License
private void createFontSettings(Composite composite) { Composite panel = new Composite(composite, SWT.NULL); GridLayout layout = new GridLayout(); layout.marginWidth = 0;//from www . j a v a 2 s. co m layout.marginHeight = 0; layout.numColumns = 4; panel.setLayout(layout); GridData data = new GridData(); data.horizontalSpan = 2; data.grabExcessHorizontalSpace = true; data.horizontalAlignment = SWT.CENTER; panel.setLayoutData(data); fontTypeEditor = new FontFieldEditor(ILogViewerConstants.PREF_EDITOR_FONT_STYLE, LogViewerPlugin.getResourceString("preferences.contenteditor.font.style.text"), panel); //$NON-NLS-1$ fontTypeEditor.setChangeButtonText( LogViewerPlugin.getResourceString("preferences.contenteditor.fontl.style.button.text")); //$NON-NLS-1$ fontTypeEditor.setPreferenceStore(doGetPreferenceStore()); fontTypeEditor.fillIntoGrid(panel, 3); fontTypeEditor.setPage(this); fontTypeEditor.load(); }
From source file:edu.buffalo.cse.green.preferences.GreenPreferencePageColors.java
License:Open Source License
/** * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() *//*from w w w . ja v a 2 s .c om*/ public void createFieldEditors() { addField(new FontFieldEditor(P_FONT, "Font", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_SELECTED, "Selected Item", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_UML, "UML Boxes", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_TYPE_BORDER, "Type Borders", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_TYPE_BORDER_HIDDENR, "Type Borders (with hidden relationships)", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_TYPE_TEXT, "Type Text", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_COMPARTMENT_BORDER, "Compartment Borders", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_NOTE, "Notes", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_NOTE_BORDER, "Note Borders", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_NOTE_TEXT, "Note Text", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_REL_ARROW_FILL, "Relationship Arrow Heads", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_REL_LINE, "Relationships", getFieldEditorParent())); addField(new ColorFieldEditor(P_COLOR_REL_TEXT, "Relationship Text", getFieldEditorParent())); adjustGridLayout(); }
From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.preferences.WorkbenchPreferenceR.java
License:Open Source License
public void createFieldEditors() { addField(new ColorFieldEditor("colourkey", "Colour Keywords:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey1", "Colour Type:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont1", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey2", "Colour String:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont2", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey3", "Colour Single Comment:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont3", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey4", "Colour Default:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont4", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey5", "Operators:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont5", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey6", "Braces:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont6", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey7", "Numbers:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont7", "Font:", getFieldEditorParent())); addField(new ColorFieldEditor("colourkey8", "Assignment:", getFieldEditorParent())); addField(new FontFieldEditor("colourkeyfont8", "Font:", getFieldEditorParent())); }
From source file:net.sourceforge.sqlexplorer.preferences.SQLPreferencePage.java
License:Open Source License
protected void createFieldEditors() { try {/*from ww w. j a v a 2 s . com*/ // Font picker fontFieldEditor = new FontFieldEditor(IConstants.FONT, Messages.getString("Text_Font__3"), getFieldEditorParent()); // MOD by zshen for bug 12046,save the font size. fontFieldEditor.setPreferenceStore(getPreferenceStore()); addField(fontFieldEditor); // ~12046 /* * Text Properties group */ Group colorGroup = new Group(getFieldEditorParent(), SWT.NULL); colorGroup.setLayout(new GridLayout()); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; colorGroup.setLayoutData(gd); colorGroup.setText(Messages.getString("Text_Properties_6")); Composite editorComposite = new Composite(colorGroup, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; editorComposite.setLayout(layout); gd = new GridData(GridData.FILL_BOTH); editorComposite.setLayoutData(gd); final List syntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = convertHeightInCharsToPixels(5); syntaxColorList.setLayoutData(gd); for (int i = 0; i < highlights.length; i++) syntaxColorList.add(highlights[i].caption); Composite stylesComposite = new Composite(editorComposite, SWT.NONE); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.numColumns = 2; stylesComposite.setLayout(layout); stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label label = new Label(stylesComposite, SWT.LEFT); label.setText(Messages.getString("Color_9")); gd = new GridData(); gd.horizontalAlignment = GridData.BEGINNING; label.setLayoutData(gd); final ColorEditor syntaxForegroundColorEditor = new ColorEditor(stylesComposite); Button foregroundColorButton = syntaxForegroundColorEditor.getButton(); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; foregroundColorButton.setLayoutData(gd); foregroundColorButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int i = syntaxColorList.getSelectionIndex(); if (i >= 0) {// text attribute List has been select. PreferenceConverter.setValue(getPreferenceStore(), highlights[i].id, syntaxForegroundColorEditor.getColorValue()); } } }); final Button boldCheckBox = new Button(stylesComposite, SWT.CHECK); boldCheckBox.setText(Messages.getString("Bold_10")); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 2; boldCheckBox.setLayoutData(gd); boldCheckBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int i = syntaxColorList.getSelectionIndex(); getPreferenceStore().setValue(highlights[i].id + BOLD, boldCheckBox.getSelection()); } }); syntaxColorList.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int i = syntaxColorList.getSelectionIndex(); if (i > -1) { boldCheckBox.setSelection(getPreferenceStore().getBoolean(highlights[i].id + BOLD)); syntaxForegroundColorEditor.setColorValue( PreferenceConverter.getColor(getPreferenceStore(), highlights[i].id)); } } }); /* * Preview group */ Group previewGroup = new Group(getFieldEditorParent(), SWT.NULL); previewGroup.setLayout(new GridLayout()); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; previewGroup.setLayoutData(gd); previewGroup.setText(Messages.getString("Preview_7")); Control previewer = createPreviewer(previewGroup); gd = new GridData(GridData.FILL_BOTH); previewer.setLayoutData(gd); /* * Export To Clipboard group */ Group exportGroup = new Group(getFieldEditorParent(), SWT.NULL); exportGroup.setLayout(new GridLayout()); exportGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); exportGroup.setText(Messages.getString("Export_to_Clipboard_1")); Label lbt1 = new Label(exportGroup, SWT.NULL); lbt1.setText("Separator"); final Button semiColon = new Button(exportGroup, SWT.RADIO); semiColon.setText(";"); final Button pipe = new Button(exportGroup, SWT.RADIO); pipe.setText("|"); final Button tab = new Button(exportGroup, SWT.RADIO); tab.setText("\\t [TAB]"); addAccessor(new Accessor() { public void load() { String value = getPreferenceStore().getString(IConstants.CLIP_EXPORT_SEPARATOR); if (value == null || value.length() < 1) value = ";"; loadValue(value.charAt(0)); } public void loadDefaults() { String value = getPreferenceStore().getDefaultString(IConstants.CLIP_EXPORT_SEPARATOR); if (value == null || value.length() < 1) value = ";"; loadValue(value.charAt(0)); } private void loadValue(char c) { semiColon.setSelection(c == ';'); pipe.setSelection(c == '|'); tab.setSelection(c == '\t'); } public void store() { String separator; if (semiColon.getSelection()) separator = ";"; else if (semiColon.getSelection()) separator = "|"; else separator = "\t"; getPreferenceStore().setValue(IConstants.CLIP_EXPORT_SEPARATOR, separator); } }); addField(new BooleanFieldEditor(IConstants.CLIP_EXPORT_COLUMNS, "Export column names", exportGroup)); } catch (Exception e) { SQLExplorerPlugin.error("Could not create SQL preference page", e); throw new RuntimeException(e); } }
From source file:org.eclipse.ecf.internal.example.collab.ui.ClientPreferencePage.java
License:Open Source License
public void createFieldEditors() { addField(new BooleanFieldEditor(ClientPlugin.PREF_USE_CHAT_WINDOW, Messages.ClientPreferencePage_USE_CHAT_WINDOW_FIELD_TEXT, getFieldEditorParent())); addField(new BooleanFieldEditor(ClientPlugin.PREF_DISPLAY_TIMESTAMP, Messages.ClientPreferencePage_SHOW_TIME_FOR_CHAT_FIELD, getFieldEditorParent())); addField(new FontFieldEditor(ClientPlugin.PREF_CHAT_FONT, Messages.ClientPreferencePage_CHAT_WINDOW_FONT_FIELD, getFieldEditorParent())); // addField(new // BooleanFieldEditor(ClientPlugin.PREF_CONFIRM_FILE_RECEIVE, "Confirm // before receiving file.", getFieldEditorParent())); // addField(new SpacerFieldEditor( // getFieldEditorParent())); addField(new ColorFieldEditor(ClientPlugin.PREF_ME_TEXT_COLOR, Messages.ClientPreferencePage_CHAT_COLOR_FOR_ME_FIELD, getFieldEditorParent())); addField(new ColorFieldEditor(ClientPlugin.PREF_OTHER_TEXT_COLOR, Messages.ClientPreferencePage_CHAT_TEXT_COLOR_FOR_OTHER_FIELD, getFieldEditorParent())); addField(new ColorFieldEditor(ClientPlugin.PREF_SYSTEM_TEXT_COLOR, Messages.ClientPreferencePage_CHAT_COLOR_FOR_SYSTEM_FIELD, getFieldEditorParent())); addField(new SpacerFieldEditor(getFieldEditorParent())); playImmediate = new BooleanFieldEditor(ClientPlugin.PREF_SHAREDEDITOR_PLAY_EVENTS_IMMEDIATELY, Messages.ClientPreferencePage_PLAY_EDITOR_EVENTS_IMMEDIATELY, getFieldEditorParent()); addField(playImmediate);/*www.jav a2s. c om*/ askParent = getFieldEditorParent(); ask = new BooleanFieldEditor(ClientPlugin.PREF_SHAREDEDITOR_ASK_RECEIVER, Messages.ClientPreferencePage_ASK_RECEIVER_FOR_PERMISSION, askParent); addField(ask); boolean val = getPreferenceStore().getBoolean(ClientPlugin.PREF_SHAREDEDITOR_PLAY_EVENTS_IMMEDIATELY); ask.setEnabled(val, askParent); }