List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:com.google.gwt.eclipse.oophm.model.ModelLabelProvider.java
License:Open Source License
@Override public Font getFont(Object element) { if (element instanceof IModelNode) { IModelNode modelNode = (IModelNode) element; if (modelNode.isTerminated()) { return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); }//from w w w. j av a 2 s .c om } return null; }
From source file:com.htmlhifive.tools.codeassist.core.proposal.wrapper.FunctionProposalWrapper.java
License:Apache License
/** * Returns the style information for displaying HTML (Javadoc) content. * //from w ww.ja v a2s . com * @return the CSS styles * */ private String getCSSStyles() { if (fgCSSStyles == null) { fgCSSStyles = ProposalWrapperUtils.getCSSStyles(); } String css = fgCSSStyles; if (css != null) { FontData fontData = JFaceResources.getFontRegistry() .getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; css = HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }
From source file:com.hundsun.ares.studio.ui.control.deprecated.FilteredTable.java
License:Open Source License
/** * Return a bold font if the given element matches the given pattern. * Clients can opt to call this method from a Viewer's label provider to get * a bold font for which to highlight the given element in the tree. * /* w w w . j a va2 s .c o m*/ * @param element * element for which a match should be determined * @param table * FilteredTree in which the element resides * @param filter * PatternFilter which determines a match * * @return bold font */ public static Font getBoldFont(Object element, FilteredTable table, PatternFilter filter) { String filterText = table.getFilterString(); if (filterText == null) { return null; } // Do nothing if it's empty string String initialText = table.getInitialText(); if (!("".equals(filterText) || initialText.equals(filterText))) {//$NON-NLS-1$ boolean initial = initialText != null && initialText.equals(filterText); if (initial) { filter.setPattern(null); } else if (filterText != null) { filter.setPattern(filterText); } if (filter.isElementVisible(table.getViewer(), element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } } return null; }
From source file:com.hundsun.ares.studio.ui.grid.table.FilteredGridTable.java
License:Open Source License
/** * Return a bold font if the given element matches the given pattern. * Clients can opt to call this method from a Viewer's label provider to get * a bold font for which to highlight the given element in the tree. * //from www. j a v a 2 s .c om * @param element * element for which a match should be determined * @param table * FilteredTree in which the element resides * @param filter * PatternFilter which determines a match * * @return bold font */ public static Font getBoldFont(Object element, FilteredGridTable table, PatternFilter filter) { String filterText = table.getFilterString(); if (filterText == null) { return null; } // Do nothing if it's empty string String initialText = table.getInitialText(); if (!("".equals(filterText) || initialText.equals(filterText))) {//$NON-NLS-1$ boolean initial = initialText != null && initialText.equals(filterText); if (initial) { filter.setPattern(null); } else if (filterText != null) { filter.setPattern(filterText); } if (filter.isElementVisible(table.getViewer(), element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } } return null; }
From source file:com.hydra.project.myplugin_nebula.xviewer.util.internal.FilteredTreeComposite.java
License:Open Source License
/** * Return a bold font if the given element matches the given pattern. Clients can opt to call this method from a * Viewer's label provider to get a bold font for which to highlight the given element in the tree. * // w ww .j a va 2s . c om * @param element element for which a match should be determined * @param tree FilteredTree in which the element resides * @param filter PatternFilter which determines a match * @return bold font */ public static Font getBoldFont(Object element, FilteredTreeComposite tree, PatternFilter filter) { String filterText = tree.getFilterString(); if (filterText == null) { return null; } // Do nothing if it's empty string String initialText = tree.getInitialText(); if (!("".equals(filterText) || initialText.equals(filterText))) {//$NON-NLS-1$ boolean initial = initialText.equals(filterText); if (initial) { filter.setPattern(null); } else { filter.setPattern(filterText); } if (filter.isElementVisible(tree.getViewer(), element) && filter.isLeafMatch(tree.getViewer(), element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } } return null; }
From source file:com.ibm.research.tagging.core.ui.controls.FilteredTable.java
License:Open Source License
/** * Return a bold font if the given element matches the given pattern. * Clients can opt to call this method from a Viewer's label provider to get * a bold font for which to highlight the given element in the tree. * //w ww .ja va2 s . c om * @param element * element for which a match should be determined * @param tree * FilteredTree in which the element resides * @param filter * PatternFilter which determines a match * * @return bold font */ public static Font getBoldFont(Object element, FilteredTable tree, NQueryTablePatternFilter filter) { String filterText = tree.getFilterString(); if (filterText == null) { return null; } // Do nothing if it's empty string String initialText = tree.getInitialText(); if (!("".equals(filterText) || initialText.equals(filterText))) {//$NON-NLS-1$ boolean initial = initialText != null && initialText.equals(filterText); if (initial) { filter.setPattern(null); } else if (filterText != null) { filter.setPattern(filterText); } if (filter.isElementVisible(tree.getViewer(), element) && filter.isLeafMatch(tree.getViewer(), element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } } return null; }
From source file:com.ibm.research.tours.editors.TourEditor.java
License:Open Source License
private void createPaletteTable(Composite parent) { fInnerPaletteComposite = fFormToolkit.createComposite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginTop = 2;//from w ww. jav a2 s . com layout.marginBottom = 0; layout.marginLeft = 0; layout.marginRight = 0; layout.marginWidth = 0; fInnerPaletteComposite.setLayout(layout); fInnerPaletteComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite titleComposite = fFormToolkit.createComposite(fInnerPaletteComposite, SWT.NONE); GridLayout titleLayout = new GridLayout(2, true); titleLayout.marginHeight = 0; titleLayout.marginWidth = 0; titleComposite.setLayout(titleLayout); titleComposite.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, false)); Label title = fFormToolkit.createLabel(titleComposite, "Tour Palette"); title.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); Label imageLabel = fFormToolkit.createLabel(titleComposite, ""); imageLabel.setImage(ToursPlugin.getDefault().getImageRegistry().get(ToursPlugin.IMG_PALETTE)); fPaletteSection = fFormToolkit.createSection(fInnerPaletteComposite, Section.NO_TITLE); fPaletteSection.setText("Palette"); GridData paletteData = new GridData(GridData.FILL_BOTH); fPaletteSection.setLayoutData(paletteData); fFilteredPaletteTable = new FilteredTable(fPaletteSection, SWT.MULTI | SWT.V_SCROLL, new NQueryTablePatternFilter()); fFilteredPaletteTable.setBackground(JFaceColors.getBannerBackground(Display.getDefault())); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; fFilteredPaletteTable.setLayoutData(data); fPaletteViewer = fFilteredPaletteTable.getViewer(); fPaletteViewer.setContentProvider(new PaletteContentProvider()); fPaletteViewer.addDoubleClickListener(new PaletteDoubleClickListener()); fPaletteViewer.setSorter(new PaletteSorter()); fPaletteViewer.setLabelProvider(new PaletteLabelProvider()); fPaletteViewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE, new Transfer[] { PaletteEntryTransfer.getInstance() }, new PaletteDragListener(fPaletteViewer)); fPaletteViewer.setInput(new Object()); fPaletteSection.setClient(fFilteredPaletteTable); fPaletteSection.setLayoutData(new GridData(GridData.FILL_VERTICAL)); ToursPlugin.getDefault().getPaletteModel().addPaletteModelListener(fPaletteModelListener); }
From source file:com.ibm.research.tours.editors.TourElements.java
License:Open Source License
@Override public Font getFont() { if (fFont == null) fFont = JFaceResources.getFontRegistry().getBold("org.eclipse.jface.viewerfont"); return fFont; }
From source file:com.imperial.fiksen.codesimilarity.compare.ParseTreeMergeViewer.java
License:Open Source License
/** * Creates a text merge viewer under the given parent control. * /* w w w .j a v a2 s .c o m*/ * @param parent * the parent control * @param style * SWT style bits for top level composite of this viewer * @param configuration * the configuration object */ public ParseTreeMergeViewer(Composite parent, int style, CompareConfiguration configuration) { super(style, ResourceBundle.getBundle(BUNDLE_NAME), configuration); operationHistoryListener = new IOperationHistoryListener() { public void historyNotification(OperationHistoryEvent event) { ParseTreeMergeViewer.this.historyNotification(event); } }; OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(operationHistoryListener); fMerger = new ParseTreeDocumentMerger(new IDocumentMergerInput() { public ITokenComparator createTokenComparator(String line) { return ParseTreeMergeViewer.this.createTokenComparator(line); } public CompareConfiguration getCompareConfiguration() { return ParseTreeMergeViewer.this.getCompareConfiguration(); } public IDocument getDocument(char contributor) { switch (contributor) { case LEFT_CONTRIBUTOR: return fLeft.getSourceViewer().getDocument(); case RIGHT_CONTRIBUTOR: return fRight.getSourceViewer().getDocument(); case ANCESTOR_CONTRIBUTOR: return fAncestor.getSourceViewer().getDocument(); } return null; } public int getHunkStart() { return ParseTreeMergeViewer.this.getHunkStart(); } public Position getRegion(char contributor) { switch (contributor) { case LEFT_CONTRIBUTOR: return fLeft.getRegion(); case RIGHT_CONTRIBUTOR: return fRight.getRegion(); case ANCESTOR_CONTRIBUTOR: return fAncestor.getRegion(); } return null; } public boolean isHunkOnLeft() { ITypedElement left = ((ICompareInput) getInput()).getRight(); return left != null && Utilities.getAdapter(left, IHunk.class) != null; } public boolean isIgnoreAncestor() { return ParseTreeMergeViewer.this.isIgnoreAncestor(); } public boolean isPatchHunk() { return ParseTreeMergeViewer.this.isPatchHunk(); } public boolean isShowPseudoConflicts() { return fShowPseudoConflicts; } public boolean isThreeWay() { return ParseTreeMergeViewer.this.isThreeWay(); } public boolean isPatchHunkOk() { return ParseTreeMergeViewer.this.isPatchHunkOk(); } }); int inheritedStyle = parent.getStyle(); if ((inheritedStyle & SWT.LEFT_TO_RIGHT) != 0) fInheritedDirection = SWT.LEFT_TO_RIGHT; else if ((inheritedStyle & SWT.RIGHT_TO_LEFT) != 0) fInheritedDirection = SWT.RIGHT_TO_LEFT; else fInheritedDirection = SWT.NONE; if ((style & SWT.LEFT_TO_RIGHT) != 0) fTextDirection = SWT.LEFT_TO_RIGHT; else if ((style & SWT.RIGHT_TO_LEFT) != 0) fTextDirection = SWT.RIGHT_TO_LEFT; else fTextDirection = SWT.NONE; fSymbolicFontName = getSymbolicFontName(); fIsMotif = Util.isMotif(); fIsCarbon = Util.isCarbon(); fIsMac = Util.isMac(); if (fIsMotif) fMarginWidth = 0; fPreferenceChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { ParseTreeMergeViewer.this.handlePropertyChangeEvent(event); } }; fPreferenceStore = createChainedPreferenceStore(); if (fPreferenceStore != null) { fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener); fLeftIsLocal = Utilities.getBoolean(getCompareConfiguration(), "LEFT_IS_LOCAL", false); //$NON-NLS-1$ fSynchronizedScrolling = fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING); fShowPseudoConflicts = fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS); // fUseSplines= // fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES); fUseSingleLine = fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE); fHighlightTokenChanges = fPreferenceStore.getBoolean(ComparePreferencePage.HIGHLIGHT_TOKEN_CHANGES); // fUseResolveUI= // fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI); } buildControl(parent); setColors(); INavigatable nav = new INavigatable() { public boolean selectChange(int flag) { if (flag == INavigatable.FIRST_CHANGE || flag == INavigatable.LAST_CHANGE) { selectFirstDiff(flag == INavigatable.FIRST_CHANGE); return false; } return navigate(flag == INavigatable.NEXT_CHANGE, false, false); } public Object getInput() { return ParseTreeMergeViewer.this.getInput(); } public boolean openSelectedChange() { return false; } public boolean hasChange(int flag) { return getNextVisibleDiff(flag == INavigatable.NEXT_CHANGE, false) != null; } }; getControl().setData(INavigatable.NAVIGATOR_PROPERTY, nav); fBirdsEyeCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); JFaceResources.getFontRegistry().addListener(fPreferenceChangeListener); JFaceResources.getColorRegistry().addListener(fPreferenceChangeListener); updateFont(); }
From source file:com.imperial.fiksen.codesimilarity.compare.ParseTreeMergeViewer.java
License:Open Source License
private String getSymbolicFontName() { Class clazz = getClass();//from www . j a v a2 s. c om do { String fontName = clazz.getName(); if (JFaceResources.getFontRegistry().hasValueFor(fontName)) return fontName; clazz = clazz.getSuperclass(); } while (clazz != null); // use text compare font if no font has been registered for subclass return getClass().getName(); }