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:org.xmind.ui.dialogs.NotificationWindow.java

License:Open Source License

private void createMoreLink(Composite parent) {
    String moreText = moreAction.getText();
    if (moreText == null) {
        moreText = Messages.NotificationDialog_MoreLink_defaultText;
    }/*from   ww w  .java2 s . com*/
    StyledLink link = new StyledLink(parent, SWT.SIMPLE);
    link.setText(moreText);
    link.setFont(FontUtils.getRelativeHeight(JFaceResources.DEFAULT_FONT, -2));
    link.setBackground(parent.getBackground());
    link.setForeground(ColorUtils.getColor(80, 100, 250));
    link.setEnabled(moreAction.isEnabled());
    link.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    final IAction theMoreAction = this.moreAction;
    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() {
                    if (closeOnMoreLink) {
                        close();
                    }
                    theMoreAction.run();
                }
            });
        }
    });
}

From source file:org.xmind.ui.dialogs.SimpleInfoPopupDialog.java

License:Open Source License

protected Font getInfoFont() {
    return FontUtils.getNewHeight(JFaceResources.DEFAULT_FONT, Util.isMac() ? 14 : 10);
}

From source file:org.xmind.ui.dialogs.StyledLink.java

License:Open Source License

public StyledLink(Composite parent, int style) {
    super(parent, style | SWT.DOUBLE_BUFFERED);
    this.styled = (style & SWT.SIMPLE) == 0;
    super.setFont(FontUtils.getFont(JFaceResources.DEFAULT_FONT));
    super.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
            drawParagraphs(e.gc);//ww w  .  j  a v a2 s  . com
        }
    });
    addMouseListener(new MouseListener() {

        boolean pressed = false;

        public void mouseUp(MouseEvent e) {
            Rectangle r = getBounds();
            if (pressed && e.x >= 0 && e.x < r.width && e.y >= 0 && e.y < r.height) {
                fireLinkActivated(createLinkEvent(e));
            }
            pressed = false;
        }

        public void mouseDown(MouseEvent e) {
            pressed = true;
        }

        public void mouseDoubleClick(MouseEvent e) {
            pressed = false;
        }
    });
    addMouseTrackListener(new MouseTrackListener() {

        public void mouseHover(MouseEvent e) {
            setHovered(true);
        }

        public void mouseExit(MouseEvent e) {
            setHovered(false);
        }

        public void mouseEnter(MouseEvent e) {
            setHovered(true);
        }
    });
}

From source file:org.xmind.ui.font.FontDialog.java

License:Open Source License

/**
 * @param parent//from w ww  .ja v a 2 s .c o m
 */
private void createTypeControl(Group parent) {
    boldButton = new Button(parent, SWT.CHECK);
    boldButton.setText(Messages.BoldButton_text);

    boldButton.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    boldButton.setSelection(getBold());

    italicButton = new Button(parent, SWT.CHECK);
    italicButton.setText(Messages.ItalicButton_text);
    italicButton.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
    italicButton.setSelection(getItalic());

    underlineButton = new Button(parent, SWT.CHECK);
    underlineButton.setText(Messages.UnderlineButton_text);
    underlineButton.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            e.gc.drawLine(e.x + 20, e.y + e.height - 4, e.x + e.width, e.y + e.height - 4);
        }

    });
    underlineButton.setSelection(getUnderline());

    strikeoutButton = new Button(parent, SWT.CHECK);
    strikeoutButton.setText(Messages.StrikeoutButton_text);
    strikeoutButton.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            e.gc.drawLine(e.x + 20, e.y + e.height / 2, e.x + e.width, e.y + e.height / 2);
        }

    });
    strikeoutButton.setSelection(getStrikeout());

    Listener listener = new Listener() {

        public void handleEvent(Event event) {
            setBold(boldButton.getSelection());
            setItalic(italicButton.getSelection());
            setUnderline(underlineButton.getSelection());
            setStrikeout(strikeoutButton.getSelection());
            fireFontChanged();
        }

    };
    boldButton.addListener(SWT.Selection, listener);
    italicButton.addListener(SWT.Selection, listener);
    underlineButton.addListener(SWT.Selection, listener);
    strikeoutButton.addListener(SWT.Selection, listener);
}

From source file:org.xmind.ui.internal.decorators.LegendTitleTextDecorator.java

License:Open Source License

public void activate(IGraphicalPart part, IFigure figure) {
    super.activate(part, figure);
    if (figure instanceof ITextFigure) {
        ITextFigure fig = (ITextFigure) figure;
        fig.setText(MindMapMessages.Legend);
        fig.setFont(FontUtils.getBold(JFaceResources.DEFAULT_FONT));
        fig.setForegroundColor(ColorConstants.black);
    }/*from ww  w  .j a  v a2 s.  c om*/
    //        if (figure instanceof RotatableWrapLabel) {
    //            ((RotatableWrapLabel) figure)
    //                    .setRenderStyle(RotatableWrapLabel.NORMAL);
    //        }
}

From source file:org.xmind.ui.internal.findreplace.FindReplaceDialog.java

License:Open Source License

protected void createContextLabel(Composite parent) {
    contextLabel = new Label(parent, SWT.NONE);
    contextLabel.setFont(FontUtils.getNewHeight(JFaceResources.DEFAULT_FONT, 11));
    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
    contextLabel.setLayoutData(layoutData);
}

From source file:org.xmind.ui.internal.mindmap.IconTipPart.java

License:Open Source License

protected IFigure createToolTip() {
    if (action != null) {
        String text = action.getText();
        String tooltip = action.getToolTipText();
        if (text != null || tooltip != null) {
            IFigure fig = new Figure();

            fig.setBorder(new MarginBorder(1, 3, 1, 3));

            ToolbarLayout layout = new ToolbarLayout(false);
            layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
            layout.setSpacing(7);/*w  w  w  .ja  va2  s  .c om*/
            fig.setLayoutManager(layout);

            //                if (actionId != null
            //                        && actionId.equals(MindMapActionFactory.EDIT_NOTES
            //                                .getId())) {
            //                    text = null;
            //                }

            if (text != null) {
                text = Action.removeAcceleratorText(text);
                text = Action.removeMnemonics(text);
                Label title = new Label(text);
                title.setFont(FontUtils.getBold(JFaceResources.DEFAULT_FONT));
                title.setForegroundColor(ColorConstants.darkGray);
                fig.add(title);
            }

            if (tooltip != null) {
                RotatableWrapLabel description = new RotatableWrapLabel(tooltip, RotatableWrapLabel.NORMAL);
                description.setTextAlignment(PositionConstants.LEFT);
                description.setPrefWidth(Math.min(Display.getCurrent().getClientArea().width / 3, 350));
                description.setFont(FontUtils.getRelativeHeight(JFaceResources.DEFAULT_FONT, -1));
                //                    description.setForegroundColor(ColorConstants.gray);
                description.setForegroundColor(ColorUtils.getColor(TEXT_COLOR));
                fig.add(description);
            }

            return fig;
        }
    }
    return super.createToolTip();
}

From source file:org.xmind.ui.internal.print.multipage.MultipageSetupDialog.java

License:Open Source License

private void createPreviewPart(Composite parent) {
    viewer = new MultipageImagePreviewViewer(true);
    viewer.createControl(parent);//from   w  w  w . jav  a2s.  c  om
    viewer.getControl().setFont(FontUtils.getNewHeight(JFaceResources.DEFAULT_FONT, 8));
}

From source file:org.xmind.ui.internal.print.PageSetupDialog.java

License:Open Source License

private void createSectionTitle(Composite parent, String title) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;//w  ww  .  j  av  a 2s.  c o  m
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    Label titleLabel = new Label(composite, SWT.NONE);
    titleLabel.setText(title);
    titleLabel.setFont(FontUtils.getBold(JFaceResources.DEFAULT_FONT));
    titleLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    Label line = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
    line.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}

From source file:org.xmind.ui.internal.print.PageSetupDialog.java

License:Open Source License

private void createPreviewPart(Composite parent) {
    Composite container = createPreviewContainer(parent);
    Composite blackContainer = createBlackContainer(container);
    Composite page = createPage(blackContainer);

    previewViewer = new MindMapViewer();
    Properties properties = previewViewer.getProperties();
    properties.set(IMindMapViewer.VIEWER_CONSTRAINED, Boolean.TRUE);
    properties.set(IMindMapViewer.VIEWER_MARGIN, Integer.valueOf(20));
    properties.set(IMindMapViewer.VIEWER_GRADIENT, Boolean.FALSE);
    previewViewer.createControl(page);/* w w  w .  j  a  va2 s . co m*/
    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
    previewViewer.getControl().setLayoutData(layoutData);
    previewViewer.getZoomManager().setConstraints(0, Double.MAX_VALUE);

    previewViewer.getCanvas().setScrollBarVisibility(FigureCanvas.NEVER);
    previewViewer.setInput(getSourceMindMap());

    //        CenterPresercationService centerPresercationService = new CenterPresercationService(
    //                previewViewer);
    //        previewViewer.installService(CenterPresercationService.class,
    //                centerPresercationService);
    //        centerPresercationService.setActive(true);

    Layer feedback = previewViewer.getLayer(GEF.LAYER_FEEDBACK);
    if (feedback != null) {
        previewFigure = new Figure();
        previewFigure.setLayoutManager(new PreviewLayout());
        feedback.add(previewFigure);

        borderFigure = new Figure();
        borderFigure.setBorder(new LineBorder(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK), 1));
        previewFigure.add(borderFigure);

        headerFigure = new RotatableWrapLabel(RotatableWrapLabel.NORMAL);
        previewFigure.add(headerFigure);

        footerFigure = new RotatableWrapLabel(RotatableWrapLabel.NORMAL);
        previewFigure.add(footerFigure);

        ((IGraphicalPart) previewViewer.getRootPart()).getFigure().addLayoutListener(new LayoutListener.Stub() {
            public boolean layout(IFigure container) {
                layoutPreviewFigure();
                return super.layout(container);
            }
        });
    }

    Label forReferenceLabel = new Label(container, SWT.LEAD);
    forReferenceLabel.setText(DialogMessages.PageSetupDialog_JustForReference);
    forReferenceLabel.setFont(FontUtils.getNewHeight(JFaceResources.DEFAULT_FONT, Util.isMac() ? 9 : 7));
    forReferenceLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}