List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole.java
License:Open Source License
protected void dispose() { // Here we can't call super.dispose() because we actually want the partitioner to remain // connected, but we won't show lines until the console is added to the console manager // again./*from w w w .jav a 2s . c o m*/ // Called when console is removed from the console view synchronized (document) { visible = false; JFaceResources.getFontRegistry().removeListener(this); } }
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 a2 s . com return super.getFont(element); }
From source file:org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog.java
License:Open Source License
/** * Creates the dialog's title area./*from w ww . ja v a 2 s . c om*/ * * @param parent the SWT parent for the title area composite * @return the created title area composite */ private Composite createMessageArea(Composite parent) { // Create the title area which will contain // a title, message, and image. fTitleArea = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; layout.horizontalSpacing = 0; layout.numColumns = 2; // Get the colors for the title area Display display = parent.getDisplay(); Color bg = JFaceColors.getBannerBackground(display); Color fg = JFaceColors.getBannerForeground(display); GridData layoutData = new GridData(GridData.FILL_BOTH); fTitleArea.setLayout(layout); fTitleArea.setLayoutData(layoutData); fTitleArea.setBackground(bg); // Message label fMessageLabel = new CLabel(fTitleArea, SWT.LEFT); fMessageLabel.setBackground(bg); fMessageLabel.setForeground(fg); fMessageLabel.setText(" ");//$NON-NLS-1$ fMessageLabel.setFont(JFaceResources.getBannerFont()); final IPropertyChangeListener fontListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (JFaceResources.BANNER_FONT.equals(event.getProperty()) || JFaceResources.DIALOG_FONT.equals(event.getProperty())) { updateMessage(); } } }; fMessageLabel.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { JFaceResources.getFontRegistry().removeListener(fontListener); } }); JFaceResources.getFontRegistry().addListener(fontListener); GridData gd = new GridData(GridData.FILL_BOTH); fMessageLabel.setLayoutData(gd); // Title image fTitleImage = new Label(fTitleArea, SWT.LEFT); fTitleImage.setBackground(bg); fTitleImage.setImage(TeamUIPlugin.getPlugin().getImageRegistry().get(PREF_DLG_TITLE_IMG)); gd = new GridData(); gd.horizontalAlignment = GridData.END; fTitleImage.setLayoutData(gd); updateMessage(); return fTitleArea; }
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 ww w . j av 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;// w w w. j a va2 s . c om 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.console.SVNConsole.java
License:Open Source License
protected void init() { if (!this.enabled) { super.init(); this.setTabWidth(4); this.cmdStream = this.newOutputStream(); this.okStream = this.newOutputStream(); this.warningStream = this.newOutputStream(); this.errorStream = this.newOutputStream(); UIMonitorUtility.getDisplay().syncExec(new Runnable() { public void run() { SVNConsole.this.loadPreferences(); }//from www . j a v a 2 s .c o m }); JFaceResources.getFontRegistry().addListener(this); SVNTeamUIPlugin.instance().getPreferenceStore().addPropertyChangeListener(this); this.enabled = true; } }
From source file:org.eclipse.team.svn.ui.console.SVNConsole.java
License:Open Source License
protected void dispose() { if (this.enabled) { this.enabled = false; super.dispose(); SVNTeamUIPlugin.instance().getPreferenceStore().removePropertyChangeListener(this); JFaceResources.getFontRegistry().removeListener(this); ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[] { this }); Color tmp1 = this.cmdStream.getColor(); Color tmp2 = this.okStream.getColor(); Color tmp3 = this.warningStream.getColor(); Color tmp4 = this.errorStream.getColor(); // unsupported in Eclipse IDE 3.0 try {/* w w w . j a v a 2 s . co m*/ this.cmdStream.close(); } catch (Exception ex) { } try { this.okStream.close(); } catch (Exception ex) { } try { this.warningStream.close(); } catch (Exception ex) { } try { this.errorStream.close(); } catch (Exception ex) { } if (tmp1 != null) { tmp1.dispose(); } if (tmp1 != null) { tmp2.dispose(); } if (tmp1 != null) { tmp3.dispose(); } if (tmp1 != null) { tmp4.dispose(); } } }
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); }/* www .jav 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 w w. j a v a 2 s .com 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 2s . c om*/ * @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; }