List of usage examples for org.eclipse.jface.resource JFaceResources getBannerFont
public static Font getBannerFont()
From source file:com.bdaum.zoom.ui.internal.widgets.CollectionEditGroup.java
License:Open Source License
@SuppressWarnings("unused") private void createSelectionAndSortCriteria(Composite parent) { if (album) {//from ww w.j a v a2 s. c o m Label sortLabel = new Label(parent, SWT.NONE); sortLabel.setText(Messages.CollectionEditDialog_sort_criteria); sortLabel.setFont(JFaceResources.getBannerFont()); } else { Composite rowComp = new Composite(parent, SWT.NONE); rowComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); rowComp.setLayout(new GridLayout(8, false)); new Label(rowComp, SWT.NONE); createLabel(rowComp, Messages.CollectionEditDialog_group); createLabel(rowComp, Messages.CollectionEditDialog_field); createLabel(rowComp, Messages.CollectionEditDialog_relation); createLabel(rowComp, Messages.CollectionEditDialog_value) .setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 4, 1)); if (current == null || current.getCriterion().isEmpty()) addGroup(rowComp, null, null, false); else for (Criterion crit : current.getCriterion()) addGroup(rowComp, null, crit, crit.getAnd()); } if (!album) new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); sortComp = new Composite(parent, SWT.NONE); sortComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sortComp.setLayout(new GridLayout(6, false)); new Label(sortComp, SWT.NONE); createLabel(sortComp, Messages.CollectionEditDialog_sort_group); createLabel(sortComp, Messages.CollectionEditDialog_sort_field); createLabel(sortComp, Messages.CollectionEditDialog_direction); new Label(sortComp, SWT.NONE).setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 2, 1)); if (current == null) addSortGroup(sortComp, null, new SortCriterionImpl(QueryField.IPTC_DATECREATED.getKey(), null, false)); else if (current.getSortCriterion().isEmpty()) addSortGroup(sortComp, null, null); else for (SortCriterion crit : current.getSortCriterion()) addSortGroup(sortComp, null, crit); }
From source file:com.bdaum.zoom.ui.internal.widgets.CollectionEditGroup.java
License:Open Source License
private static Label createLabel(Composite composite, String text) { Label label = new Label(composite, SWT.NONE); label.setFont(JFaceResources.getBannerFont()); label.setText(text);/*ww w. j a va 2 s. com*/ return label; }
From source file:com.bdaum.zoom.ui.internal.widgets.PSWTSectionBreak.java
License:Open Source License
private static Image createSectionImage(PSWTCanvas canvas, SlideImpl slide) { Display display = canvas.getDisplay(); Rectangle bounds = display.getPrimaryMonitor().getBounds(); int mx = Math.max(bounds.width, bounds.height); double fac = 640d / mx; int w = (int) (bounds.width * fac); int h = (int) (bounds.height * fac); Image image = new Image(display, w, h); int tw, th, tx, ty; int iw, ih, ix, iy; switch (slide.getLayout()) { case Constants.SLIDE_THUMBNAILS_LEFT: tw = w * 4 / 10;// ww w . j av a2 s . co m th = h * 8 / 10; tx = w / 2; ty = h / 10; iw = w * 3 / 10; ih = th; ix = w / 10; iy = ty; break; case Constants.SLIDE_THUMBNAILS_RIGHT: tw = w * 4 / 10; th = h * 8 / 10; tx = w / 10; ty = h / 10; iw = w * 3 / 10; ih = th; ix = w * 6 / 10; iy = ty; break; case Constants.SLIDE_THUMBNAILS_TOP: tw = w * 8 / 10; th = h * 4 / 10; tx = w / 10; ty = h / 2; iw = tw; ih = h * 3 / 10; ix = tx; iy = h / 10; break; case Constants.SLIDE_THUMBNAILS_BOTTOM: tw = w * 8 / 10; th = h * 4 / 10; tx = w / 10; ty = h / 10; iw = tw; ih = h * 3 / 10; ix = tx; iy = h * 6 / 10; break; default: tw = w * 8 / 10; th = h * 8 / 10; tx = w / 10; ty = h / 10; iw = ih = ix = iy = 0; break; } GC gc = new GC(image); gc.setBackground(canvas.getBackground()); gc.fillRectangle(0, 0, w, h); gc.setLineWidth(3); gc.setForeground(canvas.getForeground()); gc.drawRectangle(0, 0, w - 1, h - 1); TextLayout layout = new TextLayout(display); StringBuilder sb = new StringBuilder(); if (slide.getCaption() != null) sb.append(slide.getCaption()); int boldLength = sb.length(); if (slide.getDescription() != null && !slide.getDescription().isEmpty()) { if (sb.length() > 0) sb.append("\n\n"); //$NON-NLS-1$ sb.append(slide.getDescription()); } layout.setText(sb.toString()); layout.setStyle(new TextStyle(JFaceResources.getBannerFont(), null, null), 0, boldLength); layout.setWidth(tw); Rectangle b = layout.getBounds(); float f = Math.max(0.1f, (float) Math.sqrt((float) b.height / th)); layout.setWidth((int) (tw * f)); b = layout.getBounds(); f = 1f / Math.max((float) b.height / th, (float) b.width / tw); Transform t = new Transform(display); t.translate(tx, ty); t.scale(f, f); gc.setTransform(t); layout.draw(gc, 0, 0); layout.dispose(); gc.setTransform(null); t.dispose(); int s = Math.max(ih, iw) / 10; gc.setBackground(canvas.getForeground()); switch (slide.getLayout()) { case Constants.SLIDE_THUMBNAILS_RIGHT: case Constants.SLIDE_THUMBNAILS_LEFT: for (int i = 0; i < 5; i++) { int y = i * 2 * s + s / 2 + iy; for (int j = 0; j < 3; j++) gc.fillRectangle(j * 2 * s + s + ix, y, s, s); } break; case Constants.SLIDE_THUMBNAILS_TOP: case Constants.SLIDE_THUMBNAILS_BOTTOM: int y = s + iy; for (int i = 0; i < 6; i++) gc.fillRectangle(i * 18 * s / 10 + ix, y, s, s); break; } gc.dispose(); return image; }
From source file:com.bdaum.zoom.ui.internal.wizards.ImportFileSelectionPage.java
License:Open Source License
@SuppressWarnings("unused") @Override/* www . j a va 2 s . co m*/ public void createControl(Composite parent) { Composite comp = createComposite(parent, 1); final Composite viewerComp = new Composite(comp, SWT.NONE); viewerComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); viewerComp.setLayout(new GridLayout()); if (media) { volumeLabel = new Label(viewerComp, SWT.NONE); volumeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); volumeLabel.setFont(JFaceResources.getBannerFont()); } groupedByLabel = new Label(viewerComp, SWT.NONE); groupedByLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Composite innerComp = new Composite(viewerComp, SWT.NONE); innerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); innerComp.setLayout(new GridLayout(2, false)); ExpandCollapseGroup expandCollapseGroup = new ExpandCollapseGroup(innerComp, SWT.NONE); new Label(innerComp, SWT.NONE); importViewer = new CheckboxTreeViewer(innerComp, SWT.BORDER | SWT.V_SCROLL); expandCollapseGroup.setViewer(importViewer); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); layoutData.heightHint = 200; importViewer.getControl().setLayoutData(layoutData); importViewer.setContentProvider(new DcimContentProvider()); importViewer.setLabelProvider(new DcimLabelProvider()); importViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { selectedFiles = null; checkHierarchy(event.getElement(), event.getChecked(), false); validatePage(); if (lastImportButton != null) lastImportButton.setEnabled(lastImportTimestamp >= 0 || !lastImportPath.isEmpty()); } }); UiUtilities.installDoubleClickExpansion(importViewer); AllNoneGroup selectComp = new AllNoneGroup(innerComp, new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (e.widget.getData() == AllNoneGroup.ALL) { ImportNode[] rootElements = (ImportNode[]) importViewer.getInput(); importViewer.setCheckedElements(rootElements); for (ImportNode node : rootElements) checkHierarchy(node, true, false); } else importViewer.setCheckedElements(new ImportNode[0]); validatePage(); if (lastImportButton != null) lastImportButton.setEnabled(lastImportTimestamp >= 0 || !lastImportPath.isEmpty()); } }); if (media) { StorageObject[] dcims = ((ImportFromDeviceWizard) getWizard()).getDcims(); lastImportButton = WidgetFactory.createPushButton(selectComp, Messages.ImportFromDeviceWizard_all_since_last_import, SWT.BEGINNING); diffButton = WidgetFactory.createPushButton(selectComp, Messages.ImportFileSelectionPage_Difference, SWT.BEGINNING); diffButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { progressbar.setVisible(true); calculateDiff(); progressbar.setVisible(false); } }); Label label = new Label(selectComp, SWT.SEPARATOR | SWT.HORIZONTAL); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); manageMediaButton = WidgetFactory.createPushButton(selectComp, Messages.ImportFileSelectionPage_manage_media, SWT.BEGINNING); manageMediaButton.setToolTipText(Messages.ImportFileSelectionPage_manage_media_tooltip); final Meta meta = Core.getCore().getDbManager().getMeta(true); String key = null; LastDeviceImport lastImport = null; if (dcims.length > 0) { lastImportButton.setToolTipText(Messages.ImportFileSelectionPage_name_each_volume_differently); key = dcims[0].getMedium(); lastImport = meta.getLastDeviceImport(key); if (lastImport != null) { lastImportTimestamp = lastImport.getTimestamp(); if (lastImport.getPath() != null) lastImportPath = lastImport.getPath(); } else if (!key.isEmpty()) editMedia(meta, key, false); else AcousticMessageDialog.openInformation(getShell(), Messages.ImportFileSelectionPage_import_from_device, Messages.ImportFileSelectionPage_assign_volume_name); updateVolumeLabel(key); } if (lastImportTimestamp >= 0 || !lastImportPath.isEmpty()) lastImportButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (lastImportTimestamp >= 0 || !lastImportPath.isEmpty()) { markSinceLastImport(); validatePage(); } } }); else lastImportButton.setEnabled(false); if (meta.getLastDeviceImport() != null && !meta.getLastDeviceImport().isEmpty() || key != null) { final String k = key; manageMediaButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { editMedia(meta, k, true); } }); } else manageMediaButton.setEnabled(false); } duplicatesButton = WidgetFactory.createCheckButton(innerComp, Messages.ImportFromDeviceWizard_dont_import_dupes, new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 2, 1)); Composite skipComp = new Composite(comp, SWT.NONE); skipComp.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); Label label = new Label(skipComp, SWT.NONE); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); label.setText(Messages.ImportFileSelectionPage_skipped_file_types); if (media) { skipComp.setLayout(new GridLayout(2, false)); skipCombo = new Combo(skipComp, SWT.READ_ONLY); skipCombo.setItems(SKIPPOLICIES); skipCombo.setVisibleItemCount(5); } else { skipComp.setLayout(new GridLayout(3, false)); skipFormatsField = new Text(skipComp, SWT.BORDER | SWT.READ_ONLY | SWT.SINGLE); skipFormatsField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button skipFormatButton = new Button(skipComp, SWT.PUSH); skipFormatButton.setText("..."); //$NON-NLS-1$ skipFormatButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { SkippedFormatsDialog dialog = new SkippedFormatsDialog(getShell(), skippedFormats); if (dialog.open() == Dialog.OK) { skippedFormats = dialog.getResult(); skipFormatsField.setText(Core.toStringList(skippedFormats.toArray(), ";")); //$NON-NLS-1$ } super.widgetSelected(e); } }); } if (eject) removeMediaButton = WidgetFactory.createCheckButton(comp, Messages.ImportFromDeviceWizard_remove_media, null); if (media) { progressbar = new ProgressBar(comp, SWT.HORIZONTAL); progressbar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); progressbar.setVisible(false); } setControl(comp); setHelp(media ? HelpContextIds.IMPORT_FROM_DEVICE_WIZARD_FILE_SELECTION : HelpContextIds.IMPORT_NEW_STRUCTURE_WIZARD_FILE_SELECTION); setTitle(Messages.ImportFileSelectionPage_file_selection); setMessage(Messages.ImportFileSelectionPage_select_the_image_files); super.createControl(parent); try { fillValues(); validatePage(); } catch (InvocationTargetException e1) { UiActivator.getDefault().logError(Messages.ImportFileSelectionPage_internal_error, e1); } catch (InterruptedException e1) { if (e1.getMessage() != null && !e1.getMessage().isEmpty()) parent.getDisplay().syncExec(() -> AcousticMessageDialog.openError(getShell(), Messages.ImportFileSelectionPage_import_from_device, e1.getMessage())); ((WizardDialog) getWizard().getContainer()).close(); } }
From source file:com.drgarbage.bytecodevisualizer.editors.NoSourceViewer.java
License:Apache License
public void propertyChange(PropertyChangeEvent event) { for (Label l : fBannerLabels) { l.setFont(JFaceResources.getBannerFont()); }/*w w w .j av a 2 s. c o m*/ for (Label l : fHeaderLabels) { l.setFont(JFaceResources.getHeaderFont()); } fComposite.layout(true); fComposite.redraw(); }
From source file:com.google.dart.tools.ui.dialogs.AboutDartDialog.java
License:Open Source License
/** * Create contents of the shell.//from w ww . j a v a 2 s . c o m */ protected void createContents() { Point size = DartCoreDebug.ENABLE_UPDATE ? new Point(394, 420) : new Point(394, 364); setSize(size); addCopyDetailsPopup(this); setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); Label graphic = newLabel(SWT.SHADOW_NONE | SWT.CENTER); GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).hint(316, 416).applyTo(graphic); graphic.setImage(DartToolsPlugin.getImage(ABOUT_IMG_DESC)); addCopyDetailsPopup(graphic); Label productNameLabel = newLabel(SWT.BOLD); productNameLabel.setFont(JFaceResources.getBannerFont()); productNameLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); productNameLabel.setText(DialogsMessages.AboutDartDialog_product_label); addCopyDetailsPopup(productNameLabel); StyledText buildDetailsText = new StyledText(this, SWT.WRAP); buildDetailsText.setLineSpacing(7); buildDetailsText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); buildDetailsText.setEditable(false); center(buildDetailsText); String buildDetails = getDetails(); buildDetailsText.setText(buildDetails); buildDetailsText.setLineAlignment(1, 1, SWT.CENTER); addCopyDetailsPopup(buildDetailsText); // spacer newLabel(SWT.NONE); Label copyrightLabel = newLabel(SWT.NONE); center(copyrightLabel); copyrightLabel.setText(DialogsMessages.AboutDartDialog_copyright); addCopyDetailsPopup(copyrightLabel); Label copyrightLabel2 = newLabel(SWT.NONE); center(copyrightLabel2); copyrightLabel2.setText(DialogsMessages.AboutDartDialog_copyright_line2); addCopyDetailsPopup(copyrightLabel2); //spacer and caret repressor final StyledText spacer = new StyledText(this, SWT.NONE); spacer.setFocus(); spacer.getCaret().setSize(0, 0); //nuke the caret if (DartCoreDebug.ENABLE_UPDATE) { Label separator = new Label(this, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(separator); @SuppressWarnings("unused") UpdateStatusControl updateStatus = new UpdateStatusControl(this, Display.getDefault().getSystemColor(SWT.COLOR_WHITE), new Point(24, 4), false); } setLocation(getInitialLocation(getSize())); }
From source file:com.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java
License:Open Source License
/** * Creates the dialog's title area.//from w w w . ja va 2s .com * * @param parent * the SWT parent for the title area widgets * @return Control with the highest x axis value. */ private Control createTitleArea(Composite parent) { // add a dispose listener parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (titleAreaColor != null) { titleAreaColor.dispose(); } } }); // Determine the background color of the title bar Display display = parent.getDisplay(); Color background; Color foreground; if (titleAreaRGB != null) { titleAreaColor = new Color(display, titleAreaRGB); background = titleAreaColor; foreground = null; } else { background = JFaceColors.getBannerBackground(display); foreground = JFaceColors.getBannerForeground(display); } parent.setBackground(background); int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); // Dialog image @ right titleImageLabel = new Label(parent, SWT.CENTER); titleImageLabel.setBackground(background); if (titleAreaImage == null) titleImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER)); else titleImageLabel.setImage(titleAreaImage); FormData imageData = new FormData(); imageData.top = new FormAttachment(0, 0); // Note: do not use horizontalSpacing on the right as that would be a // regression from // the R2.x style where there was no margin on the right and images are // flush to the right // hand side. see reopened comments in 41172 imageData.right = new FormAttachment(100, 0); // horizontalSpacing titleImageLabel.setLayoutData(imageData); // Title label @ top, left titleLabel = new Label(parent, SWT.LEFT); JFaceColors.setColors(titleLabel, foreground, background); titleLabel.setFont(JFaceResources.getBannerFont()); titleLabel.setText(" ");//$NON-NLS-1$ FormData titleData = new FormData(); titleData.top = new FormAttachment(0, verticalSpacing); titleData.right = new FormAttachment(titleImageLabel); titleData.left = new FormAttachment(0, horizontalSpacing); titleLabel.setLayoutData(titleData); // Message image @ bottom, left messageImageLabel = new Label(parent, SWT.CENTER); messageImageLabel.setBackground(background); // Message label @ bottom, center messageLabel = new Link(parent, SWT.WRAP | SWT.READ_ONLY); JFaceColors.setColors(messageLabel, foreground, background); messageLabel.setText(" \n "); // two lines//$NON-NLS-1$ messageLabel.setFont(JFaceResources.getDialogFont()); messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; // Filler labels leftFillerLabel = new Label(parent, SWT.CENTER); leftFillerLabel.setBackground(background); bottomFillerLabel = new Label(parent, SWT.CENTER); bottomFillerLabel.setBackground(background); setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); determineTitleImageLargest(); if (titleImageLargest) return titleImageLabel; return messageLabel; }
From source file:com.ibm.xsp.extlib.designer.tooling.palette.applicationlayout.AlwStartPage.java
License:Open Source License
protected AlwStartPage() { super(""); setTitle("Application Layout"); // $NLX-AlwStartPage.ApplicationLayout-1$ setMessage("Choose the configuration for this control.", IMessageProvider.INFORMATION); // $NLX-AlwStartPage.Choosetheconfigurationforthiscont-1$ // Setup the title font _titleFont = JFaceResources.getBannerFont(); // Setup hand cursor _handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND); // Load images - Do not have to be disposed later - plugin maintains a list _defImage = ExtLibToolingPlugin.getImage("app_layout.jpg"); // $NON-NLS-1$ if (_showResponsiveIcon) { _responsiveImage = NavigatorPlugin.getImage("navigatorIcons/navigatorChild.png"); // $NON-NLS-1$ } else {//from ww w .j a v a 2 s. c o m _responsiveImage = null; } // Setup hyperlink color _hyperlinkColor = new Color(Display.getCurrent(), 0, 0, 255); }
From source file:com.iw.plugins.spindle.ui.SectionWidget.java
License:Mozilla Public License
public void propertyChange(PropertyChangeEvent arg0) { if (control != null && header != null) { header.setFont(JFaceResources.getBannerFont()); control.layout(true);// w w w.j a va 2 s . c o m } }
From source file:com.nokia.carbide.internal.discovery.ui.editor.TaskBar.java
License:Open Source License
private void createTitle(IActionBar actionBar) { Label l = new Label(this, SWT.LEFT); l.setFont(JFaceResources.getBannerFont()); l.setBackground(l.getDisplay().getSystemColor(SWT.COLOR_WHITE)); l.setText(actionBar.getTitle());/*from w ww .j a v a 2s .c om*/ RowDataFactory.swtDefaults().applyTo(l); l = new Label(this, SWT.HORIZONTAL | SWT.SEPARATOR); RowDataFactory.swtDefaults().applyTo(l); }