List of usage examples for org.eclipse.jface.resource JFaceResources TEXT_FONT
String TEXT_FONT
To view the source code for org.eclipse.jface.resource JFaceResources TEXT_FONT.
Click Source Link
"org.eclipse.jface.textfont"
). From source file:net.sf.solareclipse.xml.internal.ui.preferences.CSSSyntaxPreferencePage.java
License:Open Source License
private Control createPreviewer(Composite parent) { cssTextTools = new CSSTextTools(overlay); preview = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); preview.configure(new CSSConfiguration(cssTextTools)); preview.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)); preview.setEditable(false);// www .j a va 2 s . c o m initializeViewerColors(preview); String content = loadPreviewContentFromFile("preview.css"); //$NON-NLS-1$ IDocument document = new Document(content); IDocumentPartitioner partitioner = cssTextTools.createCSSPartitioner(); partitioner.connect(document); document.setDocumentPartitioner(partitioner); preview.setDocument(document); overlay.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { String p = event.getProperty(); if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND) || p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) { initializeViewerColors(preview); } preview.invalidateTextPresentation(); } }); return preview.getControl(); }
From source file:net.sf.solareclipse.xml.internal.ui.preferences.XMLSyntaxPreferencePage.java
License:Open Source License
private Control createPreviewer(Composite parent) { xmlTextTools = new XMLTextTools(overlay); // REVISIT: DTD preview = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); preview.configure(new XMLConfiguration(xmlTextTools)); preview.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)); preview.setEditable(false);/*from w ww .j a va 2 s . co m*/ initializeViewerColors(preview); String content = loadPreviewContentFromFile("preview.xml"); //$NON-NLS-1$ IDocument document = new Document(content); IDocumentPartitioner partitioner = xmlTextTools.createXMLPartitioner(); // REVISIT: DTD partitioner.connect(document); document.setDocumentPartitioner(partitioner); preview.setDocument(document); overlay.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { String p = event.getProperty(); if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND) || p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) { initializeViewerColors(preview); } preview.invalidateTextPresentation(); } }); return preview.getControl(); }
From source file:net.sf.solareclipse.xml.internal.ui.preferences.XMLSyntaxPreferencePage.java
License:Open Source License
public static void initializeDefaultPreferences(IPreferenceStore store) { // REVISIT: start of common preferences PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB()); store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, true); PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()); store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true); Bundle plugin = Platform.getBundle("org.eclipse.ui.editors"); //$NON-NLS-1$ if (plugin instanceof AbstractUIPlugin) { AbstractUIPlugin uiPlugin = (AbstractUIPlugin) plugin; IPreferenceStore uiStore = uiPlugin.getPreferenceStore(); if (uiStore != null) { Set keys = new HashSet( Arrays.asList(new String[] { AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END, AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, // AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION, // AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR, // AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, })); Iterator i = new MarkerAnnotationPreferences().getAnnotationPreferences().iterator(); while (i.hasNext()) { AnnotationPreference info = (AnnotationPreference) i.next(); keys.add(info.getColorPreferenceKey()); keys.add(info.getTextPreferenceKey()); keys.add(info.getOverviewRulerPreferenceKey()); }//from w ww . j ava 2s . c om ChainedPreferenceStore.startPropagating(uiStore, store, keys); } } // WorkbenchChainedTextFontFieldEditor // .startPropagate(store, JFaceResources.TEXT_FONT); plugin = Platform.getBundle("org.eclipse.ui.workbench"); //$NON-NLS-1$ if (plugin instanceof AbstractUIPlugin) { AbstractUIPlugin uiPlugin = (AbstractUIPlugin) plugin; IPreferenceStore uiStore = uiPlugin.getPreferenceStore(); if (uiStore != null) { ChainedPreferenceStore.startPropagating(uiStore, store, new String[] { JFaceResources.TEXT_FONT }); } } // store.setDefault( // DefaultSourceViewerConfiguration.PREFERENCE_TAB_WIDTH, 4); // REVISIT: end of common preferences setDefault(store, IXMLSyntaxConstants.XML_DEFAULT, "0,0,0", ITextStylePreferences.STYLE_NORMAL); setDefault(store, IXMLSyntaxConstants.XML_TAG, "127,0,127", ITextStylePreferences.STYLE_NORMAL); setDefault(store, IXMLSyntaxConstants.XML_ATT_NAME, "0,127,0", ITextStylePreferences.STYLE_NORMAL); setDefault(store, IXMLSyntaxConstants.XML_ATT_VALUE, "0,0,255", ITextStylePreferences.STYLE_NORMAL); setDefault(store, IXMLSyntaxConstants.XML_ENTITY, "127,127,0", ITextStylePreferences.STYLE_NORMAL); setDefault(store, IXMLSyntaxConstants.XML_CDATA, "127,127,0", ITextStylePreferences.STYLE_NORMAL); setDefault(store, IXMLSyntaxConstants.XML_PI, "127,127,127", ITextStylePreferences.STYLE_BOLD); setDefault(store, IXMLSyntaxConstants.XML_COMMENT, "127,0,0", ITextStylePreferences.STYLE_NORMAL); setDefault(store, IXMLSyntaxConstants.XML_DECL, "127,0,127", ITextStylePreferences.STYLE_BOLD); setDefault(store, IXMLSyntaxConstants.DTD_CONDITIONAL, "127,127,0", ITextStylePreferences.STYLE_BOLD); }
From source file:org.antlr.eclipse.ui.editor.AntlrOverview.java
License:Open Source License
public AntlrOverview(final Composite aParent) { super(aParent, null, SWT.V_SCROLL | SWT.H_SCROLL); EditorEnvironment.connect();//from ww w . j a v a2 s.c o m // Configure source viewer configure(new AntlrConfiguration(null)); getTextWidget().setEditable(false); getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)); // Create document with attached partitioner IDocument document = new Document(); IDocumentPartitioner partitioner = new DefaultPartitioner(new PartitionScanner(), PartitionScanner.PARTITION_TYPES); partitioner.connect(document); document.setDocumentPartitioner(partitioner); // Attach document to source viewer AFTER configuring source viewer // Otherwise syntax highlighting will not work setDocument(document); }
From source file:org.apache.directory.studio.aciitemeditor.widgets.ACIItemSourceEditorComposite.java
License:Apache License
/** * Creates and configures the source editor. * *///from ww w . j a va 2 s.co m private void createSourceEditor() { // create source editor sourceEditor = new SourceViewer(this, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); sourceEditor.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // setup basic configuration configuration = new ACISourceViewerConfiguration(); sourceEditor.configure(configuration); // set text font Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); sourceEditor.getTextWidget().setFont(font); // setup document IDocument document = new Document(); sourceEditor.setDocument(document); }
From source file:org.apache.directory.studio.connection.ui.widgets.CertificateInfoComposite.java
License:Apache License
/** * Creates the details tab.//from w ww.j av a 2 s . c o m */ private void createDetailsTab() { SashForm detailsForm = new SashForm(tabFolder, SWT.VERTICAL); detailsForm.setLayout(new FillLayout()); Composite hierarchyContainer = new Composite(detailsForm, SWT.NONE); GridLayout hierarchyLayout = new GridLayout(1, false); hierarchyLayout.marginTop = 10; hierarchyLayout.marginWidth = 10; hierarchyContainer.setLayout(hierarchyLayout); BaseWidgetUtils.createLabel(hierarchyContainer, Messages.getString("CertificateInfoComposite.CertificateHierarchyLabel"), 1); //$NON-NLS-1$ hierarchyTreeViewer = new TreeViewer(hierarchyContainer); hierarchyTreeViewer.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); hierarchyTreeViewer.setContentProvider(new HierarchyContentProvider()); hierarchyTreeViewer.setLabelProvider(new HierarchyLabelProvider()); hierarchyTreeViewer.addSelectionChangedListener(event -> populateCertificateTree()); Composite certificateContainer = new Composite(detailsForm, SWT.NONE); GridLayout certificateLayout = new GridLayout(1, false); certificateLayout.marginWidth = 10; certificateContainer.setLayout(certificateLayout); BaseWidgetUtils.createLabel(certificateContainer, Messages.getString("CertificateInfoComposite.CertificateFieldsLabel"), 1); //$NON-NLS-1$ certificateTree = new Tree(certificateContainer, SWT.BORDER); certificateTree.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); certificateTree.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { TreeItem item = (TreeItem) event.item; if ((item == null) || (item.getData() == null)) { valueText.setText(StringUtils.EMPTY); } else { valueText.setText(item.getData().toString()); } } }); Composite valueContainer = new Composite(detailsForm, SWT.NONE); GridLayout valueLayout = new GridLayout(1, false); valueLayout.marginWidth = 10; valueLayout.marginBottom = 10; valueContainer.setLayout(valueLayout); BaseWidgetUtils.createLabel(valueContainer, Messages.getString("CertificateInfoComposite.FieldValuesLabel"), //$NON-NLS-1$ 1); valueText = new Text(valueContainer, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); valueText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); valueText.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); valueText.setBackground(detailsForm.getBackground()); // create tab detailsForm.setWeights(new int[] { 1, 2, 1 }); TabItem detailsTab = new TabItem(tabFolder, SWT.NONE, DETAILS_TAB_INDEX); detailsTab.setText(Messages.getString("CertificateInfoComposite.Details")); //$NON-NLS-1$ detailsTab.setControl(detailsForm); }
From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.HexDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *///from w ww . j av a 2 s . com protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); hexText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); hexText.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); hexText.setText(toFormattedHex(currentData)); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertHorizontalDLUsToPixels((int) (IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH * 1.4)); gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2); hexText.setLayoutData(gd); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.ldapbrowser.ui.dialogs.properties.ValuePropertyPage.java
License:Apache License
/** * {@inheritDoc}/*from w ww . j a va2 s . c o m*/ */ protected Control createContents(Composite parent) { IValue value = getValue(getElement()); Composite composite = BaseWidgetUtils.createColumnContainer(parent, 1, 1); Composite mainGroup = BaseWidgetUtils.createColumnContainer(composite, 2, 1); BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.AttributeDescription"), 1); //$NON-NLS-1$ descriptionText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.ValueType"), 1); //$NON-NLS-1$ typeText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.ValueSize"), 1); //$NON-NLS-1$ sizeText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.Data"), 1); //$NON-NLS-1$ if (value != null && value.isString()) { valueText = new Text(mainGroup, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); valueText.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertHorizontalDLUsToPixels((int) (IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2)); gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 4); valueText.setLayoutData(gd); valueText.setBackground(parent.getBackground()); } else { valueText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ } if (value != null) { super.setMessage(Messages.getString("ValuePropertyPage.Value") //$NON-NLS-1$ + org.apache.directory.studio.connection.core.Utils.shorten(value.toString(), 30)); descriptionText.setText(value.getAttribute().getDescription()); // valueText.setText(LdifUtils.mustEncode(value.getBinaryValue())?"Binary":value.getStringValue()); valueText.setText( value.isString() ? value.getStringValue() : Messages.getString("ValuePropertyPage.Binary")); //$NON-NLS-1$ typeText.setText(value.isString() ? Messages.getString("ValuePropertyPage.String") //$NON-NLS-1$ : Messages.getString("ValuePropertyPage.Binary")); //$NON-NLS-1$ int bytes = value.getBinaryValue().length; int chars = value.isString() ? value.getStringValue().length() : 0; String size = value.isString() ? chars + (chars > 1 ? Messages.getString("ValuePropertyPage.Characters") //$NON-NLS-1$ : Messages.getString("ValuePropertyPage.Character")) : ""; //$NON-NLS-1$ //$NON-NLS-2$ size += Utils.formatBytes(bytes); sizeText.setText(size); } return parent; }
From source file:org.apache.directory.studio.ldifeditor.widgets.LdifEditorWidget.java
License:Apache License
/** * Creates the widget./*w w w . j a v a 2 s . com*/ * * @param parent the parent */ public void createWidget(Composite parent) { composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); // create source viewer // sourceViewer = new ProjectionViewer(parent, ruler, // getOverviewRuler(), true, styles); sourceViewer = new SourceViewer(composite, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); sourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); // configure sourceViewerConfiguration = new LdifSourceViewerConfiguration(this, this.contentAssistEnabled); sourceViewer.configure(sourceViewerConfiguration); // set font Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); sourceViewer.getTextWidget().setFont(font); // setup document try { editorInput = new NonExistingLdifEditorInput(); documentProvider = new LdifDocumentProvider(); documentProvider.connect(editorInput); IDocument document = documentProvider.getDocument(editorInput); document.set(initialLdif); sourceViewer.setDocument(document); } catch (CoreException e) { e.printStackTrace(); } // listener sourceViewer.addTextListener(this); // focus sourceViewer.getControl().setFocus(); }
From source file:org.apache.directory.studio.openldap.config.acl.widgets.OpenLdapAclSourceEditorComposite.java
License:Apache License
/** * Creates and configures the source editor. * *///from w ww. ja va 2 s.c om private void createSourceEditor() { // create source editor sourceEditor = new SourceViewer(this, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); // setup basic configuration configuration = new OpenLdapAclSourceViewerConfiguration(); sourceEditor.configure(configuration); // set text font Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); sourceEditor.getTextWidget().setFont(font); // setup document IDocument document = new Document(); sourceEditor.setDocument(document); }