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

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

Introduction

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

Prototype

String DIALOG_FONT

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

Click Source Link

Document

The symbolic font name for the dialog font (value "org.eclipse.jface.dialogfont").

Usage

From source file:org.eclipse.dltk.internal.ui.editor.ScriptEditor.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    IInformationControlCreator informationControlCreator = new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell shell) {
            boolean cutDown = false;
            //int style = cutDown ? SWT.NONE : (SWT.V_SCROLL | SWT.H_SCROLL);
            // return new DefaultInformationControl(shell, SWT.RESIZE
            // | SWT.TOOL, style, new HTMLTextPresenter(cutDown));
            if (BrowserInformationControl.isAvailable(shell))
                return new BrowserInformationControl(shell, JFaceResources.DIALOG_FONT, true);
            else//from  ww  w .  j a va 2s  .co  m
                return new DefaultInformationControl(shell, new HTMLTextPresenter(cutDown));
        }
    };

    fInformationPresenter = new InformationPresenter(informationControlCreator);
    fInformationPresenter.setSizeConstraints(60, 10, true, true);
    fInformationPresenter.install(getSourceViewer());
    fInformationPresenter.setDocumentPartitioning(IDocument.DEFAULT_CONTENT_TYPE);

    fEditorSelectionChangedListener = new EditorSelectionChangedListener();
    fEditorSelectionChangedListener.install(getSelectionProvider());
    if (true)
        installSemanticHighlighting();
    if (!isEditable()) {
        /*
         * Manually call semantic highlighting for read only editor, since
         * usually it's done from reconciler, but
         * ScriptSourceViewerConfiguration.getReconciler(ISourceViewer)
         * doesn't create reconciler for read only editor.
         */
        updateSemanticHighlighting();
    }
    if (occurrencesFinder != null) {
        occurrencesFinder.install();
    }
}

From source file:org.eclipse.dltk.internal.ui.text.hover.ScriptInformationProvider.java

License:Open Source License

public IInformationControlCreator getInformationPresenterControlCreator() {
    if (fPresenterControlCreator == null) {
        fPresenterControlCreator = new AbstractReusableInformationControlCreator() {

            public IInformationControl doCreateInformationControl(Shell parent) {
                if (BrowserInformationControl.isAvailable(parent))
                    return new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT, true);
                else
                    return new DefaultInformationControl(parent, new HTMLTextPresenter(false));
            }/*ww  w.  j a va2 s.  c o  m*/
        };
    }
    return fPresenterControlCreator;
}

From source file:org.eclipse.dltk.internal.ui.text.hover.ScriptInformationProvider_Mod.java

License:Open Source License

@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
    if (fPresenterControlCreator == null) {
        fPresenterControlCreator = new AbstractReusableInformationControlCreator() {

            @Override//from   w  ww  .  java 2s .c o m
            public IInformationControl doCreateInformationControl(Shell parent) {
                if (BrowserInformationControl.isAvailable(parent))
                    return new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT, true);
                else
                    return new DefaultInformationControl(parent, new HTMLTextPresenter(false));
            }
        };
    }
    return fPresenterControlCreator;
}

From source file:org.eclipse.e4.tools.emf.ui.common.ImageTooltip.java

License:Open Source License

@Override
protected Composite createToolTipContentArea(Event event, Composite parent) {
    clearResources();//from   w  w  w. jav a  2  s .  c  om
    parent = new Composite(parent, SWT.NONE);
    parent.setBackground(event.widget.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    parent.setBackgroundMode(SWT.INHERIT_DEFAULT);
    parent.setLayout(new GridLayout(2, false));

    URI uri = getImageURI();

    if (uri != null) {
        int fileSize = -1;
        ByteArrayOutputStream out = null;
        InputStream stream = null;
        InputStream bStream = null;
        String errorMessage = "<" + Messages.ImageTooltip_UnknownError + ">"; //$NON-NLS-1$ //$NON-NLS-2$
        try {
            URL url;
            try {
                url = new URL(uri.toString());
                stream = url.openStream();
            } catch (Exception e) {
                // FIXME Temporary fix to show icon
                // If not found in runtime search in workspace
                if (stream == null) {
                    String[] segments = uri.segments();
                    URI tmpUri = URI.createPlatformResourceURI(segments[1], true);
                    for (int i = 2; i < segments.length; i++) {
                        tmpUri = tmpUri.appendSegment(segments[i]);
                    }

                    url = new URL(tmpUri.toString());
                    stream = url.openStream();
                }
            }

            if (stream != null) {
                out = new ByteArrayOutputStream();
                byte[] buf = new byte[1024];
                int length;
                while ((length = stream.read(buf)) != -1) {
                    out.write(buf, 0, length);
                }
                fileSize = out.size();
                bStream = new ByteArrayInputStream(out.toByteArray());
                image = new Image(parent.getDisplay(), bStream);
            }
        } catch (MalformedURLException e) {
            errorMessage = e.getMessage();
        } catch (FileNotFoundException e) {
            if (uri.isPlatform()) {
                errorMessage = MessageFormat.format(Messages.ImageTooltip_FileNotFound, e.getMessage(),
                        uri.segment(1));
            } else {
                errorMessage = e.getMessage();
            }
        } catch (IOException e) {
            errorMessage = e.getMessage();
        } catch (Exception e) {
            errorMessage = e.getMessage();
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            if (bStream != null) {
                try {
                    bStream.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            if (stream != null) {
                try {
                    stream.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

        // ---------------------------------
        Label l = new Label(parent, SWT.NONE);
        l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
        l.setText(Messages.ImageTooltip_Icon + ":"); //$NON-NLS-1$

        l = new Label(parent, SWT.NONE);
        if (image == null) {
            System.err.println(errorMessage);
            l.setText(errorMessage);
        } else {
            l.setImage(image);
        }

        // ---------------------------------

        l = new Label(parent, SWT.NONE);
        l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
        l.setText(Messages.ImageTooltip_Name + ":"); //$NON-NLS-1$

        l = new Label(parent, SWT.NONE);
        l.setText(uri.lastSegment());

        // ---------------------------------

        l = new Label(parent, SWT.NONE);
        l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
        l.setText(Messages.ImageTooltip_Dimension + ":"); //$NON-NLS-1$

        l = new Label(parent, SWT.NONE);
        if (image != null) {
            l.setText(image.getBounds().width + "x" + image.getBounds().height + " px"); //$NON-NLS-1$ //$NON-NLS-2$
        } else {
            l.setText("0x0 px"); //$NON-NLS-1$
        }

        // ---------------------------------

        l = new Label(parent, SWT.NONE);
        l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
        l.setText(Messages.ImageTooltip_FileSize + ":"); //$NON-NLS-1$

        l = new Label(parent, SWT.NONE);
        l.setText(new DecimalFormat("#,##0.00").format((fileSize / 1024.0)) + "KB"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    return parent;
}

From source file:org.eclipse.e4.xwt.tools.ui.designer.properties.tabbed.sections.ColorSection.java

License:Open Source License

private Point computeImageSize(Control window) {
    GC gc = new GC(window);
    Font f = JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT);
    gc.setFont(f);//from w  w w .java2s.c  om
    int height = gc.getFontMetrics().getHeight();
    gc.dispose();
    Point p = new Point(height * 3 - 6, height);
    return p;
}

From source file:org.eclipse.edt.ide.eunit.ui.testresult.TestResultPkgNodeDetailsPage.java

License:Open Source License

protected Text createColorBoldReadOnlyNoBoraderText(FormToolkit toolkit, Composite parent, int span,
        String labelText, Color color) {
    Text textControl = createReadOnlyNoBorderText(toolkit, parent, span, labelText);
    textControl.setForeground(color);//from w  ww  . j a v a 2s.  co  m
    textControl.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    return textControl;
}

From source file:org.eclipse.emf.emfstore.client.ui.views.scm.SCMLabelProvider.java

License:Open Source License

/**
 * {@inheritDoc}//from   w  w w  .jav a2s .  c o m
 */
@Override
public Font getFont(Object element) {

    Font italic = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT);
    Font bold = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);

    // if (getText(findTopParent((TreeNode)
    // element)).equals(LOCAL_REVISION)) {
    // return italic;
    // }
    String text = getText(element);
    if (text == null) {
        text = "";
    }
    if (element instanceof HistoryInfo) {
        if (text.equals(LOCAL_REVISION)) {
            return italic;
        }
        HistoryInfo historyInfo = (HistoryInfo) element;
        if (historyInfo.getPrimerySpec().getIdentifier() == WorkspaceManager.getProjectSpace(project)
                .getBaseVersion().getIdentifier()) {
            return bold;
        }
    } else if (element instanceof ModelElementId) {
        if (text.equals(ELEMENT_NOT_FOUND)) {
            return italic;
        }
    }
    if (element instanceof EObject && ((EObject) element).eContainer() instanceof AbstractOperation) {
        AbstractOperation op = (AbstractOperation) ((EObject) element).eContainer();
        if (element instanceof ModelElementId && element.equals(op.getModelElementId())) {
            return bold;
        }

        EObject modelElement = (EObject) element;
        Project project = ModelUtil.getProject(modelElement);
        if (project != null && project.getModelElementId(modelElement).equals(op.getModelElementId())) {
            return bold;
        }
    }
    return null;
}

From source file:org.eclipse.emf.emfstore.internal.client.ui.views.scm.SCMLabelProvider.java

License:Open Source License

/**
 * {@inheritDoc}/* w ww .  java 2s  .  com*/
 */
@Override
public Font getFont(Object element) {

    final Font italic = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT);
    final Font bold = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);

    String text = getText(element);
    if (text == null) {
        text = StringUtils.EMPTY;
    }
    if (element instanceof HistoryInfo) {
        if (text.equals(LOCAL_REVISION)) {
            return italic;
        }
        final HistoryInfo historyInfo = (HistoryInfo) element;
        if (historyInfo.getPrimarySpec().getIdentifier() == ESWorkspaceProviderImpl.getProjectSpace(project)
                .getBaseVersion().getIdentifier()) {
            return bold;
        }
    } else if (element instanceof ModelElementId) {
        if (text.equals(ELEMENT_NOT_FOUND)) {
            return italic;
        }
    } else if (element instanceof VirtualNode<?>) {
        return italic;
    }
    if (element instanceof EObject && ((EObject) element).eContainer() instanceof AbstractOperation) {
        final AbstractOperation op = (AbstractOperation) ((EObject) element).eContainer();
        if (element instanceof ModelElementId && element.equals(op.getModelElementId())) {
            return bold;
        }

        final EObject modelElement = (EObject) element;
        final Project project = ModelUtil.getProject(modelElement);
        if (project != null && project.getModelElementId(modelElement).equals(op.getModelElementId())) {
            return bold;
        }
    }
    return null;
}

From source file:org.eclipse.gyrex.admin.ui.internal.widgets.FilteredTree.java

License:Open Source License

/**
 * Return a bold font if the given element matches the given pattern.
 * Clients can opt to call this method from a Viewer's label provider to get
 * a bold font for which to highlight the given element in the tree.
 * //from w  w  w. j  a  va  2s .com
 * @param element
 *            element for which a match should be determined
 * @param tree
 *            FilteredTree in which the element resides
 * @param filter
 *            PatternFilter which determines a match
 * @return bold font
 */
public static Font getBoldFont(final Object element, final FilteredTree tree, final PatternFilter filter) {
    final String filterText = tree.getFilterString();

    if (filterText == null)
        return null;

    // Do nothing if it's empty string
    final String initialText = tree.getInitialText();
    if (!filterText.equals("") && !filterText.equals(initialText)) {//$NON-NLS-1$
        if (tree.getPatternFilter() != filter) {
            final boolean initial = (initialText != null) && initialText.equals(filterText);
            if (initial) {
                filter.setPattern(null);
            } else if (filterText != null) {
                filter.setPattern(filterText);
            }
        }
        if (filter.isElementVisible(tree.getViewer(), element) && filter.isLeafMatch(tree.getViewer(), element))
            return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
    }
    return null;
}

From source file:org.eclipse.jpt.common.ui.internal.prefs.JptProblemSeveritiesPage.java

License:Open Source License

/**
 * Creates and adds to the given <code>Composite</code> an expandable pane
 * where its content can be shown or hidden depending on the expansion state.
 *
 * @param parent The parent container/* www.java 2 s  .co  m*/
 * @param text The title of the expandable section
 * @return The container to which widgets can be added, which is a child of
 * the expandable pane
 */
private Composite addExpandableSection(Composite parent, String text, GridData gridData) {
    int expansionStype = ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT;
    ExpandableComposite expandablePane = new ExpandableComposite(parent, SWT.NONE, expansionStype);

    expandablePane.setText(text);
    expandablePane.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    expandablePane.setLayoutData(gridData);
    expandablePane.addExpansionListener(this.buildExpansionListener());

    this.mainComposite.adaptChild(expandablePane);
    this.expandablePanes.add(expandablePane);

    parent = new Composite(expandablePane, SWT.NONE);
    parent.setLayout(new GridLayout(2, false));
    expandablePane.setClient(parent);

    return parent;
}