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


Java ViewerCell.setImage方法代碼示例

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


在下文中一共展示了ViewerCell.setImage方法的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 KeyProviderFactory )
    {
        cell.setText ( ele.toString () );
    }
    else if ( ele instanceof KeyProvider )
    {
        final KeyProvider keyProvider = (KeyProvider)ele;
        cell.setText ( keyProvider.toString () );
        cell.setImage ( keyProvider.isLocked () ? this.locked : null );
    }
    else if ( ele instanceof org.eclipse.scada.sec.ui.providers.Key )
    {
        final org.eclipse.scada.sec.ui.providers.Key key = (org.eclipse.scada.sec.ui.providers.Key)ele;
        cell.setText ( key.toString () );
        cell.setImage ( key.isLocked () ? this.locked : null );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:LabelProviderImpl.java

示例2: decorateWithActorType

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
public void decorateWithActorType ( final DecoratedEvent event, final ViewerCell cell )
{
    final String value = Variant.valueOf ( event.getEvent ().getField ( Fields.ACTOR_TYPE ) ).asString ( "" );
    if ( "USER".equalsIgnoreCase ( value ) ) //$NON-NLS-1$
    {
        cell.setImage ( this.userImage );
    }
    else if ( "SYSTEM".equalsIgnoreCase ( value ) ) //$NON-NLS-1$
    {
        cell.setImage ( this.systemImage );
    }
    else
    {
        cell.setImage ( null );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:17,代碼來源:LabelProviderSupport.java

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

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

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

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

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

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

示例9: update

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(final ViewerCell cell) {
	final MarkerItem item = (MarkerItem) cell.getElement();
	Image image = null;
	if (item.getMarker() == null) {
		image = GamlMarkerImageProvider.getImage(item.getAttributeValue(IMarker.MESSAGE, "")).image();
	} else {
		try {
			if (item.getMarker().isSubtypeOf(IMarker.TASK)) {
				image = GamlMarkerImageProvider.getImage(-1).image();
			} else {
				image = GamlMarkerImageProvider
						.getImage(item.getMarker().getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING))
						.image();
			}
		} catch (final CoreException e) {
			// e.printStackTrace();
		}
	}

	cell.setText(getValue(item));
	cell.setImage(image);
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:24,代碼來源:GamlDescriptionMarkerField.java

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

示例11: decorateWithMonitorState

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
public void decorateWithMonitorState ( final DecoratedEvent event, final ViewerCell cell )
{
    // FIXME: should be done using new StyleBlinker

    if ( !event.isActive () )
    {
        cell.setImage ( null );
    }
    else
    {
        switch ( event.getMonitor ().getStatus () )
        {
            case NOT_OK:
                //$FALL-THROUGH$
            case NOT_OK_AKN:
                if ( event.getMonitor ().getSeverity () == Severity.WARNING )
                {
                    cell.setImage ( this.warningImage );
                }
                else
                {
                    cell.setImage ( this.alarmImage );
                }
                break;
            case NOT_AKN:
                cell.setImage ( this.ackImage );
                break;
            case NOT_OK_NOT_AKN:
                cell.setImage ( this.ackImage );
                break;
            case INACTIVE: //$FALL-THROUGH$
            case INIT: //$FALL-THROUGH$
            case UNSAFE: //$FALL-THROUGH$
            case OK: //$FALL-THROUGH$
                break;
        }
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:39,代碼來源:LabelProviderSupport.java

示例12: renderResult

import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
protected void renderResult ( final ViewerCell cell, final Entry element )
{
    if ( element.getException () != null )
    {
        cell.setText ( ExceptionHelper.getMessage ( element.getException () ) );
        cell.setImage ( JFaceResources.getImage ( Dialog.DLG_IMG_MESSAGE_ERROR ) );
    }
    else
    {
        cell.setText ( element.getNewName () );
        cell.setImage ( null );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:14,代碼來源:PreviewPage.java

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

示例14: update

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

	setStyledText(cell, obj);

	/* Image */
	cell.setImage(getImage(obj));

	super.update(cell);
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:12,代碼來源:KspOutlinePage.java

示例15: update

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

    cell.setText(project.getName());

    if (project != SELECT_ALL_SPECIAL_PROJECT_INFO) {
        cell.setImage(getColumnImage(project));

        if (!hasValidVC(project)) {
            setCellForeground(cell, SWT.COLOR_GRAY);
        }
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:16,代碼來源:TeamProjectTable.java


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