Example usage for org.eclipse.jface.resource FontRegistry FontRegistry

List of usage examples for org.eclipse.jface.resource FontRegistry FontRegistry

Introduction

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

Prototype

public FontRegistry() 

Source Link

Document

Creates an empty font registry.

Usage

From source file:com.nokia.tools.vct.appshell.parts.misc.ObjectFigure.java

License:Open Source License

/**
 * @generated//from   w ww. j a  v  a2s. c  o m
 */
protected void createContents() {

    typeFigure = new Label();
    typeFigure.setText("short name");
    FontRegistry fr = new FontRegistry();
    Font bold = fr.getBold(JFaceResources.DEFAULT_FONT);
    typeFigure.setFont(bold);
    typeFigure.setLabelAlignment(PositionConstants.CENTER);

    this.add(typeFigure);
    GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
    this.getLayoutManager().setConstraint(typeFigure, gd);

    nameFigure = new Label();
    nameFigure.setText("very long name 444 444");
    nameFigure.setLabelAlignment(PositionConstants.CENTER);

    this.add(nameFigure);
    gd = new GridData(SWT.FILL, SWT.TOP, true, false);
    this.getLayoutManager().setConstraint(nameFigure, gd);
}

From source file:com.nokia.tools.vct.appshell.parts.misc.TooltipFigure.java

License:Open Source License

public TooltipFigure(String name) {
    Panel panel = new Panel();
    setContents(panel);//from  w w  w .  ja v  a 2s.  c  o m
    GridLayout gridLayout = new GridLayout(2, false);
    // gridLayout.marginWidth = gridLayout.marginHeight = 0;
    panel.setLayoutManager(gridLayout);

    Label label;
    FontRegistry fr = new FontRegistry();
    Font bold = fr.getBold(JFaceResources.DEFAULT_FONT);

    label = new Label(name);
    label.setFont(bold);
    panel.add(label, new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));

    createGeneralSection(panel, bold);
    createCommonSection(panel, bold);
}

From source file:com.salesforce.ide.deployment.ui.wizards.DeploymentPlanComposite.java

License:Open Source License

public void updateSummaryLabel(int candidateCnt, String orgUserName) {
    if (lblSummary != null) {
        lblSummary.setText("Found " + candidateCnt + " deployment candidates");
        FontRegistry registry = new FontRegistry();
        Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());
        lblSummary.setFont(boldFont);/* w  w  w . j a va 2 s.co  m*/
        lblSummary.update();
    }
}

From source file:com.salesforce.ide.ui.internal.utils.DeployResultsViewAssembler.java

License:Open Source License

protected void handleFailureAndWarningResults() {
    DeployMessageExtractor extractor = new DeployMessageExtractor(deployResultHandler);

    FontRegistry registry = new FontRegistry();
    Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());

    Collection<DeployMessage> deploySuccesses = extractor.getDeploySuccesses();
    handleDeploySuccessMessages(deploySuccesses);

    Collection<DeployMessage> deployFailures = extractor.getDeployFailures();
    Collection<RunTestFailure> testFailures = extractor.getTestFailures();
    if (!deployFailures.isEmpty() || !testFailures.isEmpty()) {
        TreeItem rootFailureTreeItem = new TreeItem(resultsTree, SWT.NONE);
        rootFailureTreeItem.setText("Failures");
        rootFailureTreeItem.setImage(failureIcon);
        rootFailureTreeItem.setForeground(rootFailureTreeItem.getDisplay().getSystemColor(SWT.COLOR_RED));
        rootFailureTreeItem.setFont(boldFont);
        rootFailureTreeItem.setExpanded(true);

        handleDeployFailureMessages(deployFailures, rootFailureTreeItem);
        handleDeployTestFailureMessages(testFailures, rootFailureTreeItem);
    }//from  ww  w . java  2s  .c  o m

    Collection<DeployMessage> deployWarnings = extractor.getDeployWarnings();
    List<CodeCoverageWarning> testWarnings = extractor.getTestWarnings();
    if (!deployWarnings.isEmpty()) {
        TreeItem rootWarningTreeItem = new TreeItem(resultsTree, SWT.NONE);
        rootWarningTreeItem.setText("Deploy Warnings");
        rootWarningTreeItem.setImage(warningIcon);
        rootWarningTreeItem
                .setForeground(rootWarningTreeItem.getDisplay().getSystemColor(SWT.COLOR_DARK_YELLOW));
        rootWarningTreeItem.setFont(boldFont);
        rootWarningTreeItem.setExpanded(true);
        handleDeployWarningMessages(deployWarnings, rootWarningTreeItem);
    }

    if (!testWarnings.isEmpty()) {
        TreeItem rootWarningTreeItem = new TreeItem(resultsTree, SWT.NONE);
        rootWarningTreeItem.setText("Test Warnings");
        rootWarningTreeItem.setImage(warningIcon);
        rootWarningTreeItem
                .setForeground(rootWarningTreeItem.getDisplay().getSystemColor(SWT.COLOR_DARK_YELLOW));
        rootWarningTreeItem.setFont(boldFont);
        rootWarningTreeItem.setExpanded(true);
        handleCodeCoverageWarnings(testWarnings, rootWarningTreeItem);
    }
}

From source file:com.salesforce.ide.ui.views.runtest.RunTestsView.java

License:Open Source License

/**
 * Update the UI with the test results for an asynchronous test run.
 *//*from   w w  w. ja  va 2  s.  c o m*/
@VisibleForTesting
public void processAsyncTestResults(final Map<IResource, List<String>> testResources,
        final List<ApexTestResult> testResults, final boolean expandFailedResults) {
    if (Utils.isEmpty(testResources) || Utils.isEmpty(testResults)) {
        return;
    }

    Display display = PlatformUI.getWorkbench().getDisplay();
    display.syncExec(new Runnable() {
        @Override
        public void run() {
            // Map of tree items whose key is apex class id and the value is the tree item
            Map<String, TreeItem> testClassNodes = Maps.newLinkedHashMap();

            FontRegistry registry = new FontRegistry();
            Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());

            runTestComposite.clearAllExceptProgress();
            Tree resultsTree = runTestComposite.getTree();

            // Add each test result to the tree
            for (ApexTestResult testResult : testResults) {
                // Create or find the tree node for the test class
                String classId = testResult.getApexClassId();
                if (!testClassNodes.containsKey(classId)) {
                    TreeItem newClassNode = createTestClassTreeItem(resultsTree, testResources, boldFont,
                            classId);

                    testClassNodes.put(classId, newClassNode);
                }

                // Add the a test method tree node to the test class tree node
                TreeItem classNode = testClassNodes.get(classId);
                String className = classNode.getText();

                // Create a tree item for the test method and save the test result
                TreeItem newTestMethodNode = createTestMethodTreeItem(classNode, testResult, className);
                // Set the color and icon of test method tree node based on test outcome
                setColorAndIconForNode(newTestMethodNode, testResult.getOutcome());
                // Update the color & icon of class tree node only if the test method
                // outcome is worse than what the class tree node indicates
                setColorAndIconForTheWorse(classNode, testResult.getOutcome());
            }

            if (expandFailedResults) {
                // Expand the test classes that did not pass
                expandProblematicTestClasses(resultsTree);
            }
        }
    });
}

From source file:com.salesforce.ide.ui.views.runtest.RunTestsView.java

License:Open Source License

/**
 * Update the UI with the test results for an synchronous test run.
 *///from   w  ww  . j av a2s . co m
@VisibleForTesting
public void processSyncTestResults(final IProject project, final Map<IResource, List<String>> testResources,
        final RunTestsSyncResponse testResults) {
    if (Utils.isEmpty(project) || Utils.isEmpty(testResources) || Utils.isEmpty(testResults)) {
        return;
    }

    Display display = PlatformUI.getWorkbench().getDisplay();
    display.syncExec(new Runnable() {
        @Override
        public void run() {
            // Map of tree items whose key is apex class id and the value is the tree item
            Map<String, TreeItem> testClassNodes = Maps.newLinkedHashMap();

            FontRegistry registry = new FontRegistry();
            Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());

            // Reset tree
            Tree resultsTree = runTestComposite.getTree();
            resultsTree.removeAll();

            for (RunTestsSyncSuccess testPassed : testResults.getSuccesses()) {
                // Create or find the tree node for the test class
                final String classId = testPassed.getId();
                final String className = testPassed.getName();
                if (!testClassNodes.containsKey(classId)) {
                    TreeItem newClassNode = createTestClassTreeItem(resultsTree, testResources, boldFont,
                            classId);
                    testClassNodes.put(classId, newClassNode);
                }

                // Add the a test method tree node to the test class tree node
                TreeItem classNode = testClassNodes.get(classId);
                // Create a tree item for the test method and save the test result
                TreeItem newTestMethodNode = createTestMethodTreeItem(classNode, className,
                        testPassed.getMethodName(), "", "", testResults.getApexLogId());
                // Set the color and icon of test method tree node based on test outcome
                setColorAndIconForNode(newTestMethodNode, ApexTestOutcome.Pass);
            }

            for (RunTestsSyncFailure testFailed : testResults.getFailures()) {
                // Create or find the tree node for the test class
                final String classId = testFailed.getId();
                final String className = testFailed.getName();
                if (!testClassNodes.containsKey(classId)) {
                    TreeItem newClassNode = createTestClassTreeItem(resultsTree, testResources, boldFont,
                            classId);
                    testClassNodes.put(classId, newClassNode);
                }

                // Add the a test method tree node to the test class tree node
                TreeItem classNode = testClassNodes.get(classId);
                // Create a tree item for the test method and save the test result
                TreeItem newTestMethodNode = createTestMethodTreeItem(classNode, className,
                        testFailed.getMethodName(), testFailed.getMessage(), testFailed.getStackTrace(),
                        testResults.getApexLogId());
                // Set the color and icon of test method tree node based on test outcome
                setColorAndIconForNode(newTestMethodNode, ApexTestOutcome.Fail);
                // Update the color & icon of class tree node only if the test method
                // outcome is worse than what the class tree node indicates
                setColorAndIconForTheWorse(classNode, ApexTestOutcome.Fail);
            }

            // Expand the test classes that did not pass
            expandProblematicTestClasses(resultsTree);
        }
    });
}

From source file:com.salesforce.ide.ui.views.runtest.RunTestsViewComposite.java

License:Open Source License

/**
 * Update code coverage table//from www.j  ava  2 s .  c o  m
 * @param ccResults
 */
public void setCodeCoverage(List<CodeCovResult> ccResults) {
    if (codeCovArea != null && ccResults != null && !ccResults.isEmpty()) {
        clearCodeCov();

        // Double click opens the Apex class/trigger
        codeCovArea.addMouseListener(new MouseListener() {
            @Override
            public void mouseDoubleClick(MouseEvent e) {
                Point pt = new Point(e.x, e.y);
                TableItem item = codeCovArea.getItem(pt);
                if (item != null) {
                    ApexCodeLocation location = (ApexCodeLocation) item
                            .getData(RunTestsConstants.TREEDATA_CODE_LOCATION);
                    runView.highlightLine(location);
                }
            }

            @Override
            public void mouseDown(MouseEvent e) {
            }

            @Override
            public void mouseUp(MouseEvent e) {
            }

        });

        codeCovArea.setData(RunTestsConstants.TABLE_CODE_COV_RESULT, ccResults);

        FontRegistry registry = new FontRegistry();
        Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());

        for (CodeCovResult res : ccResults) {
            TableItem ccItem = new TableItem(codeCovArea, SWT.NONE);
            String lines = String.format("%d/%d", res.getLinesCovered(), res.getLinesTotal());
            // Overall code coverage row
            if (res.getClassOrTriggerName().equals(Messages.View_CodeCoverageOverall)) {
                ccItem.setFont(boldFont);
                lines = "";
            }
            // Apply code coverage info and save the apex code location
            ccItem.setText(new String[] { res.getClassOrTriggerName(), res.getPercent() + "%", lines });
            ccItem.setData(RunTestsConstants.TREEDATA_CODE_LOCATION, res.getLoc());
        }

        packCodeCovArea(codeCovArea);
    }
}

From source file:com.salesforce.ide.upgrade.ui.wizards.UpgradeComponentConflictsComposite.java

License:Open Source License

protected void populateTree(Map<String, List<UpgradeConflict>> upgradeConflicts) {
    TreeSet<String> sortedComponentTypes = new TreeSet<String>();
    sortedComponentTypes.addAll(upgradeConflicts.keySet());

    // loop thru sorted list creating upgrade component tree
    for (String componentType : sortedComponentTypes) {
        // create root component type node
        TreeItem componentTypeTreeItem = new TreeItem(getTreeComponentConflicts(), SWT.NONE);
        componentTypeTreeItem.setText(componentType);
        FontRegistry registry = new FontRegistry();
        Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());

        componentTypeTreeItem.setFont(boldFont);
        componentTypeTreeItem.setExpanded(true);

        // loop thru each component instance and create named node
        List<UpgradeConflict> upgradeComponents = upgradeConflicts.get(componentType);
        for (UpgradeConflict upgradeConflict : upgradeComponents) {
            TreeItem componentTreeItem = new TreeItem(componentTypeTreeItem, SWT.NONE);
            componentTreeItem.setText(upgradeConflict.getLocalComponent().getFileName());
            componentTreeItem.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
            componentTreeItem.setData("local", upgradeConflict.getLocalComponent());
            componentTreeItem.setData("remote", upgradeConflict.getRemoteComponent());
            componentTreeItem.setExpanded(true);
        }/*from  w w w .jav a  2  s  .c o  m*/
    }
}

From source file:com.subgraph.vega.ui.hexeditor.HexEditFonts.java

License:Open Source License

HexEditFonts(Composite parent) {
    fontRegistry = new FontRegistry();
    addFonts(parent.getDisplay());/*  w  w w .ja v  a 2 s.  c  om*/
    offsetColumnWidth = calculateOffsetColumnWidth(parent);
    dataColumnWidth = calculateDataColumnWidth(parent);
    asciiColumnWordWidth = calculateAsciiColumnWordWidth(parent);
}

From source file:edu.harvard.i2b2.eclipse.plugins.metadataLoader.model.MetadataLabelProvider.java

License:Open Source License

public MetadataLabelProvider(TableViewer viewer, Display display) {
    this.viewer = viewer;
    this.display = display;
    fontRegistry = new FontRegistry();
    createFontRegistry();/*from   w ww. j ava 2s  . c  om*/
    colorRegistry = new ColorRegistry();
    createColorRegistry();
}