List of usage examples for org.eclipse.jface.resource FontRegistry getBold
public Font getBold(String symbolicName)
From source file:com.nokia.tools.vct.appshell.parts.misc.ObjectFigure.java
License:Open Source License
/** * @generated/*from w ww .j ava 2 s . com*/ */ 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 ww w . j a v a2 s. 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.opcoach.e34.tools.views.PluginDataProvider.java
License:Open Source License
private void initFonts() { FontData[] fontData = Display.getCurrent().getSystemFont().getFontData(); String fontName = fontData[0].getName(); FontRegistry registry = JFaceResources.getFontRegistry(); boldFont = registry.getBold(fontName); }
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);//from w w w .java 2 s. c om 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 . ja v a 2s .c om*/ 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 ww w . ja v a 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 w w . j av a 2 s . c om*/ @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 w w w . j a va 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); }// w w w .j ava2 s . co m } }
From source file:com.toubassi.jface.ContextHintDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite contents = new Composite(parent, SWT.NONE); contents.setLayout(new FormLayout()); Composite infoComposite = new Composite(contents, SWT.NONE); FormData infoCompositeFormData = new FormData(); infoCompositeFormData.left = new FormAttachment(0, 0); infoCompositeFormData.right = new FormAttachment(100, 0); infoCompositeFormData.top = new FormAttachment(0, 0); infoComposite.setLayoutData(infoCompositeFormData); infoComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); infoComposite.setLayout(new FormLayout()); infoTitleLabel = new Label(infoComposite, SWT.NONE); FontRegistry fontRegistry = JFaceResources.getFontRegistry(); infoTitleLabel.setFont(fontRegistry.getBold(JFaceResources.DIALOG_FONT)); infoTitleLabel.setBackground(infoComposite.getBackground()); if (infoTitle != null) { infoTitleLabel.setText(infoTitle); }/*from ww w . j a v a2 s . co m*/ FormData infoTitleLabelFormData = new FormData(); infoTitleLabelFormData.top = new FormAttachment(0, 10); infoTitleLabelFormData.left = new FormAttachment(0, 15); Label topSeparator = new Label(contents, SWT.SEPARATOR | SWT.HORIZONTAL); FormData topSeparatorFormData = new FormData(); topSeparatorFormData.top = new FormAttachment(infoComposite, 0); topSeparatorFormData.left = new FormAttachment(0, 0); topSeparatorFormData.right = new FormAttachment(100, 0); topSeparator.setLayoutData(topSeparatorFormData); Composite customContents = new Composite(contents, SWT.NONE); FormData customContentsFormData = new FormData(); customContentsFormData.top = new FormAttachment(topSeparator, 20); customContentsFormData.left = new FormAttachment(0, 15); customContentsFormData.right = new FormAttachment(100, -15); customContents.setLayoutData(customContentsFormData); createCustomContents(customContents); if (controlHints.size() > 0) { infoDescription = new Label(infoComposite, SWT.WRAP); infoDescription.setBackground(infoComposite.getBackground()); } else { infoTitleLabelFormData.width = 300; Composite spacer = new Composite(infoComposite, SWT.NONE); spacer.setBackground(infoComposite.getBackground()); FormData spacerFormData = new FormData(); spacerFormData.top = new FormAttachment(infoTitleLabel); spacerFormData.height = 15; spacer.setLayoutData(spacerFormData); } infoTitleLabel.setLayoutData(infoTitleLabelFormData); Label bottomSeparator = new Label(contents, SWT.SEPARATOR | SWT.HORIZONTAL); FormData bottomSeparatorFormData = new FormData(); bottomSeparatorFormData.top = new FormAttachment(customContents, 5, SWT.BOTTOM); bottomSeparatorFormData.left = new FormAttachment(0, 0); bottomSeparatorFormData.right = new FormAttachment(100, 0); bottomSeparator.setLayoutData(bottomSeparatorFormData); if (infoDescription != null) { Point size = new Point(70, 0); ControlUtil.convertSizeInCharsToPixels(infoDescription, size); String longestHint = longestControlHint(); Point infoSize = new Point(0, 0); if (longestHint != null) { infoDescription.setText(longestHint); infoSize = infoDescription.computeSize(size.x, SWT.DEFAULT); infoDescription.setText(""); } if (controlHints.get(null) != null) { infoDescription.setText((String) controlHints.get(null)); } FormData infoDescriptionFormData = new FormData(); infoDescriptionFormData.top = new FormAttachment(infoTitleLabel, 10); infoDescriptionFormData.left = new FormAttachment(0, 25); infoDescriptionFormData.right = new FormAttachment(100, -15); infoDescriptionFormData.bottom = new FormAttachment(100, -15); infoDescriptionFormData.width = size.x; infoDescriptionFormData.height = infoSize.y; infoDescription.setLayoutData(infoDescriptionFormData); } return contents; }