Java Code Examples for org.eclipse.swt.widgets.TreeItem#setForeground()
The following examples show how to use
org.eclipse.swt.widgets.TreeItem#setForeground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryDirectoryUI.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private static void createTreeItem( TreeItem parent, RepositoryElementMetaInterface repositoryObject ) { TreeItem tiObject = new TreeItem( parent, SWT.NONE ); tiObject.setData( repositoryObject ); if ( repositoryObject.getObjectType() == RepositoryObjectType.TRANSFORMATION ) { tiObject.setImage( GUIResource.getInstance().getImageTransRepo() ); } else if ( repositoryObject.getObjectType() == RepositoryObjectType.JOB ) { tiObject.setImage( GUIResource.getInstance().getImageJobRepo() ); } SimpleDateFormat simpleDateFormat = new SimpleDateFormat( DATE_FORMAT ); tiObject.setText( 0, Const.NVL( repositoryObject.getName(), "" ) ); tiObject.setText( 1, Const.NVL( repositoryObject.getObjectType().getTypeDescription(), "" ).toUpperCase() ); tiObject.setText( 2, Const.NVL( repositoryObject.getModifiedUser(), "" ) ); tiObject.setText( 3, repositoryObject.getModifiedDate() != null ? simpleDateFormat .format( repositoryObject.getModifiedDate() ) : "" ); tiObject.setText( 4, Const.NVL( repositoryObject.getDescription(), "" ) ); if ( repositoryObject.isDeleted() ) { tiObject.setForeground( GUIResource.getInstance().getColorRed() ); } }
Example 2
Source File: PyUnitView.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Called after a test has been run (so that we properly update the tree). */ private void notifyTest(PyUnitTestResult result, boolean updateBar) { if (this.disposed) { return; } if (result.getTestRun() != currentRun) { return; } if (!showOnlyErrors || (showOnlyErrors && !result.isOk() && !result.isSkip())) { TreeItem treeItem = new TreeItem(tree, 0); File file = new File(result.location); treeItem.setText(new String[] { result.index, result.status, result.test, file.getName(), result.time }); if (result.isOk()) { } else if (result.isSkip()) { } else { // failure or error Color errorColor = getErrorColor(); treeItem.setForeground(errorColor); } treeItem.setData(ToolTipPresenterHandler.TIP_DATA, result); treeItem.setData(PY_UNIT_TEST_RESULT, result); int selectionCount = tree.getSelectionCount(); if (selectionCount == 0) { tree.setSelection(treeItem); onSelectResult(result); } } if (updateBar) { updateCountersAndBar(); } }
Example 3
Source File: RepositoryDirectoryUI.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Gets a directory tree on a TreeItem to work with. * * @param ti * The TreeItem to set the directory tree on * @param dircolor * The color of the directory tree item. */ public static void getDirectoryTree( TreeItem ti, Color dircolor, RepositoryDirectoryInterface dir ) { ti.setText( dir.getName() ); ti.setForeground( dircolor ); // First, we draw the directories for ( int i = 0; i < dir.getNrSubdirectories(); i++ ) { RepositoryDirectory subdir = dir.getSubdirectory( i ); TreeItem subti = new TreeItem( ti, SWT.NONE ); subti.setImage( GUIResource.getInstance().getImageFolder() ); getDirectoryTree( subti, dircolor, subdir ); } }
Example 4
Source File: TreeManager.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void populateTreeItem( TreeItem childTreeItem, TreeNode treeNode ) { childTreeItem.setText( treeNode.getLabel() != null ? treeNode.getLabel() : "" ); childTreeItem.setImage( treeNode.getImage() ); childTreeItem.setData( treeNode.getData() ); childTreeItem.setForeground( treeNode.getForeground() ); childTreeItem.setBackground( treeNode.getBackground() ); childTreeItem.setFont( treeNode.getFont() ); treeNode.getData().forEach( childTreeItem::setData ); treeNodeItemMap.put( treeNode, childTreeItem ); }
Example 5
Source File: RunConfigurationViewTreeExtension.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private TreeItem createTreeItem( TreeItem parent, String text, Image image, int index, boolean disabled ) { TreeItem item = index == -1 ? new TreeItem( parent, SWT.NONE ) : new TreeItem( parent, SWT.NONE, index ); if ( disabled ) { item.setForeground( getDisabledColor() ); } item.setText( text ); item.setImage( image ); return item; }
Example 6
Source File: HopGuiWorkflowGridDelegate.java From hop with Apache License 2.0 | 4 votes |
private void addTrackerToTree( WorkflowTracker workflowTracker, TreeItem parentItem ) { try { if ( workflowTracker != null ) { TreeItem treeItem = new TreeItem( parentItem, SWT.NONE ); if ( nrRow % 2 != 0 ) { treeItem.setBackground( GuiResource.getInstance().getColorBlueCustomGrid() ); } nrRow++; if ( workflowTracker.nrWorkflowTrackers() > 0 ) { // This is a sub-workflow: display the name at the top of the list... treeItem.setText( 0, BaseMessages.getString( PKG, "WorkflowLog.Tree.WorkflowPrefix" ) + workflowTracker.getWorkflowName() ); // then populate the sub-actions ... for ( int i = 0; i < workflowTracker.nrWorkflowTrackers(); i++ ) { addTrackerToTree( workflowTracker.getWorkflowTracker( i ), treeItem ); } } else { ActionResult result = workflowTracker.getActionResult(); if ( result != null ) { String jobEntryName = result.getActionName(); if ( !Utils.isEmpty( jobEntryName ) ) { treeItem.setText( 0, jobEntryName ); treeItem.setText( 4, Const.NVL( result.getActionFilename(), "" ) ); } else { treeItem.setText( 0, BaseMessages.getString( PKG, "WorkflowLog.Tree.WorkflowPrefix2" ) + workflowTracker.getWorkflowName() ); } String comment = result.getComment(); if ( comment != null ) { treeItem.setText( 1, comment ); } Result res = result.getResult(); if ( res != null ) { treeItem.setText( 2, res.getResult() ? BaseMessages.getString( PKG, "WorkflowLog.Tree.Success" ) : BaseMessages.getString( PKG, "WorkflowLog.Tree.Failure" ) ); treeItem.setText( 5, Long.toString( res.getEntryNr() ) ); if ( res.getResult() ) { treeItem.setForeground( GuiResource.getInstance().getColorSuccessGreen() ); } else { treeItem.setForeground( GuiResource.getInstance().getColorRed() ); } } String reason = result.getReason(); if ( reason != null ) { treeItem.setText( 3, reason ); } Date logDate = result.getLogDate(); if ( logDate != null ) { treeItem.setText( 6, new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" ).format( logDate ) ); } } } treeItem.setExpanded( true ); } } catch ( Exception e ) { workflowGraph.getLogChannel().logError( Const.getStackTracker( e ) ); } }
Example 7
Source File: JobGridDelegate.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void addTrackerToTree( JobTracker jobTracker, TreeItem parentItem ) { try { if ( jobTracker != null ) { TreeItem treeItem = new TreeItem( parentItem, SWT.NONE ); if ( nrRow % 2 != 0 ) { treeItem.setBackground( GUIResource.getInstance().getColorBlueCustomGrid() ); } nrRow++; if ( jobTracker.nrJobTrackers() > 0 ) { // This is a sub-job: display the name at the top of the list... treeItem.setText( 0, BaseMessages.getString( PKG, "JobLog.Tree.JobPrefix" ) + jobTracker.getJobName() ); // then populate the sub-job entries ... for ( int i = 0; i < jobTracker.nrJobTrackers(); i++ ) { addTrackerToTree( jobTracker.getJobTracker( i ), treeItem ); } } else { JobEntryResult result = jobTracker.getJobEntryResult(); if ( result != null ) { String jobEntryName = result.getJobEntryName(); if ( !Utils.isEmpty( jobEntryName ) ) { treeItem.setText( 0, jobEntryName ); treeItem.setText( 4, Const.NVL( result.getJobEntryFilename(), "" ) ); } else { treeItem.setText( 0, BaseMessages.getString( PKG, "JobLog.Tree.JobPrefix2" ) + jobTracker.getJobName() ); } String comment = result.getComment(); if ( comment != null ) { treeItem.setText( 1, comment ); } Result res = result.getResult(); if ( res != null ) { treeItem.setText( 2, res.getResult() ? BaseMessages.getString( PKG, "JobLog.Tree.Success" ) : BaseMessages.getString( PKG, "JobLog.Tree.Failure" ) ); treeItem.setText( 5, Long.toString( res.getEntryNr() ) ); if ( res.getResult() ) { treeItem.setForeground( GUIResource.getInstance().getColorSuccessGreen() ); } else { treeItem.setForeground( GUIResource.getInstance().getColorRed() ); } } String reason = result.getReason(); if ( reason != null ) { treeItem.setText( 3, reason ); } Date logDate = result.getLogDate(); if ( logDate != null ) { treeItem.setText( 6, new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" ).format( logDate ) ); } } } treeItem.setExpanded( true ); } } catch ( Exception e ) { log.logError( Const.getStackTracker( e ) ); } }
Example 8
Source File: TypeSection.java From uima-uimaj with Apache License 2.0 | 2 votes |
/** * Sets the item color. * * @param item the item * @param isLocal the is local */ private void setItemColor(TreeItem item, boolean isLocal) { if (isLocal) return; item.setForeground(editor.getFadeColor()); }