List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:com.arc.cdt.debug.seecode.ui.views.AbstractEngineBasedView.java
License:Open Source License
@Override public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site); if (memento != null) { String title = memento.getString(TITLE); String tip = memento.getString(TIP); if (title != null) setPartName(title);//from w w w. j a va 2 s .co m if (tip != null) setContentDescription(tip); } mDebugEventListener = new IDebugEventSetListener() { @Override public void handleDebugEvents(DebugEvent[] events) { for (int j = 0; j < events.length; j++) { DebugEvent event = events[j]; switch (event.getKind()) { case DebugEvent.TERMINATE: handleTerminateEvent(event); break; default: break; } } } }; DebugPlugin.getDefault().addDebugEventListener(mDebugEventListener); setFont(); setColor(); JFaceResources.getFontRegistry().addListener(this); JFaceResources.getColorRegistry().addListener(this); }
From source file:com.arc.cdt.debug.seecode.ui.views.AbstractEngineBasedView.java
License:Open Source License
@Override public void dispose() { getSite().getPage().removePartListener(fPartListener); super.dispose(); if (!mUnwired) { mUnwired = true;//from ww w . j a v a 2s.c o m IWorkbenchWindow w = this.getViewSite().getWorkbenchWindow(); DebugUITools.getDebugContextManager().getContextService(w) .removeDebugContextListener(mDebugContextListener); mEngine = null; mControlMap.clear(); DebugPlugin.getDefault().removeDebugEventListener(mDebugEventListener); JFaceResources.getFontRegistry().removeListener(this); JFaceResources.getColorRegistry().removeListener(this); } }
From source file:com.arc.cdt.debug.seecode.ui.views.SeeCodeErrorLogView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { mCards = new Composite(parent, 0); mCardLayout = new StackLayout(); mCards.setLayout(mCardLayout);//from ww w.java 2 s . c o m mBlank = new Composite(mCards, 0); mCardLayout.topControl = mBlank; // listen to selection in debug view IWorkbenchWindow w = this.getViewSite().getWorkbenchWindow(); DebugUITools.getDebugContextManager().getContextService(w).addDebugContextListener(mDebugContextListener); getSite().getPage().addPartListener(fPartListener); setFont(); setColor(); JFaceResources.getFontRegistry().addListener(this); JFaceResources.getColorRegistry().addListener(this); fIsVisible = true; resetSelection(); if (fLaunchListener == null) { // Remove engine's error log cache when reference is removed from Launch View. fLaunchListener = new ILaunchesListener() { @Override public void launchesRemoved(ILaunch[] launches) { for (ILaunch launch : launches) { IDebugTarget targets[] = launch.getDebugTargets(); for (IDebugTarget target : targets) { ICDISession session = (ICDISession) target.getAdapter(ICDISession.class); for (ICDITarget cdiTarget : session.getTargets()) { if (cdiTarget instanceof IAdaptable) { EngineInterface engine = (EngineInterface) ((IAdaptable) cdiTarget) .getAdapter(EngineInterface.class); if (engine != null) { fContent.remove(engine); } } } } } } @Override public void launchesAdded(ILaunch[] launches) { } @Override public void launchesChanged(ILaunch[] launches) { } }; DebugPlugin.getDefault().getLaunchManager().addLaunchListener(fLaunchListener); } }
From source file:com.archimatetool.editor.ui.components.ColorChooser.java
License:Open Source License
/** * Compute the size of the image to be displayed. * /*from w w w.j a v a 2 s. com*/ * @param window - * the window used to calculate * @return <code>Point</code> */ protected Point computeImageSize(Control window) { GC gc = new GC(window); Font f = JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT); gc.setFont(f); int height = gc.getFontMetrics().getHeight(); gc.dispose(); Point p = new Point(height * 3 - 6, height); return p; }
From source file:com.archimatetool.help.hints.HintsView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(); layout.marginHeight = 0;/*from w w w. j a va2 s . c o m*/ layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); if (!JFaceResources.getFontRegistry().hasValueFor("HintsTitleFont")) { //$NON-NLS-1$ FontData[] fontData = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT) .getFontData(); fontData[0].setHeight(fontData[0].getHeight() + 4); JFaceResources.getFontRegistry().put("HintsTitleFont", fontData); //$NON-NLS-1$ } fTitleLabel = new CLabel(parent, SWT.NULL); fTitleLabel.setFont(JFaceResources.getFont("HintsTitleFont")); //$NON-NLS-1$ fTitleLabel.setBackground(ColorConstants.white); GridData gd = new GridData(GridData.FILL_HORIZONTAL); fTitleLabel.setLayoutData(gd); /* * It's possible that the system might not be able to create the Browser */ fBrowser = createBrowser(parent); if (fBrowser == null) { return; } gd = new GridData(GridData.FILL_BOTH); fBrowser.setLayoutData(gd); // Listen to Loading progress fBrowser.addProgressListener(new ProgressListener() { @Override public void completed(ProgressEvent event) { fPageLoaded = true; } @Override public void changed(ProgressEvent event) { } }); // Listen to Diagram Editor Selections ComponentSelectionManager.INSTANCE.addSelectionListener(this); fActionPinContent = new PinAction(); //IMenuManager menuManager = getViewSite().getActionBars().getMenuManager(); //menuManager.add(fActionPinContent); IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); toolBarManager.add(fActionPinContent); createFileMap(); // Listen to workbench selections getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this); // Help PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID); // Initialise with whatever is selected in the workbench ISelection selection = getSite().getWorkbenchWindow().getSelectionService().getSelection(); IWorkbenchPart part = getSite().getWorkbenchWindow().getPartService().getActivePart(); selectionChanged(part, selection); }
From source file:com.architexa.org.eclipse.gef.ui.palette.DefaultPaletteViewerPreferences.java
License:Open Source License
/** * Constructor/*from www . j a v a2 s. co m*/ * * @param store The IPreferenceStore where the settings are to be saved. */ public DefaultPaletteViewerPreferences(final IPreferenceStore store) { this.store = store; store.setDefault(PREFERENCE_DETAILS_ICON_SIZE, false); store.setDefault(PREFERENCE_COLUMNS_ICON_SIZE, true); store.setDefault(PREFERENCE_ICONS_ICON_SIZE, true); store.setDefault(PREFERENCE_LIST_ICON_SIZE, false); store.setDefault(PREFERENCE_LAYOUT, LAYOUT_LIST); store.setDefault(PREFERENCE_AUTO_COLLAPSE, COLLAPSE_AS_NEEDED); store.setDefault(PREFERENCE_FONT, DEFAULT_FONT); listener = new PreferenceStoreListener(); store.addPropertyChangeListener(listener); fontListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) { if (getPreferenceStore().getString(PREFERENCE_FONT).equals(DEFAULT_FONT)) { setFontData(JFaceResources.getDialogFont().getFontData()[0]); handlePreferenceStorePropertyChanged(PREFERENCE_FONT); } } } }; JFaceResources.getFontRegistry().addListener(fontListener); }
From source file:com.astra.ses.spell.dev.advisor.ApplicationWorkbenchWindowAdvisor.java
License:Open Source License
public Control createEmptyWindowContents(Composite parent) { // final IWorkbenchWindow window = getWindowConfigurer().getWindow(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); Display display = composite.getDisplay(); Color bgCol = display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); composite.setBackground(bgCol);//from w ww .j a v a2 s . co m Label label = new Label(composite, SWT.WRAP); label.setForeground(display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); label.setBackground(bgCol); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); String msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective; label.setText(msg); ToolBarManager toolBarManager = new ToolBarManager(); // // TODO: should obtain the open perspective action from ActionFactory // openPerspectiveAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG // .create(window); // toolBarManager.add(openPerspectiveAction); ToolBar toolBar = toolBarManager.createControl(composite); toolBar.setBackground(bgCol); return composite; }
From source file:com.astra.ses.spell.gui.dialogs.PropertiesDialog.java
License:Open Source License
/*************************************************************************** * Add a generic property// ww w . j av a2 s. com **************************************************************************/ protected void addGeneric(String title, ProcProperties tag, boolean multi) { Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); Label label = new Label(m_tabGenerics, SWT.NONE); label.setText(title + ":"); label.setFont(boldFont); Text text = null; if (multi) { text = new Text(m_tabGenerics, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); } else { text = new Text(m_tabGenerics, SWT.BORDER); } String value = m_properties.get(tag); if (value == null) value = "(?)"; text.setText(value); text.setEditable(false); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); }
From source file:com.astra.ses.spell.gui.model.FontInfo.java
License:Open Source License
/*************************************************************************** * Constructor//ww w . ja v a 2 s. c o m * * @param xmlElement The XML config file element for a font definition * **************************************************************************/ public FontInfo(Element xmlElement) { if (xmlElement.getNodeType() == Node.ELEMENT_NODE) { m_id = xmlElement.getAttribute("id"); m_face = xmlElement.getAttribute("face"); String fontSize = xmlElement.getAttribute("size"); m_size = Integer.parseInt(fontSize); String fontStyle = xmlElement.getAttribute("style"); if (fontStyle.equals("bold")) { m_style = SWT.BOLD; } else if (fontStyle.equals("italic")) { m_style = SWT.ITALIC; } else { m_style = SWT.NORMAL; } if (m_face.equals("header")) { m_font = JFaceResources.getHeaderFont(); } else if (m_face.equals("dialog")) { if (m_style == SWT.BOLD) { m_font = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } else if (m_style == SWT.ITALIC) { m_font = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT); } else { m_font = JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT); } } else { m_font = new Font(Display.getCurrent(), new FontData[] { new FontData(m_face, m_size, m_style) }); } } }
From source file:com.axmor.eclipse.typescript.editor.contentassist.TypeScriptAssistProcessor.java
License:Open Source License
protected String getCSSStyles() { if (fgCSSStyles == null) { Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); URL url = bundle.getEntry("/css/JavadocHoverStyleSheet.css"); //$NON-NLS-1$ if (url != null) { BufferedReader reader = null; try { url = FileLocator.toFileURL(url); reader = new BufferedReader(new InputStreamReader(url.openStream())); StringBuffer buffer = new StringBuffer(200); String line = reader.readLine(); while (line != null) { buffer.append(line); buffer.append('\n'); line = reader.readLine(); }/*from ww w. java2 s. c om*/ fgCSSStyles = buffer.toString(); } catch (IOException ex) { } finally { try { if (reader != null) reader.close(); } catch (IOException e) { } } } } String css = fgCSSStyles; if (css != null) { FontData fontData = JFaceResources.getFontRegistry() .getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; css = HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }