Example usage for org.eclipse.jface.resource JFaceResources DEFAULT_FONT

List of usage examples for org.eclipse.jface.resource JFaceResources DEFAULT_FONT

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.

Prototype

String DEFAULT_FONT

To view the source code for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.

Click Source Link

Document

The symbolic font name for the standard font (value "org.eclipse.jface.defaultfont").

Usage

From source file:com.google.gapid.widgets.Widgets.java

License:Apache License

public static Group createGroup(Composite parent, String text) {
    Group group = new Group(parent, SWT.NONE);
    group.setLayout(new FillLayout(SWT.VERTICAL));
    group.setText(text);//ww  w.  j ava  2 s.c o  m
    group.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    return group;
}

From source file:com.google.gwt.eclipse.oophm.model.ModelLabelProvider.java

License:Open Source License

@Override
public Font getFont(Object element) {
    if (element instanceof IModelNode) {
        IModelNode modelNode = (IModelNode) element;
        if (modelNode.isTerminated()) {
            return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
        }// w  ww . j av  a  2  s. c o  m
    }
    return null;
}

From source file:com.hangum.tadpole.engine.manager.TadpoleApplicationContextManager.java

License:Open Source License

/**
 * get erd title font/*from w  w w .j a  v  a2 s  . co  m*/
 * @return
 */
public static Font getERDTitleFont() {
    ApplicationContext context = RWT.getApplicationContext();
    Object obj = context.getAttribute("getERDTitleFont");
    if (obj == null) {
        Font defaultFont = JFaceResources.getFont(JFaceResources.DEFAULT_FONT);
        FontData[] fd = defaultFont.getFontData();
        int fontSize = fd[0].getHeight() + 1;
        fd[0].setHeight(fontSize);

        Font titleFont = new Font(Display.getCurrent(), fd[0]);
        context.setAttribute("getERDTitleFont", titleFont);
        return titleFont;
    }

    return (Font) obj;
}

From source file:com.hangum.tadpole.engine.manager.TadpoleApplicationContextManager.java

License:Open Source License

/**
 * gulim font//  w  w w.j av  a  2s . c  om
 * @return
 */
public static Font getGulimFont() {
    ApplicationContext context = RWT.getApplicationContext();
    Object obj = context.getAttribute("getGulimFont");
    if (obj == null) {
        Font defaultFont = JFaceResources.getFont(JFaceResources.DEFAULT_FONT);
        int intDefaultHeight = defaultFont.getFontData()[0].getHeight() + 1;
        Font font = new Font(Display.getCurrent(),
                new FontData(Messages.get().Gullim, intDefaultHeight, SWT.NONE));
        context.setAttribute("getGulimFont", font);
        return font;
    }

    return (Font) obj;
}

From source file:com.ibm.research.tours.editors.TourEditor.java

License:Open Source License

private void createPaletteTable(Composite parent) {
    fInnerPaletteComposite = fFormToolkit.createComposite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginTop = 2;/*from   w  w  w  . j ava 2s  . c  om*/
    layout.marginBottom = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginWidth = 0;
    fInnerPaletteComposite.setLayout(layout);
    fInnerPaletteComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite titleComposite = fFormToolkit.createComposite(fInnerPaletteComposite, SWT.NONE);
    GridLayout titleLayout = new GridLayout(2, true);
    titleLayout.marginHeight = 0;
    titleLayout.marginWidth = 0;
    titleComposite.setLayout(titleLayout);
    titleComposite.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, false));

    Label title = fFormToolkit.createLabel(titleComposite, "Tour Palette");
    title.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    Label imageLabel = fFormToolkit.createLabel(titleComposite, "");
    imageLabel.setImage(ToursPlugin.getDefault().getImageRegistry().get(ToursPlugin.IMG_PALETTE));

    fPaletteSection = fFormToolkit.createSection(fInnerPaletteComposite, Section.NO_TITLE);
    fPaletteSection.setText("Palette");
    GridData paletteData = new GridData(GridData.FILL_BOTH);
    fPaletteSection.setLayoutData(paletteData);

    fFilteredPaletteTable = new FilteredTable(fPaletteSection, SWT.MULTI | SWT.V_SCROLL,
            new NQueryTablePatternFilter());
    fFilteredPaletteTable.setBackground(JFaceColors.getBannerBackground(Display.getDefault()));

    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    fFilteredPaletteTable.setLayoutData(data);

    fPaletteViewer = fFilteredPaletteTable.getViewer();
    fPaletteViewer.setContentProvider(new PaletteContentProvider());
    fPaletteViewer.addDoubleClickListener(new PaletteDoubleClickListener());
    fPaletteViewer.setSorter(new PaletteSorter());
    fPaletteViewer.setLabelProvider(new PaletteLabelProvider());
    fPaletteViewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE,
            new Transfer[] { PaletteEntryTransfer.getInstance() }, new PaletteDragListener(fPaletteViewer));
    fPaletteViewer.setInput(new Object());
    fPaletteSection.setClient(fFilteredPaletteTable);
    fPaletteSection.setLayoutData(new GridData(GridData.FILL_VERTICAL));

    ToursPlugin.getDefault().getPaletteModel().addPaletteModelListener(fPaletteModelListener);
}

From source file:com.microsoft.tfs.client.common.ui.controls.vc.properties.branches.BranchesPropertiesLabelProvider.java

License:Open Source License

@Override
public Font getFont(final Object element) {
    // Make tree item bold if it is the one that we requested branch
    // history on.
    if (((BranchHistoryTreeItem) element).isRequested()) {
        return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
    }/*w  w w . j  a  va2s.  co  m*/
    return null;
}

From source file:com.microsoft.tfs.client.common.ui.teambuild.dialogs.BuildStatusNotificationDialog.java

License:Open Source License

@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout dialogLayout = new GridLayout(2, false);
    dialogLayout.marginWidth = getHorizontalMargin();
    dialogLayout.marginHeight = getVerticalMargin();
    dialogLayout.horizontalSpacing = getHorizontalSpacing() * 2;
    dialogLayout.verticalSpacing = getVerticalSpacing();
    dialogArea.setLayout(dialogLayout);//ww w . j  a va 2 s. c o  m

    final Image image = getBuildDetailImage();

    if (image != null) {
        final Label imageLabel = new Label(dialogArea, SWT.NONE);
        imageLabel.setImage(image);
        GridDataBuilder.newInstance().vAlignTop().applyTo(imageLabel);
    }

    /* Create a composite for the many labels we're displaying. */
    final Composite messageComposite = new Composite(dialogArea, SWT.NONE);
    GridDataBuilder.newInstance().hSpan(image != null ? 1 : 2).hAlignFill().vAlignTop().hFill()
            .applyTo(messageComposite);

    final GridLayout messageCompositeLayout = new GridLayout(1, true);
    messageCompositeLayout.marginWidth = 0;
    messageCompositeLayout.marginHeight = 0;
    messageCompositeLayout.horizontalSpacing = getHorizontalSpacing();
    messageCompositeLayout.verticalSpacing = getVerticalSpacing();
    messageComposite.setLayout(messageCompositeLayout);

    final Label titleLabel = new Label(messageComposite, SWT.WRAP);
    titleLabel.setText(getBuildDetailTitle());
    titleLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    GridDataBuilder.newInstance().hAlignFill().vAlignTop().hFill().wHint(getMinimumMessageAreaWidth())
            .applyTo(titleLabel);

    if (buildDetail != null) {
        final Composite buildDetailComposite = createBuildDetailMessages(messageComposite);
        GridDataBuilder.newInstance().hAlignFill().vAlignTop().hFill().applyTo(buildDetailComposite);

        /*
         * Provide an informative label about their options for gated
         * checkins
         */
        final String helpMessage = getBuildHelpMessage();
        if (helpMessage != null) {
            final Label helpLabel = new Label(messageComposite, SWT.WRAP);
            helpLabel.setText(helpMessage);
            GridDataBuilder.newInstance().hAlignFill().vAlignTop().hFill().wHint(getMinimumMessageAreaWidth())
                    .applyTo(helpLabel);
        }
    }

    /* Provide some space between the button area and the message area */
    final Label spacerLabel = new Label(dialogArea, SWT.NONE);
    GridDataBuilder.newInstance().hSpan(2).applyTo(spacerLabel);

    final Button neverShowButton = new Button(dialogArea, SWT.CHECK | SWT.LEFT);
    neverShowButton
            .setText(Messages.getString("BuildStatusNotificationDialog.NeverShowNotificationToggleMessage")); //$NON-NLS-1$
    neverShowButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            neverShowToggle = neverShowButton.getSelection();
        }
    });
    GridDataBuilder.newInstance().hSpan(2).applyTo(neverShowButton);

    /*
     * Can only unshelve failed (or partially successful) builds
     */
    final boolean unshelve = (buildDetail != null && buildDetail.isBuildFinished()
            && (buildDetail.getStatus().contains(BuildStatus.FAILED)
                    || buildDetail.getStatus().contains(BuildStatus.PARTIALLY_SUCCEEDED))
            && buildDetail.getReason().contains(BuildReason.CHECK_IN_SHELVESET));

    /*
     * Can only reconcile successfully (or partially successful) builds that
     * were checked in (ie, have a non-negative changeset id)
     */
    final boolean reconcile = (buildDetail != null && buildDetail.isBuildFinished()
            && (buildDetail.getStatus().contains(BuildStatus.SUCCEEDED)
                    || buildDetail.getStatus().contains(BuildStatus.PARTIALLY_SUCCEEDED))
            && buildDetail.getReason().contains(BuildReason.CHECK_IN_SHELVESET)
            && InformationNodeConverters.getChangesetID(buildDetail.getInformation()) > 0);

    /*
     * If we're not offering reconcile or unshelve, this is simply a build
     * completion alert. In this case, only offer an okay button.
     */
    if (unshelve || reconcile) {
        if (reconcile) {
            /*
             * Reconcile should be in the OK position (the default button)
             */
            addButtonDescription(RECONCILE_BUTTON_ID,
                    Messages.getString("BuildStatusNotificationDialog.ReconcileButtonLabel"), //$NON-NLS-1$
                    true);
        }

        if (unshelve) {
            /*
             * Unshelve should be in the OK position (the default button)
             * unless there's a reconcile
             */
            addButtonDescription(UNSHELVE_BUTTON_ID,
                    Messages.getString("BuildStatusNotificationDialog.UnshelveButtonLabel"), //$NON-NLS-1$
                    (!reconcile));
        }

        /*
         * Note: all non-action buttons (ie, any buttons that are not
         * unshelve or reconcile) always return cancel id, indicating that
         * no action was performed and the build should still be considered
         * "watched".
         */
        addButtonDescription(IGNORE_BUTTON_ID,
                Messages.getString("BuildStatusNotificationDialog.IgnoreButtonLabel"), //$NON-NLS-1$
                false);
    } else {
        /*
         * Note: all non-action buttons (ie, any buttons that are not
         * unshelve or reconcile) always return cancel id, indicating that
         * no action was performed and the build should still be considered
         * "watched".
         */
        addButtonDescription(IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    }
}

From source file:com.nextep.designer.View.java

License:Open Source License

public void createPartControl(Composite parent) {
    Composite top = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;/* w ww  . ja v  a  2 s.  c om*/
    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
    Text text = new Text(top, SWT.MULTI | SWT.WRAP);
    text.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");
    text.setLayoutData(new GridData(GridData.FILL_BOTH));
}

From source file:com.nokia.carbide.cpp.internal.news.reader.editor.NewsPageLabelProvider.java

License:Open Source License

public Font getFont(Object element, int columnIndex) {
    Font font = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
    return font;
}

From source file:com.nokia.carbide.cpp.internal.news.reader.ui.NewsControlContribution.java

License:Open Source License

@Override
protected Control createControl(Composite parent) {

    if (parent instanceof ToolBar) {
        toolbar = (ToolBar) parent;//from   w  w  w  .  j a  v a2 s  . c o  m
        ToolItem[] items = toolbar.getItems();
        for (ToolItem item : items) {
            Object data = item.getData();
            if (data instanceof CommandContributionItem
                    && ((CommandContributionItem) data).getId().contains(NEWS_TRIM_COMMAND_ID)) {
                newsIconItem = item;
                break;
            }
        }
    } else {
        toolbar = null;
    }

    container = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().margins(2, 0).applyTo(container);

    // Create a label for the trim.
    label = new Label(container, SWT.BOTTOM);
    GridDataFactory.swtDefaults().grab(false, true).applyTo(label);
    String text = MessageFormat.format(Messages.NewsControlContribution_UnreadMessageFormat,
            CarbideNewsReaderPlugin.getFeedManager().getUnreadEntriesCount());
    label.setText(text);
    if (alert) {
        Font font = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
        label.setFont(font);
        alert = false;
    }

    if (newsIconItem != null) {
        // Yuck, toolbars and items have a wonky UI.  We need to do these events on the parent,
        // since the ToolItem itself is just an area inside the parent.  (#getControl() is only for separators ?!)

        // On icon: left click = open view, right click = menu
        if (toolbar != null) {
            if (toolbarListener != null)
                toolbar.removeMouseListener(toolbarListener);

            toolbarListener = new MouseAdapter() {
                /* (non-Javadoc)
                 * @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt.events.MouseEvent)
                 */
                @Override
                public void mouseDown(MouseEvent event) {
                    ToolItem item = toolbar.getItem(new Point(event.x, event.y));
                    if (item == newsIconItem) {
                        if (event.button == 1) {
                            NewsEditor.openEditor();
                        } else if (event.button == 3) {
                            Point screenLoc = toolbar.toDisplay(event.x, event.y);
                            handleNewsMenu(screenLoc);
                        }
                    }
                }
            };
            toolbar.addMouseListener(toolbarListener);
        }
    }

    // On label: left or right click = menu
    label.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e) {
            if (e.button == 1 || e.button == 3) {
                Point screenLoc = label.toDisplay(e.x, e.y);
                handleNewsMenu(screenLoc);
            }
        }
    });

    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, NewsUIHelpIDs.NEWSREADER_TRIM_COMMAND);
    return container;
}