Java Code Examples for org.eclipse.swt.SWT#NORMAL

The following examples show how to use org.eclipse.swt.SWT#NORMAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemovedNodeElementEditPart.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
protected Font changeFont(IFigure figure) {
	this.disposeFont();

	RemovedNodeElement removedNodeElement = (RemovedNodeElement) this
			.getModel();

	String fontName = removedNodeElement.getFontName();
	int fontSize = removedNodeElement.getFontSize();

	if (fontName == null) {
		FontData fontData = Display.getCurrent().getSystemFont()
				.getFontData()[0];
		fontName = fontData.getName();
	}
	if (fontSize <= 0) {
		fontSize = ViewableModel.DEFAULT_FONT_SIZE;
	}

	this.font = new Font(Display.getCurrent(), fontName, fontSize,
			SWT.NORMAL);

	figure.setFont(this.font);

	return font;
}
 
Example 2
Source File: CompositeFactory.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
public static Label createExampleLabel(Composite composite, String title,
		int span) {
	Label label = new Label(composite, SWT.NONE);
	label.setText(ResourceString.getResourceString(title));

	if (span > 0) {
		GridData gridData = new GridData();
		gridData.horizontalSpan = span;
		label.setLayoutData(gridData);
	}

	FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
	Font font = new Font(Display.getCurrent(), fontData.getName(), 8,
			SWT.NORMAL);
	label.setFont(font);

	return label;
}
 
Example 3
Source File: CompositeFactory.java    From erflute with Apache License 2.0 6 votes vote down vote up
public static Label createExampleLabel(Composite composite, String title, int span) {
    final Label label = new Label(composite, SWT.NONE);
    label.setText(DisplayMessages.getMessage(title));

    if (span > 0) {
        final GridData gridData = new GridData();
        gridData.horizontalSpan = span;
        label.setLayoutData(gridData);
    }

    final FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
    final Font font = new Font(Display.getCurrent(), fontData.getName(), 8, SWT.NORMAL);
    label.setFont(font);

    return label;
}
 
Example 4
Source File: EndTerminatedEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 5
Source File: SubProcessEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 6
Source File: PoolNameEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 7
Source File: EndMessageEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 8
Source File: StartMessageEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 9
Source File: EndSignalEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 10
Source File: SendTaskLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 11
Source File: ANDGatewayLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 12
Source File: QueueNameEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 13
Source File: TaskName2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 14
Source File: IntermediateThrowMessageEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 15
Source File: MessageFlowLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 16
Source File: MultilineListCellRenderer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public MultilineListCellRenderer() {
    super(null);
    boldFont = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD);
    normalFont = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL);
}
 
Example 17
Source File: ScriptValuesHighlight.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Event.detail line start offset (input) Event.text line text (input) LineStyleEvent.styles Enumeration of
 * StyleRanges, need to be in order. (output) LineStyleEvent.background line background color (output)
 */
public void lineGetStyle( LineStyleEvent event ) {
  Vector<StyleRange> styles = new Vector<StyleRange>();
  int token;
  StyleRange lastStyle;

  if ( inBlockComment( event.lineOffset, event.lineOffset + event.lineText.length() ) ) {
    styles.addElement( new StyleRange( event.lineOffset, event.lineText.length() + 4, colors[2], null ) );
    event.styles = new StyleRange[styles.size()];
    styles.copyInto( event.styles );
    return;
  }
  scanner.setRange( event.lineText );
  String xs = ( (StyledText) event.widget ).getText();
  if ( xs != null ) {
    parseBlockComments( xs );
  }
  token = scanner.nextToken();
  while ( token != EOF ) {
    if ( token != OTHER ) {
      if ( ( token == WHITE ) && ( !styles.isEmpty() ) ) {
        int start = scanner.getStartOffset() + event.lineOffset;
        lastStyle = styles.lastElement();
        if ( lastStyle.fontStyle != SWT.NORMAL ) {
          if ( lastStyle.start + lastStyle.length == start ) {
            // have the white space take on the style before it to minimize font style
            // changes
            lastStyle.length += scanner.getLength();
          }
        }
      } else {
        Color color = getColor( token );
        if ( color != colors[0] ) { // hardcoded default foreground color, black
          StyleRange style =
            new StyleRange( scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null );
          if ( token == KEY ) {
            style.fontStyle = SWT.BOLD;
          }
          if ( styles.isEmpty() ) {
            styles.addElement( style );
          } else {
            lastStyle = styles.lastElement();
            if ( lastStyle.similarTo( style ) && ( lastStyle.start + lastStyle.length == style.start ) ) {
              lastStyle.length += style.length;
            } else {
              styles.addElement( style );
            }
          }
        }
      }
    }
    token = scanner.nextToken();
  }
  event.styles = new StyleRange[styles.size()];
  styles.copyInto( event.styles );
}
 
Example 18
Source File: UserDefinedJavaClassHighlight.java    From hop with Apache License 2.0 4 votes vote down vote up
/**
 * Event.detail line start offset (input) Event.text line text (input) LineStyleEvent.styles Enumeration of
 * StyleRanges, need to be in order. (output) LineStyleEvent.background line background color (output)
 */
public void lineGetStyle( LineStyleEvent event ) {
  Vector<StyleRange> styles = new Vector<StyleRange>();
  int token;
  StyleRange lastStyle;

  if ( inBlockComment( event.lineOffset, event.lineOffset + event.lineText.length() ) ) {
    styles.addElement( new StyleRange( event.lineOffset, event.lineText.length() + 4, colors[ 2 ], null ) );
    event.styles = new StyleRange[ styles.size() ];
    styles.copyInto( event.styles );
    return;
  }
  scanner.setRange( event.lineText );
  String xs = ( (StyledText) event.widget ).getText();
  if ( xs != null ) {
    parseBlockComments( xs );
  }
  token = scanner.nextToken();
  while ( token != EOF ) {
    if ( token != OTHER ) {
      if ( ( token == WHITE ) && ( !styles.isEmpty() ) ) {
        int start = scanner.getStartOffset() + event.lineOffset;
        lastStyle = styles.lastElement();
        if ( lastStyle.fontStyle != SWT.NORMAL ) {
          if ( lastStyle.start + lastStyle.length == start ) {
            // have the white space take on the style before it to minimize font style
            // changes
            lastStyle.length += scanner.getLength();
          }
        }
      } else {
        Color color = getColor( token );
        if ( color != colors[ 0 ] ) { // hardcoded default foreground color, black
          StyleRange style =
            new StyleRange( scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null );
          if ( token == KEY ) {
            style.fontStyle = SWT.BOLD;
          }
          if ( styles.isEmpty() ) {
            styles.addElement( style );
          } else {
            lastStyle = styles.lastElement();
            if ( lastStyle.similarTo( style ) && ( lastStyle.start + lastStyle.length == style.start ) ) {
              lastStyle.length += style.length;
            } else {
              styles.addElement( style );
            }
          }
        }
      }
    }
    token = scanner.nextToken();
  }
  event.styles = new StyleRange[ styles.size() ];
  styles.copyInto( event.styles );
}
 
Example 19
Source File: SWTLinkLabel.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SWTLinkLabel(SWTContainer<? extends Composite> parent) {
	super(new Link(parent.getControl(), SWT.NORMAL), parent);
	
	this.linkListener = new SWTLinkListenerManager(this);
}
 
Example 20
Source File: AbstractSyntaxColoringTest.java    From dsl-devkit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Creates a {@link StyleRange} from the given parameters.
 *
 * @param offset
 *          the offset
 * @param length
 *          the length of the range
 * @param textAttribute
 *          the {@link TextAttribute}
 * @return a {@link StyleRange} from the given parameters
 */
public static StyleRange createStyleRange(final int offset, final int length, final TextAttribute textAttribute) {
  int style = textAttribute.getStyle();
  int fontStyle = style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
  StyleRange styleRange = new StyleRange(offset, length, textAttribute.getForeground(), textAttribute.getBackground(), fontStyle);
  styleRange.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
  styleRange.underline = (style & TextAttribute.UNDERLINE) != 0;
  styleRange.font = textAttribute.getFont();
  return styleRange;
}