List of usage examples for org.eclipse.jface.viewers ViewerCell setImage
public void setImage(Image image)
From source file:org.eclipse.papyrus.uml.diagram.dnd.strategy.instancespecification.ui.ClassifierPropertiesLabelProvider.java
License:Open Source License
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); int columnIndex = cell.getColumnIndex(); StyledString styledText = getStyledText(element, columnIndex); cell.setText(styledText.getString()); cell.setStyleRanges(styledText.getStyleRanges()); cell.setImage(getImage(element, columnIndex)); }
From source file:org.eclipse.pde.internal.ui.shared.target.TargetLocationLabelProvider.java
License:Open Source License
public void update(ViewerCell cell) { Object element = cell.getElement(); cell.setText(getText(element)); cell.setImage(getImage(element)); }
From source file:org.eclipse.php.composer.ui.controller.PackageController.java
License:Open Source License
public void update(ViewerCell cell) { Object obj = cell.getElement(); if (obj instanceof MinimalPackage) { MinimalPackage pkg = (MinimalPackage) obj; StyledString styledString = new StyledString(); // if (author.getEmail() != null && author.getEmail().trim() != "" // && !author.getEmail().trim().equals("")) { // styledString.append(" <" + author.getEmail().trim() + ">", // StyledString.COUNTER_STYLER); // }// www .ja v a 2 s . com // // if (author.getHomepage() != null && author.getHomepage().trim() // != "" && !author.getHomepage().trim().equals("")) { // styledString.append(" - " + author.getHomepage().trim(), // StyledString.DECORATIONS_STYLER); // } updateText(pkg, styledString); cell.setText(styledString.toString()); cell.setStyleRanges(styledString.getStyleRanges()); cell.setImage(getImage(pkg)); super.update(cell); } }
From source file:org.eclipse.php.composer.ui.controller.PsrController.java
License:Open Source License
public void update(ViewerCell cell) { Object obj = cell.getElement(); String text = getText(obj);//from w ww . j a v a2 s . c om StyledString styledString = new StyledString(text); if (obj instanceof Namespace) { Namespace namespace = (Namespace) obj; styledString.append(" (" + namespace.size() + ")", StyledString.COUNTER_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ cell.setImage(namespaceImage); } else { cell.setImage(pathImage); } cell.setText(styledString.toString()); cell.setStyleRanges(styledString.getStyleRanges()); super.update(cell); }
From source file:org.eclipse.php.composer.ui.controller.ScriptsController.java
License:Open Source License
public void update(ViewerCell cell) { Object obj = cell.getElement(); String text = getText(obj);//from w w w .jav a 2s . co m StyledString styledString = new StyledString(text); if (obj instanceof Script) { Script script = (Script) obj; styledString.append(" (" + script.size() + ")", StyledString.COUNTER_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ cell.setImage(eventImage); } else { cell.setImage(scriptImage); } cell.setText(styledString.toString()); cell.setStyleRanges(styledString.getStyleRanges()); super.update(cell); }
From source file:org.eclipse.ptp.internal.rdt.ui.search.RemoteSearchListLabelProvider.java
License:Open Source License
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); switch (fColumnIndex) { case RemoteSearchViewPage.LOCATION_COLUMN_INDEX: if (element instanceof RemoteLineSearchElement) { RemoteLineSearchElement lineElement = (RemoteLineSearchElement) element; String location = RemoteSearchTreeContentProvider.getAbsolutePath(lineElement.getLocation()) .toString();/*from w ww .j a v a 2s . c om*/ int lineNumber = lineElement.getLineNumber(); cell.setText( Messages.format(CSearchMessages.CSearchResultCollector_location, location, lineNumber)); cell.setImage(CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_SEARCH_LINE)); } break; case RemoteSearchViewPage.DEFINITION_COLUMN_INDEX: if (element instanceof RemoteLineSearchElement) { RemoteLineSearchElement lineElement = (RemoteLineSearchElement) element; ICElement enclosingElement = lineElement.getMatches()[0].getEnclosingElement(); if (fPage.isShowEnclosingDefinitions() && enclosingElement != null) { cell.setText(enclosingElement.getElementName()); cell.setImage(getImage(element)); } else { cell.setText(""); //$NON-NLS-1$ } } break; case RemoteSearchViewPage.MATCH_COLUMN_INDEX: super.update(cell); cell.setImage(null); break; default: cell.setText(""); //$NON-NLS-1$ break; } }
From source file:org.eclipse.ptp.internal.rm.jaxb.control.ui.providers.ViewerDataCellLabelProvider.java
License:Open Source License
@Override public void update(ViewerCell cell) { int index = cell.getColumnIndex(); Object element = cell.getElement(); Color color = getBackground(element, index); if (color != null) { cell.setBackground(color);/* w ww .ja v a 2 s. com*/ } color = getForeground(element, index); if (color != null) { cell.setForeground(color); } else { /* * If foreground color is not specified, then we use the edit status of the * cell to determine the color. We save the default foreground color to use * when the cell is editable. */ if (foregroundColor == null) { foregroundColor = cell.getForeground(); } if (!canEdit(element)) { cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)); } else { cell.setForeground(foregroundColor); } } Font font = getFont(element, index); if (font != null) { cell.setFont(font); } Image img = getColumnImage(element, index); if (img != null) { cell.setImage(img); } cell.setText(getColumnText(element, index)); }
From source file:org.eclipse.ptp.rm.jaxb.control.ui.providers.ViewerDataCellLabelProvider.java
License:Open Source License
@Override public void update(ViewerCell cell) { int index = cell.getColumnIndex(); Object element = cell.getElement(); Color color = getBackground(element, index); if (color != null) { cell.setBackground(color);//from w w w .j a va 2s. c o m } color = getForeground(element, index); if (color != null) { cell.setBackground(color); } Font font = getFont(element, index); if (font != null) { cell.setFont(font); } Image img = getColumnImage(element, index); if (img != null) { cell.setImage(img); } cell.setText(getColumnText(element, index)); }
From source file:org.eclipse.rcptt.ui.actions.Q7ElementLabelProvider.java
License:Open Source License
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); Control ctrl = cell.getControl(); Widget item = cell.getViewerRow().getItem(); int index = 0; if (ctrl instanceof Tree) { index = ((Tree) ctrl).indexOf((TreeItem) item); } else if (ctrl instanceof Table) { index = ((Table) ctrl).indexOf((TableItem) item); }//from w w w. j a va 2 s . c o m StyledString styled = getStyledText(element, index); cell.setText(styled.getString()); cell.setStyleRanges(styled.getStyleRanges()); cell.setImage(getImage(element)); }
From source file:org.eclipse.rcptt.verifications.tree.ui.VerificationTreeLabelProvider.java
License:Open Source License
@Override public void update(ViewerCell cell) { if (cell.getElement() instanceof Row) { Row row = (Row) cell.getElement(); int ind = cell.getColumnIndex(); if (row.getValues().size() > ind) { Cell cellValue = row.getValues().get(ind); ItemData cellData = cellValue.getData(); if (ignoreStyle) { cell.setStyleRanges(null); cell.setText(cellData.getText()); } else { StyleRange[] ranges = RangeUtils.fromEMF(cellValue.getStyle(), cell.getItem().getDisplay()); if (skipStyledText) { cell.setStyleRanges(null); cell.setText(StyleRangeUtils.getNonStyledText(ranges, cellData.getText())); } else { cell.setStyleRanges(ranges); cell.setText(cellData.getText()); }// w w w.j a v a 2s .c o m } cell.setBackground( RangeUtils.colorFromEMF(cellData.getBackgroundColor(), cell.getItem().getDisplay())); cell.setForeground( RangeUtils.colorFromEMF(cellData.getForegroundColor(), cell.getItem().getDisplay())); if (drawIcons) { String imgPath = TreeVerificationUtils.getDecoratedImagePath(cellData.getImage()); if (images.containsKey(imgPath)) { cell.setImage(images.get(imgPath)); } } else { cell.setImage(null); } } } }