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


Java ViewerCell.setStyleRanges方法代碼示例

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


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

示例1: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update ( final ViewerCell cell )
{
    final Object ele = cell.getElement ();
    if ( ele instanceof GroupEntry )
    {
        cell.setText ( String.format ( Messages.FlagsDetailsPart_GroupSumFormat, ( (GroupEntry)ele ).getActiveCount (), ( (GroupEntry)ele ).getCount () ) );
    }
    else if ( ele instanceof AttributeEntry )
    {
        final StyledString str = new StyledString ();

        if ( ( (AttributeEntry)ele ).isActive () )
        {
            str.append ( Messages.FlagsDetailsPart_ActiveMarker, this.activeStyler );
        }
        else
        {
            str.append ( Messages.FlagsDetailsPart_InactiveMarker, this.inactiveStyler );
        }

        cell.setText ( str.getString () );
        cell.setStyleRanges ( str.getStyleRanges () );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:FlagsDetailsPart.java

示例2: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
protected void update ( final ViewerCell cell, final ServerEndpoint element )
{
    final StyledString str = new StyledString ();

    final boolean running = element.isRunning ();

    str.append ( element.getLabel () );

    cell.setText ( str.getString () );
    cell.setStyleRanges ( str.getStyleRanges () );

    if ( element.getError () != null )
    {
        cell.setImage ( this.errorImage );
    }
    else
    {
        cell.setImage ( running ? this.runningImage : this.stoppedImage );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:ServerLabelProvider.java

示例3: setStyledText

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setStyledText(ViewerCell cell, TreeObject obj) {
	/* Calcul du texte. */
	String mainText = obj.getMainText();
	if (mainText == null) {
		return;
	}
	String subText = obj.getSubText();
	String subTextFinal = subText == null ? "" : (" : " + subText);
	String fullText = mainText + subTextFinal;
	cell.setText(fullText);

	/* Calcul du style. */
	List<StyleRange> styles = new ArrayList<>();
	StyleRange styleMainText = new StyleRange(0, mainText.length(), null, null);
	styles.add(styleMainText);
	if (!subTextFinal.isEmpty()) {
		Display display = Display.getCurrent();
		Color blue = display.getSystemColor(SWT.COLOR_DARK_YELLOW);
		StyleRange styleSubText = new StyleRange(mainText.length(), subTextFinal.length(), blue, null);
		styles.add(styleSubText);
	}
	cell.setStyleRanges(styles.toArray(new StyleRange[0]));
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:24,代碼來源:KspOutlinePage.java

示例4: update

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

      AvroNode node = nodeConverter.convertToAvroNode(cell.getElement());
      
String text = labelProvider.getText(node);
      Image image = labelProvider.getImage(node);
      StyleRange[] styleRanges = labelProvider.getStyleRanges(node);

      cell.setText(text);
cell.setImage(image);
      cell.setStyleRanges(styleRanges);

      Color backgroundColor = labelProvider.getBackgroundColor(node);
      if (backgroundColor != null) {
      	cell.setBackground(backgroundColor);
      }
      
      super.update(cell);
  }
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:21,代碼來源:SchemaViewerStyledCellLabelProvider.java

示例5: 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

示例6: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
   public void update(ViewerCell cell) {
	if(!(cell.getElement() instanceof TreeNode)) {
		final String text = String.format(
				"(%s, %s)", 
				cell.getElement(),
				cell.getColumnIndex()
		);
		cell.setText(text);
		super.update(cell);
		return;
	}

	final TreeNode node = (TreeNode)cell.getElement();
	final int columnIndex = cell.getColumnIndex();
    final StyledString styledText = getStyledText(node, columnIndex);
    
    if(columnIndex == Column.CAPTION.ordinal()) {
           cell.setImage(getImage(node));
       }
    
	cell.setText(styledText.toString());
	cell.setStyleRanges(styledText.getStyleRanges());
	super.update(cell);
}
 
開發者ID:insweat,項目名稱:hssd,代碼行數:26,代碼來源:ValueTreeLP.java

示例7: 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

示例8: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
/**
 * @see org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
 */
@Override
public void update(final ViewerCell cell) {
	final CSVRow element = (CSVRow) cell.getElement();
	final int index = cell.getColumnIndex();
	final String columnText = getColumnText(element, index);
	cell.setText(columnText);
	cell.setImage(null);
	if (searchText != null && searchText.length() > 0) {
		final int intRangesCorrectSize[] = SearchResultStyle.getSearchTermOccurrences(searchText, columnText);
		final List<StyleRange> styleRange = new ArrayList<StyleRange>();
		for (int i = 0; i < intRangesCorrectSize.length / 2; i++) {
			final StyleRange myStyleRange = new StyleRange(0, 0, null, searchColor);
			myStyleRange.start = intRangesCorrectSize[i];
			myStyleRange.length = intRangesCorrectSize[++i];
			styleRange.add(myStyleRange);
		}
		cell.setStyleRanges(styleRange.toArray(new StyleRange[styleRange.size()]));
	} else {
		cell.setStyleRanges(null);
	}

	super.update(cell);
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:27,代碼來源:CSVLabelProvider.java

示例9: applyCellScoreMatchStyles

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void applyCellScoreMatchStyles(ViewerCell cell, final RankedItem<T> rankedItem) {
	Score score = rankedItem.getColumnScore(getColumnIdFromColumnIndex(cell.getColumnIndex()));
	if (score != null) {
		// TODO - investigate performance options
		// this is currently the bottle neck in UI performance.  Creating and setting styles.
		cell.setStyleRanges(createStyles(score.matches));
	}
}
 
開發者ID:dakaraphi,項目名稱:eclipse-plugin-commander,代碼行數:9,代碼來源:KaviListColumns.java

示例10: provideTreeCellLabelDecorations

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void provideTreeCellLabelDecorations(ViewerCell cell) {
    TreeElement el = (TreeElement) cell.getElement();
    List<StyleRange> styles = new ArrayList<>();

    Image icon = Activator.getDbObjImage(el.getType());
    String name = el.getName();

    if(btnDebugView.getSelection()) {
        cell.setText(String.format("%s:%s:%s", //$NON-NLS-1$
                el.getType(), name, el.getSide()));
    } else {
        StringBuilder label = new StringBuilder(name);

        if(el.getType() == DbObjType.DATABASE
                || el.getType() == DbObjType.SCHEMA
                || el.getType() == DbObjType.TABLE) {
            label.append(" (") //$NON-NLS-1$
            .append(el.countChildren())
            .append(") [") //$NON-NLS-1$
            .append(el.countDescendants())
            .append(']');

            TextStyle styleGray = new TextStyle();
            styleGray.foreground = getDisplay().getSystemColor(
                    SWT.COLOR_GRAY);

            StyleRange styleCount = new StyleRange(styleGray);
            styleCount.start = name.length();
            styleCount.length = label.length() - name.length();

            styles.add(styleCount);
        }

        cell.setText(label.toString());
    }

    cell.setStyleRanges(styles.toArray(new StyleRange[styles.size()]));
    cell.setImage(icon);
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:40,代碼來源:DiffTreeViewer.java

示例11: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
	StyledString styledText = getStyledText(cell.getElement());
	cell.setText(styledText.toString());
	cell.setStyleRanges(styledText.getStyleRanges());
	cell.setImage(getImage(cell.getElement()));
	super.update(cell);
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:9,代碼來源:BookmarksPathLabelProvider.java

示例12: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
    StackedCommand cmd = (StackedCommand) cell.getElement();
    StyledString str = cmd.toStyledString(styleProvider);
    cell.setText(str.toString());
    cell.setImage(cmd.isValid() ? null : errorImage);
    cell.setStyleRanges(str.getStyleRanges());
    super.update(cell);
}
 
開發者ID:yamcs,項目名稱:yamcs-studio,代碼行數:10,代碼來源:CommandSourceColumnLabelProvider.java

示例13: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(final ViewerCell cell) {
	Object element = cell.getElement();
	StyledString text = new StyledString();
	if (element instanceof Order) {
		Order order = (Order) element;
		if (OrderState.NOT_FOUND.equals(order.getState())) {
			cell.setImage(orderNotFoundImage);
		} else if (orderHasLoaded(order)) {
			cell.setImage(orderLoadedImage);
		} else {
			cell.setImage(orderImage);
		}
		text.append(getTextForOrder(order, cell));
	} else {
		cell.setImage(orderPositionImage);
		PositionWithArticleInfo position = (PositionWithArticleInfo) element;
		if (position.getArticle() != null) {
			text.append(position.getArticle().getArticleNumber());
		} else {
			text.append("new");
		}
	}
	cell.setText(text.toString());
	cell.setStyleRanges(text.getStyleRanges());
	super.update(cell);
}
 
開發者ID:scenarioo,項目名稱:scenarioo-example-swtbot-e4,代碼行數:28,代碼來源:OrdersOverviewPart.java

示例14: update

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

    StyledString styledText = new StyledString("");
    if(!(element instanceof TraitThypeLike)) {
        styledText.append("");
    }
    else {
        final String text;
        final TraitThypeLike trait = (TraitThypeLike)element;
        if(columnIndex == Column.CAPTION.ordinal()) {
            text = trait.caption();
        }
        else if(columnIndex == Column.DESC.ordinal()) {
            text = ((Thype)trait).description();
        }
        else {
            text = "";
        }
        
        if(inherited.contains(trait)) {
            styledText.append(text, LPHelper.DIM_OUT_STYLER);
        }
        else {
            styledText.append(text);
        }
    }

    cell.setText(styledText.getString());
    cell.setStyleRanges(styledText.getStyleRanges());
}
 
開發者ID:insweat,項目名稱:hssd,代碼行數:34,代碼來源:TraitSelectLP.java

示例15: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
    if(0 == cell.getColumnIndex()) {
        imp.update(cell);
        return;
    }

    if(!(cell.getElement() instanceof TreeNode)) {
        final String text = String.format(
                "(%s, %s)", 
                cell.getElement(),
                cell.getColumnIndex()
        );
        cell.setText(text);
        super.update(cell);
        return;
    }

    TreeNode pseudoVN = (TreeNode)cell.getElement();
    ValueData pseudoVD = ValueData.of(pseudoVN);
    MultiDiffEntryTree et = 
            (MultiDiffEntryTree)pseudoVD.entryNode().owner();
    EntryData ed = EntryData.of(et.entries.get(cell.getColumnIndex() - 1));
    Option<TreeNode> optVN = ed.valueTree().find(pseudoVN.path());
    if(!optVN.isDefined()) {
        cell.setText("");
        super.update(cell);
        return;
    }

    StyledString ss = ValueTreeLP.getStyledText(optVN.get(), COL_VAL_INDEX);
    cell.setText(ss.toString());
    cell.setStyleRanges(ss.getStyleRanges());
    super.update(cell);
}
 
開發者ID:insweat,項目名稱:hssd,代碼行數:36,代碼來源:MultiDiffLP.java


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