List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:com.siteview.mde.internal.ui.SWTFactory.java
License:Open Source License
/** * Creates an ExpandibleComposite widget * //from w ww .ja v a2s . c o m * @param parent the parent to add this widget to * @param style the style for ExpandibleComposite expanding handle, and layout * @param label the label for the widget * @param hspan how many columns to span in the parent * @param fill the fill style for the widget * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code> * @return a new ExpandibleComposite widget */ public static ExpandableComposite createExpandibleComposite(Composite parent, String label, int hspan, int fill) { ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); ex.setText(label); ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); GridData gd = new GridData(fill); gd.horizontalSpan = hspan; gd.grabExcessHorizontalSpace = true; ex.setLayoutData(gd); return ex; }
From source file:com.toubassi.jface.ContextHintDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite contents = new Composite(parent, SWT.NONE); contents.setLayout(new FormLayout()); Composite infoComposite = new Composite(contents, SWT.NONE); FormData infoCompositeFormData = new FormData(); infoCompositeFormData.left = new FormAttachment(0, 0); infoCompositeFormData.right = new FormAttachment(100, 0); infoCompositeFormData.top = new FormAttachment(0, 0); infoComposite.setLayoutData(infoCompositeFormData); infoComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); infoComposite.setLayout(new FormLayout()); infoTitleLabel = new Label(infoComposite, SWT.NONE); FontRegistry fontRegistry = JFaceResources.getFontRegistry(); infoTitleLabel.setFont(fontRegistry.getBold(JFaceResources.DIALOG_FONT)); infoTitleLabel.setBackground(infoComposite.getBackground()); if (infoTitle != null) { infoTitleLabel.setText(infoTitle); }//w w w. j a v a2 s. com FormData infoTitleLabelFormData = new FormData(); infoTitleLabelFormData.top = new FormAttachment(0, 10); infoTitleLabelFormData.left = new FormAttachment(0, 15); Label topSeparator = new Label(contents, SWT.SEPARATOR | SWT.HORIZONTAL); FormData topSeparatorFormData = new FormData(); topSeparatorFormData.top = new FormAttachment(infoComposite, 0); topSeparatorFormData.left = new FormAttachment(0, 0); topSeparatorFormData.right = new FormAttachment(100, 0); topSeparator.setLayoutData(topSeparatorFormData); Composite customContents = new Composite(contents, SWT.NONE); FormData customContentsFormData = new FormData(); customContentsFormData.top = new FormAttachment(topSeparator, 20); customContentsFormData.left = new FormAttachment(0, 15); customContentsFormData.right = new FormAttachment(100, -15); customContents.setLayoutData(customContentsFormData); createCustomContents(customContents); if (controlHints.size() > 0) { infoDescription = new Label(infoComposite, SWT.WRAP); infoDescription.setBackground(infoComposite.getBackground()); } else { infoTitleLabelFormData.width = 300; Composite spacer = new Composite(infoComposite, SWT.NONE); spacer.setBackground(infoComposite.getBackground()); FormData spacerFormData = new FormData(); spacerFormData.top = new FormAttachment(infoTitleLabel); spacerFormData.height = 15; spacer.setLayoutData(spacerFormData); } infoTitleLabel.setLayoutData(infoTitleLabelFormData); Label bottomSeparator = new Label(contents, SWT.SEPARATOR | SWT.HORIZONTAL); FormData bottomSeparatorFormData = new FormData(); bottomSeparatorFormData.top = new FormAttachment(customContents, 5, SWT.BOTTOM); bottomSeparatorFormData.left = new FormAttachment(0, 0); bottomSeparatorFormData.right = new FormAttachment(100, 0); bottomSeparator.setLayoutData(bottomSeparatorFormData); if (infoDescription != null) { Point size = new Point(70, 0); ControlUtil.convertSizeInCharsToPixels(infoDescription, size); String longestHint = longestControlHint(); Point infoSize = new Point(0, 0); if (longestHint != null) { infoDescription.setText(longestHint); infoSize = infoDescription.computeSize(size.x, SWT.DEFAULT); infoDescription.setText(""); } if (controlHints.get(null) != null) { infoDescription.setText((String) controlHints.get(null)); } FormData infoDescriptionFormData = new FormData(); infoDescriptionFormData.top = new FormAttachment(infoTitleLabel, 10); infoDescriptionFormData.left = new FormAttachment(0, 25); infoDescriptionFormData.right = new FormAttachment(100, -15); infoDescriptionFormData.bottom = new FormAttachment(100, -15); infoDescriptionFormData.width = size.x; infoDescriptionFormData.height = infoSize.y; infoDescription.setLayoutData(infoDescriptionFormData); } return contents; }
From source file:com.vectrace.MercurialEclipse.history.GraphLogTableViewer.java
License:Open Source License
protected void paint(Event event) { TableItem tableItem = (TableItem) event.item; if (event.index != 0) { return;/*from ww w. j av a 2 s . com*/ } MercurialRevision rev = (MercurialRevision) tableItem.getData(); MercurialHistory data = mhp.getMercurialHistory(); paintRow(event, rev.getGraphRow()); final Table table = tableItem.getParent(); int from = rev.getRevision() - 1; int lastReqVersion = data.getLastRequestedVersion(); if (from != lastReqVersion && from >= 0 && data.getLastVersion() > 0) { if (tableItem.equals(table.getItems()[table.getItemCount() - 1])) { MercurialHistoryPage.LoadMercurialHistoryJob refreshJob = mhp.new LoadMercurialHistoryJob(from); refreshJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event1) { Display.getDefault().asyncExec(new Runnable() { public void run() { if (table.isDisposed()) { return; } table.redraw(); table.update(); } }); } }); mhp.scheduleInPage(refreshJob); } } // validate signed changesets Signature sig = rev.getSignature(); if (sig != null) { if (sig.validate()) { tableItem.setBackground(colors.get(0)); } else { tableItem.setBackground(colors.get(2)); } } if (mhp.getCurrentWorkdirChangeset() != null) { if (rev.getRevision() == mhp.getCurrentWorkdirChangeset().getIndex()) { tableItem.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); } } // bisect colorization Status bisectStatus = rev.getBisectStatus(); if (bisectStatus != null) { if (bisectStatus == Status.BAD) { tableItem.setBackground(colors.get(10)); } else { tableItem.setBackground(colors.get(9)); } } else { if (rev.getChangeSet().isMerge()) { // Don't set font here -> UI freezes on windows tableItem.setBackground(mergeBack); tableItem.setForeground(mergeFore); } } }
From source file:com.vectrace.MercurialEclipse.synchronize.cs.SyncViewLabelProvider.java
License:Open Source License
/** * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider#getFont(java.lang.Object) *///w w w . j a v a 2 s. c o m @Override public Font getFont(Object element) { if (element instanceof GroupedUncommittedChangeSet) { if (((GroupedUncommittedChangeSet) element).isDefault()) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); } } return super.getFont(element); }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsoleHolder.java
License:Open Source License
protected void initConsole() { console = new HgConsole(consoleDocument); getConsoleManager().addConsoleListener(this); ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.addPropertyChangeListener(this); JFaceResources.getFontRegistry().addListener(this); console.setConsoleFont();//from w w w.ja v a2 s . co m }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsoleHolder.java
License:Open Source License
public void consolesRemoved(IConsole[] consoles) { for (int i = 0; i < consoles.length; i++) { IConsole c = consoles[i];//from w ww . j a v a2 s. c om if (c == console) { registered = false; console.dispose(); console = null; JFaceResources.getFontRegistry().removeListener(this); MercurialEclipsePlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.removePropertyChangeListener(this); break; } } }
From source file:de.itemis.tooling.terminology.ui.preferences.TerminologyBuilderPreferencePage.java
License:Open Source License
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) { ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.setText(label);/*from ww w . j a va 2s. c om*/ excomposite.setExpanded(false); excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1)); excomposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { getShell().layout(true, true); } }); return excomposite; }
From source file:de.itemis.tooling.terminology.ui.search.TerminologyEObjectSearchDialog.java
License:Open Source License
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) { ExpandableComposite excomposite = new ExpandableComposite(parent, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.setText(label);// w w w . ja va 2s. c o m excomposite.setExpanded(false); excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1)); excomposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { getShell().layout(true, true); } }); return excomposite; }
From source file:de.jcup.egradle.eclipse.ui.SWTFactory.java
License:Apache License
/** * Creates an ExpandibleComposite widget * /*from w w w .ja v a 2 s.c o m*/ * @param parent * the parent to add this widget to * @param style * the style for ExpandibleComposite expanding handle, and layout * @param label * the label for the widget * @param hspan * how many columns to span in the parent * @param fill * the fill style for the widget Can be one of * <code>GridData.FILL_HORIZONAL</code>, * <code>GridData.FILL_BOTH</code> or * <code>GridData.FILL_VERTICAL</code> * @return a new ExpandibleComposite widget */ public static ExpandableComposite createExpandibleComposite(Composite parent, int style, String label, int hspan, int fill) { ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, style); ex.setText(label); ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); GridData gd = new GridData(fill); gd.horizontalSpan = hspan; ex.setLayoutData(gd); return ex; }
From source file:de.loskutov.anyedit.ui.preferences.SupportPanel.java
License:Open Source License
static void createSupportLinks(Composite defPanel) { Composite commonPanel = new Composite(defPanel, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); GridLayout layout = new GridLayout(); layout.numColumns = 1;//from www. j ava2 s.c o m layout.marginWidth = 0; commonPanel.setLayout(layout); commonPanel.setLayoutData(gridData); Font font = JFaceResources.getFontRegistry() .getBold(JFaceResources.getDialogFont().getFontData()[0].getName()); Link link = new Link(commonPanel, SWT.NONE); link.setFont(font); link.setText(" - <a>visit homepage</a>"); link.setToolTipText("You need just a sense of humor!"); link.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { handleUrlClick("http://andrei.gmxhome.de/anyedit"); } }); link = new Link(commonPanel, SWT.NONE); link.setFont(font); link.setText(" - <a>report issue or feature request</a>"); link.setToolTipText("You need a valid google account at google.com!"); link.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { handleUrlClick("https://github.com/iloveeclipse/anyedittools/issues"); } }); link = new Link(commonPanel, SWT.NONE); link.setFont(font); link.setText(" - <a>add to your Ohloh software stack</a>"); link.setToolTipText("You need a valid Ohloh account at ohloh.net!"); link.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { handleUrlClick("http://www.ohloh.net/p/anyedittools"); } }); link = new Link(commonPanel, SWT.NONE); link.setFont(font); link.setText(" - <a>add to your favorites at Eclipse MarketPlace</a>"); link.setToolTipText("You need a valid bugzilla account at Eclipse.org!"); link.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { handleUrlClick("http://marketplace.eclipse.org/content/anyedit-tools"); } }); link = new Link(commonPanel, SWT.NONE); link.setFont(font); link.setText(" - <a>make a donation to support plugin development</a>"); link.setToolTipText("You do NOT need a PayPal account!"); link.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { handleUrlClick( "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5SHJLNGUXKHU"); } }); }