當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewerCell.setForeground方法代碼示例

本文整理匯總了Java中org.eclipse.jface.viewers.ViewerCell.setForeground方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewerCell.setForeground方法的具體用法?Java ViewerCell.setForeground怎麽用?Java ViewerCell.setForeground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.viewers.ViewerCell的用法示例。


在下文中一共展示了ViewerCell.setForeground方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update ( final ViewerCell cell )
{
    final Object element = cell.getElement ();
    if ( element instanceof TreeNode )
    {
        final TreeNode node = (TreeNode)element;
        cell.setText ( node.getName () );

        final CurrentStyle style = node.getStyle ();
        cell.setImage ( style.image );
        cell.setFont ( style.font );
        cell.setForeground ( style.foreground );
        cell.setBackground ( style.background );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:17,代碼來源:NameLabelProviderImpl.java

示例2: applyCellDefaultStyles

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private RankedItem<T> applyCellDefaultStyles(final ColumnOptions<T> options, ViewerCell cell) {
	final RankedItem<T> rankedItem = (RankedItem<T>) cell.getElement();
	cell.setForeground(fromRegistry(options.getFontColor()));
	int rowState = rowStateResolver.apply(rankedItem);
	
    if ((rowState & RowState.SELECTED.value) != 0 && options.isEnableBackgroundSelection()) {
		cell.setBackground(fromRegistry(new RGB(225,226,206)));
	} else {
		cell.setBackground(fromRegistry(options.getBackgroundColor()));
	}
    if ((rowState & RowState.CURSOR.value) != 0 && options.isEnableBackgroundSelection()) {
		cell.setBackground(fromRegistry(ColorUtil.blend(cell.getBackground().getRGB(), new RGB(200,200,200))));
    }
	Font font = createColumnFont(options, cell);
	cell.setFont(font);
	return rankedItem;
}
 
開發者ID:dakaraphi,項目名稱:eclipse-plugin-commander,代碼行數:19,代碼來源:KaviListColumns.java

示例3: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
public void update(ViewerCell cell) {
	Object element = cell.getElement();

	if (!(element instanceof ItemsListSeparator)
			&& provider instanceof IStyledLabelProvider) {
		IStyledLabelProvider styledLabelProvider = (IStyledLabelProvider) provider;
		StyledString styledString = getStyledText(element,
				styledLabelProvider);

		cell.setText(styledString.getString());
		cell.setStyleRanges(styledString.getStyleRanges());
		cell.setImage(styledLabelProvider.getImage(element));
	} else {
		cell.setText(getText(element));
		cell.setImage(getImage(element));
	}
	cell.setFont(getFont(element));
	cell.setForeground(getForeground(element));
	cell.setBackground(getBackground(element));

	super.update(cell);
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:23,代碼來源:FilteredItemsSelectionDialog.java

示例4: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
	try {
		Object element = cell.getElement();
		StyledString st = getStyledText(element);
		cell.setText(st.getString());
		cell.setStyleRanges(getStyledText(element).getStyleRanges());
		cell.setImage(getImage(element));
		cell.setBackground(getBackground(element));
		cell.setForeground(getForeground(element));
		cell.setFont(getFont(element));
	} catch (Exception e) {
		e.printStackTrace();
	}

}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:17,代碼來源:ReportTreeLabelProvider.java

示例5: setCellColor

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setCellColor(final ViewerCell cell, final Object element) {

		if (element instanceof TVICompareResultReferenceTour) {

			cell.setForeground(JFaceResources.getColorRegistry().get(net.tourbook.ui.UI.VIEW_COLOR_TITLE));

		} else if (element instanceof TVICompareResultComparedTour) {

			// show the saved tours in a different color

			if (((TVICompareResultComparedTour) (element)).isSaved()) {
				cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
			} else {
				// show the text with tour color
				cell.setForeground(JFaceResources.getColorRegistry().get(net.tourbook.ui.UI.VIEW_COLOR_TOUR));
//				cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
			}
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:20,代碼來源:TourCompareResultView.java

示例6: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
public void update(ViewerCell cell) {
	// labels
	cell.setText(getColumnText(cell.getElement(), cell.getColumnIndex()));
	
	// images
	cell.setImage(getColumnImage(cell.getElement(), cell.getColumnIndex()));
	
	// font
	cell.setFont(getFont(cell.getElement(), cell.getColumnIndex()));
	
	// colors
	cell.setForeground(getForeground(cell.getElement(), cell.getColumnIndex()));
	cell.setBackground(getBackground(cell.getElement(), cell.getColumnIndex()));
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:15,代碼來源:TLCErrorView.java

示例7: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
/**************************************************************************
 * 
 *************************************************************************/
@Override
   public void update(ViewerCell cell)
   {
	Object element = cell.getElement();
    cell.setText(getText(element));
    cell.setBackground(getBackground(element));
    cell.setForeground(getForeground(element));
    cell.setImage(getImage(element));
    cell.setFont(getFont(element));
   }
 
開發者ID:Spacecraft-Code,項目名稱:SPELL,代碼行數:14,代碼來源:HistoryTreeLabelProvider.java

示例8: setCellColor

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setCellColor(final ViewerCell cell, final Object element) {

		if (element instanceof TVITourBookYear) {
			cell.setForeground(JFaceResources.getColorRegistry().get(net.tourbook.ui.UI.VIEW_COLOR_SUB));
		} else if (element instanceof TVITourBookYearSub) {
			cell.setForeground(JFaceResources.getColorRegistry().get(net.tourbook.ui.UI.VIEW_COLOR_SUB_SUB));
//		} else if (element instanceof TVITourBookTour) {
//			cell.setForeground(JFaceResources.getColorRegistry().get(UI.VIEW_COLOR_TOUR));
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:11,代碼來源:TourBookView.java

示例9: setCellColor

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setCellColor(final ViewerCell cell, final Object element) {

		// set color
		if (element instanceof TVITagViewTag) {
			cell.setForeground(JFaceResources.getColorRegistry().get(UI.VIEW_COLOR_TITLE));
		} else if (element instanceof TVITagViewYear) {
			cell.setForeground(JFaceResources.getColorRegistry().get(UI.VIEW_COLOR_SUB));
		} else if (element instanceof TVITagViewMonth) {
			cell.setForeground(JFaceResources.getColorRegistry().get(UI.VIEW_COLOR_SUB_SUB));
//		} else if (element instanceof TVITagViewTour) {
//			cell.setForeground(JFaceResources.getColorRegistry().get(UI.VIEW_COLOR_TOUR));
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:14,代碼來源:TaggingView.java

示例10: setColor

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setColor(final ViewerCell cell, final ColumnDefinition colDef) {

		// paint columns in a different color which can't be hidden
		if (colDef.canModifyVisibility() == false) {
			cell.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:8,代碼來源:DialogModifyColumns.java

示例11: updateListEntry

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void updateListEntry ( final ListEntry listEntry, final ViewerCell cell )
{
    cell.setFont ( listEntry.getFont () );
    cell.setForeground ( listEntry.getForeground () );
    cell.setBackground ( listEntry.getBackground () );

    switch ( cell.getColumnIndex () )
    {
        case 0:
            cell.setImage ( listEntry.getImage () );
            cell.setText ( listEntry.getDataItem ().getItem ().getId () );
            break;
        case 1:
            if ( listEntry.getSubscriptionError () != null )
            {
                cell.setText ( String.format ( "%s (%s)", listEntry.getSubscriptionState (), listEntry.getSubscriptionError ().getMessage () ) ); //$NON-NLS-1$
            }
            else
            {
                cell.setText ( listEntry.getSubscriptionState ().name () );
            }
            break;
        case 2:
            if ( listEntry.getValue () != null )
            {
                cell.setText ( listEntry.getValue ().getType ().name () );
            }
            break;
        case 3:
            if ( listEntry.getValue () != null )
            {
                cell.setText ( listEntry.getValue ().asString ( "<null>" ) ); //$NON-NLS-1$
            }
            break;
        case 4:
            if ( listEntry.getItemValue () != null )
            {
                final Calendar timestamp = listEntry.getItemValue ().getTimestamp ();
                if ( timestamp != null )
                {
                    cell.setText ( formatTimestamp ( timestamp ) );
                }
                else
                {
                    cell.setText ( null );
                }
            }
            break;
        default:
            break;
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:53,代碼來源:ItemCellLabelProvider.java

示例12: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update ( final ViewerCell cell )
{
    final ArchiveEntry entry = (ArchiveEntry)cell.getElement ();

    if ( cell.getColumnIndex () == 0 )
    {
        if ( entry.isHeartbeat () )
        {
            if ( entry.isDeleted () )
            {
                cell.setImage ( this.resourceManager.createImageWithDefault ( Activator.getImageDescriptor ( "icons/heart-empty.png" ) ) );
            }
            else
            {
                cell.setImage ( this.resourceManager.createImageWithDefault ( Activator.getImageDescriptor ( "icons/heart.png" ) ) );
            }
        }
    }

    if ( entry.isDeleted () )
    {
        cell.setForeground ( this.resourceManager.createColor ( new RGB ( 128, 128, 128 ) ) );
    }
    else if ( entry.isError () )
    {
        cell.setForeground ( this.resourceManager.createColor ( new RGB ( 255, 0, 0 ) ) );
    }

    switch ( cell.getColumnIndex () )
    {
        case 0:
            cell.setText ( DATE_FORMAT.format ( entry.getTimestamp () ) );
            break;
        case 1:
            cell.setText ( "" + entry.getValue () );
            break;
        case 2:
            cell.setText ( makeCheck ( entry.isError () ) );
            break;
        case 3:
            cell.setText ( makeCheck ( entry.isManual () ) );
            break;
        case 4:
            cell.setText ( makeCheck ( entry.isDeleted () ) );
            break;
        case 5:
            cell.setText ( makeCheck ( entry.isHeartbeat () ) );
            break;
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:52,代碼來源:EntryLabelProvider.java

示例13: setCellForeground

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setCellForeground(final ViewerCell cell, final int color) {
    cell.setForeground(getDisplay().getSystemColor(color));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:4,代碼來源:TeamProjectTable.java

示例14: setCellForeground

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setCellForeground(final ViewerCell cell, final int color) {
    cell.setForeground(getControl().getDisplay().getSystemColor(color));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:4,代碼來源:GitImportWizardSelectProjectsPage.java


注:本文中的org.eclipse.jface.viewers.ViewerCell.setForeground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。