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


Java ViewerCell類代碼示例

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


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

示例1: createViewerToolTipContentArea

import org.eclipse.jface.viewers.ViewerCell; //導入依賴的package包/類
@Override
protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setBackground(rowColorBack);
    Plugin plugin = (Plugin) cell.getElement();

    Hyperlink button = new Hyperlink(composite, SWT.FLAT);
    button.setText("\uf05A");
    button.setFont(fontAwesome);
    button.setBackground(composite.getBackground());
    button.setForeground(rowColorTitle);
    button.setUnderlined(false);
    button.addListener (SWT.MouseDown, e -> Program.launch(GLUON_PLUGIN_URL + plugin.getUrl()));
    button.setToolTipText("Click to access the service's JavaDoc");

    Label text = new Label(composite, SWT.LEFT);
    final String description = plugin.getDescription();
    text.setText(description.contains(".") ? description.substring(0, description.indexOf(".")) : description);
    text.setBackground(composite.getBackground());
    text.setForeground(rowColorTitle);
    composite.pack();
    return composite;
}
 
開發者ID:gluonhq,項目名稱:ide-plugins,代碼行數:25,代碼來源:PluginsSWT.java

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

示例3: update

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

    if ( this.decoration != null )
    {
        switch ( this.decoration )
        {
        case ACTOR:
            this.labelProviderSupport.decorateWithActorType ( event, cell );
            break;
        case MONITOR:
            this.labelProviderSupport.decorateWithMonitorState ( event, cell );
            break;
        }
    }

    if ( this.key != null && !this.key.isEmpty () )
    {
        cell.setText ( this.labelProviderSupport.toLabel ( event, this.key ) );
    }

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:25,代碼來源:VariantLabelProvider.java

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

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

示例6: update

import org.eclipse.jface.viewers.ViewerCell; //導入依賴的package包/類
@Override
public void update ( final ViewerCell cell )
{
    final ConfigurationDescriptor cfg = (ConfigurationDescriptor)cell.getElement ();
    switch ( cell.getColumnIndex () )
    {
    case 0:
        cell.setText ( cfg.getConfigurationInformation ().getId () );
        break;
    case 1:
        cell.setText ( "" + cfg.getConfigurationInformation ().getState () );
        break;
    }

    if ( cfg.getConfigurationInformation ().getErrorInformation () != null )
    {
        cell.setBackground ( Display.getCurrent ().getSystemColor ( SWT.COLOR_RED ) );
    }
    else
    {
        cell.setBackground ( null );
    }

    super.update ( cell );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:FactoryCellLabelProvider.java

示例7: update

import org.eclipse.jface.viewers.ViewerCell; //導入依賴的package包/類
@Override
public void update ( final ViewerCell cell )
{
    final Entry entry = (Entry)cell.getElement ();
    switch ( cell.getColumnIndex () )
    {
    case 0:
        cell.setText ( entry.getHandlerName () );
        break;
    case 1:
        cell.setText ( entry.getState ().toString () );
        break;
    case 2:
        final String errorText = makeError ( entry.getError () );
        // only update when we have an error to prevent
        // the error from disapearing
        if ( errorText != null )
        {
            cell.setText ( errorText );
        }
        break;
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:ConnectionAnalyzer.java

示例8: updateAttributePair

import org.eclipse.jface.viewers.ViewerCell; //導入依賴的package包/類
private void updateAttributePair ( final AttributePair attributePair, final ViewerCell cell )
{
    switch ( cell.getColumnIndex () )
    {
        case 0:
            cell.setText ( attributePair.key );
            break;
        case 2:
            if ( attributePair.value != null )
            {
                cell.setText ( attributePair.value.getType ().name () );
            }
            break;
        case 3:
            if ( attributePair.value != null )
            {
                cell.setText ( attributePair.value.asString ( "<null>" ) ); //$NON-NLS-1$
            }
            break;
        default:
            break;
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:ItemCellLabelProvider.java

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

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

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

示例12: update

import org.eclipse.jface.viewers.ViewerCell; //導入依賴的package包/類
@Override
public void update(ViewerCell cell) {
	  TableItem item = (TableItem) cell.getItem();
	  
	  Pattern pattern = Pattern.compile("^[a-zA-Z0-9 _]*$");
		
		if (!pattern.matcher(((InputField)cell.getElement()).getFieldName()).matches()) {
			  item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
			  item.setForeground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
			  ((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should match regular expression- \"^[a-zA-Z0-9_]*$\" ");
			  ((InputField)cell.getElement()).getErrorObject().setHasError(true);
	    }else{
	    	
	    	if(((InputField)cell.getElement()).getFieldName().trim().equalsIgnoreCase("")){
	    		item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
	    		((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should not be empty");
				  ((InputField)cell.getElement()).getErrorObject().setHasError(true);
	    	}else{
				  ((InputField)cell.getElement()).getErrorObject().setHasError(false);
	    	}
	    	
	    	
	    }
	super.update(cell);
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:26,代碼來源:InputFieldColumnLabelProvider.java

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

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

示例15: focusCellChanged

import org.eclipse.jface.viewers.ViewerCell; //導入依賴的package包/類
@Override
protected void focusCellChanged(final ViewerCell newCell, final ViewerCell oldCell) {
    super.focusCellChanged(newCell, oldCell);

    /*
     * When the focus is changed, we merely tell the table to redraw the
     * affected row(s).
     */
    if (newCell != null) {
        newCell.getViewerRow().getControl().redraw();
    }

    if (oldCell != null) {
        oldCell.getViewerRow().getControl().redraw();
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:17,代碼來源:MultiRowHighlighter.java


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