Java Code Examples for org.eclipse.jface.viewers.StyledString#toString()
The following examples show how to use
org.eclipse.jface.viewers.StyledString#toString() .
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: XViewerStyledTextLabelProvider.java From nebula with Eclipse Public License 2.0 | 6 votes |
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); StyledString styledString = getStyledText(element, cell.getColumnIndex()); String newText = styledString.toString(); StyleRange[] oldStyleRanges = cell.getStyleRanges(); StyleRange[] newStyleRanges = isOwnerDrawEnabled() ? styledString.getStyleRanges() : null; if (!Arrays.equals(oldStyleRanges, newStyleRanges)) { cell.setStyleRanges(newStyleRanges); } cell.setText(newText); cell.setImage(getColumnImage(element, cell.getColumnIndex())); cell.setFont(getFont(element, cell.getColumnIndex())); cell.setForeground(getForeground(element, cell.getColumnIndex())); cell.setBackground(getBackground(element, cell.getColumnIndex())); // no super call required. changes on item will trigger the refresh. }
Example 2
Source File: StyledFilterLabelProvider.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public String getText(Object element) { ActorFilter filter = (ActorFilter) element; ConnectorDefinition def = defStore.getDefinition(filter.getDefinitionId(),filter.getDefinitionVersion()) ; StyledString styledString = new StyledString(); styledString.append(filter.getName(), null); styledString.append(" -- ",StyledString.QUALIFIER_STYLER) ; String connectorType = messageProvider.getConnectorDefinitionLabel(def) ; if(connectorType==null && def != null) { connectorType = def.getId(); } if(connectorType!=null){ styledString.append(connectorType, StyledString.DECORATIONS_STYLER); } if(filter.getEvent() != null && !filter.getEvent().isEmpty()){ styledString.append(" -- ",StyledString.QUALIFIER_STYLER) ; styledString.append(filter.getEvent(), StyledString.COUNTER_STYLER); } if(def == null){ styledString.setStyle(0, styledString.length(), new org.eclipse.jface.viewers.StyledString.Styler() { @Override public void applyStyles(TextStyle textStyle) { textStyle.strikeout = true ; } }) ; styledString.append(" "); styledString.append(Messages.bind(Messages.filterDefinitionNotFound,filter.getDefinitionId() + " ("+filter.getDefinitionVersion()+")")) ; } return styledString.toString() ; }
Example 3
Source File: AppEngineLabelProvider.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
@Override public String getText(Object element) { StyledString result = getStyledText(element); return result == null ? null : result.toString(); }
Example 4
Source File: OutlineNodeLabelProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public String getText(Object element) { final StyledString styledText = getStyledText(element); return styledText != null? styledText.toString() : null; }
Example 5
Source File: ParameterContextInformationProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void getContextInformation(ContentAssistContext context, IContextInformationAcceptor acceptor) { XExpression containerCall = getContainerCall(eObjectAtOffsetHelper.resolveContainedElementAt(context.getResource(), context.getOffset())); LightweightTypeReferenceFactory factory = proposalProvider.getTypeConverter(context.getResource()); if (containerCall != null) { ICompositeNode containerCallNode = NodeModelUtils.findActualNodeFor(containerCall); ITextRegion containerCallRegion = containerCallNode.getTextRegion(); if(containerCallRegion.getOffset() > context.getOffset() || containerCallRegion.getOffset() + containerCallRegion.getLength() < context.getOffset()) return; JvmIdentifiableElement calledFeature = getCalledFeature(containerCall); if (calledFeature instanceof JvmExecutable) { if(getParameterListOffset(containerCall) > context.getOffset()) return; ParameterData parameterData = new ParameterData(); IScope scope = getScope(containerCall); QualifiedName qualifiedName = QualifiedName.create(getCalledFeatureName(containerCall)); boolean candidatesFound = false; for (IEObjectDescription element : scope.getElements(qualifiedName)) { if (element instanceof IIdentifiableElementDescription) { IIdentifiableElementDescription featureDescription = (IIdentifiableElementDescription) element; JvmIdentifiableElement featureCandidate = featureDescription.getElementOrProxy(); if (featureCandidate instanceof JvmExecutable) { JvmExecutable executable = (JvmExecutable) featureCandidate; if(!executable.getParameters().isEmpty()) { StyledString styledString = new StyledString(); proposalProvider.appendParameters(styledString, executable, featureDescription.getNumberOfIrrelevantParameters(), factory); parameterData.addOverloaded(styledString.toString(), executable.isVarArgs()); candidatesFound = true; } } } } if (candidatesFound) { StyledString displayString = proposalProvider.getStyledDisplayString((JvmExecutable) calledFeature, true, 0, qualifiedNameConverter.toString(qualifiedNameProvider.getFullyQualifiedName(calledFeature)), calledFeature.getSimpleName(), factory); ParameterContextInformation parameterContextInformation = new ParameterContextInformation( parameterData, displayString.toString(), getParameterListOffset(containerCall), context.getOffset()); acceptor.accept(parameterContextInformation); } } } }