List of usage examples for org.eclipse.jface.resource JFaceResources DEFAULT_FONT
String DEFAULT_FONT
To view the source code for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.
Click Source Link
"org.eclipse.jface.defaultfont"
). From source file:org.eclipse.tcf.te.ui.swt.widgets.NoteCompositeHelper.java
License:Open Source License
/** * Creates a composite with a highlighted Note entry and a message text. * This is designed to take up the full width of the page. * * @see PreferencePage#createNoteComposite, this is a plain copy of that! * @param font//from w ww .ja v a2 s . c o m * the font to use * @param composite * the parent composite * @param title * the title of the note * @param message * the message for the note * @param minCharsPerLine * the minimum number of characters per line. Defaults to '65' if less than '20'. * * @return the composite for the note */ public static Composite createNoteComposite(Font font, Composite composite, String title, String message, int minCharsPerLine) { Composite messageComposite = new NoteComposite(composite, SWT.NONE); GridLayout messageLayout = new GridLayout(); messageLayout.numColumns = 2; messageLayout.marginWidth = 0; messageLayout.marginHeight = 0; messageComposite.setLayout(messageLayout); GridData layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); if (composite.getLayout() instanceof GridLayout) { layoutData.horizontalSpan = ((GridLayout) composite.getLayout()).numColumns; } messageComposite.setLayoutData(layoutData); messageComposite.setFont(font); final Label noteLabel = new Label(messageComposite, SWT.BOLD); noteLabel.setText(title); noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final IPropertyChangeListener fontListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { // Note: This is actually wrong but the same as in platforms // PreferencePage if (JFaceResources.BANNER_FONT.equals(event.getProperty())) { noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT)); } } }; JFaceResources.getFontRegistry().addListener(fontListener); noteLabel.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent event) { JFaceResources.getFontRegistry().removeListener(fontListener); } }); Label messageLabel = new Label(messageComposite, SWT.WRAP); messageLabel.setText(message); messageLabel.setFont(font); /** * Set the controls style to FILL_HORIZONTAL making it multi-line if * needed */ layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(messageLabel, minCharsPerLine >= 20 ? minCharsPerLine : 65); messageLabel.setLayoutData(layoutData); return messageComposite; }
From source file:org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetLabelProvider.java
License:Open Source License
public Font getFont(Object element) { element = internalGetElement(element); if (element instanceof ActiveChangeSet && isDefaultActiveSet((ActiveChangeSet) element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); }/*from w ww .j a v a2s . com*/ return super.getFont(element); }
From source file:org.eclipse.team.svn.revision.graph.graphic.figure.RevisionFigure.java
License:Open Source License
protected void createControls() { GridLayout layout = new GridLayout(); //layout.marginHeight = layout.marginWidth = 2; //layout.horizontalSpacing = layout.verticalSpacing = 3; this.setLayoutManager(layout); Figure revisionParent = new Figure(); this.add(revisionParent); FlowLayout revisionLayout = new FlowLayout(true); revisionParent.setLayoutManager(revisionLayout); GridData data = new GridData(); layout.setConstraint(revisionParent, data); this.revisionFigure = new Label(); revisionParent.add(this.revisionFigure); Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); this.revisionFigure.setFont(boldFont); //status/*from w w w. j a v a 2s . c o m*/ this.statusFigure = new Label(); revisionParent.add(this.statusFigure); //merge if (this.revisionNode.hasIncomingMerges() || this.revisionNode.hasOutgoingMerges()) { Figure mergeParent = new Figure(); this.add(mergeParent); FlowLayout mergeParentLayout = new FlowLayout(true); mergeParent.setLayoutManager(mergeParentLayout); data = new GridData(); layout.setConstraint(mergeParent, data); Label mergeTextLabel = new Label(SVNRevisionGraphMessages.RevisionFigure_Merges); mergeParent.add(mergeTextLabel); mergeTextLabel.setIcon(MERGE_IMAGE); mergeTextLabel.setFont(boldFont); //incoming if (this.revisionNode.hasIncomingMerges()) { this.incomingMergeLabel = new Label(); mergeParent.add(this.incomingMergeLabel); this.incomingMergeLabel.setIcon(INCOMING_MERGE_IMAGE); this.incomingMergeLabel.setCursor(Cursors.HAND); this.incomingMergeLabel.addMouseListener(new MouseListener.Stub() { public void mousePressed(MouseEvent me) { if (RevisionFigure.this.isIncomingMergePressed) { RevisionFigure.this.revisionNode.removeAllIncomingMergeConnections(); RevisionFigure.this.incomingMergeLabel.setIcon(INCOMING_MERGE_IMAGE); RevisionFigure.this.isIncomingMergePressed = false; } else { RevisionFigure.this.revisionNode.addAllIncomingMergeConnections(); RevisionFigure.this.incomingMergeLabel.setIcon(INCOMING_MERGE_IMAGE_PRESSED); RevisionFigure.this.isIncomingMergePressed = true; } } }); } //outgoing if (this.revisionNode.hasOutgoingMerges()) { this.outgoingMergeLabel = new Label(); mergeParent.add(this.outgoingMergeLabel); this.outgoingMergeLabel.setIcon(OUTGOING_MERGE_IMAGE); this.outgoingMergeLabel.setCursor(Cursors.HAND); this.outgoingMergeLabel.addMouseListener(new MouseListener.Stub() { public void mousePressed(MouseEvent me) { if (RevisionFigure.this.isOutgoingMergePressed) { RevisionFigure.this.revisionNode.removeAllOutgoingMergeConnections(); RevisionFigure.this.outgoingMergeLabel.setIcon(OUTGOING_MERGE_IMAGE); RevisionFigure.this.isOutgoingMergePressed = false; } else { RevisionFigure.this.revisionNode.addAllOutgoingMergeConnections(); RevisionFigure.this.outgoingMergeLabel.setIcon(OUTGOING_MERGE_IMAGE_PRESSED); RevisionFigure.this.isOutgoingMergePressed = true; } } }); } } //path if (this.revisionNode.getAction() == RevisionNodeAction.ADD || this.revisionNode.getAction() == RevisionNodeAction.COPY || this.revisionNode.getAction() == RevisionNodeAction.RENAME) { this.pathFigure = new PathFigure(); data = new GridData(); data.widthHint = GraphConstants.NODE_WIDTH - 10; layout.setConstraint(this.pathFigure, data); this.add(this.pathFigure); } //comment String comment = this.revisionNode.getMessage(); if (comment != null && comment.length() > 0) { this.commentFigure = new Label(); this.add(commentFigure); data = new GridData(); data.widthHint = GraphConstants.NODE_WIDTH - 10; data.horizontalAlignment = SWT.BEGINNING; layout.setConstraint(this.commentFigure, data); this.commentFigure.setLabelAlignment(PositionConstants.LEFT); } }
From source file:org.eclipse.team.svn.revision.graph.graphic.figure.RevisionTooltipFigure.java
License:Open Source License
protected void createControls() { ToolbarLayout parentLayout = new ToolbarLayout(); this.setLayoutManager(parentLayout); Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); Figure parent = new Figure(); this.add(parent); GridLayout layout = new GridLayout(); layout.numColumns = 2;/*from w w w . ja v a 2 s . c o m*/ layout.verticalSpacing = 0; parent.setLayoutManager(layout); this.pathText = new Label(); parent.add(this.pathText); GridData data = new GridData(); data.horizontalAlignment = SWT.LEFT; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; layout.setConstraint(this.pathText, data); this.pathText.setFont(boldFont); final int blankSpacing = 5; Figure blankFigure = new Figure(); data = new GridData(); data.horizontalSpan = 2; data.heightHint = blankSpacing; layout.setConstraint(blankFigure, data); parent.add(blankFigure); //author Label authorLabel = new Label(SVNRevisionGraphMessages.RevisionTooltipFigure_Author); parent.add(authorLabel); data = new GridData(); layout.setConstraint(authorLabel, data); authorLabel.setFont(boldFont); this.authorText = new Label(); parent.add(this.authorText); layout.setConstraint(this.authorText, new GridData()); //date Label dateLabel = new Label(SVNRevisionGraphMessages.RevisionTooltipFigure_Date); parent.add(dateLabel); data = new GridData(); layout.setConstraint(dateLabel, data); dateLabel.setFont(boldFont); this.dateText = new Label(); parent.add(this.dateText); layout.setConstraint(this.dateText, new GridData()); //copied from if (this.revisionNode.getCopiedFrom() != null) { Label copyLabel = new Label(SVNRevisionGraphMessages.RevisionTooltipFigure_CopiedFrom); parent.add(copyLabel); data = new GridData(); layout.setConstraint(copyLabel, data); copyLabel.setFont(boldFont); this.copyText = new Label(); parent.add(this.copyText); layout.setConstraint(this.copyText, new GridData()); } //incoming merge if (this.revisionNode.hasIncomingMerges()) { blankFigure = new Figure(); data = new GridData(); data.horizontalSpan = 2; data.heightHint = blankSpacing; layout.setConstraint(blankFigure, data); parent.add(blankFigure); Label mergedFromLabel = new Label(SVNRevisionGraphMessages.RevisionTooltipFigure_IncomingMerge); parent.add(mergedFromLabel); data = new GridData(); data.horizontalAlignment = SWT.LEFT; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; layout.setConstraint(mergedFromLabel, data); mergedFromLabel.setFont(boldFont); this.incomingMergeText = new Label(); parent.add(this.incomingMergeText); data = new GridData(); data.horizontalAlignment = SWT.LEFT; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; layout.setConstraint(this.incomingMergeText, data); } //outgoing merge if (this.revisionNode.hasOutgoingMerges()) { blankFigure = new Figure(); data = new GridData(); data.horizontalSpan = 2; data.heightHint = blankSpacing; layout.setConstraint(blankFigure, data); parent.add(blankFigure); Label mergedToLabel = new Label(SVNRevisionGraphMessages.RevisionTooltipFigure_OutgoingMerge); parent.add(mergedToLabel); data = new GridData(); data.horizontalAlignment = SWT.LEFT; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; layout.setConstraint(mergedToLabel, data); mergedToLabel.setFont(boldFont); this.outgoingMergeText = new Label(); parent.add(this.outgoingMergeText); data = new GridData(); data.horizontalAlignment = SWT.LEFT; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; layout.setConstraint(this.outgoingMergeText, data); } //comment blankFigure = new Figure(); data = new GridData(); data.horizontalSpan = 2; data.heightHint = blankSpacing; layout.setConstraint(blankFigure, data); parent.add(blankFigure); blankFigure = new Figure(); data = new GridData(); data.horizontalSpan = 2; data.heightHint = blankSpacing; layout.setConstraint(blankFigure, data); parent.add(blankFigure); Figure separator = new Figure() { public void paintFigure(Graphics graphics) { Rectangle rect = this.getClientArea(); graphics.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y); } }; separator.setForegroundColor(ColorConstants.gray); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 1; data.horizontalSpan = 2; layout.setConstraint(separator, data); parent.add(separator); blankFigure = new Figure(); data = new GridData(); data.horizontalSpan = 2; data.heightHint = 2; layout.setConstraint(blankFigure, data); parent.add(blankFigure); this.commentText = new Label(); this.commentText.setIconAlignment(PositionConstants.TOP); this.commentText.setIcon(COMMENT_IMAGE); parent.add(this.commentText); data = new GridData(); data.horizontalAlignment = SWT.LEFT; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; layout.setConstraint(this.commentText, data); }
From source file:org.eclipse.team.svn.ui.mapping.SVNChangeSetLabelProvider.java
License:Open Source License
public Font getFont(Object element) { element = this.internalGetElement(element); if (element instanceof ActiveChangeSet && this.isDefaultActiveSet((ActiveChangeSet) element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); }/*from w w w. j a v a 2s .c om*/ return super.getFont(element); }
From source file:org.eclipse.team.svn.ui.panel.local.EditTreeConflictsPanel.java
License:Open Source License
protected void createConflictResolutionControls(Composite parent) { Group composite = new Group(parent, SWT.NULL); GridLayout layout = new GridLayout(); //layout.marginHeight = layout.marginWidth = 0; layout.numColumns = 1;// w ww.jav a 2s. co m GridData data = new GridData(GridData.FILL_HORIZONTAL); composite.setLayout(layout); composite.setLayoutData(data); composite.setText(SVNUIMessages.EditTreeConflictsPanel_Conflict_Resolution_Group); //tips section String tip = this.helper.getTip(); if (tip != null) { Label tipLabel = new Label(composite, SWT.NONE); tipLabel.setLayoutData(new GridData()); tipLabel.setText(SVNUIMessages.EditTreeConflictsPanel_Tips_Label); tipLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); Label tipValue = new Label(composite, SWT.WRAP); tipValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); tipValue.setText(tip); } this.localResolutionButton = new Button(composite, SWT.RADIO); this.localResolutionButton.setLayoutData(new GridData()); this.localResolutionButton.setText(SVNUIMessages.EditTreeConflictsPanel_ApplyLocalChanges_Resolution); this.localResolutionButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { EditTreeConflictsPanel.this.changeResolutionSelection(); } }); this.remoteResolutionButton = new Button(composite, SWT.RADIO); this.remoteResolutionButton.setLayoutData(new GridData()); this.remoteResolutionButton.setText(SVNUIMessages.EditTreeConflictsPanel_ApplyIncomigChanges_Resolution); this.remoteResolutionButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { EditTreeConflictsPanel.this.changeResolutionSelection(); } }); this.manualResolutionButton = new Button(composite, SWT.RADIO); this.manualResolutionButton.setLayoutData(new GridData()); this.manualResolutionButton.setText(SVNUIMessages.EditTreeConflictsPanel_ManualResolution); this.manualResolutionButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { EditTreeConflictsPanel.this.changeResolutionSelection(); } }); this.markAsMergedButton = new Button(composite, SWT.CHECK); this.markAsMergedButton.setLayoutData(new GridData()); this.markAsMergedButton.setText(SVNUIMessages.EditTreeConflictsPanel_MarkAsMerged_Button); }
From source file:org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider.java
License:Open Source License
/** * Method that provides a custom font for elements that are * busy. Although this label provider does not implement * {@link IFontProvider}, subclasses that wish to get * busy indication using a font can do so. * @param element the element//from ww w . j a v a 2 s.c o m * @return the font to indicate that the element is busy */ public Font getFont(Object element) { if (isBusy(internalGetElement(element))) { return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); } return null; }
From source file:org.eclipse.tm.te.rcp.application.ApplicationWorkbenchWindowAdvisor.java
License:Open Source License
@Override public Control createEmptyWindowContents(Composite parent) { final IWorkbenchWindow window = getWindowConfigurer().getWindow(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); Display display = composite.getDisplay(); Color bgCol = display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); composite.setBackground(bgCol);/*from ww w. jav a 2 s .c o m*/ Label label = new Label(composite, SWT.WRAP); label.setForeground(display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); label.setBackground(bgCol); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); String msg = Messages.ApplicationWorkbenchAdvisor_noPerspective; label.setText(msg); ToolBarManager toolBarManager = new ToolBarManager(); // TODO: should obtain the open perspective action from ActionFactory openPerspectiveAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(window); toolBarManager.add(openPerspectiveAction); ToolBar toolBar = toolBarManager.createControl(composite); toolBar.setBackground(bgCol); return composite; }
From source file:org.eclipse.tm.te.ui.swt.widgets.NoteCompositeHelper.java
License:Open Source License
/** * Creates a composite with a highlighted Note entry and a message text. * This is designed to take up the full width of the page. * * @see PreferencePage#createNoteComposite, this is a plain copy of that! * @param font//from ww w . j a v a 2s .c o m * the font to use * @param composite * the parent composite * @param title * the title of the note * @param message * the message for the note * @return the composite for the note */ public static Composite createNoteComposite(Font font, Composite composite, String title, String message) { Composite messageComposite = new NoteComposite(composite, SWT.NONE); GridLayout messageLayout = new GridLayout(); messageLayout.numColumns = 2; messageLayout.marginWidth = 0; messageLayout.marginHeight = 0; messageComposite.setLayout(messageLayout); GridData layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); if (composite.getLayout() instanceof GridLayout) { layoutData.horizontalSpan = ((GridLayout) composite.getLayout()).numColumns; } messageComposite.setLayoutData(layoutData); messageComposite.setFont(font); final Label noteLabel = new Label(messageComposite, SWT.BOLD); noteLabel.setText(title); noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final IPropertyChangeListener fontListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { // Note: This is actually wrong but the same as in platforms // PreferencePage if (JFaceResources.BANNER_FONT.equals(event.getProperty())) { noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT)); } } }; JFaceResources.getFontRegistry().addListener(fontListener); noteLabel.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent event) { JFaceResources.getFontRegistry().removeListener(fontListener); } }); Label messageLabel = new Label(messageComposite, SWT.WRAP); messageLabel.setText(message); messageLabel.setFont(font); /** * Set the controls style to FILL_HORIZONTAL making it multi-line if * needed */ layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(messageLabel, 65); messageLabel.setLayoutData(layoutData); return messageComposite; }
From source file:org.eclipse.tm.terminal.view.ui.controls.NoteCompositeHelper.java
License:Open Source License
/** * Creates a composite with a highlighted Note entry and a message text. * This is designed to take up the full width of the page. * * @see PreferencePage#createNoteComposite, this is a plain copy of that! * @param font/*from w w w.ja v a 2 s . c om*/ * the font to use * @param composite * the parent composite * @param title * the title of the note * @param message * the message for the note * @param minCharsPerLine * the minimum number of characters per line. Defaults to '65' if less than '20'. * * @return the composite for the note */ public static Composite createNoteComposite(Font font, Composite composite, String title, String message, int minCharsPerLine) { final GC gc = new GC(composite); gc.setFont(font); Composite messageComposite = new NoteComposite(composite, SWT.NONE); GridLayout messageLayout = new GridLayout(); messageLayout.numColumns = 2; messageLayout.marginWidth = 0; messageLayout.marginHeight = 0; messageComposite.setLayout(messageLayout); GridData layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); if (composite.getLayout() instanceof GridLayout) { layoutData.horizontalSpan = ((GridLayout) composite.getLayout()).numColumns; } messageComposite.setLayoutData(layoutData); messageComposite.setFont(font); final Label noteLabel = new Label(messageComposite, SWT.BOLD); noteLabel.setText(title); noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); noteLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); final IPropertyChangeListener fontListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { // Note: This is actually wrong but the same as in platforms // PreferencePage if (JFaceResources.BANNER_FONT.equals(event.getProperty())) { noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT)); } } }; JFaceResources.getFontRegistry().addListener(fontListener); noteLabel.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent event) { JFaceResources.getFontRegistry().removeListener(fontListener); } }); Label messageLabel = new Label(messageComposite, SWT.WRAP); messageLabel.setText(message); messageLabel.setFont(font); /** * Set the controls style to FILL_HORIZONTAL making it multi-line if * needed */ layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), minCharsPerLine >= 20 ? minCharsPerLine : 65); messageLabel.setLayoutData(layoutData); gc.dispose(); return messageComposite; }