@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;
}
java类org.eclipse.jface.viewers.ViewerCell的实例源码
PluginsSWT.java 文件源码
项目:ide-plugins
阅读 33
收藏 0
点赞 0
评论 0
LabelProviderImpl.java 文件源码
项目:neoscada
阅读 30
收藏 0
点赞 0
评论 0
@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 );
}
}
VariantLabelProvider.java 文件源码
项目:neoscada
阅读 52
收藏 0
点赞 0
评论 0
@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 ) );
}
}
LabelProviderSupport.java 文件源码
项目:neoscada
阅读 35
收藏 0
点赞 0
评论 0
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 );
}
}
FlagsDetailsPart.java 文件源码
项目:neoscada
阅读 40
收藏 0
点赞 0
评论 0
@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 () );
}
}
FactoryCellLabelProvider.java 文件源码
项目:neoscada
阅读 42
收藏 0
点赞 0
评论 0
@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 );
}
ConnectionAnalyzer.java 文件源码
项目:neoscada
阅读 31
收藏 0
点赞 0
评论 0
@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;
}
}
ItemCellLabelProvider.java 文件源码
项目:neoscada
阅读 36
收藏 0
点赞 0
评论 0
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;
}
}
NameLabelProviderImpl.java 文件源码
项目:neoscada
阅读 36
收藏 0
点赞 0
评论 0
@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 );
}
}
ServerLabelProvider.java 文件源码
项目:neoscada
阅读 36
收藏 0
点赞 0
评论 0
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 );
}
}
KaviListColumns.java 文件源码
项目:eclipse-plugin-commander
阅读 34
收藏 0
点赞 0
评论 0
@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;
}
InputFieldColumnLabelProvider.java 文件源码
项目:Hydrograph
阅读 27
收藏 0
点赞 0
评论 0
@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);
}
KspOutlinePage.java 文件源码
项目:vertigo-chroma-kspplugin
阅读 35
收藏 0
点赞 0
评论 0
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]));
}
SchemaViewerStyledCellLabelProvider.java 文件源码
项目:avro-schema-editor
阅读 38
收藏 0
点赞 0
评论 0
@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);
}
MultiRowHighlighter.java 文件源码
项目:team-explorer-everywhere
阅读 31
收藏 0
点赞 0
评论 0
@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();
}
}
CellEditorAccessibility.java 文件源码
项目:team-explorer-everywhere
阅读 31
收藏 0
点赞 0
评论 0
public static final Point getFocusCellIndex(final TableViewer viewer) {
try {
if (viewer.getColumnViewerEditor() != null) {
final ViewerCell focusCell = viewer.getColumnViewerEditor().getFocusCell();
if (focusCell != null) {
final int x = focusCell.getColumnIndex();
final int y = viewer.getTable().indexOf((TableItem) focusCell.getItem());
return new Point(x, y);
}
}
} catch (final Exception e) {
log.warn("Could not determine cell index", e); //$NON-NLS-1$
}
return new Point(-1, -1);
}
GitImportWizardSelectProjectsPage.java 文件源码
项目:team-explorer-everywhere
阅读 30
收藏 0
点赞 0
评论 0
@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);
}
}
}
FilteredItemsSelectionDialog.java 文件源码
项目:tlaplus
阅读 35
收藏 0
点赞 0
评论 0
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);
}
FocusBorderCellHighlighter.java 文件源码
项目:fluentmark
阅读 31
收藏 0
点赞 0
评论 0
private void hookListener(final ColumnViewer viewer) {
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if ((event.detail & SWT.SELECTED) > 0) {
ViewerCell focusCell = getFocusCell();
ViewerRow row = focusCell.getViewerRow();
Assert.isNotNull(row, "Internal structure invalid. Item without associated row is not possible."); //$NON-NLS-1$
ViewerCell cell = row.getCell(event.index);
if (focusCell == null || !cell.equals(focusCell)) {
removeSelectionInformation(event, cell);
} else {
markFocusedCell(event, cell);
}
}
}
};
viewer.getControl().addListener(SWT.EraseItem, listener);
}
TourBookView.java 文件源码
项目:mytourbook
阅读 33
收藏 0
点赞 0
评论 0
/**
* Column: Device name
*/
private void defineColumn_Device_Name() {
final TreeColumnDefinition colDef = TreeColumnFactory.DEVICE_NAME.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
final String dbValue = ((TVITourBookItem) element).col_DeviceName;
if (dbValue == null) {
cell.setText(UI.EMPTY_STRING);
} else {
cell.setText(dbValue);
}
setCellColor(cell, element);
}
});
}
ImageGallery.java 文件源码
项目:mytourbook
阅读 46
收藏 0
点赞 0
评论 0
/**
* column: image direction degree
*/
private void defineColumn_ImageDirectionText() {
final ColumnDefinition colDef = TableColumnFactory.PHOTO_FILE_IMAGE_DIRECTION_TEXT//
.createColumn(_columnManager, _pc);
colDef.setIsDefaultColumn();
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Photo photo = (Photo) cell.getElement();
final double imageDirection = photo.getImageDirection();
if (imageDirection == Double.MIN_VALUE) {
cell.setText(UI.EMPTY_STRING);
} else {
final int imageDirectionInt = (int) imageDirection;
cell.setText(getDirectionText(imageDirectionInt));
}
}
});
}
TourDataEditorView.java 文件源码
项目:mytourbook
阅读 35
收藏 0
点赞 0
评论 0
/**
* Column: Gear ratio
*/
private void defineColumn_Powertrain_GearRatio() {
final ColumnDefinition colDef = TableColumnFactory.POWERTRAIN_GEAR_RATIO.createColumn(_sliceColumnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
if (_serieGears == null) {
cell.setText(UI.EMPTY_STRING);
} else {
final int serieIndex = ((TimeSlice) cell.getElement()).serieIndex;
final float gearRatio = _serieGears[0][serieIndex];
cell.setText(_nf2.format(gearRatio));
}
}
});
}
RawDataView.java 文件源码
项目:mytourbook
阅读 32
收藏 0
点赞 0
评论 0
/**
* column: import file path
*/
private void defineColumn_Data_ImportFilePath() {
final ColumnDefinition colDef = TableColumnFactory.DATA_IMPORT_FILE_PATH.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final TourData tourData = (TourData) cell.getElement();
final String importFilePath = tourData.getImportFilePath();
if (importFilePath != null) {
cell.setText(importFilePath);
}
}
});
}
TourBookView.java 文件源码
项目:mytourbook
阅读 30
收藏 0
点赞 0
评论 0
/**
* column: avg pulse
*/
private void defineColumn_Body_AvgPulse() {
final TreeColumnDefinition colDef = TreeColumnFactory.BODY_PULSE_AVG.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
final double value = ((TVITourBookItem) element).colAvgPulse;
colDef.printDoubleValue(cell, value, element instanceof TVITourBookTour);
setCellColor(cell, element);
}
});
}
CollatedToursView.java 文件源码
项目:mytourbook
阅读 33
收藏 0
点赞 0
评论 0
/**
* column: number of photos
*/
private void defineColumn_Tour_Photos() {
final TreeColumnDefinition colDef = TreeColumnFactory.TOUR_NUM_PHOTOS.createColumn(_columnManager, _pc);
colDef.setIsDefaultColumn();
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
final int value = ((TVICollatedTour) element).colNumberOfPhotos;
colDef.printValue_0(cell, value);
setCellColor(cell, element);
}
});
}
TourSegmenterView.java 文件源码
项目:mytourbook
阅读 33
收藏 0
点赞 0
评论 0
/**
* Column: Altitude segment up
*/
private void defineColumn_Altitude_Segment_Up(final SelectionAdapter defaultColumnSelectionListener) {
final ColumnDefinition colDef;
colDef = TableColumnFactory.ALTITUDE_ELEVATION_SEGMENT_UP.createColumn(_columnManager, _pc);
colDef.setIsDefaultColumn();
colDef.setColumnSelectionListener(defaultColumnSelectionListener);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final TourSegment segment = (TourSegment) cell.getElement();
final double value = segment.altitude_Segment_Up;
colDef.printValue_0(cell, value);
if (segment.isTotal) {
setTotalStyle(cell);
}
}
});
}
TourMarkerView.java 文件源码
项目:mytourbook
阅读 33
收藏 0
点赞 0
评论 0
/**
* Column: Description
*/
private void defineColumn_Waypoint_Description() {
final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_DESCRIPTION.createColumn(_columnManager, _pc);
colDef.setIsDefaultColumn();
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final TourMarker marker = (TourMarker) cell.getElement();
cell.setText(marker.getDescription());
}
});
}
RawDataView.java 文件源码
项目:mytourbook
阅读 35
收藏 0
点赞 0
评论 0
/**
* column: import file name
*/
private void defineColumn_Data_ImportFileName() {
final ColumnDefinition colDef = TableColumnFactory.DATA_IMPORT_FILE_NAME.createColumn(_columnManager, _pc);
colDef.setColumnSelectionListener(_columnSortListener);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final TourData tourData = (TourData) cell.getElement();
final String importFileName = tourData.getImportFileName();
if (importFileName != null) {
cell.setText(importFileName);
}
}
});
_columnId_ImportFileName = colDef.getColumnId();
}
TaggingView.java 文件源码
项目:mytourbook
阅读 33
收藏 0
点赞 0
评论 0
/**
* column: altitude up (m)
*/
private void defineColumn_Altitude_Up() {
final TreeColumnDefinition colDef = TreeColumnFactory.ALTITUDE_UP.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVITagViewTagCategory) {
return;
}
final long dbAltitudeUp = ((TVITagViewItem) element).colAltitudeUp;
final double value = dbAltitudeUp / UI.UNIT_VALUE_ALTITUDE;
colDef.printValue_0(cell, value);
setCellColor(cell, element);
}
});
}
GalleryTreeViewer.java 文件源码
项目:PDFReporter-Studio
阅读 34
收藏 0
点赞 0
评论 0
public void editElement(Object element, int column) {
if (element instanceof TreePath) {
setSelection(new TreeSelection((TreePath) element));
GalleryItem[] items = gallery.getSelection();
if (items.length == 1) {
ViewerRow row = getViewerRowFromItem(items[0]);
if (row != null) {
ViewerCell cell = row.getCell(column);
if (cell != null) {
getControl().setRedraw(false);
triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell));
getControl().setRedraw(true);
}
}
}
} else {
super.editElement(element, column);
}
}