List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont
public static Font getDialogFont()
From source file:com.architexa.diagrams.parts.NavAidsEditPolicy.java
License:Open Source License
private IFigure getSingleHandle(final NavAidsSpec hs) { hs.decorationFig = new Figure(); hs.buildHandles();/*from ww w. j a va2 s . com*/ final IFigure hostFig = getHostFigure(); hs.decorationFig.setOpaque(true); hs.decorationFig.setBorder(new SimpleRaisedBorder()); hs.decorationFig.setFont(JFaceResources.getDialogFont()); hs.decorationFig.setLayoutManager(new ToolbarLayout(true)); Point topLeft = hs.getHandlesPosition(hostFig); hs.decorationFig.setBounds(new Rectangle(topLeft, hs.decorationFig.getPreferredSize())); if (moreButton.intersects(hs.decorationFig.getBounds())) hs.decorationFig.getBounds().y += moreButton.getBounds().height; hostFig.addFigureListener(new FigureListener() { public void figureMoved(IFigure source) { Point topLeft = hs.getHandlesPosition(hostFig); hs.decorationFig.setLocation(topLeft); } }); return hs.decorationFig; }
From source file:com.architexa.diagrams.parts.NavAidsEditPolicy.java
License:Open Source License
private IFigure getMultiHandle(final NavAidsSpec hs, boolean show) { hs.decorationFig = new Figure(); hs.buildHandles();/*from w w w. j ava 2 s. co m*/ hs.decorationFig.setOpaque(true); hs.decorationFig.setBorder(new SimpleRaisedBorder()); hs.decorationFig.setFont(JFaceResources.getDialogFont()); hs.decorationFig.setLayoutManager(new ToolbarLayout(true)); List<AbstractGraphicalEditPart> selected = getSelectedNavAidsEditParts(); int maxX = 0; int minY = Integer.MAX_VALUE; for (AbstractGraphicalEditPart part : selected) { final IFigure hostFig = part.getFigure(); Point topLeft = hostFig.getBounds().getTopRight(); int x = topLeft.x; int y = topLeft.y; if (x > maxX) { maxX = x; } if (y < minY) { minY = y; } } Point topLeft = new Point(maxX + 5 + hs.decorationFig.getPreferredSize().width, minY); hs.decorationFig.setBounds(new Rectangle(topLeft, hs.decorationFig.getPreferredSize())); final IFigure hostFig = getHostFigure(); hostFig.addFigureListener(new FigureListener() { public void figureMoved(IFigure source) { List<AbstractGraphicalEditPart> selected = getSelectedNavAidsEditParts(); int maxX = 0; int minY = Integer.MAX_VALUE; for (AbstractGraphicalEditPart part : selected) { final IFigure hostFig = part.getFigure(); Point topLeft = hostFig.getBounds().getTopRight(); int x = topLeft.x; int y = topLeft.y; if (x > maxX) { maxX = x; } if (y < minY) { minY = y; } } Point topLeft = new Point(maxX + 5 + hs.decorationFig.getPreferredSize().width, minY); hs.decorationFig.setLocation(topLeft); } }); return hs.decorationFig; }
From source file:com.architexa.org.eclipse.gef.ui.palette.customize.PaletteSettingsDialog.java
License:Open Source License
/** * This method is invoked when the user selects the "Restore Default" font button. It * changes the font, in case it was different, to the default one, which is the Workbench * Dialog font./*from w w w . j av a 2s . c o m*/ */ protected void handleDefaultFontRequested() { prefs.setFontData(JFaceResources.getDialogFont().getFontData()[0]); updateFontName(); }
From source file:com.architexa.org.eclipse.gef.ui.palette.customize.PaletteSettingsDialog.java
License:Open Source License
/** * Updates the label showing the font's name to show the name of the current font. */// w w w . j av a 2 s .co m protected void updateFontName() { String name; if (prefs.getFontData().equals((JFaceResources.getDialogFont().getFontData()[0]))) { name = PaletteMessages.SETTINGS_WORKBENCH_FONT_LABEL; } else { name = StringConverter.asString(prefs.getFontData()); } fontName.setText(PaletteMessages.SETTINGS_FONT_CURRENT + name); }
From source file:com.architexa.org.eclipse.gef.ui.palette.DefaultPaletteViewerPreferences.java
License:Open Source License
/** * Constructor//from ww w. ja v a 2s.com * * @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.architexa.org.eclipse.gef.ui.palette.DefaultPaletteViewerPreferences.java
License:Open Source License
/** * @see com.architexa.org.eclipse.gef.ui.palette.PaletteViewerPreferences#getFontData() *//*from w ww . j a v a 2s . c o m*/ public FontData getFontData() { if (fontData == null) { String value = getPreferenceStore().getString(PREFERENCE_FONT); if (value.equals(DEFAULT_FONT)) { fontData = JFaceResources.getDialogFont().getFontData()[0]; } else { fontData = new FontData(value); } } return fontData; }
From source file:com.architexa.org.eclipse.gef.ui.palette.DefaultPaletteViewerPreferences.java
License:Open Source License
/** * @see com.architexa.org.eclipse.gef.ui.palette.PaletteViewerPreferences#setFontData(FontData) *///www . j a v a2s . co m public void setFontData(FontData data) { fontData = data; String value = data.toString(); if (fontData.equals(JFaceResources.getDialogFont().getFontData()[0])) { value = DEFAULT_FONT; } getPreferenceStore().setValue(PREFERENCE_FONT, value); }
From source file:com.astra.ses.spell.gui.preferences.initializer.elements.FontInfo.java
License:Open Source License
/*************************************************************************** * Constructor// w ww .j av 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) { id = xmlElement.getAttribute("id"); face = xmlElement.getAttribute("face"); String fontSize = xmlElement.getAttribute("size"); size = Integer.parseInt(fontSize); String fontStyle = xmlElement.getAttribute("style"); if (fontStyle.equals("bold")) { style = SWT.BOLD; } else if (fontStyle.equals("italic")) { style = SWT.ITALIC; } else if (fontStyle.equals("bold-italic")) { style = SWT.BOLD | SWT.ITALIC; } else if (fontStyle.equals("norm")) { style = SWT.NORMAL; } else { Logger.error("Bad font style definition: " + fontStyle + ". Using norm", Level.CONFIG, this); style = SWT.NORMAL; } if (face.equals("header")) { face = JFaceResources.getHeaderFont().getFontData()[0].getName(); } else if (face.equals("dialog")) { face = JFaceResources.getDialogFont().getFontData()[0].getName(); } } }
From source file:com.atlassian.connector.eclipse.internal.crucible.ui.dialogs.CrucibleAddCommentDialog.java
License:Open Source License
protected Button createDefectButton(Composite parent) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; defectButton = new Button(parent, SWT.CHECK); defectButton.setText(DEFECT_LABEL);/*w w w . jav a 2 s . c om*/ defectButton.setFont(JFaceResources.getDialogFont()); defectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { defect = !defect; // toggle combos for (CustomFieldDef field : customCombos.keySet()) { customCombos.get(field).getCombo().setEnabled(defect); } } }); return defectButton; }
From source file:com.atlassian.connector.eclipse.internal.crucible.ui.dialogs.CrucibleEditCommentDialog.java
License:Open Source License
protected Button createDefectButton(Composite parent) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; defectButton = new Button(parent, SWT.CHECK); defectButton.setText(DEFECT_LABEL);//from w ww.j a v a2 s.c o m defectButton.setFont(JFaceResources.getDialogFont()); defectButton.setSelection(defect); defectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { defect = !defect; // toggle combos updateComboEnablement(); updateButtonsState(); } }); return defectButton; }