当前位置: 首页>>代码示例>>Java>>正文


Java ViewerCell.getElement方法代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.ViewerCell.getElement方法的典型用法代码示例。如果您正苦于以下问题:Java ViewerCell.getElement方法的具体用法?Java ViewerCell.getElement怎么用?Java ViewerCell.getElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.viewers.ViewerCell的用法示例。


在下文中一共展示了ViewerCell.getElement方法的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: 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

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

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

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

示例8: update

import org.eclipse.jface.viewers.ViewerCell; //导入方法依赖的package包/类
@Override
public void update(final ViewerCell cell) {
    final Object element = cell.getElement();

    if (element instanceof ImportEclipseProject) {
        final ImportEclipseProject project = (ImportEclipseProject) element;

        if (project.isDamaged()) {
            cell.setText(Messages.getString("GitImportWizardSelectProjectsPage.ProjectDamaged")); //$NON-NLS-1$
            setCellFontStyle(cell, SWT.ITALIC);
        } else {
            cell.setText(project.getProjectName());
        }

        if (!canImport(project)) {
            setCellForeground(cell, SWT.COLOR_GRAY);
        }
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:20,代码来源:GitImportWizardSelectProjectsPage.java

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

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

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

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

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

示例14: update

import org.eclipse.jface.viewers.ViewerCell; //导入方法依赖的package包/类
@Override
public void update ( final ViewerCell cell )
{
    final Object element = cell.getElement ();
    final Object value = this.attributeMaps[0].get ( element );
    cell.setText ( value == null ? "" : value.toString () ); //$NON-NLS-1$
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:8,代码来源:ObservableMapStyledCellLabelProvider.java

示例15: update

import org.eclipse.jface.viewers.ViewerCell; //导入方法依赖的package包/类
@Override
public void update ( final ViewerCell cell )
{
    if ( cell.getElement () instanceof ConnectionInformationProvider )
    {
        final ConnectionInformationProvider provider = (ConnectionInformationProvider)cell.getElement ();
        switch ( cell.getColumnIndex () )
        {
            case 0:
                cell.setText ( provider.getLabel () );
                break;
        }
    }
    else if ( cell.getElement () instanceof InformationBean )
    {
        final InformationBean bean = (InformationBean)cell.getElement ();
        switch ( cell.getColumnIndex () )
        {
            case 0:
                cell.setText ( bean.getLabel () );
                break;
            case 1:
                cell.setText ( format ( bean.getValue () ) );
                break;
            case 2:
                cell.setText ( format ( bean.getMin () ) );
                break;
            case 3:
                cell.setText ( format ( bean.getMax () ) );
                break;
        }
    }
    super.update ( cell );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:35,代码来源:LabelProvider.java


注:本文中的org.eclipse.jface.viewers.ViewerCell.getElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。