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:hierarchyviewer.ios.View.java
License:GNU General Public License
public void createPartControl(Composite parent) { Composite top = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0;/*from w w w . jav a 2s .co m*/ layout.marginWidth = 0; top.setLayout(layout); // top banner Composite banner = new Composite(top, SWT.NONE); banner.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false)); layout = new GridLayout(); layout.marginHeight = 5; layout.marginWidth = 10; layout.numColumns = 2; banner.setLayout(layout); // setup bold font Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); Label l = new Label(banner, SWT.WRAP); l.setText("Subject:"); l.setFont(boldFont); l = new Label(banner, SWT.WRAP); l.setText("This is a message about the cool Eclipse RCP!"); l = new Label(banner, SWT.WRAP); l.setText("From:"); l.setFont(boldFont); final Link link = new Link(banner, SWT.NONE); link.setText("<a>nicole@mail.org</a>"); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { MessageDialog.openInformation(getSite().getShell(), "Not Implemented", "Imagine the address book or a new message being created now."); } }); l = new Label(banner, SWT.WRAP); l.setText("Date:"); l.setFont(boldFont); l = new Label(banner, SWT.WRAP); l.setText("10:34 am"); // message contents messageText = new Text(top, SWT.MULTI | SWT.WRAP); messageText.setText( "This RCP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\n" + "- add a top-level menu and toolbar with actions\n" + "- add keybindings to actions\n" + "- create views that can't be closed and\n" + " multiple instances of the same view\n" + "- perspectives with placeholders for new views\n" + "- use the default about dialog\n" + "- create a product definition\n"); messageText.setLayoutData(new GridData(GridData.FILL_BOTH)); }
From source file:name.schedenig.eclipse.grepconsole.view.items.ItemLabelProvider.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.OwnerDrawLabelProvider#measure(org.eclipse.swt.widgets.Event, java.lang.Object) *//*from w w w. ja v a 2s . c o m*/ @Override protected void measure(Event event, Object element) { GC gc = event.gc; Image image = getImage(element); String text = getText(element); Font oldFont = gc.getFont(); Font font = getFont(element); if (font == null) { font = JFaceResources.getFont(JFaceResources.DEFAULT_FONT); } gc.setFont(font); Point size = gc.textExtent(text); gc.setFont(oldFont); if (image != null) { Rectangle imageBounds = image.getBounds(); size.x += imageBounds.width + SPACE; size.y = Math.max(size.y, imageBounds.height); } event.setBounds(new Rectangle(event.x, event.y, size.x, size.y)); }
From source file:name.schedenig.eclipse.grepconsole.view.items.ItemLabelProvider.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.OwnerDrawLabelProvider#paint(org.eclipse.swt.widgets.Event, java.lang.Object) *///w w w .j a v a 2 s. co m @Override protected void paint(Event event, Object element) { Image image = getImage(element); String text = getText(element); boolean enabled = isElementEnabled((AbstractGrepModelElement) element); boolean selected = (event.detail & SWT.SELECTED) != 0; Color color; if (enabled) { Display display = viewer.getControl().getDisplay(); color = selected ? display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT) : display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); } else { color = colorRegistry.get(RGB_DISABLED); } int x = event.x; if (image != null) { Rectangle imageBounds = image.getBounds(); event.gc.drawImage(image, event.x, event.y + (event.height - imageBounds.height) / 2); int imageWidth = imageBounds.width + SPACE; x += imageWidth; } Device device = event.gc.getDevice(); TextLayout layout = new TextLayout(device); try { Font font = getFont(element); if (font == null) { font = JFaceResources.getFont(JFaceResources.DEFAULT_FONT); } TextStyle style = new TextStyle(font, color, null); layout.setText(text); layout.setStyle(style, 0, text.length()); layout.draw(event.gc, x, event.y + (event.height - layout.getBounds().height) / 2); } finally { layout.dispose(); } }
From source file:net.lopezbobeda.rap.examples.mail.views.MessageView.java
License:Open Source License
public MessageView(final Composite parent, final Email pEmail) { Composite top = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0;//w w w. j av a 2s . com layout.marginWidth = 0; top.setLayout(layout); GridData gd = new GridData(); gd.verticalAlignment = SWT.TOP; top.setLayoutData(gd); // top banner Composite banner = new Composite(top, SWT.NONE); banner.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false)); layout = new GridLayout(); layout.marginHeight = 5; layout.marginWidth = 10; layout.numColumns = 2; banner.setLayout(layout); // setup bold font Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); Label l = new Label(banner, SWT.WRAP); l.setText("Subject:"); l.setFont(boldFont); l = new Label(banner, SWT.WRAP); l.setText(pEmail.getSubject()); l = new Label(banner, SWT.WRAP); l.setText("From:"); l.setFont(boldFont); final Link link = new Link(banner, SWT.NONE); link.setText("<a>" + pEmail.getSender() + "</a>"); link.addSelectionListener(new SelectionAdapter() { /** * Serial id. */ private static final long serialVersionUID = -2734992566910878564L; public void widgetSelected(SelectionEvent e) { MessageBox messageBox = new MessageBox(parent.getShell(), SWT.YES); messageBox.setMessage( "Not Implemented\n" + "Imagine the address book or a new message being created now."); DialogUtil.open(messageBox, new DialogCallback() { /** * Serial id. */ private static final long serialVersionUID = -8172492596304353383L; public void dialogClosed(int returnCode) { System.out.println("Yessss!"); } }); } }); l = new Label(banner, SWT.WRAP); l.setText("Date:"); l.setFont(boldFont); l = new Label(banner, SWT.WRAP); l.setText("10:34 am"); // message contents Text text = new Text(top, SWT.MULTI | SWT.WRAP); text.setText(pEmail.getMessage()); text.setLayoutData(new GridData(GridData.FILL_BOTH)); view = top; }
From source file:net.refractions.udig.catalog.internal.wmt.ui.wizard.controls.CSControl.java
License:Open Source License
@Override protected Control buildControl(Composite composite) { Composite control = new Composite(composite, SWT.NONE); control.setLayout(new RowLayout(SWT.VERTICAL)); //region Description Link text = new Link(control, SWT.HORIZONTAL | SWT.WRAP); text.setLayoutData(new RowData(400, 110)); text.setText(Messages.Wizard_CS_Description); text.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { Program.launch(Messages.Wizard_CS_UrlTileNames); }// ww w. j a v a 2 s.c om }); //endregion //region URL Label lblUrl = new Label(control, SWT.HORIZONTAL | SWT.BOLD); lblUrl.setText(Messages.Wizard_CS_Url); Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); lblUrl.setFont(boldFont); txtUrl = new Text(control, SWT.BORDER); txtUrl.setLayoutData(new RowData(380, 20)); txtUrl.setText(Messages.Wizard_CS_UrlDefault); //endregion // type typeButton = new Button(control, SWT.CHECK); typeButton.setLayoutData(new RowData(380, 20)); typeButton.setText("Handle as TMS as opposed to Google tile schema."); // end type //region Zoom-Range Composite compositeRow = new Composite(control, SWT.NONE); compositeRow.setLayout(new RowLayout(SWT.HORIZONTAL)); Composite compositeZoom = new Composite(compositeRow, SWT.NONE); compositeZoom.setLayout(new RowLayout(SWT.VERTICAL)); compositeZoom.setLayoutData(new RowData(200, 100)); Label lblZoom = new Label(compositeZoom, SWT.HORIZONTAL | SWT.BOLD); lblZoom.setText(Messages.Wizard_CS_ZoomLevel); lblZoom.setFont(boldFont); //region Zoom-Min Composite compositeRowZoom = new Composite(compositeZoom, SWT.NONE); compositeRowZoom.setLayout(new GridLayout(2, true)); Label lblZoomMin = new Label(compositeRowZoom, SWT.HORIZONTAL | SWT.BOLD); lblZoomMin.setText(Messages.Wizard_CS_Min); spZoomMin = new Spinner(compositeRowZoom, SWT.BORDER | SWT.READ_ONLY); spZoomMin.setMinimum(0); spZoomMin.setMaximum(22); spZoomMin.setSelection(2); spZoomMin.setIncrement(1); spZoomMin.pack(); //endregion //region Zoom-Max Label lblZoomMax = new Label(compositeRowZoom, SWT.HORIZONTAL | SWT.BOLD); lblZoomMax.setText(Messages.Wizard_CS_Max); spZoomMax = new Spinner(compositeRowZoom, SWT.BORDER | SWT.READ_ONLY); spZoomMax.setMinimum(0); spZoomMax.setMaximum(22); spZoomMax.setSelection(18); spZoomMax.setIncrement(1); spZoomMax.pack(); //endregion //endregion //region Tags Composite compositeTags = new Composite(compositeRow, SWT.NONE); compositeTags.setLayout(new RowLayout(SWT.VERTICAL)); Label lblTags = new Label(compositeTags, SWT.HORIZONTAL | SWT.BOLD); lblTags.setText(Messages.Wizard_CS_AvailableTags); lblTags.setFont(boldFont); Label lblTagZ = new Label(compositeTags, SWT.HORIZONTAL | SWT.BOLD); lblTagZ.setText(Messages.Wizard_CS_TagZoom); Label lblTagX = new Label(compositeTags, SWT.HORIZONTAL | SWT.BOLD); lblTagX.setText(Messages.Wizard_CS_TagX); Label lblTagY = new Label(compositeTags, SWT.HORIZONTAL | SWT.BOLD); lblTagY.setText(Messages.Wizard_CS_TagY); //endregion serviceExtension = new WMTServiceExtension(); this.control = control; return control; }
From source file:net.refractions.udig.catalog.internal.wmt.ui.wizard.controls.JGrasstoolsTmsFolderControl.java
License:Open Source License
@Override protected Control buildControl(Composite composite) { final Composite control = new Composite(composite, SWT.NONE); control.setLayout(new GridLayout(2, false)); // region Description Link text = new Link(control, SWT.HORIZONTAL | SWT.WRAP); GridData textGD = new GridData(SWT.FILL, SWT.FILL, true, false); textGD.horizontalSpan = 2;//from w w w. ja va2 s. c o m text.setLayoutData(textGD); text.setText( "Here you can load a TMS tiles folder that was exported with the Spatial Toolbox and the JGrasstools tiler."); // endregion Label lblUrl = new Label(control, SWT.HORIZONTAL | SWT.BOLD); lblUrl.setText("Select the tiles file definition (*.mapurl)"); Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); lblUrl.setFont(boldFont); GridData lblUrlGD = new GridData(SWT.FILL, SWT.FILL, true, false); lblUrlGD.horizontalSpan = 2; lblUrl.setLayoutData(lblUrlGD); txtUrl = new Text(control, SWT.BORDER); txtUrl.setLayoutData(new RowData(380, 20)); GridData txtUrlGD = new GridData(SWT.FILL, SWT.FILL, true, false); txtUrl.setLayoutData(txtUrlGD); Button browseButton = new Button(control, SWT.PUSH); browseButton.setLayoutData(new GridData(SWT.END, SWT.FILL, false, false)); browseButton.setText("..."); browseButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { FileDialog fileDialog = new FileDialog(control.getShell(), SWT.OPEN); String path = fileDialog.open(); if (path == null || path.length() < 1) { txtUrl.setText(""); } else { txtUrl.setText(path); } } }); serviceExtension = new WMTServiceExtension(); this.control = control; return control; }
From source file:net.refractions.udig.catalog.internal.wmt.ui.wizard.controls.OSMCloudMadeControl.java
License:Open Source License
@Override protected Control buildControl(Composite infoBox) { display = infoBox.getDisplay();//from w w w . j a va2s. c o m Composite composite = new Composite(infoBox, SWT.NONE); composite.setLayout(new RowLayout(SWT.VERTICAL)); //region Get Style From Groups btnStyleGroups = new Button(composite, SWT.RADIO); btnStyleGroups.setSelection(true); btnStyleGroups.setText(Messages.Wizard_CloudMade_StyleFromGroup); btnStyleGroups.addSelectionListener(radioSelectionListener); Composite compositeGroups = new Composite(composite, SWT.NONE); compositeGroups.setLayout(new RowLayout(SWT.HORIZONTAL)); gBCloudMade = new Group(compositeGroups, SWT.BORDER); gBCloudMade.setLayout(new RowLayout(SWT.VERTICAL)); gBCloudMade.setText(Messages.Wizard_CloudMade_GroupCloudMade); lvCloudMade = new ListViewer(gBCloudMade); lvCloudMade.getList().setLayoutData(new RowData(180, 80)); lvCloudMade.setContentProvider(new ArrayContentProvider()); lvCloudMade.setLabelProvider(new LabelProvider()); gBCloudMade.pack(); gBFeatured = new Group(compositeGroups, SWT.BORDER); gBFeatured.setLayout(new RowLayout(SWT.VERTICAL)); gBFeatured.setText(Messages.Wizard_CloudMade_GroupFeatured); lvFeatured = new ListViewer(gBFeatured); lvFeatured.getList().setLayoutData(new RowData(180, 80)); lvFeatured.setContentProvider(new ArrayContentProvider()); lvFeatured.setLabelProvider(new LabelProvider()); gBFeatured.pack(); //endregion //region Get Style From Id Button btnOwnStyle = new Button(composite, SWT.RADIO); btnOwnStyle.setText(Messages.Wizard_CloudMade_StyleFromId); Composite compositeStyleId = new Composite(composite, SWT.NONE); compositeStyleId.setLayout(new RowLayout(SWT.HORIZONTAL)); lblStyleIdField = new Label(compositeStyleId, SWT.HORIZONTAL); lblStyleIdField.setText(Messages.Wizard_CloudMade_StyleId); txtStyleId = new Text(compositeStyleId, SWT.BORDER); txtStyleId.setBounds(10, 10, 200, 200); txtStyleId.setText(Messages.Wizard_CloudMade_DefaultStyleId); txtStyleId.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent event) { if ((event.keyCode == SWT.CR) || (event.keyCode == SWT.KEYPAD_CR)) { updatePreview(); } } public void keyReleased(KeyEvent arg0) { } }); txtStyleId.addListener(SWT.Verify, new Listener() { public void handleEvent(Event e) { String input = e.text; for (int i = 0; i < input.length(); i++) { if (!('0' <= input.charAt(i) && input.charAt(i) <= '9')) { e.doit = false; return; } } } }); btnRefresh = new Button(compositeStyleId, SWT.PUSH); btnRefresh.setText(Messages.Wizard_CloudMade_RefreshPreview); btnRefresh.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updatePreview(); } }); link = new Link(composite, SWT.BORDER); link.setText(Messages.Wizard_CloudMade_StyleEditorInfo); link.setLayoutData(new RowData(400, 50)); link.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { Program.launch("http://maps.cloudmade.com/editor"); //$NON-NLS-1$ } }); //endregion //region Preview Group gBPreview = new Group(composite, SWT.BORDER); gBPreview.setLayout(new RowLayout(SWT.HORIZONTAL)); gBPreview.setText(Messages.Wizard_CloudMade_Preview); Composite compositeStyleInfo = new Composite(gBPreview, SWT.NONE); compositeStyleInfo.setLayout(new RowLayout(SWT.VERTICAL)); compositeStyleInfo.setLayoutData(new RowData(180, 160)); Label lblStyleName = new Label(compositeStyleInfo, SWT.HORIZONTAL | SWT.BOLD); lblStyleName.setText(Messages.Wizard_CloudMade_PreviewName); Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); lblStyleName.setFont(boldFont); lblStyleNameValue = new Label(compositeStyleInfo, SWT.HORIZONTAL); lblStyleNameValue.setText(""); //$NON-NLS-1$ Label lblStyleId = new Label(compositeStyleInfo, SWT.HORIZONTAL); lblStyleId.setText(Messages.Wizard_CloudMade_PreviewId); lblStyleId.setFont(boldFont); lblStyleIdValue = new Label(compositeStyleInfo, SWT.HORIZONTAL); lblStyleIdValue.setText(""); //$NON-NLS-1$ Label lblStyleAuthor = new Label(compositeStyleInfo, SWT.HORIZONTAL); lblStyleAuthor.setText(Messages.Wizard_CloudMade_PreviewAuthor); lblStyleAuthor.setFont(boldFont); lblStyleAuthorValue = new Label(compositeStyleInfo, SWT.HORIZONTAL); lblStyleAuthorValue.setText(""); //$NON-NLS-1$ previewImage = new Composite(gBPreview, SWT.NONE); previewImage.setLayoutData(new RowData(233, 160)); previewImage.setCursor(new Cursor(display, SWT.CURSOR_HAND)); previewImage.setToolTipText(Messages.Wizard_CloudMade_PreviewGetFullMap); previewImage.addMouseListener(new MouseListener() { public void mouseDoubleClick(MouseEvent arg0) { } public void mouseUp(MouseEvent arg0) { } public void mouseDown(MouseEvent arg0) { if (!previewStyleId.equals(OSMCloudMadeStylesManager.CloudMadeStyle.EMPTY_STYLE_ID)) { Program.launch("http://maps.cloudmade.com/?lat=51.508315&lng=-0.124712&zoom=14&styleId=" //$NON-NLS-1$ + previewStyleId); } } }); gBPreview.pack(); //endregion //region Load group styles stylesManager = new OSMCloudMadeStylesManager(); // Group CloudMade styleGroupCloudMade = stylesManager.getGroupCloudMade(); lvCloudMade.setInput(styleGroupCloudMade.getStyles()); // Group Featured styleGroupFeatured = stylesManager.getGroupFeatured(); lvFeatured.setInput(styleGroupFeatured.getStyles()); // Select default style if (styleGroupCloudMade.getStyles().size() > 0) { lvCloudMade.getList().setSelection(0); } //endregion //region Set up image cache imageCache = new ImageRegistry(display); // load default image ImageDescriptor descDefault = ImageDescriptor.createFromFile(getClass(), OSMCloudMadeStylesManager.IMG_DEFAULT); imageCache.put(OSMCloudMadeStylesManager.CloudMadeStyle.EMPTY_STYLE_ID, descDefault); // load loading image ImageDescriptor descLoading = ImageDescriptor.createFromFile(getClass(), OSMCloudMadeStylesManager.IMG_LOADING); imageCache.put(OSMCloudMadeStylesManager.IMG_LOADING, descLoading); //endregion //region Set up listeners lvCloudMade.getList().addSelectionListener(listSelectionListener); lvFeatured.getList().addSelectionListener(listSelectionListener); radioSelectionListener.widgetSelected(null); //endregion serviceExtension = new WMTServiceExtension(); control = composite; return composite; }
From source file:net.refractions.udig.feature.panel.FeaturePanelList.java
License:Open Source License
/** * Get the dimensions of the provided string. * //from www. j a va 2 s.c om * @param text * the string. * @return the dimensions of the provided string. */ private Point getTextDimension(String text) { GC gc = new GC(this); gc.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); Point point = gc.textExtent(text); point.x++; gc.dispose(); return point; }
From source file:net.refractions.udig.feature.panel.FeaturePanelTitle.java
License:Open Source License
/** * Constructor for TabbedPropertyTitle./*from ww w . j a v a 2s .co m*/ * * @param parent the parent composite. * @param factory2 the widget factory for the tabbed property sheet */ public FeaturePanelTitle(Composite parent, FeaturePanelWidgetFactory 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 = 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)); */ }
From source file:net.refractions.udig.project.ui.internal.PaletteCombo.java
License:Open Source License
/** * @param window/*from w w w . j a va 2 s . c o m*/ * @return */ protected Point computeImageSize(Control window) { GC gc = new GC(window); Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT); gc.setFont(f); int height = gc.getFontMetrics().getHeight(); gc.dispose(); Point p = new Point(height * 3 - 6, height); return p; }