Java Code Examples for org.eclipse.swt.graphics.Font

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.ec2/src/com/amazonaws/eclipse/ec2/ui/.

Source file: ChargeWarningComposite.java

  22 
vote

/** 
 * Changes the font style on the specified label so that the text is displayed in italics.
 * @param label The label to change.
 */
private void italicizeLabel(Label label){
  Font font=label.getFont();
  FontData[] fontDataArray=font.getFontData();
  for (  FontData fontData : fontDataArray) {
    fontData.setStyle(SWT.ITALIC);
  }
  Font newFont=new Font(Display.getDefault(),fontDataArray);
  label.setFont(newFont);
}
 

Example 2

From project bndtools, under directory /bndtools.core/src/bndtools/.

Source file: UIConstants.java

  22 
vote

@Override public void applyStyles(TextStyle textStyle){
  ColorRegistry colorRegistry=JFaceResources.getColorRegistry();
  Font font=JFaceResources.getFontRegistry().getItalic(fontName);
  if (fForegroundColorName != null) {
    textStyle.foreground=colorRegistry.get(fForegroundColorName);
  }
  if (fBackgroundColorName != null) {
    textStyle.background=colorRegistry.get(fBackgroundColorName);
  }
  textStyle.font=font;
}
 

Example 3

From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/launch/.

Source file: BPELLaunchMainTab.java

  22 
vote

public void createControl(Composite parent){
  Font font=parent.getFont();
  Composite comp=new Composite(parent,SWT.NONE);
  setControl(comp);
  GridLayout topLayout=new GridLayout();
  topLayout.verticalSpacing=0;
  comp.setLayout(topLayout);
  comp.setFont(font);
  createProjectSection(comp);
  createVerticalSpacer(comp,1);
  createSuiteSection(comp,"&BPEL Test Suite File:",new Button[]{});
}
 

Example 4

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/editor/.

Source file: CeylonEditor.java

  22 
vote

private void setSourceFontFromPreference(){
  String fontName=WorkbenchPlugin.getDefault().getPreferenceStore().getString(JFaceResources.TEXT_FONT);
  FontRegistry fontRegistry=CeylonPlugin.getInstance().getFontRegistry();
  if (!fontRegistry.hasValueFor(fontName)) {
    fontRegistry.put(fontName,PreferenceConverter.readFontData(fontName));
  }
  Font sourceFont=fontRegistry.get(fontName);
  if (sourceFont != null) {
    getSourceViewer().getTextWidget().setFont(sourceFont);
  }
}
 

Example 5

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/swtdesigner/.

Source file: SWTResourceManager.java

  22 
vote

/** 
 * Returns a bold version of the given  {@link Font}.
 * @param baseFont the  {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont){
  Font font=m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[]=baseFont.getFontData();
    FontData data=fontDatas[0];
    font=new Font(Display.getCurrent(),data.getName(),data.getHeight(),SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont,font);
  }
  return font;
}
 

Example 6

From project dawn-product, under directory /org.dawb.workbench.application/src/com/swtdesigner/.

Source file: SWTResourceManager.java

  22 
vote

/** 
 * Returns a bold version of the given  {@link Font}.
 * @param baseFont the  {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont){
  Font font=m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[]=baseFont.getFontData();
    FontData data=fontDatas[0];
    font=new Font(Display.getCurrent(),data.getName(),data.getHeight(),SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont,font);
  }
  return font;
}
 

Example 7

From project Diver, under directory /org.eclipse.zest.custom.sequence/src/org/eclipse/zest/custom/sequence/figures/.

Source file: ActivationGroupFigure.java

  22 
vote

/** 
 */
private void recalculateTextExtents(){
  subStringText=text;
  Font font=getFont();
  if (text != null && font != null) {
    Dimension te=FigureUtilities.getTextExtents(text,font);
    if (te.width >= bounds.width) {
      Dimension ee=FigureUtilities.getTextExtents(ELLIPSIS,font);
      int subStringLength=getLargestSubstringConfinedTo(text,font,getBounds().width - ee.width - 12);
      subStringText=new String(text.substring(0,subStringLength) + ELLIPSIS);
    }
  }
}
 

Example 8

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/rulebuilder/ui/.

Source file: RuleModeller.java

  22 
vote

private void setTitleAndFont(ScrolledForm form){
  form.setText("Guided rule editor");
  Font systemFont=form.getDisplay().getSystemFont();
  FontData[] exfds=systemFont.getFontData();
  if (exfds.length > 0) {
    FontData fd=exfds[0];
    fd.setHeight(fd.getHeight() + 2);
    fd.setStyle(SWT.BOLD);
    Font f=new Font(systemFont.getDevice(),fd);
    form.setFont(f);
  }
}
 

Example 9

From project flyingsaucer, under directory /flying-saucer-swt/src/main/java/org/xhtmlrenderer/swt/.

Source file: SWTTextRenderer.java

  22 
vote

public int getWidth(FontContext context,FSFont font,String string){
  GC gc=((SWTFontContext)context).getGC();
  Font previous=gc.getFont();
  gc.setFont(((SWTFSFont)font).getSWTFont());
  int width=gc.stringExtent(string).x;
  gc.setFont(previous);
  return width;
}
 

Example 10

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/com/swtdesigner/.

Source file: SWTResourceManager.java

  22 
vote

/** 
 * Returns a bold version of the given  {@link Font}.
 * @param baseFont the  {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont){
  Font font=m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[]=baseFont.getFontData();
    FontData data=fontDatas[0];
    font=new Font(Display.getCurrent(),data.getName(),data.getHeight(),SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont,font);
  }
  return font;
}
 

Example 11

From project grails-ide, under directory /org.grails.ide.eclipse.ui/src/org/grails/ide/eclipse/ui/internal/inplace/.

Source file: GrailsInplaceDialog.java

  22 
vote

private void smallFont(Control widget){
  if (statusTextFont == null) {
    Font font=widget.getFont();
    Display display=widget.getDisplay();
    FontData[] fontDatas=font.getFontData();
    for (    FontData element : fontDatas) {
      element.setHeight(element.getHeight() * 9 / 10);
    }
    statusTextFont=new Font(display,fontDatas);
  }
  widget.setFont(statusTextFont);
}
 

Example 12

From project JGit, under directory /org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/.

Source file: CommitGraphTable.java

  22 
vote

private static Font highlightFont(){
  final Font n, h;
  n=Activator.getFont(UIPreferences.THEME_CommitGraphNormalFont);
  h=Activator.getFont(UIPreferences.THEME_CommitGraphHighlightFont);
  final FontData[] nData=n.getFontData();
  final FontData[] hData=h.getFontData();
  if (nData.length != hData.length)   return h;
  for (int i=0; i < nData.length; i++)   if (!nData[i].equals(hData[i]))   return h;
  return Activator.getBoldFont(UIPreferences.THEME_CommitGraphNormalFont);
}
 

Example 13

From project koneki.ldt, under directory /plugins/org.eclipse.koneki.ldt.debug.ui/src/org/eclipse/koneki/ldt/debug/ui/internal/launchconfiguration/attach/.

Source file: LuaAttachMainTab.java

  22 
vote

private Font getInformationFont(){
  Font textFont=JFaceResources.getTextFont();
  if (textFont == null)   return JFaceResources.getDefaultFont();
  if (textFont.getFontData().length > 0) {
    Font italic=JFaceResources.getFontRegistry().getItalic(textFont.getFontData()[0].getName());
    if (italic != null)     return italic;
  }
  return textFont;
}
 

Example 14

From project mousefeed, under directory /com.mousefeed/src/com/mousefeed/eclipse/.

Source file: NagPopUp.java

  22 
vote

/** 
 * Configures big font for this. 
 * @param c the control to increase font for. Not <code>null</code>.
 */
private void configureBigFont(final Control c){
  final FontData[] fontData=c.getFont().getFontData();
  for (int i=0; i < fontData.length; i++) {
    fontData[i].setHeight(fontData[i].getHeight() * FONT_INCREASE_MULT);
  }
  final Font newFont=new Font(getDisplay(),fontData);
  c.setFont(newFont);
  c.addDisposeListener(new DestroyFontDisposeListener(newFont));
}
 

Example 15

From project mylyn.context, under directory /org.eclipse.mylyn.team.ui/src/org/eclipse/mylyn/internal/team/ui/properties/.

Source file: ProjectTeamPage.java

  22 
vote

@Override protected Control createContents(Composite parent){
  Font font=parent.getFont();
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  composite.setLayout(layout);
  composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  composite.setFont(font);
  createDescription(composite);
  createPropertiesControl(composite);
  initialize();
  return composite;
}
 

Example 16

From project mylyn.docs, under directory /org.eclipse.mylyn.wikitext.tests/src/org/eclipse/mylyn/internal/wikitext/ui/editor/syntax/.

Source file: MarkupTokenScannerTest.java

  22 
vote

@Override protected void setUp() throws Exception {
  super.setUp();
  Font normalFont=new Font(null,new FontData[]{new FontData("normalFont",12,0)});
  Font monospaceFont=new Font(null,new FontData[]{new FontData("monoFont",12,0)});
  tokenScanner=new MarkupTokenScanner(normalFont,monospaceFont);
}
 

Example 17

From project netifera, under directory /platform/com.netifera.platform.host/com.netifera.platform.host.terminal.ui/src/com/netifera/platform/host/terminal/ui/view/.

Source file: TerminalView.java

  22 
vote

public void onTerminalFontChanged(){
  Font font=JFaceResources.getFont(FONT_DEFINITION);
  ITerminalViewConnection[] conn=fMultiConnectionManager.getConnections();
  for (int i=0; i < conn.length; i++) {
    conn[i].getCtlTerminal().setFont(font);
  }
}
 

Example 18

From project org.openscada.dakara, under directory /org.openscada.vi.ui.draw2d/src/org/openscada/vi/ui/draw2d/impl/.

Source file: ScaledGraphics.java

  22 
vote

/** 
 * @see Graphics#dispose() 
 */
@Override public void dispose(){
  while (this.stackPointer > 0) {
    popState();
  }
  final Iterator iter=this.fontCache.values().iterator();
  while (iter.hasNext()) {
    final Font font=(Font)iter.next();
    font.dispose();
  }
}
 

Example 19

From project org.openscada.external, under directory /org.eclipse.albireo/src/org/eclipse/albireo/core/.

Source file: SwingControl.java

  22 
vote

private void handleSettingsChange(){
  final Font newFont=getDisplay().getSystemFont();
  final FontData[] newFontData=newFont.getFontData();
  EventQueue.invokeLater(new Runnable(){
    public void run(){
      updateDefaultFont(newFont,newFontData);
    }
  }
);
}
 

Example 20

From project p2-browser, under directory /com.ifedorenko.p2browser/src/org/eclipse/wb/swt/.

Source file: SWTResourceManager.java

  22 
vote

/** 
 * Returns a bold version of the given  {@link Font}.
 * @param baseFont the  {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont){
  Font font=m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[]=baseFont.getFontData();
    FontData data=fontDatas[0];
    font=new Font(Display.getCurrent(),data.getName(),data.getHeight(),SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont,font);
  }
  return font;
}
 

Example 21

From project phing-eclipse, under directory /org.ganoro.phing.ui/src/org/ganoro/phing/ui/editors/.

Source file: AntSourceViewerInformationControl.java

  22 
vote

private SourceViewer createViewer(Composite parent){
  SourceViewer viewer=new SourceViewer(parent,null,SWT.NONE);
  SourceViewerConfiguration configuration=new AntSourceViewerConfiguration();
  viewer.configure(configuration);
  viewer.setEditable(false);
  Font font=JFaceResources.getFont(JFaceResources.TEXT_FONT);
  viewer.getTextWidget().setFont(font);
  return viewer;
}
 

Example 22

From project phresco-eclipse, under directory /com.photon.phresco.ui/src/org/eclipse/wb/swt/.

Source file: SWTResourceManager.java

  22 
vote

/** 
 * Returns a bold version of the given  {@link Font}.
 * @param baseFont the  {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont){
  Font font=m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[]=baseFont.getFontData();
    FontData data=fontDatas[0];
    font=new Font(Display.getCurrent(),data.getName(),data.getHeight(),SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont,font);
  }
  return font;
}
 

Example 23

From project scisoft-icat, under directory /uk.ac.diamond.scisoft.icatexplorer.rcp/src/org/eclipse/wb/swt/.

Source file: SWTResourceManager.java

  22 
vote

/** 
 * Returns a bold version of the given  {@link Font}.
 * @param baseFont the  {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont){
  Font font=m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[]=baseFont.getFontData();
    FontData data=fontDatas[0];
    font=new Font(Display.getCurrent(),data.getName(),data.getHeight(),SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont,font);
  }
  return font;
}
 

Example 24

From project scisoft-ui, under directory /uk.ac.diamond.scisoft.analysis.rcp/src/com/swtdesigner/.

Source file: SWTResourceManager.java

  22 
vote

/** 
 * Returns a bold version of the given  {@link Font}.
 * @param baseFont the  {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont){
  Font font=m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[]=baseFont.getFontData();
    FontData data=fontDatas[0];
    font=new Font(Display.getCurrent(),data.getName(),data.getHeight(),SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont,font);
  }
  return font;
}
 

Example 25

From project swtbot, under directory /examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/.

Source file: LogicLabelEditManager.java

  22 
vote

private void updateScaledFont(double zoom){
  if (cachedZoom == zoom)   return;
  Text text=(Text)getCellEditor().getControl();
  Font font=getEditPart().getFigure().getFont();
  disposeScaledFont();
  cachedZoom=zoom;
  if (zoom == 1.0)   text.setFont(font);
 else {
    FontData fd=font.getFontData()[0];
    fd.setHeight((int)(fd.getHeight() * zoom));
    text.setFont(scaledFont=new Font(null,fd));
  }
}
 

Example 26

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/wizards/.

Source file: NewProjectWizardPage.java

  21 
vote

/** 
 * {@inheritDoc}
 */
@Override public void createControl(Composite parent){
  Font f=parent.getFont();
  Composite composite=createComposite(parent,f,1,1,FILL_BOTH);
  setControl(composite);
  ((GridLayout)composite.getLayout()).verticalSpacing=15;
  Listener listener=new Listener();
  boolean no_home=false;
  if (noLength(getDefault().getBELFrameworkHome())) {
    link=new Link(composite,NONE);
    link.setText(linktxt);
    link.addSelectionListener(listener);
    no_home=true;
  }
  g1=new Group(composite,NONE);
  g1.setText("&Project Name:");
  GridData gd=new GridData(FILL_HORIZONTAL);
  g1.setLayoutData(gd);
  GridLayout gl=new GridLayout();
  gl.numColumns=2;
  g1.setLayout(gl);
  g1.setFont(f);
  txtProject=new Text(g1,SINGLE | BORDER);
  gd=new GridData(FILL_HORIZONTAL);
  txtProject.setLayoutData(gd);
  txtProject.setFont(f);
  txtProject.addKeyListener(listener);
  if (no_home) {
    g1.setEnabled(false);
  }
  setPageComplete(false);
  setControl(composite);
}
 

Example 27

From project ccw, under directory /ccw.core/src/java/ccw/preferences/.

Source file: SyntaxColoringPreferencePage.java

  21 
vote

private Control createPreviewer(Composite parent){
  IPreferenceStore generalTextStore=EditorsUI.getPreferenceStore();
  IPreferenceStore store=new ChainedPreferenceStore(new IPreferenceStore[]{fOverlayStore,generalTextStore});
  fPreviewViewer=new ClojureSourceViewer(parent,null,null,false,SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER,store,null){
    public void setStatusLineErrorMessage(    String you_need_a_running_repl){
    }
  }
;
  ClojureSourceViewerConfiguration configuration=new ClojureSourceViewerConfiguration(store,fPreviewViewer);
  fPreviewViewer.configure(configuration);
  fPreviewViewer.initializeViewerColors();
  Font font=JFaceResources.getFont(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_TEXT_FONT);
  fPreviewViewer.getTextWidget().setFont(font);
  IDocument document=new Document(PREVIEW_SOURCE);
  IDocumentPartitioner partitioner=new ClojurePartitioner(new ClojurePartitionScanner(),ClojurePartitionScanner.CLOJURE_CONTENT_TYPES);
  Map<String,IDocumentPartitioner> m=new HashMap<String,IDocumentPartitioner>();
  m.put(ClojurePartitionScanner.CLOJURE_PARTITIONING,partitioner);
  TextUtilities.addDocumentPartitioners(document,m);
  fPreviewViewer.setDocument(document);
  return fPreviewViewer.getControl();
}
 

Example 28

From project CIShell, under directory /templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/.

Source file: AddInputDataPanel.java

  21 
vote

private Font createInputDataLabelFont(Device device,FontData[] oldFontData){
  FontData[] newFontData=new FontData[oldFontData.length];
  for (int ii=0; ii < oldFontData.length; ii++) {
    newFontData[ii]=new FontData(oldFontData[ii].getName(),oldFontData[ii].getHeight() + 2,oldFontData[ii].getStyle() | SWT.BOLD);
  }
  return new Font(device,newFontData);
}
 

Example 29

From project dawn-third, under directory /org.dawb.org.csstudio.swt.xygraph/src/org/csstudio/swt/xygraph/figures/.

Source file: Axis.java

  21 
vote

/** 
 * Constructor
 * @param title title of the axis
 * @param yAxis true if this is the Y-Axis, false if this is the X-Axis.
 */
public Axis(final String title,final boolean yAxis){
  super();
  this.title=title;
  if (yAxis)   setOrientation(Orientation.VERTICAL);
  final AxisMouseListener panner=new AxisMouseListener();
  addMouseListener(panner);
  addMouseMotionListener(panner);
  grabbing=XYGraphMediaFactory.getCursor(CURSOR_TYPE.GRABBING);
  Font sysFont=Display.getCurrent().getSystemFont();
  titleFont=XYGraphMediaFactory.getInstance().getFont(new FontData(sysFont.getFontData()[0].getName(),12,SWT.BOLD));
  if (getBackgroundColor() != null) {
    RGB backRGB=getBackgroundColor().getRGB();
    revertBackColor=XYGraphMediaFactory.getInstance().getColor(255 - backRGB.red,255 - backRGB.green,255 - backRGB.blue);
  }
 else   revertBackColor=XYGraphMediaFactory.getInstance().getColor(100,100,100);
  autoScaler=new NullAutoScaler();
}
 

Example 30

From project dawn-ui, under directory /org.dawb.workbench.plotting/src/org/dawb/workbench/plotting/system/swtxy/selection/.

Source file: RingSelection.java

  21 
vote

public RingSelection(String name,ICoordinateSystem coords){
  super(name,coords);
  setRegionColor(ColorConstants.yellow);
  setAlpha(80);
  labelColour=ColorConstants.black;
  labelFont=new Font(Display.getCurrent(),"Dialog",10,SWT.BOLD);
}
 

Example 31

From project dawn-workflow, under directory /org.dawb.passerelle.actors/src/org/dawb/passerelle/editors/.

Source file: XpathLabelProvider.java

  21 
vote

public XpathLabelProvider(XPathEditor ed,int column,final Font current){
  super(column);
  this.editor=ed;
  this.messageMap=new HashMap<VARIABLE_TYPE,String>(4);
  messageMap.put(VARIABLE_TYPE.PATH,"A path, '");
  messageMap.put(VARIABLE_TYPE.SCALAR,"A scalar value, '");
  messageMap.put(VARIABLE_TYPE.ARRAY,"An array, '");
  messageMap.put(VARIABLE_TYPE.IMAGE,"An image, '");
  messageMap.put(VARIABLE_TYPE.XML,"An uneditable xml attribute tag, '");
  toolTipMap.put(VARIABLE_TYPE.XML,"An xml attribute, element or elements extracted using XPath. Note you can put other variables in the name, for instance 'x_${file_name}'");
  final FontData curDat=current.getFontData()[0];
  this.uneditableFont=new Font(current.getDevice(),curDat.getName(),curDat.getHeight(),SWT.ITALIC);
}
 

Example 32

From project dolphin, under directory /org.adarsh.jutils/src/org/adarsh/jutils/preferences/.

Source file: PreferenceUtils.java

  21 
vote

/** 
 * Creates a new source viewer for each invocation.
 * @param parent parent component.
 * @param labelText the text to be used as label.
 * @param document contains the text to be rendered.
 */
public static void createViewer(Composite parent,String labelText,IDocument document){
  Label label=new Label(parent,0);
  label.setFont(new Font(Display.getCurrent(),"",10,SWT.BOLD | SWT.COLOR_RED));
  label.setText(labelText);
  GridData data=new GridData();
  data.horizontalSpan=PreferenceConstants.WIDTH;
  label.setLayoutData(data);
  JavaTextTools tools=JavaPlugin.getDefault().getJavaTextTools();
  tools.setupJavaDocumentPartitioner(document,PreferenceConstants.PARTITIONING);
  IPreferenceStore store=JavaPlugin.getDefault().getCombinedPreferenceStore();
  SourceViewer viewer=new JavaSourceViewer(parent,null,null,false,PreferenceConstants.SOURCEVIEWER_STYLE,store);
  viewer.setEditable(true);
  viewer.setDocument(document);
  Font font=JFaceResources.getFont(PreferenceConstants.JAVA_FONT);
  viewer.getTextWidget().setFont(font);
  Control control=viewer.getControl();
  data=new GridData(GridData.FILL_BOTH);
  data.widthHint=PreferenceConstants.WIDTH;
  data.heightHint=PreferenceConstants.HEIGHT;
  control.setLayoutData(data);
}
 

Example 33

From project Eclipse, under directory /com.mobilesorcery.sdk.ui/src/com/mobilesorcery/sdk/ui/.

Source file: IconAndMultilineLabelProvider.java

  21 
vote

private void drawLines(GC gc,Object element,int x,int y){
  String[] lines=getLines(element);
  Color[] colors=getColors(element);
  Font[] fonts=getFonts(element);
  for (int i=0; i < lines.length; i++) {
    if (lines[i] != null) {
      Color color=colors != null && colors.length > i ? colors[i] : display.getSystemColor(SWT.COLOR_BLACK);
      gc.setForeground(colors[i]);
      Font font=fonts != null && fonts.length > i ? fonts[i] : null;
      gc.setFont(font);
      gc.drawText(lines[i],x,y,true);
      y+=gc.textExtent(lines[i]).y;
    }
  }
}
 

Example 34

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.ui/src/org/springsource/ide/eclipse/commons/frameworks/ui/internal/wizard/.

Source file: GenericWizardCommandParametersPage.java

  21 
vote

/** 
 * Given a list of parameters, find the parameter name that is the longest, as this will be used to compute the pixel equivalent width for the label column.
 * @param parent
 * @param parameters
 * @return longest parameter name that is found in pixels.
 */
protected Point getLongestLabelSize(){
  if (longestLabelWidth != null) {
    return longestLabelWidth;
  }
  int length=SWT.DEFAULT;
  int charLength=0;
  List<ICommandParameter> parameters=getCommand().getParameters();
  if (parameters != null) {
    for (    ICommandParameter parameter : parameters) {
      ParameterKind kind=parameter.getParameterDescriptor().getParameterKind();
      if (kind != ParameterKind.BOOLEAN) {
        String name=parameter.getParameterDescriptor().getName();
        if (name != null) {
          int nameLength=name.length();
          if (nameLength > charLength) {
            charLength=nameLength;
          }
        }
      }
    }
  }
  if (charLength > 0) {
    Control control=getShell();
    GC gc=new GC(control);
    Font requiredLabelFont=getRequiredParameterFont();
    gc.setFont(requiredLabelFont != null ? requiredLabelFont : control.getFont());
    FontMetrics fontMetrics=gc.getFontMetrics();
    length=Dialog.convertWidthInCharsToPixels(fontMetrics,charLength);
    gc.dispose();
  }
  longestLabelWidth=new Point(length,-1);
  longestLabelWidth.x+=getLabelNameSeparatorOffset();
  return longestLabelWidth;
}
 

Example 35

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.debug.ui/INTERNAL/java/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/.

Source file: HaskellArgumentsTab.java

  21 
vote

private void createWorkDirectoryComponent(final Composite parent){
  Font font=parent.getFont();
  Composite composite=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.marginWidth=0;
  layout.marginHeight=0;
  layout.numColumns=1;
  GridData gridData=new GridData(GridData.FILL_HORIZONTAL);
  composite.setLayout(layout);
  composite.setLayoutData(gridData);
  Label label=new Label(composite,SWT.NONE);
  label.setText(UITexts.haskellArgumentsTab_workDir);
  label.setFont(font);
  txtWorkDirectory=new Text(composite,SWT.BORDER);
  GridData data=new GridData(GridData.FILL_HORIZONTAL);
  data.widthHint=IDialogConstants.ENTRY_FIELD_WIDTH;
  txtWorkDirectory.setLayoutData(data);
  txtWorkDirectory.setFont(font);
  createButtonComposite(parent,font);
}
 

Example 36

From project eik, under directory /plugins/info.evanchik.eclipse.karaf.ui/src/main/java/info/evanchik/eclipse/karaf/ui/.

Source file: KarafConfigurationTab.java

  21 
vote

/** 
 * Creates the necessary UI controls to manipulate the features system.
 * @param parent
 */
private void createFeaturesBlock(final Composite parent){
  final Font font=parent.getFont();
  final GridLayout layout=new GridLayout(2,false);
  final Group group=new Group(parent,SWT.NONE);
  group.setFont(font);
  group.setLayout(layout);
  group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  group.setText("Features");
  enableFeaturesManagement=new Button(group,SWT.CHECK);
  enableFeaturesManagement.setText("Enable Karaf Features management");
  enableFeaturesManagement.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    final Event event){
      if (event.widget == enableFeaturesManagement) {
        final boolean enabledState=availableFeaturesViewer.getControl().getEnabled();
        availableFeaturesViewer.getControl().setEnabled(!enabledState);
        bootFeaturesViewer.getControl().setEnabled(!enabledState);
        bootFeatureOrderDecreaseButton.setEnabled(!enabledState);
        bootFeatureOrderIncreaseButton.setEnabled(!enabledState);
        bootFeatureRemoveButton.setEnabled(!enabledState);
        KarafConfigurationTab.this.updateLaunchConfigurationDialog();
      }
    }
  }
);
  enableFeaturesManagement.setLayoutData(new GridData(SWT.BEGINNING));
  final Label bootFeatureRankLabel=new Label(group,SWT.NONE);
  bootFeatureRankLabel.setText("Boot Feature Rank");
  bootFeatureRankLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  createAvailableFeaturesControls(group);
  createBootFeatureManagementControls(group);
}
 

Example 37

From project Foglyn, under directory /com.foglyn.ui/src/com/foglyn/ui/.

Source file: TaskEditorFogbugzEventsPart.java

  21 
vote

private Font getBoldFont(Display display,Font normal){
  FontData[] fontDatas=normal.getFontData();
  for (int i=0; i < fontDatas.length; i++) {
    fontDatas[i].setStyle(fontDatas[i].getStyle() | SWT.BOLD);
  }
  return new Font(display,fontDatas);
}
 

Example 38

From project iee, under directory /org.eclipse.iee.sample.graph/src/org/jfree/experimental/swt/.

Source file: SWTUtils.java

  21 
vote

/** 
 * Create a <code>FontData</code> object which encapsulate the essential data to create a swt font. The data is taken from the provided awt Font. <p>Generally speaking, given a font size, the returned swt font will display differently on the screen than the awt one. Because the SWT toolkit use native graphical resources whenever it is possible, this fact is platform dependent. To address this issue, it is possible to enforce the method to return a font with the same size (or at least as close as possible) as the awt one. <p>When the object is no more used, the user must explicitly call the dispose method on the returned font to free the operating system resources (the garbage collector won't do it).
 * @param device The swt device to draw on (display or gc device).
 * @param font The awt font from which to get the data.
 * @param ensureSameSize A boolean used to enforce the same size(in pixels) between the awt font and the newly created swt font.
 * @return a <code>FontData</code> object.
 */
public static FontData toSwtFontData(Device device,java.awt.Font font,boolean ensureSameSize){
  FontData fontData=new FontData();
  fontData.setName(font.getFamily());
  fontData.setStyle(font.getStyle());
  int height=(int)Math.round(font.getSize() * 72.0 / device.getDPI().y);
  fontData.setHeight(height);
  if (ensureSameSize) {
    GC tmpGC=new GC(device);
    Font tmpFont=new Font(device,fontData);
    tmpGC.setFont(tmpFont);
    if (tmpGC.textExtent(Az).x > DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) {
      while (tmpGC.textExtent(Az).x > DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) {
        tmpFont.dispose();
        height--;
        fontData.setHeight(height);
        tmpFont=new Font(device,fontData);
        tmpGC.setFont(tmpFont);
      }
    }
 else     if (tmpGC.textExtent(Az).x < DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) {
      while (tmpGC.textExtent(Az).x < DUMMY_PANEL.getFontMetrics(font).stringWidth(Az)) {
        tmpFont.dispose();
        height++;
        fontData.setHeight(height);
        tmpFont=new Font(device,fontData);
        tmpGC.setFont(tmpFont);
      }
    }
    tmpFont.dispose();
    tmpGC.dispose();
  }
  return fontData;
}
 

Example 39

From project incubator, under directory /net.karlmartens.ui/src/net/karlmartens/ui/action/.

Source file: ResizeColumnAction.java

  21 
vote

private Font createColumnHeaderFont(){
  final Display display=_table.getDisplay();
  final FontData[] fontData=_table.getFont().getFontData();
  for (int i=0; i < fontData.length; i++) {
    fontData[i].setStyle(SWT.BOLD);
  }
  return new Font(display,fontData);
}
 

Example 40

From project m2eclipse-webby, under directory /org.sonatype.m2e.webby/src/org/sonatype/m2e/webby/internal/launch/ui/.

Source file: WebbyTab.java

  21 
vote

private void createApplicationEditor(Composite parent){
  Font font=parent.getFont();
  Group group=new Group(parent,SWT.NONE);
  group.setText("Web Application");
  group.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
  group.setLayout(new GridLayout(3,false));
  group.setFont(font);
  new Label(group,SWT.LEFT).setText("Project:");
  projectName=new Text(group,SWT.SINGLE | SWT.BORDER);
  projectName.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      updateLaunchConfigurationDialog();
    }
  }
);
  projectName.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
  projectName.setFont(font);
  projectNameBrowse=createPushButton(group,LauncherMessages.AbstractJavaMainTab_1,null);
  projectNameBrowse.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      IJavaProject project=chooseJavaProject();
      if (project != null) {
        projectName.setText(project.getElementName());
      }
    }
  }
);
  new Label(group,SWT.LEFT).setText("Context:");
  contextName=new Text(group,SWT.SINGLE | SWT.BORDER);
  contextName.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      updateLaunchConfigurationDialog();
    }
  }
);
  contextName.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
  contextName.setFont(font);
  return;
}
 

Example 41

From project mwe, under directory /plugins/org.eclipse.emf.mwe.ui/src/org/eclipse/emf/mwe/internal/ui/debug/launching/ui/.

Source file: MWELaunchConfigMainTab.java

  21 
vote

public void createControl(final Composite parent){
  Font font=parent.getFont();
  Composite comp=new Composite(parent,SWT.NONE);
  setControl(comp);
  GridLayout topLayout=new GridLayout();
  topLayout.verticalSpacing=0;
  comp.setLayout(topLayout);
  comp.setFont(font);
  projButton=createPushButton(parent,Messages.MWELaunchConfigMainTab_Browse,null);
  projText=createGroup(comp,Messages.MWELaunchConfigMainTab_Project,projButton,null);
  createVerticalSpacer(comp,1);
  wfButton=createPushButton(parent,Messages.MWELaunchConfigMainTab_Search,null);
  stopInMainCheckbox=createCheckButton(parent,Messages.MWELaunchConfigMainTab_StopInMain);
  javaDebugCheckbox=createCheckButton(parent,Messages.MWELaunchConfigMainTab_JavaDebug);
  wfText=createGroup(comp,Messages.MWELaunchConfigMainTab_initialWorkflowFile,wfButton,new Button[]{stopInMainCheckbox,javaDebugCheckbox});
}
 

Example 42

From project mylyn.docs.intent.main, under directory /plugins/org.eclipse.mylyn.docs.intent.client.ui/src/org/eclipse/mylyn/docs/intent/client/ui/editor/configuration/.

Source file: IntentFontConstants.java

  21 
vote

/** 
 * Initialize the font to associate with not keyWords elements.
 */
private static void initializeWikiFont(){
  IntentFontConstants.TITLE_FONT=new Font(Display.getCurrent(),DOCUMENTATION_DEFAULT_FONT_NAME,IntentFontConstants.DU_TITLE_SIZE,SWT.BOLD);
  IntentFontConstants.DU_FONT=new Font(Display.getCurrent(),DOCUMENTATION_FONT_NAME,IntentFontConstants.DU_FONT_SIZE,SWT.NONE);
  if (IntentFontConstants.DU_FONT == null) {
    IntentFontConstants.DU_FONT=new Font(Display.getCurrent(),DOCUMENTATION_DEFAULT_FONT_NAME,DU_FONT_SIZE,SWT.NONE);
    IntentFontConstants.TITLE_FONT=new Font(Display.getCurrent(),DOCUMENTATION_DEFAULT_FONT_NAME,IntentFontConstants.DU_TITLE_SIZE,SWT.BOLD);
  }
}
 

Example 43

From project mylyn.incubator, under directory /org.eclipse.mylyn.sandbox.ui/src/org/eclipse/mylyn/internal/sandbox/ui/planner/.

Source file: TaskActivityWizardPage.java

  21 
vote

/** 
 * Creates the buttons for selecting all or none of the categories.
 * @param parent parent composite
 */
private final void createButtonsGroup(Composite parent){
  Font font=parent.getFont();
  new Label(parent,SWT.NONE);
  Composite buttonComposite=new Composite(parent,SWT.NONE);
  buttonComposite.setFont(parent.getFont());
  GridLayout layout=new GridLayout();
  layout.numColumns=3;
  layout.makeColumnsEqualWidth=true;
  buttonComposite.setLayout(layout);
  buttonComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
  Button selectButton=new Button(buttonComposite,SWT.NONE);
  selectButton.setText("Select All");
  selectButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      setChecked(true);
    }
  }
);
  selectButton.setFont(font);
  setButtonLayoutData(selectButton);
  Button deselectButton=new Button(buttonComposite,SWT.NONE);
  deselectButton.setText("Deselect All");
  deselectButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      setChecked(false);
    }
  }
);
  deselectButton.setFont(font);
  setButtonLayoutData(deselectButton);
}
 

Example 44

From project org.openscada.orilla, under directory /org.openscada.hd.ui.chart/src/org/swtchart/internal/axis/.

Source file: AxisTitle.java

  21 
vote

/** 
 * Constructor.
 * @param chart the chart
 * @param style the style
 * @param axis the axis
 * @param direction the direction
 */
public AxisTitle(Chart chart,int style,Axis axis,Direction direction){
  super(chart,style);
  this.axis=axis;
  this.direction=direction;
  defaultFont=new Font(Display.getDefault(),"Tahoma",DEFAULT_FONT_SIZE,SWT.BOLD);
  setFont(defaultFont);
}
 

Example 45

From project PSP-NetParty, under directory /src/pspnetparty/client/swt/.

Source file: SwtUtils.java

  21 
vote

public static Font loadFont(String setting,FontData[] defaultFont){
  String[] values=setting.split(",");
  if (values.length == 3) {
    String name=values[0];
    int size=Integer.parseInt(values[1]);
    int style=parseFontStyle(values[2]);
    return new Font(DISPLAY,name,size,style);
  }
  return new Font(DISPLAY,defaultFont);
}
 

Example 46

From project rascal-eclipse, under directory /src/org/rascalmpl/eclipse/console/internal/.

Source file: OutputWidget.java

  21 
vote

private void setFont(){
  final FontRegistry fontRegistry=RuntimePlugin.getInstance().getFontRegistry();
  final String fontDescriptor=RuntimePlugin.getInstance().getPreferenceStore().getString(PreferenceConstants.P_SOURCE_FONT);
  if (fontDescriptor != null) {
    if (!fontRegistry.hasValueFor(fontDescriptor)) {
      FontData[] fontData=PreferenceConverter.readFontData(fontDescriptor);
      fontRegistry.put(fontDescriptor,fontData);
    }
    Display.getDefault().syncExec(new Runnable(){
      public void run(){
        Font sourceFont=fontRegistry.get(fontDescriptor);
        text.setFont(sourceFont);
      }
    }
);
  }
}
 

Example 47

From project rj-client, under directory /de.walware.rj.eclient.graphics/src/de/walware/rj/eclient/graphics/.

Source file: RGraphicsPreferencePage.java

  21 
vote

protected void set(final FontPref pref,final String value){
  if (value.equals(pref.currentName)) {
    return;
  }
  pref.valueLabel.setText("");
  Font font;
  try {
    font=new Font(pref.valueLabel.getDisplay(),value,fSize,SWT.NONE);
    if (pref != fSymbolFontPref) {
      pref.valueLabel.setFont(font);
    }
    pref.valueLabel.setText(value);
  }
 catch (  final SWTError e) {
    font=JFaceResources.getDialogFont();
    pref.valueLabel.setFont(font);
    pref.valueLabel.setText(value + " (not available)");
  }
  if (pref.currentFont != null && !pref.currentFont.isDisposed()) {
    pref.currentFont.dispose();
  }
  pref.currentName=value;
  pref.currentFont=font;
}
 

Example 48

From project sandbox, under directory /xeclipse/org.xwiki.eclipse.ui/src/main/java/org/xwiki/eclipse/ui/editors/.

Source file: Preferences.java

  21 
vote

private Preferences(){
  stylesToTextAttributeMap=new HashMap<Style,TextAttribute>();
  Font headingFont=new Font(Display.getDefault(),JFaceResources.getDefaultFont().getFontData()[0].getName(),18,SWT.BOLD);
  stylesToTextAttributeMap.put(Style.HEADING1,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.BOLD,headingFont));
  headingFont=new Font(Display.getDefault(),JFaceResources.getDefaultFont().getFontData()[0].getName(),16,SWT.BOLD);
  stylesToTextAttributeMap.put(Style.HEADING2,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.BOLD,headingFont));
  headingFont=new Font(Display.getDefault(),JFaceResources.getDefaultFont().getFontData()[0].getName(),14,SWT.BOLD);
  stylesToTextAttributeMap.put(Style.HEADING3,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.BOLD,headingFont));
  stylesToTextAttributeMap.put(Style.HEADING4,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.BOLD,headingFont));
  stylesToTextAttributeMap.put(Style.HEADING5,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.BOLD,headingFont));
  stylesToTextAttributeMap.put(Style.HEADING6,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.BOLD,headingFont));
  stylesToTextAttributeMap.put(Style.BOLD,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_BLUE),null,SWT.BOLD));
  stylesToTextAttributeMap.put(Style.ITALIC,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GREEN),null,SWT.ITALIC));
  TextAttribute attribute=new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GREEN),null,SWT.NONE);
  stylesToTextAttributeMap.put(Style.UNDERLINE,attribute);
  stylesToTextAttributeMap.put(Style.STRIKEOUT,attribute);
  stylesToTextAttributeMap.put(Style.SUPERSCRIPT,attribute);
  stylesToTextAttributeMap.put(Style.SUBSCRIPT,attribute);
  attribute=new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_RED),null,SWT.BOLD);
  stylesToTextAttributeMap.put(Style.LINK,attribute);
  stylesToTextAttributeMap.put(Style.IMAGE,attribute);
  stylesToTextAttributeMap.put(Style.DEFINITION_TERM,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.NONE));
  stylesToTextAttributeMap.put(Style.IDENTIFIER,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_CYAN),null,SWT.BOLD));
  stylesToTextAttributeMap.put(Style.LIST_BULLET,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_CYAN),null,SWT.BOLD));
  attribute=new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_MAGENTA),null,SWT.BOLD);
  stylesToTextAttributeMap.put(Style.MACRO,attribute);
  Font ttFont=new Font(Display.getDefault(),"Courier",JFaceResources.getDefaultFont().getFontData()[0].getHeight(),SWT.BOLD);
  stylesToTextAttributeMap.put(Style.TT,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.BOLD,ttFont));
  stylesToTextAttributeMap.put(Style.CODE,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY),null,SWT.BOLD,ttFont));
  stylesToTextAttributeMap.put(Style.HTML,new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW),null,SWT.NONE));
  defaultTextAttribute=new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_BLUE),null,SWT.NONE);
}
 

Example 49

From project sisu, under directory /sisu-examples/guice-rcp/guice-rcp-plugin/src/org/sonatype/examples/guice/rcp/.

Source file: View.java

  21 
vote

public void createPartControl(Composite parent){
  Composite top=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.marginHeight=0;
  layout.marginWidth=0;
  top.setLayout(layout);
  Composite banner=new Composite(top,SWT.NONE);
  banner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL,GridData.VERTICAL_ALIGN_BEGINNING,true,false));
  layout=new GridLayout();
  layout.marginHeight=5;
  layout.marginWidth=10;
  layout.numColumns=2;
  banner.setLayout(layout);
  Font boldFont=JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
  Label l=new Label(banner,SWT.WRAP);
  l.setText("Subject:");
  l.setFont(boldFont);
  l=new Label(banner,SWT.WRAP);
  l.setText("This is a message about the cool Eclipse RCP!");
  l=new Label(banner,SWT.WRAP);
  l.setText("From:");
  l.setFont(boldFont);
  final Link link=new Link(banner,SWT.NONE);
  link.setText("<a>[email protected]</a>");
  link.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      MessageDialog.openInformation(getSite().getShell(),"Not Implemented","Imagine the address book or a new message being created now.");
    }
  }
);
  l=new Label(banner,SWT.WRAP);
  l.setText("Date:");
  l.setFont(boldFont);
  l=new Label(banner,SWT.WRAP);
  l.setText("10:34 am");
  Text text=new Text(top,SWT.MULTI | SWT.WRAP);
  text.setText("This RCP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\n" + "- add a top-level menu and toolbar with actions\n" + "- add keybindings to actions\n"+ "- create views that can't be closed and\n"+ "  multiple instances of the same view\n"+ "- perspectives with placeholders for new views\n"+ "- use the default about dialog\n"+ "- create a product definition\n");
  text.setLayoutData(new GridData(GridData.FILL_BOTH));
}
 

Example 50

From project studio3-ruby, under directory /plugins/com.aptana.ruby.debug.ui/src/com/aptana/ruby/debug/ui/launcher/.

Source file: RubyMainTab.java

  21 
vote

public void createControl(Composite parent){
  Font font=parent.getFont();
  Composite comp=new Composite(parent,SWT.NONE);
  setControl(comp);
  GridLayout topLayout=new GridLayout();
  topLayout.verticalSpacing=0;
  topLayout.numColumns=3;
  comp.setLayout(topLayout);
  comp.setFont(font);
  createVerticalSpacer(comp,3);
  Label programLabel=new Label(comp,SWT.NONE);
  programLabel.setText(Messages.RubyMainTab_FileLabel);
  GridData gd=new GridData(GridData.BEGINNING);
  programLabel.setLayoutData(gd);
  programLabel.setFont(font);
  fProgramText=new Text(comp,SWT.SINGLE | SWT.BORDER);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  fProgramText.setLayoutData(gd);
  fProgramText.setFont(font);
  fProgramText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      updateLaunchConfigurationDialog();
    }
  }
);
  fProgramButton=createPushButton(comp,"&Browse...",null);
  fProgramButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      browseRubyFiles();
    }
  }
);
}
 

Example 51

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/image/.

Source file: IconUtils.java

  20 
vote

public static ImageDescriptor createIconDescriptor(String iconText){
  final ImageData data=new ImageData(16,16,8,PaletteFactory.makeGrayScalePalette());
  final Image image=new Image(Display.getCurrent(),data);
  final GC gc=new GC(image);
  gc.setForeground(ColorConstants.white);
  gc.fillRectangle(new Rectangle(0,0,16,16));
  gc.setForeground(ColorConstants.darkGray);
  gc.setFont(new Font(Display.getCurrent(),new FontData("Dialog",6,SWT.BOLD)));
  gc.drawText(iconText,4,2);
  gc.dispose();
  return new ImageDescriptor(){
    @Override public ImageData getImageData(){
      return image.getImageData();
    }
  }
;
}
 

Example 52

From project interactive-self-assessment, under directory /editbox/src/pm/eclipse/editbox/pref/.

Source file: EditboxPreferencePage.java

  20 
vote

@Override protected Control createContents(Composite parent){
  noDefaultAndApplyButton();
  Composite c=new Composite(parent,SWT.NONE);
  c.setLayout(new GridLayout(1,false));
  Link link=new Link(c,SWT.NONE);
  link.setText("Turn off current line highlighting <A>here</A>.");
  FontData[] fontData=link.getFont().getFontData();
  for (  FontData fd : fontData) {
    fd.setHeight(10);
    fd.setStyle(SWT.BOLD);
  }
  link.setFont(new Font(getShell().getDisplay(),fontData));
  link.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      IWorkbenchPreferenceContainer container=(IWorkbenchPreferenceContainer)getContainer();
      container.openPage("org.eclipse.ui.preferencePages.GeneralTextEditor",null);
    }
  }
);
  folder=new TabFolder(c,SWT.NONE);
  folder.setLayoutData(new GridData(GridData.FILL_BOTH));
  TabItem ti=new TabItem(folder,SWT.NONE);
  ti.setText("Themes");
  ti.setControl(createCategoryControl(folder));
  folder.pack();
  return c;
}
 

Example 53

From project RegexUtil, under directory /RegexUtil/src/com/ess/regexutil/views/.

Source file: RegexEditor.java

  20 
vote

public RegexEditor(Composite parent,int style,Flags flags,final IAction[] actions){
  super(parent,SWT.SINGLE | style);
  setFont(new Font(Display.getDefault(),"Courier New",10,0));
  adapter=new SWTAdapter(this);
  highlighter=new RegexHighlighter(adapter,flags);
  MenuManager menuMgr=new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      for (      IAction action : actions) {
        manager.add(action);
      }
    }
  }
);
  Menu menu=menuMgr.createContextMenu(this);
  this.setMenu(menu);
}
 

Example 54

From project Siafu, under directory /Siafu/src/main/java/de/nec/nle/siafu/graphics/controlpanel/.

Source file: BaseStatus.java

  20 
vote

/** 
 * Create a base panel, but specify the color of the marker.
 * @param parent the parent composite
 * @param gui the container GUI
 * @param panel the panel where this status item belongs
 * @param content the element being shown
 * @param caption the caption on top of the status item.
 * @param icon the icon shown next to the caption.
 * @param color the color of the marker.
 */
protected BaseStatus(final Composite parent,final GUI gui,final BasePanel panel,final Object content,final String caption,final Image icon,final RGB color){
  super(parent,SWT.NORMAL);
  this.panel=panel;
  this.color=color;
  this.gui=gui;
  this.content=content;
  this.setLayoutData(new GridData(SWT.FILL,SWT.NORMAL,true,false));
  if (nameFont == null) {
    nameFont=new Font(display,"default",HEADER_FONT_SIZE,SWT.BOLD);
  }
  thisStatusBox=this;
  this.setLayout(new GridLayout(1,false));
  createHeader(caption,icon);
  createBody();
  refresh();
  parent.pack();
}
 

Example 55

From project bundlemaker, under directory /main/org.bundlemaker.core.ui.editor.dsm/src/org/bundlemaker/core/ui/editor/dsm/figures/.

Source file: BoxSizeUtil.java

  19 
vote

/** 
 * <p> </p>
 * @return
 */
public static int computeNodeBoxSize(IMatrixContentProvider contentProvider,ILabelProvider artifactLabelProvider,Font font){
  String value=getLongestString(contentProvider.getNodes(),artifactLabelProvider);
  System.out.println("computeNodeBoxSize " + value);
  int result=FigureUtilities.getTextWidth(value,font);
  System.out.println(result);
  return result;
}
 

Example 56

From project dozer, under directory /eclipse-plugin/net.sf.dozer.eclipse.plugin/src/org/dozer/eclipse/plugin/editorpage/imagecombo/.

Source file: ImageCombo.java

  19 
vote

@Override public void setFont(Font font){
  super.setFont(font);
  this.font=font;
  text.setFont(font);
  table.setFont(font);
  internalLayout(true);
}
 

Example 57

From project hackergarten-moreunit, under directory /org.moreunit.plugin/src/org/moreunit/properties/.

Source file: UnitSourceFolderBlock.java

  19 
vote

private Button createAddButton(Composite buttonComposite,Font font){
  Button button=new Button(buttonComposite,SWT.PUSH);
  button.setFont(font);
  button.setText("Add");
  button.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent selectionEvent){
      addButtonClicked();
    }
  }
);
  return button;
}
 

Example 58

From project mylyn.builds, under directory /org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/view/.

Source file: BuildLabelProvider.java

  19 
vote

public Font getFont(Object element){
  if (!decorateOperations) {
    return null;
  }
  if (element instanceof IBuildElement) {
    if (((IBuildElement)element).getOperations().size() > 0) {
      return CommonFonts.ITALIC;
    }
  }
  return null;
}
 

Example 59

From project Newsreader, under directory /bundles/org.eclipse.ecf.salvo.ui/src/org/eclipse/ecf/salvo/ui/internal/editor/.

Source file: ArticlePaneLabelProvider.java

  19 
vote

public Font getFont(Object element,int columnIndex){
  IArticle article=(IArticle)((ISalvoResource)element).getObject();
  if (columnIndex == 0) {
    if (!article.isRead()) {
      return unreadArticle;
    }
    if (!article.isReplyRead()) {
      return unreadReplies;
    }
  }
  return JFaceResources.getDefaultFont();
}