@Override protected FontData getFontData(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { return JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]; }
/** * Returns a FontDescriptor that is equivalent to the receiver, but uses * the given style bits. * * <p>Does not modify the receiver.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given style * * @since 3.3 */ public final FontDescriptor setStyle(int style) { FontData[] data = getFontData(); for (FontData next : data) { next.setStyle(style); } // Optimization: avoid holding onto extra instances by returning the receiver if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a new FontDescriptor that is equivalent to the reciever, but * has the given height.</p> * * <p>Does not modify the reciever.</p> * * @param height a height, in points * @return a new FontDescriptor with the height, in points * @since 3.3 */ public final FontDescriptor setHeight(int height) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setHeight(height); } // Optimization: avoid holding onto extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * Returns a FontDescriptor that is equivalent to the reciever, but uses * the given style bits. * * <p>Does not modify the reciever.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given style * * @since 1.1 */ public final FontDescriptor setStyle(int style) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setStyle(style); } // Optimization: avoid holding onto extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a new FontDescriptor that is equivalent to the reciever, but * has the given height.</p> * * <p>Does not modify the reciever.</p> * * @param height a height, in points * @return a new FontDescriptor with the height, in points * @since 1.1 */ public final FontDescriptor setHeight(int height) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setHeight(height); } // Optimization: avoid holding onto extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a new FontDescriptor that is equivalent to the receiver, but * has the given height.</p> * * <p>Does not modify the receiver.</p> * * @param height a height, in points * @return a new FontDescriptor with the height, in points * @since 3.3 */ public final FontDescriptor setHeight(int height) { FontData[] data = getFontData(); for (FontData next : data) { next.setHeight(height); } // Optimization: avoid holding onto extra instances by returning the receiver if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * Returns a FontDescriptor that is equivalent to the reciever, but uses * the given style bits. * * <p>Does not modify the reciever.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given style * * @since 3.3 */ public final FontDescriptor setStyle(int style) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setStyle(style); } // Optimization: avoid holding onto extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
private void updateLabel(ILabelUpdate update, int columnIndex) { update.setLabel(fMessage, columnIndex); FontData fontData = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]; fontData.setStyle(SWT.ITALIC); } }
/** * <p>Returns a FontDescriptor that is equivalent to the reciever, but * has the given style bits, in addition to any styles the reciever already has.</p> * * <p>Does not modify the reciever.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given additional style bits * @since 3.3 */ public final FontDescriptor withStyle(int style) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setStyle(next.getStyle() | style); } // Optimization: avoid allocating extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a FontDescriptor that is equivalent to the reciever, but * has the given style bits, in addition to any styles the reciever already has.</p> * * <p>Does not modify the reciever.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given additional style bits * @since 1.1 */ public final FontDescriptor withStyle(int style) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setStyle(next.getStyle() | style); } // Optimization: avoid allocating extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a FontDescriptor that is equivalent to the receiver, but * has the given style bits, in addition to any styles the receiver already has.</p> * * <p>Does not modify the receiver.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given additional style bits * @since 3.3 */ public final FontDescriptor withStyle(int style) { FontData[] data = getFontData(); for (FontData next : data) { next.setStyle(next.getStyle() | style); } // Optimization: avoid allocating extra instances by returning the receiver if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a FontDescriptor that is equivalent to the receiver, but whose height * is larger by the given number of points.</p> * * <p>Does not modify the receiver.</p> * * @param heightDelta a change in height, in points. Negative values will return smaller * fonts. * @return a FontDescriptor whose height differs from the receiver by the given number * of points. * @since 3.3 */ public final FontDescriptor increaseHeight(int heightDelta) { if (heightDelta == 0) { return this; } FontData[] data = getFontData(); for (FontData next : data) { next.setHeight(next.getHeight() + heightDelta); } return new ArrayFontDescriptor(data); }
/** * <p>Returns a FontDescriptor that is equivalent to the reciever, but whose height * is larger by the given number of points.</p> * * <p>Does not modify the reciever.</p> * * @param heightDelta a change in height, in points. Negative values will return smaller * fonts. * @return a FontDescriptor whose height differs from the reciever by the given number * of points. * @since 3.3 */ public final FontDescriptor increaseHeight(int heightDelta) { if (heightDelta == 0) { return this; } FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setHeight(next.getHeight() + heightDelta); } return new ArrayFontDescriptor(data); }
/** * <p>Returns a FontDescriptor that is equivalent to the reciever, but whose height * is larger by the given number of points.</p> * * <p>Does not modify the reciever.</p> * * @param heightDelta a change in height, in points. Negative values will return smaller * fonts. * @return a FontDescriptor whose height differs from the reciever by the given number * of points. * @since 1.2 */ public final FontDescriptor increaseHeight(int heightDelta) { if (heightDelta == 0) { return this; } FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setHeight(next.getHeight() + heightDelta); } return new ArrayFontDescriptor(data); }
@SuppressWarnings("deprecation") private void updateLabel(ILabelUpdate update, int columnIndex) { update.setLabel(DebugUIMessages.ExpressionManagerContentProvider_1, columnIndex); update.setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_MONITOR_EXPRESSION), columnIndex); // Display the "Add new expression" element in italic to // distinguish it from user elements in view. FontData fontData = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0]; fontData.setStyle(SWT.ITALIC); update.setFontData(fontData, columnIndex); }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { AbstractTextEditor textEditor= getActiveTextEditor(event); if (textEditor == null) { return null; } FontRegistry fontRegistry= textEditor.getSite().getWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry(); String fontProperty= textEditor.getSymbolicFontName(); if (fontProperty == null) { fontProperty= JFaceResources.TEXT_FONT; } Set<String> fontsToSet= getAffectedFontNames(fontProperty, fontRegistry); FontData[] initialFontData= null; String currentFontName= fontProperty; while (currentFontName != null && (initialFontData= fontRegistry.getFontData(currentFontName)) == null) { currentFontName= fgFontToDefault.get(currentFontName); } FontData[] newFontData= createFontDescriptor(initialFontData).getFontData(); if (newFontData != null) { fontsToSet.stream().forEach(fontName -> fontRegistry.put(fontName, newFontData)); } return Status.OK_STATUS; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { AbstractTextEditor textEditor= getActiveTextEditor(event); if (textEditor == null) { return null; } FontRegistry fontRegistry= textEditor.getSite().getWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry(); String fontProperty= textEditor.getSymbolicFontName(); if (fontProperty == null) { fontProperty= JFaceResources.TEXT_FONT; } Set<String> fontsToSet= getAffectedFontNames(fontProperty, fontRegistry); FontData[] initialFontData= null; String currentFontName= fontProperty; while (currentFontName != null && (initialFontData= fontRegistry.getFontData(currentFontName)) == null) { currentFontName= fgFontToDefault.get(currentFontName); } FontData[] newFontData= createFontDescriptor(initialFontData).getFontData(); if (newFontData != null) { fontsToSet.stream().forEach(fontName -> fontRegistry.put(fontName, newFontData)); } return Status.OK_STATUS; }
fontData = FontDescriptor.createFrom ( fontName, fontSize, SWT.NORMAL ).getFontData (); fontData = FontDescriptor.createFrom ( fontName, origFontSize, SWT.NORMAL ).getFontData ();
fontData = FontDescriptor.createFrom ( fontName, fontSize, SWT.NORMAL ).getFontData (); fontData = FontDescriptor.createFrom ( fontName, origFontSize, SWT.NORMAL ).getFontData ();