List of usage examples for org.eclipse.jface.resource JFaceResources getTextFont
public static Font getTextFont()
From source file:com.siteview.mde.internal.ui.editor.schema.DocSection.java
License:Open Source License
public void createClient(Section section, FormToolkit toolkit) { Composite container = toolkit.createComposite(section); container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2;/*w w w.ja v a 2s. co m*/ section.setLayoutData(data); fTabFolder = new CTabFolder(container, SWT.FLAT | SWT.TOP); toolkit.adapt(fTabFolder, true, true); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.heightHint = 2; fTabFolder.setLayoutData(gd); toolkit.getColors().initializeSectionToolBarColors(); Color selectedColor = toolkit.getColors().getColor(IFormColors.TB_BG); fTabFolder.setSelectionBackground(new Color[] { selectedColor, toolkit.getColors().getBackground() }, new int[] { 100 }, true); fTabFolder.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateTabSelection(); } }); int styles = SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL; fSourceViewer = new SourceViewer(container, null, styles); fSourceViewer.configure(fSourceConfiguration); fSourceViewer.setDocument(fDocument); fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateSelection(event.getSelection()); } }); StyledText styledText = fSourceViewer.getTextWidget(); styledText.setFont(JFaceResources.getTextFont()); styledText.setMenu(getPage().getMDEEditor().getContextMenu()); styledText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); styledText.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { getPage().getMDEEditor().getContributor().updateSelectableActions(null); } }); if (SWT.getPlatform().equals("motif") == false) //$NON-NLS-1$ toolkit.paintBordersFor(container); Control[] children = container.getChildren(); Control control = children[children.length - 1]; gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 50; gd.heightHint = 50; control.setLayoutData(gd); createTabs(); section.setClient(container); initialize(); if (fTabFolder.getItemCount() > 0) { fTabFolder.setSelection(0); updateTabSelection(); } }
From source file:com.siteview.mde.internal.ui.nls.ExternalizeStringsWizardPage.java
License:Open Source License
private void createSourceViewer(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setLayout(new GridLayout()); Label label = new Label(composite, SWT.NONE); label.setText(MDEUIMessages.ExternalizeStringsWizardPage_sourceLabel); label.setLayoutData(new GridData()); fSourceViewer = new SourceViewer(composite, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fSourceViewer.setEditable(false);//from w ww .jav a2 s . c om fSourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); fSourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); fEmptyDoc = new Document(); fSourceViewer.setDocument(fEmptyDoc); }
From source file:com.surelogic.common.ui.serviceability.SendServiceMessageCollectInformationPage.java
@Override public void createControl(Composite parent) { final Composite panel = new Composite(parent, SWT.NONE); setControl(panel);// w w w . ja va2s .co m @Nullable Pair<String, String> nameEmail = SLLicenseManager.getInstance().getNameAndEmail(); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; panel.setLayout(gridLayout); final Label info = new Label(panel, SWT.WRAP); info.setText(I18N.msg(f_data.propPfx() + "info")); GridData data = new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1); data.widthHint = CONTENTS_WIDTH_HINT; info.setLayoutData(data); final Label email = new Label(panel, SWT.RIGHT); email.setText(I18N.msg(f_data.propPfx() + "email")); email.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, false, false)); final Text emailText = new Text(panel, SWT.SINGLE | SWT.BORDER); String emailValue = CommonCorePreferencesUtility.getServicabilityEmail(); if (nameEmail != null && "".equals(emailValue)) emailValue = nameEmail.second(); emailText.setText(emailValue); emailText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Label name = new Label(panel, SWT.RIGHT); name.setText(I18N.msg(f_data.propPfx() + "name")); name.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, false, false)); final Text nameText = new Text(panel, SWT.SINGLE | SWT.BORDER); // Use name preference if set (otherwise get from license) String nameValue = CommonCorePreferencesUtility.getServicabilityName(); if (nameEmail != null && "".equals(nameValue)) nameValue = nameEmail.first(); nameText.setText(nameValue); nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Button sendVersion = new Button(panel, SWT.CHECK); sendVersion.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1)); sendVersion.setText(I18N.msg(f_data.propPfx() + "sendVersion")); sendVersion.setSelection(true); final Button sendEclipseLog; if (f_data instanceof MessageWithLog) { final MessageWithLog mwl = (MessageWithLog) f_data; sendEclipseLog = new Button(panel, SWT.CHECK); sendEclipseLog.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1)); sendEclipseLog.setText(I18N.msg(f_data.propPfx() + "sendEclipseLog")); sendEclipseLog.setSelection(mwl.getSendLog()); } else { sendEclipseLog = null; } final Label space = new Label(panel, SWT.NONE); space.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1)); final Label summary = new Label(panel, SWT.RIGHT); summary.setText(I18N.msg(f_data.propPfx() + "summary")); summary.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, false, false)); final Text summaryText = new Text(panel, SWT.SINGLE | SWT.BORDER); if (f_data.getSummary() != null) { summaryText.setText(f_data.getSummary()); } summaryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Label description = new Label(panel, SWT.WRAP); description.setText(I18N.msg(f_data.propPfx() + "desc")); data = new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1); data.widthHint = CONTENTS_WIDTH_HINT; description.setLayoutData(data); final Text descriptionText = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); descriptionText.setFont(JFaceResources.getTextFont()); if (f_data.getDescription() != null) descriptionText.setText(f_data.getDescription()); data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); data.heightHint = TIP_HEIGHT_HINT; descriptionText.setLayoutData(data); final Runnable updatePageComplete = new Runnable() { @Override public void run() { f_data.setEmail(emailText.getText()); f_data.setName(nameText.getText()); f_data.setSummary(summaryText.getText()); f_data.setDescription(descriptionText.getText()); f_data.setSendVersionInfo(sendVersion.getSelection()); if (f_data instanceof MessageWithLog) { final MessageWithLog mwl = (MessageWithLog) f_data; mwl.setSendLog(sendEclipseLog.getSelection()); } setPageComplete(f_data.minimumDataEntered()); } }; final Listener listener = new Listener() { @Override public void handleEvent(Event event) { updatePageComplete.run(); } }; emailText.addListener(SWT.Modify, listener); nameText.addListener(SWT.Modify, listener); summaryText.addListener(SWT.Modify, listener); descriptionText.addListener(SWT.Modify, listener); sendVersion.addListener(SWT.Selection, listener); if (f_data instanceof MessageWithLog) { sendEclipseLog.addListener(SWT.Selection, listener); } /* * We have to run this a bit later so that the OK button is created. */ EclipseUIUtility.asyncExec(updatePageComplete); setTitle(I18N.msg(f_data.propPfx() + "msg.title")); setMessage(I18N.msg(f_data.propPfx() + "msg"), IMessageProvider.INFORMATION); }
From source file:de.jcup.egradle.eclipse.ui.QuickLaunchDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); boolean isWin32 = Util.isWindows(); GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2).applyTo(composite); Text text = new Text(composite, SWT.NONE); Font terminalFont = JFaceResources.getTextFont(); text.setFont(terminalFont);/*from www. j av a 2 s . c o m*/ GridData textLayoutData = new GridData(); textLayoutData.horizontalAlignment = GridData.FILL; textLayoutData.verticalAlignment = GridData.FILL; textLayoutData.grabExcessHorizontalSpace = true; textLayoutData.grabExcessVerticalSpace = false; textLayoutData.horizontalSpan = 2; text.setLayoutData(textLayoutData); text.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent event) { if (event.character == '\r') { inputText = text.getText(); close(); } } }); return composite; }
From source file:de.openali.odysseus.chart.framework.model.layer.impl.GenericLayerRenderer.java
License:Open Source License
public void paintEditInfo(final GC gcw) { ChartUtilities.resetGC(gcw);/*from www . j a v a2 s . c om*/ if (m_editInfo == null) return; // draw hover shape if (m_editInfo.getHoverFigure() != null) m_editInfo.getHoverFigure().paint(gcw); // draw edit shape if (m_editInfo.getEditFigure() != null) m_editInfo.getEditFigure().paint(gcw); // draw tooltip ChartUtilities.resetGC(gcw); final Rectangle screen = gcw.getClipping(); String tooltiptext = m_editInfo.getText(); final Point mousePos = m_editInfo.getPosition(); if (tooltiptext != null && mousePos != null) { tooltiptext = tooltiptext.replace('\r', ' '); final Display display = ChartUtilities.getDisplay(); final Font oldFont = gcw.getFont(); final Font bannerFont = JFaceResources.getTextFont(); gcw.setFont(bannerFont); gcw.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); gcw.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); final Point toolsize = gcw.textExtent(tooltiptext); /* * Positionieren der Tooltip-Box: der ideale Platz liegt rechts unter dem Mauszeiger. Wenn rechts nicht gengend * Platz ist, dann wird er nach links verschoben. Der Startpunkt soll dabei immer im sichtbaren Bereich liegen. */ int toolx = mousePos.x + 3 + TOOLINSET; if (toolx + toolsize.x > screen.width) { toolx = screen.width - 5 - toolsize.x; if (toolx < 5) toolx = 5; } int tooly = mousePos.y + 3 + TOOLINSET + 20; if (tooly + toolsize.y > screen.height && mousePos.y - 3 - TOOLINSET - toolsize.y - 20 > 0) tooly = mousePos.y - 3 - TOOLINSET - toolsize.y - 20; gcw.setLineWidth(1); final Rectangle toolrect = new Rectangle(toolx - TOOLINSET, tooly - TOOLINSET, toolsize.x + TOOLINSET * 2, toolsize.y + TOOLINSET * 2); gcw.fillRectangle(toolrect); gcw.drawRectangle(toolrect); gcw.drawText(tooltiptext, toolx, tooly, true); gcw.setFont(oldFont); } }
From source file:de.openali.odysseus.chart.framework.util.img.ChartTooltipPainter.java
License:Open Source License
public ChartTooltipPainter() { final TitleTypeBean titleType = new TitleTypeBean(null); titleType.setInsets(new Insets(2, 2, 2, 2)); titleType.setRotation(0);//from w w w . j a va 2 s. c o m final FontData fontData = JFaceResources.getTextFont().getFontData()[0]; final Display display = ChartUtilities.getDisplay(); final RGB rgbFill = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(); final RGB rgbText = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(); titleType.setTextStyle(new TextStyle(fontData.getHeight(), fontData.getName(), rgbText, rgbFill, FONTSTYLE.NORMAL, FONTWEIGHT.NORMAL, ALIGNMENT.LEFT, 255, true)); m_labelRenderer = new GenericChartLabelRenderer(titleType); final IAreaStyle borderStyle = StyleUtils.getDefaultAreaStyle(); borderStyle.getStroke().setColor(new RGB(0, 0, 0)); borderStyle.getStroke().setWidth(1); borderStyle.setFill(new ColorFill(rgbFill)); m_labelRenderer.setBorderStyle(borderStyle); }
From source file:de.ovgu.featureide.fm.ui.editors.SimpleSyntaxHighlightEditor.java
License:Open Source License
/** * @param parent// ww w. ja v a 2 s. c om * @param style */ public SimpleSyntaxHighlightEditor(Composite parent, int style, final String[] keywords) { super(parent, style); this.keywords = keywords; this.keywordColor = Display.getDefault().getSystemColor(SWT.COLOR_DARK_RED); this.wrongWordColor = Display.getDefault().getSystemColor(SWT.COLOR_RED); this.normalColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); this.setFont(JFaceResources.getTextFont()); super.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { updateHighlight(); } }); }
From source file:de.tobject.findbugs.view.properties.BugGroupSection.java
License:Open Source License
@Override public void createControls(Composite parent, final TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); Color background = tabbedPropertySheetPage.getWidgetFactory().getColors().getBackground(); rootComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); layout.marginLeft = 5;// ww w.j a v a 2 s. c om layout.marginTop = 5; rootComposite.setLayout(layout); rootComposite.setSize(SWT.DEFAULT, SWT.DEFAULT); rootComposite.setBackground(background); text = new Text(rootComposite, SWT.READ_ONLY | SWT.WRAP); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalIndent = 0; data.verticalIndent = 0; text.setLayoutData(data); text.setBackground(background); text.setFont(JFaceResources.getTextFont()); }
From source file:de.walware.ecommons.ui.components.EditableTextList.java
License:Open Source License
public Control create(final Composite parent, final ViewerComparator comparator) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(LayoutUtil.applyCompositeDefaults(new GridLayout(), 2)); fComposite = new ViewerUtil.TableComposite(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION); fComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fViewer = fComposite.viewer;//from w ww.j a v a 2 s . c om fViewer.setContentProvider(new ArrayContentProvider()); fViewer.setComparator(comparator); fComposite.table.setFont(JFaceResources.getTextFont()); fComposite.table.setLinesVisible(true); fColumn = new TableViewerColumn(fViewer, SWT.NONE); fColumn.setLabelProvider(new ColumnLabelProvider()); fComposite.layout.setColumnData(fColumn.getColumn(), new ColumnWeightData(100)); fButtonGroup = new ButtonGroup<String>(composite, this, true); fButtonGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, true)); fButtonGroup.addAddButton(null); fButtonGroup.addEditButton(null); fButtonGroup.addDeleteButton(null); return composite; }
From source file:de.walware.statet.r.internal.ui.rhelp.RHelpInfoHoverCreator.java
License:Open Source License
@Override public Point computeSizeHint() { updateInput();// ww w .jav a 2 s.co m final Point sizeConstraints = getSizeConstraints(); final Rectangle trim = computeTrim(); fTitleText.setFont(JFaceResources.getDialogFont()); final PixelConverter converter = new PixelConverter(fTitleText); int widthHint = converter.convertWidthInCharsToPixels(60); final GC gc = new GC(fContentComposite); gc.setFont(JFaceResources.getTextFont()); widthHint = Math.max(widthHint, gc.getFontMetrics().getAverageCharWidth() * 60); gc.dispose(); final int heightHint = fTitleText.getLineHeight() * 12; final int widthMax = ((sizeConstraints != null && sizeConstraints.x != SWT.DEFAULT) ? sizeConstraints.x : widthHint + 100) - trim.width; final int heightMax = ((sizeConstraints != null && sizeConstraints.y != SWT.DEFAULT) ? sizeConstraints.y : fTitleText.getLineHeight() * 12) - trim.height; final Point size = new Point(widthHint, heightHint); size.y += LayoutUtil.defaultVSpacing(); size.x = Math.max(Math.min(size.x, widthMax), 200) + trim.width; size.y = Math.max(Math.min(size.y, heightMax), 100) + trim.height; return size; }