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:org.kalypso.ui.editor.diagrameditor.actions.EditDiagCurveDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) *///from w w w . j a v a 2s.c o m @Override protected Control createDialogArea(final Composite parent) { setTitle(Messages.getString("org.kalypso.ui.editor.diagrameditor.actions.EditDiagCurveDialog.2")); //$NON-NLS-1$ setMessage(Messages.getString("org.kalypso.ui.editor.diagrameditor.actions.EditDiagCurveDialog.3")); //$NON-NLS-1$ final Group composite = new Group(parent, SWT.NONE); composite.setLayout(new GridLayout(3, false)); // composite.setText( "Eigenschaften" ); // Also set layoutData as it is not set by parent. Maybe fixed in 3.3? composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // Name final Label nameLabel = new Label(composite, SWT.NONE); nameLabel.setText(Messages.getString("org.kalypso.ui.editor.diagrameditor.actions.EditDiagCurveDialog.4")); //$NON-NLS-1$ final Text nameText = new Text(composite, SWT.BORDER); final GridData nameData = new GridData(SWT.FILL, SWT.CENTER, true, false); nameData.horizontalSpan = 2; nameText.setLayoutData(nameData); // Color final Label colorLabel = new Label(composite, SWT.NONE); colorLabel.setText(Messages.getString("org.kalypso.ui.editor.diagrameditor.actions.EditDiagCurveDialog.5")); //$NON-NLS-1$ final Button colorButton = new Button(composite, SWT.PUSH); final GridData colorData = new GridData(SWT.FILL, SWT.CENTER, true, false); colorButton.setLayoutData(colorData); final Scale alphaSlider = new Scale(composite, SWT.HORIZONTAL); final GridData alphaData = new GridData(SWT.FILL, SWT.CENTER, true, false); alphaData.widthHint = 150; alphaSlider.setLayoutData(alphaData); alphaSlider.setIncrement(1); alphaSlider.setMinimum(0); alphaSlider.setMaximum(255); alphaSlider.setPageIncrement(20); // Stroke final Label sizeLabel = new Label(composite, SWT.NONE); sizeLabel.setText(Messages.getString("org.kalypso.ui.editor.diagrameditor.actions.EditDiagCurveDialog.6")); //$NON-NLS-1$ final ComboViewer dashCombo = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY); dashCombo.getControl().setFont(composite.getDisplay().getSystemFont()); final GridData dashData = new GridData(SWT.FILL, SWT.CENTER, true, false); dashCombo.getCombo().setLayoutData(dashData); // Better would be some fixed-sized font, but what is the best way to find it? final Font comboFont = JFaceResources.getFont(JFaceResources.TEXT_FONT); dashCombo.getCombo().setFont(comboFont); dashCombo.setLabelProvider(new DashTypeLabelProvider()); dashCombo.setContentProvider(new ArrayContentProvider()); dashCombo.setInput(DashType.KNOWN_DASHS); final Scale sizeSlider = new Scale(composite, SWT.HORIZONTAL); final GridData sizeData = new GridData(SWT.FILL, SWT.CENTER, true, false); sizeData.widthHint = 150; sizeSlider.setLayoutData(sizeData); sizeSlider.setIncrement(1); sizeSlider.setMinimum(1); sizeSlider.setMaximum(10); sizeSlider.setPageIncrement(5); // hook-listeners nameText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { handleNameTextModified(nameText); updateControl(nameText, colorButton, sizeSlider, dashCombo, alphaSlider); } }); colorButton.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(final SelectionEvent e) { handleColorButtonSelected(); updateControl(nameText, colorButton, sizeSlider, dashCombo, alphaSlider); } }); colorButton.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { if (colorButton.getImage() != null) colorButton.getImage().dispose(); } }); alphaSlider.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(final SelectionEvent e) { handleAlphaSliderSelected(alphaSlider); updateControl(nameText, colorButton, sizeSlider, dashCombo, alphaSlider); } }); sizeSlider.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(final SelectionEvent e) { handleSizeSliderSelected(sizeSlider); updateControl(nameText, colorButton, sizeSlider, dashCombo, alphaSlider); } }); dashCombo.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { handleTypeSelectionChanged((IStructuredSelection) event.getSelection()); updateControl(nameText, colorButton, sizeSlider, dashCombo, alphaSlider); } }); // Initalize controls if (m_name == NAME_UNDEF) nameText.setEditable(false); else nameText.setText(m_name); if (m_color == LineProperties.COLOR_UNDEF) { } else alphaSlider.setSelection(m_alpha); if (m_size != LineProperties.SIZE_UNDEF) sizeSlider.setSelection(m_size.intValue()); dashCombo.setSelection(new StructuredSelection(m_dash)); updateControl(nameText, colorButton, sizeSlider, dashCombo, alphaSlider); return super.createDialogArea(parent); }
From source file:org.melanee.ocl.service.console.consoles.LMLOCLConsolePage.java
License:Open Source License
@Override public void createControl(Composite parent) { page = new SashForm(parent, SWT.VERTICAL | SWT.LEFT_TO_RIGHT); output = new TextViewer(page, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); output.getTextWidget().setLayoutData(new GridData(GridData.FILL_BOTH)); output.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); output.setEditable(false);/*from w ww . j a va2 s. c o m*/ output.setDocument(new Document()); colorManager = new ColorManager(); document = new LMLOCLDocument(); document.setOCLFactory(oclFactory); document.setModelingLevel(modelingLevel); input = new LMLOCLSourceViewer(page, colorManager, SWT.BORDER | SWT.MULTI); input.setDocument(document); input.getTextWidget().addKeyListener(new InputKeyListener()); selectionListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { LMLOCLConsolePage.this.selectionChanged(selection); } }; selectionService = getSite().getWorkbenchWindow().getSelectionService(); selectionService.addPostSelectionListener(selectionListener); ISelection selection = selectionService.getSelection(); selectionChanged(selection); }
From source file:org.metaborg.spoofax.eclipse.editor.SpoofaxInformationControl.java
License:Open Source License
/** * Creates a source viewer information control with the given shell as parent. The given shell styles are applied to * the created shell. The given styles are applied to the created styled text widget. The text widget will be * initialized with the given font. The status field will contain the given text or be hidden. * * @param parent//from w w w . java 2 s.co m * the parent shell * @param isResizable * <code>true</code> if resizable * @param symbolicFontName * the symbolic font name * @param statusFieldText * the text to be used in the optional status field or <code>null</code> if the status field should be * hidden */ public SpoofaxInformationControl(Shell parent, boolean isResizable, String statusFieldText, ILanguageImpl language) { this.syntaxService = SpoofaxPlugin.spoofax().syntaxService; this.unitService = SpoofaxPlugin.spoofax().unitService; this.language = language; this.styler = SpoofaxPlugin.spoofax().stylerService; this.categorizer = SpoofaxPlugin.spoofax().categorizerService; GridLayout layout; GridData gd; int shellStyle = SWT.TOOL | SWT.ON_TOP | (isResizable ? SWT.RESIZE : 0); int textStyle = isResizable ? SWT.V_SCROLL | SWT.H_SCROLL : SWT.NONE; fShell = new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP | shellStyle); Display display = fShell.getDisplay(); Composite composite = fShell; layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); gd = new GridData(GridData.FILL_HORIZONTAL); composite.setLayoutData(gd); if (statusFieldText != null) { composite = new Composite(composite, SWT.NONE); layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); gd = new GridData(GridData.FILL_BOTH); composite.setLayoutData(gd); composite.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); composite.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); } // Source viewer fViewer = new SourceViewer(composite, null, textStyle); fViewer.configure(new SourceViewerConfiguration()); fViewer.setEditable(false); fText = fViewer.getTextWidget(); gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); fText.setLayoutData(gd); fText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); fText.setBackground(new Color(display, new RGB(246, 246, 246))); // fSymbolicFontName= symbolicFontName; fTextFont = JFaceResources.getFont(JFaceResources.TEXT_FONT); fText.setFont(fTextFont); fText.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.character == 0x1B) // ESC fShell.dispose(); } public void keyReleased(KeyEvent e) { } }); // Status field if (statusFieldText != null) { // Horizontal separator line fSeparator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.LINE_DOT); fSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Status field label fStatusField = new Label(composite, SWT.RIGHT); fStatusField.setText(statusFieldText); Font font = fStatusField.getFont(); FontData[] fontDatas = font.getFontData(); for (int i = 0; i < fontDatas.length; i++) fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10); fStatusTextFont = new Font(fStatusField.getDisplay(), fontDatas); fStatusField.setFont(fStatusTextFont); GridData gd2 = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fStatusField.setLayoutData(gd2); fStatusTextForegroundColor = new Color(fStatusField.getDisplay(), blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f)); fStatusField.setForeground(fStatusTextForegroundColor); fStatusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); } addDisposeListener(this); }
From source file:org.multicore_association.shim.edit.gui.swt.viewer.ShimObjectTableLabelProvider.java
License:MIT License
/** * @see org.eclipse.jface.viewers.ITableFontProvider#getFont(java.lang.Object, * int)/*from w w w.j av a 2 s. c o m*/ */ @Override public Font getFont(Object element, int columnIndex) { ShimObject so = (ShimObject) element; Object obj = so.getObj(); Font result = JFaceResources.getFont(JFaceResources.DEFAULT_FONT); if (obj == null || apiClass.equals(obj.getClass())) { ShimObjectColumnFormat format = formatList.get(columnIndex); ColumnType type = format.getType(); switch (type) { case INT: case FLOAT: case HEX: // memo. JFaceResources.TEXT_FONT is monospace font. result = JFaceResources.getFont(JFaceResources.TEXT_FONT); break; default: break; } } return result; }
From source file:org.overture.ide.plugins.poviewer.view.PoTableView.java
License:Open Source License
/** * The constructor.//from w w w . java2 s .c o m */ public PoTableView() { IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); ITheme currentTheme = themeManager.getCurrentTheme(); FontRegistry fontRegistry = currentTheme.getFontRegistry(); font = fontRegistry.get(JFaceResources.TEXT_FONT); }
From source file:org.overture.ide.plugins.quickinterpreter.view.VdmQuickInterpreter.java
License:Open Source License
@Override public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(1, false); FillLayout fillLayout = new FillLayout(); fillLayout.type = org.eclipse.swt.SWT.VERTICAL; fillLayout.marginHeight = 0;/*from w ww. j a v a 2 s . co m*/ fillLayout.spacing = 5; parent.setLayout(layout); textAreaResult = new StyledText(parent, SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY); textAreaResult.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); textInput = new Text(parent, SWT.BORDER | SWT.SINGLE); textInput.setLayoutData(new GridData(SWT.FILL, 10, false, false, 1, 1)); textInput.addKeyListener(new org.eclipse.swt.events.KeyAdapter() { public void keyPressed(org.eclipse.swt.events.KeyEvent e) { if (e.keyCode == ENTER_KEYCODE) { String input = textInput.getText(); execute(input); textInput.setText(""); } else if (e.keyCode == UP_KEYCODE) { recallHistory(true); e.doit = false; } else if (e.keyCode == DOWN_KEYCODE) { recallHistory(false); e.doit = false; } } }); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); ITheme currentTheme = themeManager.getCurrentTheme(); FontRegistry fontRegistry = currentTheme.getFontRegistry(); Font font = fontRegistry.get(JFaceResources.TEXT_FONT); textAreaResult.setFont(font); textInput.setFont(font); }
From source file:org.polarsys.capella.ocl.requester.view.OCLInterpreterView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { // force left-to-right text direction in the console, because it // works with OCL text and the OCL language is based on English page = new SashForm(parent, SWT.VERTICAL | SWT.LEFT_TO_RIGHT); page.setFont(JFaceResources.getHeaderFont()); colorManager = new ColorManager(); document = new OCLDocument(); document.setModelingLevel(modelingLevel); contextName = new Label(page, SWT.NONE); errorOutput = new Label(page, SWT.NONE); errorOutput.setForeground(colorManager.getColor(ColorManager.OUTPUT_ERROR)); input = new OCLSourceViewer(page, colorManager, SWT.BORDER | SWT.MULTI); input.setDocument(document);//from w w w . j a v a 2s .com input.getTextWidget().addKeyListener(new InputKeyListener()); input.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); CTabFolder tabFolder = new CTabFolder(page, SWT.BORDER); tabFolder.setSelectionBackground( Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); CTabItem tabItem1 = new CTabItem(tabFolder, SWT.NONE); tabItem1.setText(OCLInterpreterMessages.OCLInterpreterView_tbtmModelOutput_text); Composite composite = new Composite(tabFolder, SWT.NONE); tabItem1.setControl(composite); composite.setLayout(new TreeColumnLayout()); ComposedAdapterFactory adapterFactory = (ComposedAdapterFactory) SiriusEditPlugin.getPlugin() .getItemProvidersAdapterFactory(); adapterFactory.insertAdapterFactory(new TupleItemProviderAdapterFactory()); labelProvider = new AdapterFactoryLabelProvider(adapterFactory); treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.MULTI); Tree tree = treeViewer.getTree(); tree.setHeaderVisible(true); tree.setLinesVisible(true); treeViewer.setContentProvider(getContentProvider()); treeViewer.setLabelProvider(labelProvider); CTabItem tabItem2 = new CTabItem(tabFolder, SWT.NONE); tabItem2.setText("Console Output"); //$NON-NLS-1$ output = new TextViewer(tabFolder, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); StyledText styledTextOutput = output.getTextWidget(); tabItem2.setControl(styledTextOutput); output.getTextWidget().setLayoutData(new GridData(GridData.FILL_BOTH)); output.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); output.setEditable(false); output.setDocument(new Document()); tabFolder.setSelection(0); selectionListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { OCLInterpreterView.this.selectionChanged(selection); } }; selectionService = getSite().getWorkbenchWindow().getSelectionService(); selectionService.addPostSelectionListener(selectionListener); // get current selection ISelection selection = selectionService.getSelection(); if (selection == null) { selection = getActiveSelection(); } selectionChanged(selection); ((SashForm) page).setWeights(new int[] { 1, 1, 5, 8 }); createActions(); }
From source file:org.rascalmpl.eclipse.console.internal.InteractiveInterpreterConsole.java
License:Open Source License
private void setFont() { Display.getDefault().syncExec(new Runnable() { public void run() { setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)); }/* www .j a va2 s .c om*/ }); }
From source file:org.rubypeople.rdt.internal.debug.ui.RubyDebugSourceViewer.java
License:Open Source License
/** * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent) *///from www . j ava 2s . co m public void propertyChange(PropertyChangeEvent event) { IContentAssistant assistant = getContentAssistant(); // if (assistant instanceof ContentAssistant) { // JDIContentAssistPreference.changeConfiguration((ContentAssistant) assistant, event); // } String property = event.getProperty(); if (JFaceResources.TEXT_FONT.equals(property)) { updateViewerFont(); } if (AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)) { updateViewerColors(); } if (fConfiguration != null) { if (fConfiguration.affectsTextPresentation(event)) { fConfiguration.handlePropertyChangeEvent(event); invalidateTextPresentation(); } } }
From source file:org.springsource.ide.eclipse.gradle.ui.cli.editor.TasksViewer.java
License:Open Source License
@SuppressWarnings("unchecked") public TasksViewer(Composite parent, GradleProjectIndex tasksIndex, boolean consoleMode) { super();//from w ww . ja va2s. c om this.tasksIndex = tasksIndex; DefaultMarkerAnnotationAccess markerAccess = new DefaultMarkerAnnotationAccess(); OverviewRuler overviewRuler = consoleMode ? null : new OverviewRuler(markerAccess, 12, colorsCache); int style = SWT.NONE; if (!consoleMode) { style = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; } viewer = new SourceViewer(parent, null, overviewRuler, true, style); IPreferenceStore preferences = EditorsUI.getPreferenceStore(); viewer.configure(new TasksViewerConfiguration(tasksIndex, preferences)); decorationSupport = new SourceViewerDecorationSupport(viewer, overviewRuler, markerAccess, colorsCache); for (AnnotationPreference preference : (List<AnnotationPreference>) new MarkerAnnotationPreferences() .getAnnotationPreferences()) { decorationSupport.setAnnotationPreference(preference); } decorationSupport.install(preferences); Font font = null; if (preferences != null) { // Backward compatibility if (preferences.contains(JFaceResources.TEXT_FONT) && !preferences.isDefault(JFaceResources.TEXT_FONT)) { FontData data = PreferenceConverter.getFontData(preferences, JFaceResources.TEXT_FONT); if (data != null) { font = new Font(viewer.getTextWidget().getDisplay(), data); } } } if (font == null) font = JFaceResources.getTextFont(); if (!font.equals(viewer.getTextWidget().getFont())) { viewer.getTextWidget().setFont(font); } activateHandler(); }