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:au.gov.ansto.bragg.nbi.ui.widgets.HMImageDisplayWidget.java
License:Open Source License
protected Composite createImageArea() { GridLayoutFactory.swtDefaults().numColumns(9).margins(0, 0).applyTo(this); // Mode/*from w ww .ja v a2 s . c o m*/ Label label = getToolkit().createLabel(this, "Mode: "); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).grab(true, false).applyTo(label); comboViewer = new ComboViewer(this, SWT.READ_ONLY); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setLabelProvider(new LabelProvider()); comboViewer.setInput(getImageMode().getValues()); comboViewer.setSelection(new StructuredSelection(getImageMode())); comboViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { // Change display mode setImageMode((HMImageMode) ((IStructuredSelection) event.getSelection()).getFirstElement()); // Update NOW Job job = new Job(HMImageDisplayWidget.class.getName()) { protected IStatus run(IProgressMonitor monitor) { try { // Get data (one off) pullData(); } catch (Exception e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to fetch data.", e); } return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); } }); // Separator label = getToolkit().createLabel(this, ""); GridDataFactory.swtDefaults().hint(8, SWT.DEFAULT).applyTo(label); Label scaleLabel = getToolkit().createLabel(this, "Scale: "); scaleLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).grab(true, false).applyTo(scaleLabel); ComboViewer scaleViewer = new ComboViewer(this, SWT.READ_ONLY); scaleViewer.setContentProvider(new ArrayContentProvider()); scaleViewer.setLabelProvider(new LabelProvider()); scaleViewer.setInput(SCALE_INPUT); isScaleEnabled = true; try { isScaleEnabled = Boolean.valueOf(System.getProperty(IS_SCALE_ENABLED)); } catch (Exception e) { } scaleViewer.setSelection(new StructuredSelection(SCALE_INPUT[isScaleEnabled ? 0 : 1])); scaleViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { // Change display mode setScaleEnabled( SCALE_INPUT[0].equals(((IStructuredSelection) event.getSelection()).getFirstElement())); // Update NOW Job job = new Job(HMImageDisplayWidget.class.getName()) { protected IStatus run(IProgressMonitor monitor) { try { // Get data (one off) pullData(); } catch (Exception e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to fetch data.", e); } return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); } }); label = getToolkit().createLabel(this, ""); GridDataFactory.swtDefaults().hint(8, SWT.DEFAULT).applyTo(label); // Refresh label = getToolkit().createLabel(this, "Refresh: "); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); final Text refreshText = getToolkit().createText(this, ""); Realm.runWithDefault(SWTObservables.getRealm(Display.getDefault()), new Runnable() { public void run() { DataBindingContext bindingContext = new DataBindingContext(); bindingContext.bindValue(SWTObservables.observeText(refreshText, SWT.Modify), BeansObservables.observeValue(HMImageDisplayWidget.this, "refreshDelay"), new UpdateValueStrategy(), new UpdateValueStrategy()); } }); GridDataFactory.swtDefaults().hint(20, SWT.DEFAULT).applyTo(refreshText); label = getToolkit().createLabel(this, "sec "); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); Composite imageArea = getToolkit().createComposite(this, SWT.NONE); GridLayoutFactory.fillDefaults().margins(0, 0).spacing(0, 0).applyTo(imageArea); GridDataFactory.fillDefaults().grab(true, true).span(9, 1).applyTo(imageArea); return imageArea; }
From source file:au.gov.ansto.bragg.nbi.ui.widgets.ShutterStatusWidget.java
License:Open Source License
public void renderWidget() { setBackgroundMode(SWT.INHERIT_FORCE); GridLayoutFactory.swtDefaults().applyTo(this); Label label = getToolkit().createLabel(this, "Secondary\n--", SWT.CENTER | SWT.WRAP | SWT.BORDER); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(label); Context context = new Context(); context.path = "/instrument/status/secondary"; context.label = label;/*from w w w . ja va2 s .c o m*/ context.originalForeground = label.getForeground(); context.handler = new HdbEventHandler(context).activate(); contexts.add(context); label = getToolkit().createLabel(this, "Sample\n--", SWT.CENTER | SWT.WRAP | SWT.BORDER); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(label); context = new Context(); context.path = "/instrument/status/tertiary"; context.label = label; context.originalForeground = label.getForeground(); context.handler = new HdbEventHandler(context).activate(); contexts.add(context); // TODO: test this code // [GUMTREE-141] Blinking eventHandler = new EventHandler(IDirectoryService.EVENT_TOPIC_BIND) { @Override public void handleEvent(Event event) { // TODO: use topic to filter if (event.getProperty(IDirectoryService.EVENT_PROP_NAME).equals("shutterStatusCheckFailed")) { if ((Boolean) event.getProperty(IDirectoryService.EVENT_PROP_OBJECT)) { final int[] counter = new int[] { 0 }; final Map<Label, Color> originalColourMap = new HashMap<Label, Color>(); Job job = new Job("") { protected IStatus run(IProgressMonitor monitor) { // Over 5 times ... exit if (isDisposed() || counter[0] > 5) { return Status.OK_STATUS; } SafeUIRunner.asyncExec(new SafeRunnable() { public void run() throws Exception { for (Context context : contexts) { if (!context.isActivated) { continue; } // Initialise and finalise if (counter[0] == 0) { originalColourMap.put(context.label, context.label.getBackground()); } else if (counter[0] >= 5) { context.label.setBackground(originalColourMap.get(context.label)); } // Blinking if (counter[0] % 2 == 0) { context.label.setBackground(null); } else { context.label.setBackground(originalColourMap.get(context.label)); } } counter[0]++; } }); // Repeat every 0.5 sec schedule(500); return Status.OK_STATUS; } }; // Run now job.schedule(); } } } }; }
From source file:chuck.terran.admin.ui.jface.LineFieldEditor.java
License:Open Source License
/** * Computes the size of the color image displayed on the button. * <p>/*from www . j a v a2 s. co m*/ * This is an internal method and should not be called by clients. * </p> * * @param window * the window to create a GC on for calculation. * @return Point The image size * */ protected Point computeImageSize(Control window) { // Make the image height as high as a corresponding character. This // makes sure that the button has the same size as a "normal" text // button. 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; }
From source file:cideplus.ui.astview.ASTViewLabelProvider.java
License:Open Source License
public ASTViewLabelProvider() { fSelectionStart = -1;// w w w.j a v a 2s . c o m fSelectionLength = -1; Display display = Display.getCurrent(); fRed = display.getSystemColor(SWT.COLOR_RED); fDarkGray = display.getSystemColor(SWT.COLOR_DARK_GRAY); fBlue = display.getSystemColor(SWT.COLOR_DARK_BLUE); fDarkGreen = display.getSystemColor(SWT.COLOR_DARK_GREEN); fDarkRed = display.getSystemColor(SWT.COLOR_DARK_RED); fLightBlue = new Color(display, 232, 242, 254); // default for AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR fLightRed = new Color(display, 255, 190, 190); fBold = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry() .getBold(JFaceResources.DEFAULT_FONT); FontData[] fontData = fBold.getFontData(); for (int i = 0; i < fontData.length; i++) { fontData[i].setStyle(fontData[i].getStyle() | SWT.ITALIC); } fAllocatedBoldItalic = new Font(display, fontData); }
From source file:coloredide.astview.ASTViewLabelProvider.java
License:Open Source License
public ASTViewLabelProvider(ASTView view) { this.fView = view; fSelectionStart = -1;/*from www. ja v a 2s.c o m*/ fSelectionLength = -1; Display display = Display.getCurrent(); fRed = display.getSystemColor(SWT.COLOR_RED); fDarkGray = display.getSystemColor(SWT.COLOR_DARK_GRAY); fBlue = display.getSystemColor(SWT.COLOR_DARK_BLUE); fDarkGreen = display.getSystemColor(SWT.COLOR_DARK_GREEN); fDarkRed = display.getSystemColor(SWT.COLOR_DARK_RED); fLightBlue = new Color(display, 232, 242, 254); // default for // AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR fLightRed = new Color(display, 255, 190, 190); fBold = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry() .getBold(JFaceResources.DEFAULT_FONT); FontData[] fontData = fBold.getFontData(); for (int i = 0; i < fontData.length; i++) { fontData[i].setStyle(fontData[i].getStyle() | SWT.ITALIC); } fAllocatedBoldItalic = new Font(display, fontData); }
From source file:com.android.ide.eclipse.adt.internal.editors.layout.gle2.AccordionControl.java
License:Open Source License
/** * Create the composite.//from ww w . j a v a 2 s . c o m * * @param parent the parent widget to add the accordion to * @param style the SWT style mask to use * @param headers a list of headers, whose {@link Object#toString} method should * produce the heading label * @param greedy if true, grow vertically as much as possible * @param wrapChildren if true, configure the child area to be horizontally laid out * with wrapping * @param expand Set of headers to expand initially */ public AccordionControl(Composite parent, int style, List<?> headers, boolean greedy, boolean wrapChildren, Set<String> expand) { super(parent, style); mWrap = wrapChildren; GridLayout gridLayout = new GridLayout(1, false); gridLayout.verticalSpacing = HEADER_SPACING; gridLayout.horizontalSpacing = 0; gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; setLayout(gridLayout); Font labelFont = null; mOpen = IconFactory.getInstance().getIcon("open-folder"); //$NON-NLS-1$ mClosed = IconFactory.getInstance().getIcon("closed-folder"); //$NON-NLS-1$ List<CLabel> expandLabels = new ArrayList<CLabel>(); for (Object header : headers) { final CLabel label = new CLabel(this, SWT.SHADOW_OUT); label.setText(header.toString().replace("&", "&&")); //$NON-NLS-1$ //$NON-NLS-2$ updateBackground(label, false); if (labelFont == null) { labelFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); } label.setFont(labelFont); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); setHeader(header, label); label.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { if (e.button == 1 && (e.stateMask & SWT.MODIFIER_MASK) == 0) { toggle(label, true, mSingle); } } }); label.addMouseTrackListener(new MouseTrackListener() { @Override public void mouseEnter(MouseEvent e) { updateBackground(label, true); } @Override public void mouseExit(MouseEvent e) { updateBackground(label, false); } @Override public void mouseHover(MouseEvent e) { } }); // Turn off border? final ScrolledComposite scrolledComposite = new ScrolledComposite(this, SWT.V_SCROLL); ScrollBar verticalBar = scrolledComposite.getVerticalBar(); verticalBar.setIncrement(20); verticalBar.setPageIncrement(100); // Do we need the scrolled composite or can we just look at the next // wizard in the hierarchy? setContentArea(label, scrolledComposite); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); GridData scrollGridData = new GridData(SWT.FILL, greedy ? SWT.FILL : SWT.TOP, false, greedy, 1, 1); scrollGridData.exclude = true; scrollGridData.grabExcessHorizontalSpace = wrapChildren; scrolledComposite.setLayoutData(scrollGridData); if (wrapChildren) { scrolledComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle r = scrolledComposite.getClientArea(); Control content = scrolledComposite.getContent(); if (content != null && r != null) { Point minSize = content.computeSize(r.width, SWT.DEFAULT); scrolledComposite.setMinSize(minSize); ScrollBar vBar = scrolledComposite.getVerticalBar(); vBar.setPageIncrement(r.height); } } }); } updateIcon(label); if (expand != null && expand.contains(label.getText())) { // Comparing "label.getText()" rather than "header" because we make some // tweaks to the label (replacing & with && etc) and in the getExpandedCategories // method we return the label texts expandLabels.add(label); } } // Expand the requested categories for (CLabel label : expandLabels) { toggle(label, false, false); } }
From source file:com.aptana.ide.rcp.IDEWorkbenchWindowAdvisor.java
License:Open Source License
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);/*ww w .ja v 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 = IDEWorkbenchMessages.IDEWorkbenchAdvisor_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:com.aptana.rcp.IDEWorkbenchWindowAdvisor.java
License:Open Source License
/** * @see org.eclipse.ui.application.WorkbenchAdvisor#createEmptyWindowContents(org.eclipse.ui.application.IWorkbenchWindowConfigurer, * org.eclipse.swt.widgets.Composite) *///from w w w. j ava 2 s . co m 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); 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 = IDEWorkbenchMessages.IDEWorkbenchAdvisor_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:com.archimatetool.help.hints.HintsView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(); layout.marginHeight = 0;/*from w w w . ja va 2s. c o m*/ layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); if (!JFaceResources.getFontRegistry().hasValueFor("HintsTitleFont")) { //$NON-NLS-1$ FontData[] fontData = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT) .getFontData(); fontData[0].setHeight(fontData[0].getHeight() + 4); JFaceResources.getFontRegistry().put("HintsTitleFont", fontData); //$NON-NLS-1$ } fTitleLabel = new CLabel(parent, SWT.NULL); fTitleLabel.setFont(JFaceResources.getFont("HintsTitleFont")); //$NON-NLS-1$ fTitleLabel.setBackground(ColorConstants.white); GridData gd = new GridData(GridData.FILL_HORIZONTAL); fTitleLabel.setLayoutData(gd); /* * It's possible that the system might not be able to create the Browser */ fBrowser = createBrowser(parent); if (fBrowser == null) { return; } gd = new GridData(GridData.FILL_BOTH); fBrowser.setLayoutData(gd); // Listen to Loading progress fBrowser.addProgressListener(new ProgressListener() { @Override public void completed(ProgressEvent event) { fPageLoaded = true; } @Override public void changed(ProgressEvent event) { } }); // Listen to Diagram Editor Selections ComponentSelectionManager.INSTANCE.addSelectionListener(this); fActionPinContent = new PinAction(); //IMenuManager menuManager = getViewSite().getActionBars().getMenuManager(); //menuManager.add(fActionPinContent); IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); toolBarManager.add(fActionPinContent); createFileMap(); // Listen to workbench selections getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this); // Help PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID); // Initialise with whatever is selected in the workbench ISelection selection = getSite().getWorkbenchWindow().getSelectionService().getSelection(); IWorkbenchPart part = getSite().getWorkbenchWindow().getPartService().getActivePart(); selectionChanged(part, selection); }
From source file:com.astra.ses.spell.dev.advisor.ApplicationWorkbenchWindowAdvisor.java
License:Open Source License
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);//ww w . j a v a 2s . c om 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 = IDEWorkbenchMessages.IDEWorkbenchAdvisor_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; }