org.eclipse.ui.forms.IFormColors Java Examples

The following examples show how to use org.eclipse.ui.forms.IFormColors. 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: AppraiseDiffViewerPart.java    From git-appraise-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates an individual diff viewer in the given composite.
 */
private void createDiffViewer(final FormToolkit toolkit, Composite composite,
    final TaskAttribute diffTaskAttribute) {

  int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
      | ExpandableComposite.COMPACT;
  ExpandableComposite diffComposite = toolkit.createExpandableComposite(composite, style);
  diffComposite.clientVerticalSpacing = 0;
  diffComposite.setLayout(new GridLayout());
  diffComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  diffComposite.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE));
  diffComposite.setText(calculateDiffChangeHeader(diffTaskAttribute));

  final Composite diffViewerComposite = toolkit.createComposite(diffComposite);
  diffComposite.setClient(diffViewerComposite);
  diffViewerComposite.setLayout(
      new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 15, 0, 0, 3));

  diffComposite.addExpansionListener(new ExpansionAdapter() {
    @Override
    public void expansionStateChanged(ExpansionEvent event) {
      expandCollapseDiff(toolkit, diffViewerComposite, diffTaskAttribute, event.getState());
    }
  });
  GridDataFactory.fillDefaults().grab(true, false).applyTo(diffComposite);
}
 
Example #2
Source File: TabbedPropertyTitle.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param e
 */
protected void drawTitleBackground(PaintEvent e) {
	Rectangle bounds = getClientArea();
	label.setBackground(new Color[] {
			factory.getColors().getColor(IFormColors.H_GRADIENT_END),
			factory.getColors().getColor(IFormColors.H_GRADIENT_START) },
			new int[] { 100 }, true);
	Color bg = factory.getColors().getColor(IFormColors.H_GRADIENT_END);
	Color gbg = factory.getColors().getColor(IFormColors.H_GRADIENT_START);
	GC gc = e.gc;
	gc.setForeground(bg);
	gc.setBackground(gbg);
	gc.fillGradientRectangle(bounds.x, bounds.y, bounds.width,
			bounds.height, true);
	// background bottom separator
	gc.setForeground(factory.getColors().getColor(
			IFormColors.H_BOTTOM_KEYLINE1));
	gc.drawLine(bounds.x, bounds.height - 2, bounds.x + bounds.width - 1,
			bounds.height - 2);
	gc.setForeground(factory.getColors().getColor(
			IFormColors.H_BOTTOM_KEYLINE2));
	gc.drawLine(bounds.x, bounds.height - 1, bounds.x + bounds.width - 1,
			bounds.height - 1);
}
 
Example #3
Source File: AppraiseDiffViewerPart.java    From git-appraise-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent, final FormToolkit toolkit) {
  final List<TaskAttribute> diffTaskAttributes = getDiffTaskAttributes();

  if (diffTaskAttributes == null || diffTaskAttributes.isEmpty()) {
    return;
  }
  int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
  final Section groupSection = toolkit.createSection(parent, style);
  groupSection.setText("Changes (" + diffTaskAttributes.size() + ')');
  groupSection.clientVerticalSpacing = 0;
  groupSection.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

  if (groupSection.isExpanded()) {
    addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
  } else {
    groupSection.addExpansionListener(new ExpansionAdapter() {
      @Override
      public void expansionStateChanged(ExpansionEvent e) {
        if (groupSection.getClient() == null) {
          try {
            getTaskEditorPage().setReflow(false);
            addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
          } finally {
            getTaskEditorPage().setReflow(true);
          }
          getTaskEditorPage().reflow();
        }
      }
    });
  }
}
 
Example #4
Source File: TabbedPropertyTitle.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void resetSectionToolBarColors() {
	TabbedPropertySheetWidgetFactory f = new TabbedPropertySheetWidgetFactory();
	FormColors defaultColors = f.getColors();
	defaultColors.initializeSectionToolBarColors();

	FormColors colors = factory.getColors();
	colors.createColor(IFormColors.H_GRADIENT_START, defaultColors.getColor(IFormColors.H_GRADIENT_START).getRGB());
	colors.createColor(IFormColors.H_GRADIENT_END, defaultColors.getColor(IFormColors.H_GRADIENT_END).getRGB());
	colors.createColor(IFormColors.H_BOTTOM_KEYLINE1,
			defaultColors.getColor(IFormColors.H_BOTTOM_KEYLINE1).getRGB());
	colors.createColor(IFormColors.H_BOTTOM_KEYLINE2,
			defaultColors.getColor(IFormColors.H_BOTTOM_KEYLINE2).getRGB());
}
 
Example #5
Source File: AbapGitStagingView.java    From ADT_Frontend with MIT License 4 votes vote down vote up
private void createPersonLabel(Composite parent, Image image, String text) {
	Label imageLabel = new Label(parent, 0);
	imageLabel.setImage(image);
	Label textLabel = this.toolkit.createLabel(parent, text);
	textLabel.setForeground(this.toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
}
 
Example #6
Source File: AbapGitStagingLabelProvider.java    From ADT_Frontend with MIT License 4 votes vote down vote up
public void applyStyles(TextStyle textStyle) {
	textStyle.foreground = new FormToolkit(Display.getDefault()).getColors().getColor(IFormColors.TB_TOGGLE);
	if (textStyle instanceof StyleRange) {
		((StyleRange) textStyle).fontStyle = SWT.ITALIC;
	}
}
 
Example #7
Source File: TabbedPropertyTitleCssPropertyHandler.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public TabbedPropertyTitleCssPropertyHandler() {
	cssPropertyToSWTProperty.put(BOTTOM_KEYLINE_1, IFormColors.H_BOTTOM_KEYLINE1);
	cssPropertyToSWTProperty.put(BOTTOM_KEYLINE_2, IFormColors.H_BOTTOM_KEYLINE2);
	cssPropertyToSWTProperty.put(GRADIENT_START, IFormColors.H_GRADIENT_START);
	cssPropertyToSWTProperty.put(GRADIENT_END, IFormColors.H_GRADIENT_END);
}
 
Example #8
Source File: TabbedPropertyTitle.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor for TabbedPropertyTitle.
 *
 * @param parent
 *            the parent composite.
 * @param factory
 *            the widget factory for the tabbed property sheet
 */
public TabbedPropertyTitle(Composite parent,
		TabbedPropertySheetWidgetFactory factory) {
	super(parent, SWT.NO_FOCUS);
	this.factory = factory;

	this.addPaintListener(e -> {
			if (image == null && (text == null || text.equals(BLANK))) {
				label.setVisible(false);
			} else {
				label.setVisible(true);
			}
			drawTitleBackground(e);
	});

	factory.getColors().initializeSectionToolBarColors();
	setBackground(factory.getColors().getBackground());
	setForeground(factory.getColors().getForeground());

	FormLayout layout = new FormLayout();
	layout.marginWidth = 1;
	layout.marginHeight = 2;
	setLayout(layout);

	Font font;
	if (! JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) {
		FontData[] fontData = JFaceResources.getFontRegistry().getBold(
				JFaceResources.DEFAULT_FONT).getFontData();
		/* title font is 2pt larger than that used in the tabs. */
		fontData[0].setHeight(fontData[0].getHeight() + 2);
		JFaceResources.getFontRegistry().put(TITLE_FONT, fontData);
	}
	font = JFaceResources.getFont(TITLE_FONT);

	label = factory.createCLabel(this, BLANK);
	label.setBackground(new Color[] {
			factory.getColors().getColor(IFormColors.H_GRADIENT_END),
			factory.getColors().getColor(IFormColors.H_GRADIENT_START) },
			new int[] { 100 }, true);
	label.setFont(font);
	label.setForeground(factory.getColors().getColor(IFormColors.TITLE));
	FormData data = new FormData();
	data.left = new FormAttachment(0, 0);
	data.top = new FormAttachment(0, 0);
	data.right = new FormAttachment(100, 0);
	data.bottom = new FormAttachment(100, 0);
	label.setLayoutData(data);

	/*
	 * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
	 * ISharedImages.IMG_OBJ_ELEMENT));
	 */
}