本文整理汇总了Java中org.eclipse.ui.forms.IFormColors类的典型用法代码示例。如果您正苦于以下问题:Java IFormColors类的具体用法?Java IFormColors怎么用?Java IFormColors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IFormColors类属于org.eclipse.ui.forms包,在下文中一共展示了IFormColors类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEditor
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
/**
* Adds the given editor instance to the part, with the given label.
*
* The editor life-cycle will get managed by the part.
*
* @param text a string containing a label text
* @param editor an editor instance
* @param indent an extra margin that will be added to the left side of the editor's cell
*/
protected void addEditor(String text, IEditor editor, int indent) {
// Creates the controls
Label label = toolkit.createLabel(content, text);
Composite container = toolkit.createComposite(content);
GridData labelData = new GridData(SWT.FILL, SWT.CENTER, false, false);
GridData containerData = new GridData(SWT.FILL, SWT.FILL, true, false);
labelData.verticalIndent = spacer;
labelData.horizontalIndent = indent;
labelData.grabExcessVerticalSpace = editor.grabVerticalSpace();
containerData.verticalIndent = spacer;
containerData.grabExcessVerticalSpace = editor.grabVerticalSpace();
label.setLayoutData(labelData);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
container.setLayoutData(containerData);
editor.createContent(container, toolkit);
spacer = 0;
// Registers the editor
editors.add(editor);
}
示例2: createDiffViewer
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
/**
* 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);
}
示例3: drawTitleBackground
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
/**
* @param e
*/
protected void drawTitleBackground(PaintEvent e) {
if (factory.getColors() == null) return;
Rectangle bounds = getClientArea();
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);
}
示例4: drawTitleBackground
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
/**
* @param e
*/
protected void drawTitleBackground(PaintEvent e) {
if (factory.getColors() == null) return;
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);
}
示例5: AbstractEASyEditorPage
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
/**
* Sole constructor for this class.
* @param plp The {@link ProductLineProject} edited in this editor page.
* @param title The title for this editor page.
* @param parent The parent, holding this editor page.
*/
public AbstractEASyEditorPage(ProductLineProject plp, String title, Composite parent) {
super(parent, SWT.BORDER);
this.plp = plp;
setLayout(new FillLayout());
pageListeners = new ArrayList<IEASyPageListener>();
toolkit = new FormToolkit(getDisplay()); // display is assumed to be valid!
contentPane = toolkit.createScrolledForm(this);
GridLayout layout = new GridLayout();
contentPane.getBody().setLayout(layout);
//Set Title contentPane.setText(text) will cause that scrollbars won't work correctly.
FormText titleText = toolkit.createFormText(contentPane.getBody(), false);
String htmlTitle = "<form><p><span color=\"header\" font=\"header\">" + title + ": " + plp.getProjectName()
+ "</span></p></form>";
titleText.setWhitespaceNormalized(true);
titleText.setFont("header", JFaceResources.getHeaderFont());
titleText.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE));
titleText.setText(htmlTitle, true, false);
}
示例6: FormComboBoxField
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
public FormComboBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, String[] options) {
label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
final TableWrapData layoutData = new TableWrapData();
layoutData.valign = TableWrapData.MIDDLE;
label.setLayoutData(layoutData);
combobox = new Combo(sectionClient, SWT.READ_ONLY);
combobox.setItems(options);
combobox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
示例7: FormCheckBoxField
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
public FormCheckBoxField(FormToolkit toolkit, Composite sectionClient, String labelText, boolean defaultValue) {
label = toolkit.createLabel(sectionClient, labelText, SWT.WRAP);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
final TableWrapData layoutData = new TableWrapData();
layoutData.valign = TableWrapData.MIDDLE;
label.setLayoutData(layoutData);
checkbox = toolkit.createButton(sectionClient, "", SWT.CHECK);
checkbox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
checkbox.setSelection(defaultValue);
}
示例8: FormTextField
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
public FormTextField(FormToolkit toolkit, Composite sectionClient, String labelText, String defaultValue, int textStyle) {
label = toolkit.createFormText(sectionClient, true);
label.setText("<form><p>" + labelText + "</p></form>", true, false);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
final TableWrapData layoutData = new TableWrapData();
layoutData.valign = TableWrapData.MIDDLE;
label.setLayoutData(layoutData);
text = toolkit.createText(sectionClient, defaultValue, textStyle|SWT.WRAP);
text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
}
示例9: createControl
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
@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();
}
}
});
}
}
示例10: createLabel
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
private Label createLabel(Composite parent, String value, int verticalAlign) {
Label label = toolkit.createLabel(parent, value);
GridDataFactory.fillDefaults().align(SWT.FILL, verticalAlign).applyTo(label);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
return label;
}
示例11: createToolTipContentArea
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
protected Composite createToolTipContentArea(Event event, Composite parent) {
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
FormColors colors = toolkit.getColors();
Color top = colors.getColor(IFormColors.H_GRADIENT_END);
Color bot = colors.getColor(IFormColors.H_GRADIENT_START);
// create the base form
Form form = toolkit.createForm(parent);
form.setText(title);
form.setTextBackground(new Color[] { top, bot }, new int[] { 100 }, true);
FormLayout layout = new FormLayout();
layout.marginTop = 10;
layout.marginBottom = 10;
layout.marginLeft = 10;
layout.marginRight = 10;
form.getBody().setLayout(layout);
// Scrolled text
ScrolledFormText scrolledFormText = new ScrolledFormText(form.getBody(), true);
FormText text = toolkit.createFormText(scrolledFormText, true);
scrolledFormText.setAlwaysShowScrollBars(false);
StringBuilder builder = new StringBuilder();
for (final String currentText : texts) {
builder.append("<p>").append(currentText).append("</p>");
}
text.setText(String.format("<form>%s</form>", builder.toString()), true, false);
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100);
scrolledFormText.setLayoutData(data);
scrolledFormText.setFormText(text);
scrolledFormText.setBackground(ColorConstants.white);
return parent;
}
示例12: TabbedPropertyTitle
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
/**
* 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(new PaintListener() {
public void paintControl(PaintEvent 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 = 0;
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));
*/
}
示例13: createMessageAndPersonArea
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
private Composite createMessageAndPersonArea(Composite container) {
messageAndPersonArea = toolkit.createComposite(container);
GridDataFactory.fillDefaults().grab(true, true)
.applyTo(messageAndPersonArea);
GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0)
.applyTo(messageAndPersonArea);
Section messageSection = toolkit.createSection(messageAndPersonArea,
ExpandableComposite.TITLE_BAR | ExpandableComposite.CLIENT_INDENT);
messageSection.setText(Messages.FilesChangedListDialog_CommitMessage);
Composite messageArea = toolkit.createComposite(messageSection);
GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(2, 2, 2, 2).applyTo(messageArea);
toolkit.paintBordersFor(messageArea);
GridDataFactory.fillDefaults().grab(true, true).applyTo(messageSection);
GridLayoutFactory.swtDefaults().applyTo(messageSection);
Composite headerArea = new Composite(messageSection, SWT.NONE);
GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(2).applyTo(headerArea);
ToolBar messageToolbar = new ToolBar(headerArea, SWT.FLAT | SWT.HORIZONTAL);
GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).applyTo(messageToolbar);
addMessageDropDown(headerArea);
messageSection.setTextClient(headerArea);
Composite personArea = toolkit.createComposite(messageAndPersonArea);
toolkit.paintBordersFor(personArea);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(personArea);
GridDataFactory.fillDefaults().grab(true, false).applyTo(personArea);
toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_OlderCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
setOlderVersionText(toolkit.createText(personArea, null));
getOlderVersionText().setText(commitPreviousID);
getOlderVersionText().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
getOlderVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_NewerCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
setNewerVersionText(toolkit.createText(personArea, null));
getNewerVersionText().setText(commitCurrentID);
getNewerVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
Point size = createJavaSourceCodeViewer(container, messageSection,
messageArea);
createSignatureCanvas(size);
return messageAndPersonArea;
}
示例14: createMessageAndPersonArea
import org.eclipse.ui.forms.IFormColors; //导入依赖的package包/类
private Composite createMessageAndPersonArea(Composite container) {
messageAndPersonArea = toolkit.createComposite(container);
GridDataFactory.fillDefaults().grab(true, true)
.applyTo(messageAndPersonArea);
GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0)
.applyTo(messageAndPersonArea);
Section messageSection = toolkit.createSection(messageAndPersonArea,
ExpandableComposite.TITLE_BAR | ExpandableComposite.CLIENT_INDENT);
messageSection.setText(Messages.FilesChangedListDialog_CommitMessage);
Composite messageArea = toolkit.createComposite(messageSection);
GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(2, 2, 2, 2).applyTo(messageArea);
toolkit.paintBordersFor(messageArea);
GridDataFactory.fillDefaults().grab(true, true).applyTo(messageSection);
GridLayoutFactory.swtDefaults().applyTo(messageSection);
Composite headerArea = new Composite(messageSection, SWT.NONE);
GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(2).applyTo(headerArea);
ToolBar messageToolbar = new ToolBar(headerArea, SWT.FLAT | SWT.HORIZONTAL);
GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).applyTo(messageToolbar);
addMessageDropDown(headerArea);
messageSection.setTextClient(headerArea);
Composite personArea = toolkit.createComposite(messageAndPersonArea);
toolkit.paintBordersFor(personArea);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(personArea);
GridDataFactory.fillDefaults().grab(true, false).applyTo(personArea);
toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_OlderCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
setOlderVersionText(toolkit.createText(personArea, null));
getOlderVersionText().setText(commitPreviousID);
getOlderVersionText().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
getOlderVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
toolkit.createLabel(personArea, Messages.DescribeVersionsDialog_NewerCommitId).setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
setNewerVersionText(toolkit.createText(personArea, null));
getNewerVersionText().setText(commitCurrentID);
getNewerVersionText().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
Point size = createJavaSourceCodeViewer(container, messageSection,
messageArea);
createSignatureCanvas(size);
return messageAndPersonArea;
}