org.eclipse.jface.viewers.ViewerCell Java Examples
The following examples show how to use
org.eclipse.jface.viewers.ViewerCell.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GridColumnLabelProvider.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public void update(ViewerCell cell) { super.update(cell); Object element = cell.getElement(); String rowText = getRowHeaderText(element); int colSpan = getColumnSpan(element); int rowSpan = getRowSpan(element); GridItem gridItem = (GridItem)cell.getViewerRow().getItem(); if (rowText != null) { gridItem.setHeaderText(rowText); } gridItem.setColumnSpan(cell.getColumnIndex(), colSpan); gridItem.setRowSpan(cell.getColumnIndex(), rowSpan); }
Example #2
Source File: GridColumnLabelProvider.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void update(ViewerCell cell) { super.update(cell); Object element = cell.getElement(); String rowText = getRowHeaderText(element); int colSpan = getColumnSpan(element); int rowSpan = getRowSpan(element); GridItem gridItem = (GridItem)cell.getViewerRow().getItem(); if (rowText != null) { gridItem.setHeaderText(rowText); } gridItem.setColumnSpan(cell.getColumnIndex(), colSpan); gridItem.setRowSpan(cell.getColumnIndex(), rowSpan); }
Example #3
Source File: DiagramLabelProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void update(ViewerCell cell) { if (cell.getElement() instanceof DiagramFileStore) { DiagramFileStore filseStore = (DiagramFileStore) cell.getElement(); StyledString styledString = new StyledString(); styledString.append(fileStoreLabelProvider.getText(filseStore), null); if(filseStore.hasMigrationReport()){ styledString.append(" -- ",StyledString.DECORATIONS_STYLER) ; styledString.append( Messages.migrationOngoing ,StyledString.COUNTER_STYLER) ; } cell.setText(styledString.getString()); cell.setImage(fileStoreLabelProvider.getImage(filseStore)) ; cell.setStyleRanges(styledString.getStyleRanges()); } super.update(cell); }
Example #4
Source File: GridTableViewer.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void editElement(Object element, int column) { try { getControl().setRedraw(false); Widget item = findItem(element); if (item != null) { ViewerRow row = getViewerRowFromItem(item); if (row != null) { ViewerCell cell = row.getCell(column); if (cell != null) { triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell)); } } } } finally { getControl().setRedraw(true); } // } }
Example #5
Source File: UserManagementPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override public void update(ViewerCell cell){ User user = (User) cell.getElement(); cell.setText(user.getLabel()); Anwender ac = user.getAssignedContact(); if (ac != null && ac.isExecutiveDoctor()) { Mandant m = Mandant.load(ac.getId()); Color mc = UiMandant.getColorForMandator(m); cell.setImage(MandantSelectionContributionItem.getBoxSWTColorImage(mc)); } else { cell.setImage(Images.IMG_EMPTY_TRANSPARENT.getImage()); } if (user.isAdministrator()) { cell.setForeground(UiDesk.getColor(UiDesk.COL_RED)); cell.setImage(Images.IMG_AUSRUFEZ.getImage()); } }
Example #6
Source File: GridTableViewer.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public void editElement(Object element, int column) { try { getControl().setRedraw(false); Widget item = findItem(element); if (item != null) { ViewerRow row = getViewerRowFromItem(item); if (row != null) { ViewerCell cell = row.getCell(column); if (cell != null) { triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent( cell)); } } } } finally { getControl().setRedraw(true); } // } }
Example #7
Source File: CTreeComboViewer.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * @see org.eclipse.jface.viewers.ColumnViewer#editElement(java.lang.Object, int) */ public void editElement(Object element, int column) { if (element instanceof TreePath) { try { getControl().setRedraw(false); setSelection(new TreeSelection((TreePath) element)); CTreeComboItem[] items = tree.getSelection(); if (items.length == 1) { ViewerRow row = getViewerRowFromItem(items[0]); if (row != null) { ViewerCell cell = row.getCell(column); if (cell != null) { triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell)); } } } } finally { getControl().setRedraw(true); } } else { super.editElement(element, column); } }
Example #8
Source File: GenerericTreeViewer.java From offspring with MIT License | 6 votes |
@Override public void mouseDown(final MouseEvent event) { doubleClick = false; Display.getDefault().timerExec(Display.getDefault().getDoubleClickTime(), new Runnable() { @Override public void run() { if (!doubleClick) { Point pt = new Point(event.x, event.y); ViewerCell cell = getCell(pt); if (cell != null) { IGenericTableColumn column = getGenericTable().getColumns()[cell .getColumnIndex()]; if (column.getCellActivateHandler() != null) { column.getCellActivateHandler().activate(cell.getElement()); } } } } }); }
Example #9
Source File: LabelProviderImpl.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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 ); } }
Example #10
Source File: LabelProviderSupport.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ); } }
Example #11
Source File: GenerericTableViewer.java From offspring with MIT License | 6 votes |
@Override public void mouseDown(final MouseEvent event) { doubleClick = false; Display.getDefault().timerExec(Display.getDefault().getDoubleClickTime(), new Runnable() { @Override public void run() { if (!doubleClick) { Point pt = new Point(event.x, event.y); ViewerCell cell = getCell(pt); if (cell != null) { IGenericTableColumn column = getGenericTable().getColumns()[cell .getColumnIndex()]; if (column.getCellActivateHandler() != null) { column.getCellActivateHandler().activate(cell.getElement()); } } } } }); }
Example #12
Source File: ConnectionAnalyzer.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; } }
Example #13
Source File: GalleryTreeViewer.java From nebula with Eclipse Public License 2.0 | 6 votes |
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); } }
Example #14
Source File: GamlDescriptionMarkerField.java From gama with GNU General Public License v3.0 | 6 votes |
@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); }
Example #15
Source File: CloneDiffTooltip.java From JDeodorant with MIT License | 6 votes |
public void update(ViewerCell cell) { Object element = cell.getElement(); if (element instanceof CloneStructureNode){ cell.setText("CloneStructureNode"); } if (element instanceof PreconditionViolation){ PreconditionViolation preconditionViolation = (PreconditionViolation) element; StyledString styledString = preconditionViolation.getStyledViolation(); cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); cell.setImage(PRECONDITION_VIOLATION_IMAGE); } if (element instanceof Suggestion){ Suggestion suggestion = (Suggestion) element; cell.setText(suggestion.getSuggestion()); cell.setImage(SUGGESTION_IMAGE); } }
Example #16
Source File: ChartMakerDialog.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override public void update(@Nullable ViewerCell cell) { if (cell == null) { return; } /* Create a button if it doesn't exist */ ChartSeriesDialog series = (ChartSeriesDialog) cell.getViewerRow().getElement(); Button button = series.getButton(); /* Set the position of the button into the cell */ TableItem item = (TableItem) cell.getItem(); TableEditor editor = new TableEditor(item.getParent()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(button, item, cell.getColumnIndex()); editor.layout(); }
Example #17
Source File: ErrorTraceTreeViewer.java From tlaplus with MIT License | 6 votes |
@Override public void update(final ViewerCell cell) { // labels cell.setText(getColumnText(cell.getElement(), cell.getColumnIndex())); // images cell.setImage(getColumnImage(cell.getElement(), cell.getColumnIndex())); // font cell.setFont(getFont(cell.getElement(), cell.getColumnIndex())); final Color bg = getBackground(cell.getElement(), cell.getColumnIndex()); cell.setBackground(bg); if (TLAEditorActivator.getDefault().isCurrentThemeDark()) { cell.setForeground((bg == null) ? null : Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); } else { cell.setForeground(null); } }
Example #18
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 6 votes |
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); }
Example #19
Source File: ServerLabelProvider.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ); } }
Example #20
Source File: GridViewerEditor.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ protected void updateFocusCell(ViewerCell focusCell, ColumnViewerEditorActivationEvent event) { Grid grid = ((Grid)getViewer().getControl()); if (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) { grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex())); grid.setFocusItem((GridItem) focusCell.getItem()); if( selectionFollowsEditor ) { grid.setCellSelection(new Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focusCell.getItem()))); } } grid.showColumn(grid.getColumn(focusCell.getColumnIndex())); grid.showItem((GridItem) focusCell.getItem()); }
Example #21
Source File: NameLabelProviderImpl.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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 ); } }
Example #22
Source File: ActorMappingStyledTreeLabelProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void update(ViewerCell cell) { final Object cellElement = cell.getElement(); if (cellElement instanceof ActorMapping) { ActorMapping actor = (ActorMapping) cellElement; StyledString styledString = new StyledString(); styledString.append(actor.getName(), null); if (isNotDefined(actor)) { styledString.append(" -- "); styledString.append(Messages.notMappedActors, StyledString.DECORATIONS_STYLER); } cell.setText(styledString.getString()); cell.setImage(null); cell.setStyleRanges(styledString.getStyleRanges()); } else if (cellElement != null) { cell.setText(labelProvider.getText(cellElement)); cell.setImage(labelProvider.getImage(cellElement)); cell.setForeground(labelProvider.getForeground(cellElement)); } }
Example #23
Source File: SdkToolsControl.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public void update(ViewerCell cell) { String txt = ""; //$NON-NLS-1$ Image img = null; ModelItem it = (ModelItem)cell.getElement(); if (it.isRoot()) { if (cell.getColumnIndex() == 0) { txt = it.rootName; img = ImageUtils.getImage(ImageUtils.PACKAGE_FRAGMENT_IMAGE_NAME); } } else { if (it.tool.isSeparator()) { if (cell.getColumnIndex() == 0) { txt = Messages.SdkToolsControl_SeparatorLine; } } else { if (cell.getColumnIndex() == 0) { txt = it.tool.getToolName(); if (!it.tool.isValid()) { img = ImageUtils.getImage(ImageUtils.ERROR_16x16); } } else { txt = it.tool.getLocation(); } } } cell.setText(txt); cell.setImage(img); }
Example #24
Source File: OrganizationLabelProvider.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void update(final ViewerCell cell) { final String orgaName = getText(cell.getElement()); final String activeOrganization = activeOrganizationProvider.getActiveOrganization(); final StyledString styledString = new StyledString(); styledString.append(orgaName, null); if (orgaName.equals(activeOrganization)) { styledString.append(" (" + Messages.active + ")", boldgreen); } cell.setText(styledString.getString()); cell.setImage(null); cell.setStyleRanges(styledString.getStyleRanges()); }
Example #25
Source File: ExecutionContextLabelProvider.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public void update(ViewerCell cell) { switch (index) { case 0: updateNameCell(cell); break; case 1: updateValueCell(cell); break; } super.update(cell); }
Example #26
Source File: CustomUserInformationDefinitionNameEditingSupport.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected IObservableValue doCreateElementObservable(final Object element, final ViewerCell viewerCell) { final IObservableValue observeValue = PojoObservables.observeValue(element, "name"); observeValue.addValueChangeListener(new ColumnViewerUpdateListener(getViewer(), element)); observeValue.addValueChangeListener(new IValueChangeListener() { @Override public void handleValueChange(final ValueChangeEvent event) { final String oldInformationName = (String) event.diff.getOldValue(); final String newInformationName = (String) event.diff.getNewValue(); for(final User user : organization.getUsers().getUser()){ updateCustomUserInformationName(user, oldInformationName, newInformationName); } } }); //sort the table after a modification observeValue.addDisposeListener(new IDisposeListener() { @Override public void handleDispose(final DisposeEvent arg0) { viewer.refresh(); } }); return observeValue; }
Example #27
Source File: LaborResultsComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private List<LabResult> getSelectedResults(ViewerCell cell){ if (cell != null && cell.getColumnIndex() > 2) { TreeViewerColumn column = resultColumns.get(cell.getColumnIndex() - 3); TimeTool time = (TimeTool) column.getColumn().getData(COLUMN_DATE_KEY); if ((time != null) && (cell.getElement() instanceof LaborItemResults)) { LaborItemResults results = (LaborItemResults) cell.getElement(); return results.getResult(time.toString(TimeTool.DATE_COMPACT)); } } return null; }
Example #28
Source File: StateLabelProviderImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void update ( final ViewerCell cell ) { final Object element = cell.getElement (); if ( ! ( element instanceof TreeNode ) ) { return; } final boolean active = isActive ( (TreeNode)element ); cell.setText ( active ? "X" : "" ); }
Example #29
Source File: PreviewPage.java From neoscada with Eclipse Public License 1.0 | 5 votes |
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 ); } }
Example #30
Source File: ValidPreferenceCheckedTreeViewer.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** {@inheritDoc} */ @Override public Point getLocation(final Point tipSize, final Event event) { // try to position the tooltip at the bottom of the cell final ViewerCell cell = ValidPreferenceCheckedTreeViewer.this.getCell(new Point(event.x, event.y)); if (cell != null) { return tree.toDisplay(event.x, cell.getBounds().y + cell.getBounds().height); } return super.getLocation(tipSize, event); }