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.sonarlint.eclipse.ui.internal.popup.AbstractNotificationPopup.java
License:Open Source License
/** * Override to customize the title bar//ww w . ja v a 2s.c om */ protected void createTitleArea(Composite parent) { ((GridData) parent.getLayoutData()).heightHint = TITLE_HEIGHT; Label titleImageLabel = new Label(parent, SWT.NONE); titleImageLabel.setImage(getPopupShellImage(TITLE_HEIGHT)); Label titleTextLabel = new Label(parent, SWT.NONE); titleTextLabel.setText(getPopupShellTitle()); titleTextLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); titleTextLabel.setForeground(getTitleForeground()); titleTextLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); titleTextLabel.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND)); final Label button = new Label(parent, SWT.NONE); button.setImage(SonarLintImages.NOTIFICATION_CLOSE); button.addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseEnter(MouseEvent e) { button.setImage(SonarLintImages.NOTIFICATION_CLOSE_HOVER); } @Override public void mouseExit(MouseEvent e) { button.setImage(SonarLintImages.NOTIFICATION_CLOSE); } }); button.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { close(); setReturnCode(CANCEL); } }); }
From source file:org.talend.core.repository.ui.view.RepositoryLabelProvider.java
License:Open Source License
@Override public Font getFont(Object element) { RepositoryNode node = (RepositoryNode) element; switch (node.getType()) { case STABLE_SYSTEM_FOLDER: if (node.getLabel().equals(ERepositoryObjectType.SNIPPETS.toString())) { return JFaceResources.getFontRegistry().defaultFont(); }/*from ww w .j ava2s . c om*/ case SYSTEM_FOLDER: return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); default: return JFaceResources.getFontRegistry().defaultFont(); } }
From source file:org.talend.core.ui.properties.tab.TalendTabbedPropertyList.java
License:Open Source License
/** * Get the dimensions of the provided string. * //from w w w .ja va2s . co m * @param text the string. * @return the dimensions of the provided string. */ private Point getTextDimension(String text) { if (textToDimensionMap.containsKey(text)) { return textToDimensionMap.get(text); } Shell shell = new Shell(); GC gc = new GC(shell); gc.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); Point point = gc.textExtent(text); point.x++; gc.dispose(); shell.dispose(); textToDimensionMap.put(text, point); return point; }
From source file:org.talend.core.ui.properties.tab.TalendTabbedPropertyTitle.java
License:Open Source License
/** * Constructor for TabbedPropertyTitle./*from w ww .j a v a 2 s . c o m*/ * * @param parent the parent composite. * @param factory the widget factory for the tabbed property sheet */ public TalendTabbedPropertyTitle(Composite parent, TabbedPropertySheetWidgetFactory factory) { super(parent, SWT.NO_FOCUS); this.factory = factory; colorHelper = new TalendTabbedPropertyColorHelper(factory); // CSS CoreUIPlugin.setCSSClass(this, this.getClass().getSimpleName()); this.addPaintListener(new PaintListener() { @Override 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 = 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); if (colorHelper.getTitleBackground() == null) { label.setBackground(new Color[] { factory.getColors().getColor(IFormColors.H_GRADIENT_END), factory.getColors().getColor(IFormColors.H_GRADIENT_START) }, new int[] { 100 }, true); } else { label.setBackground(colorHelper.getTitleBackground()); } label.setFont(font); label.setForeground(colorHelper.getTitleForeground()); 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)); */ }
From source file:org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider.java
License:Open Source License
@Override public Font getFont(Object element) { boolean changeURL = false; if (element instanceof IRepositoryNode) { IRepositoryNode node = (IRepositoryNode) element; if (node instanceof RecycleBinRepNode) { return super.getFont(element); }//w w w. j av a2s.c om if (node.getObject() != null) { switch (node.getType()) { case STABLE_SYSTEM_FOLDER: case SYSTEM_FOLDER: return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); case REPOSITORY_ELEMENT: if (node instanceof DBConnectionRepNode) { ConnectionItem connectionItem = (ConnectionItem) node.getObject().getProperty().getItem(); if (connectionItem.getConnection() instanceof DatabaseConnection) { changeURL = ConnectionHelper.isUrlChanged(connectionItem.getConnection()); if (changeURL) { return getItalicFont(); } } } default: return JFaceResources.getFontRegistry().defaultFont(); } } } return super.getFont(element); }
From source file:org.talend.repository.ui.views.RepositoryLabelProvider.java
License:Open Source License
public Font getFont(Object element) { RepositoryNode node = (RepositoryNode) element; switch (node.getType()) { case STABLE_SYSTEM_FOLDER: if (node.getLabel().equals(ERepositoryObjectType.SNIPPETS.toString())) { return JFaceResources.getFontRegistry().defaultFont(); }//from ww w.j a v a 2 s . co m case SYSTEM_FOLDER: return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); default: return JFaceResources.getFontRegistry().defaultFont(); } }
From source file:org.talend.repository.viewer.label.AbstractRepoViewLabelProvider.java
License:Open Source License
@Override public Font getFont(Object element) { if (element instanceof RepositoryNode) { RepositoryNode node = (RepositoryNode) element; switch (node.getType()) { case SYSTEM_FOLDER: return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); case STABLE_SYSTEM_FOLDER: default://from w w w . java 2 s . co m } } return JFaceResources.getFontRegistry().defaultFont(); }
From source file:org.tigris.subversion.subclipse.ui.operations.ShowAnnotationOperation.java
License:Open Source License
private RevisionInformation createRevisionInformation(final AnnotateBlocks annotateBlocks, IProgressMonitor monitor) {//from w ww . ja va2 s .c o m Map logEntriesByRevision = new HashMap(); GetLogsCommand logCommand = new GetLogsCommand(this.remoteFile, SVNRevision.HEAD, this.fromRevision, this.toRevision, false, 0, null, false); try { logCommand.run(monitor); ILogEntry[] logEntries = logCommand.getLogEntries(); for (int i = 0; i < logEntries.length; i++) { ILogEntry logEntry = logEntries[i]; logEntriesByRevision.put(new Long(logEntry.getRevision().getNumber()), logEntry); } } catch (SVNException e) { SVNUIPlugin.log(e); } RevisionInformation info = new RevisionInformation(); try { // Have to use reflection for compatibility with Eclipse 3.2 API // info.setHoverControlCreator(new AnnotationControlCreator("Press F2 for focus.")); // info.setInformationPresenterControlCreator(new AnnotationControlCreator(null)); String tooltipAffordance = "Press F2 for focus."; try { // Will either set an affordance, or null if the tooltip affordance turned is off tooltipAffordance = (String) EditorsUI.class.getMethod("getTooltipAffordanceString", null) .invoke(null, null); } catch (Exception e) { //ignore } Class infoClass = info.getClass(); Class[] paramTypes = { IInformationControlCreator.class }; Method setHoverControlCreator = infoClass.getMethod("setHoverControlCreator", paramTypes); Method setInformationPresenterControlCreator = infoClass .getMethod("setInformationPresenterControlCreator", paramTypes); final class AnnotationControlCreator implements IInformationControlCreator { private final String statusFieldText; public AnnotationControlCreator(String statusFieldText) { this.statusFieldText = statusFieldText; } public IInformationControl createInformationControl(Shell parent) { return new SourceViewerInformationControl(parent, SWT.TOOL, SWT.NONE, JFaceResources.DEFAULT_FONT, statusFieldText); } } setHoverControlCreator.invoke(info, new Object[] { new AnnotationControlCreator(tooltipAffordance) }); setInformationPresenterControlCreator.invoke(info, new Object[] { new AnnotationControlCreator(null) }); } catch (Exception e) { // ignore } final CommitterColors colors = CommitterColors.getDefault(); HashMap sets = new HashMap(); for (Iterator blocks = annotateBlocks.getAnnotateBlocks().iterator(); blocks.hasNext();) { final AnnotateBlock block = (AnnotateBlock) blocks.next(); final String revisionString = Long.toString(block.getRevision()); LogEntry logEntry = (LogEntry) logEntriesByRevision.get(new Long(block.getRevision())); final String logMessage; if (logEntry == null) { logMessage = getSingleEntry(remoteFile, new Long(block.getRevision())); } else { logMessage = logEntry.getComment(); } Revision revision = (Revision) sets.get(revisionString); if (revision == null) { revision = new Revision() { public Object getHoverInfo() { return block.getUser() + " " + revisionString + " " + DateFormat //$NON-NLS-1$//$NON-NLS-2$ .getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(block.getDate()) + "\n\n" + //$NON-NLS-1$ (logMessage != null ? logMessage : ""); //$NON-NLS-1$ } public String getAuthor() { return block.getUser(); } public String getId() { return revisionString; } public Date getDate() { return block.getDate(); } public RGB getColor() { return colors.getCommitterRGB(getAuthor()); } }; sets.put(revisionString, revision); info.addRevision(revision); } revision.addRange(new LineRange(block.getStartLine(), block.getEndLine() - block.getStartLine() + 1)); } return info; }
From source file:org.xmind.ui.dialogs.NotificationWindow.java
License:Open Source License
private void createTitle(Composite parent) { String text = Display.getAppName(); if (text == null && title == null) return;// ww w. j av a 2 s.c o m if (text == null) { text = title; } else if (title != null) { text = text + " - " + title; //$NON-NLS-1$ } Label label = new Label(parent, SWT.WRAP); label.setText(text); label.setBackground(parent.getBackground()); label.setForeground(parent.getForeground()); label.setFont(FontUtils.getBoldRelative(JFaceResources.DEFAULT_FONT, 1)); label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); }
From source file:org.xmind.ui.dialogs.NotificationWindow.java
License:Open Source License
private void createActionLink(Composite parent) { StyledLink link;/* w ww .j a va2s . c om*/ String content = action.getText(); if (content.indexOf("<form>") >= 0) { //$NON-NLS-1$ link = new StyledLink(parent, SWT.NONE); } else { link = new StyledLink(parent, SWT.SIMPLE); } link.setText(content); link.setBackground(parent.getBackground()); link.setForeground(parent.getForeground()); link.setEnabled(action.isEnabled()); link.setFont(FontUtils.getRelativeHeight(JFaceResources.DEFAULT_FONT, Util.isMac() ? -2 : -1)); link.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final IAction theAction = this.action; link.addHyperlinkListener(new IHyperlinkListener() { public void linkExited(HyperlinkEvent e) { } public void linkEntered(HyperlinkEvent e) { } public void linkActivated(HyperlinkEvent e) { Display.getCurrent().asyncExec(new Runnable() { public void run() { close(); theAction.run(); } }); } }); }