List of usage examples for org.eclipse.jface.viewers ViewerCell setStyleRanges
public void setStyleRanges(StyleRange[] styleRanges)
From source file:com.mobilesorcery.sdk.testing.internal.ui.TestSessionLabelProvider.java
License:Open Source License
public void update(ViewerCell cell) { Object element = cell.getElement(); String mainText = getText(element); StyledString text = new StyledString(mainText); String elapsedTimeText = getElapsedTimeText(element); if (elapsedTimeText != null) { text = StyledCellLabelProvider.styleDecoratedString( MessageFormat.format("{0} {1}", text, elapsedTimeText), StyledString.COUNTER_STYLER, text); }//from w ww . ja v a 2 s . c o m cell.setText(text.getString()); cell.setStyleRanges(text.getStyleRanges()); Image image = getImage(element); cell.setImage(image); }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn5(ViewerCell cell, Object element) { if (element instanceof ServiceFlowRelationship) { ServiceFlowRelationship rel = (ServiceFlowRelationship) element; if (rel.eIsSet(ServicesPackage.Literals.SERVICE_FLOW_RELATIONSHIP__REFERENCE_RELATIONSHIP)) { ReferenceRelationship referenceRelationship = rel.getReferenceRelationship(); // Check if the interface is set. if (referenceRelationship .eIsSet(LibraryPackage.Literals.REFERENCE_RELATIONSHIP__REF_INTERFACE2_REF)) { NodeType nodeTypeRef = referenceRelationship.getRefInterface2Ref(); // Set the name of the Node Type. StyledString styledString = new StyledString(nodeTypeRef.getName(), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); }/*from w w w . j a v a 2 s . co m*/ } else { cell.setText("-"); } } }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn6(ViewerCell cell, Object element) { if (element instanceof ServiceFlowRelationship) { ServiceFlowRelationship sfRel = (ServiceFlowRelationship) element; if (sfRel.eIsSet(ServicesPackage.Literals.SERVICE_FLOW_RELATIONSHIP__PROTOCOL)) { Protocol protocol = sfRel.getProtocol(); // Set the name of the Node Type. StyledString styledString = new StyledString(protocol.getName(), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else {/* w w w .j a v a 2s .com*/ cell.setText("-"); } } }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn7(ViewerCell cell, Object element) { if (element instanceof ServiceFlowRelationship) { ServiceFlowRelationship rel = (ServiceFlowRelationship) element; if (rel.eIsSet(ServicesPackage.Literals.SERVICE_FLOW_RELATIONSHIP__MESSAGE)) { Message msg = rel.getMessage(); if (msg.eIsSet(ProtocolsPackage.Literals.MESSAGE__NAME)) { // Set the name of the Node Type. StyledString styledString = new StyledString( (String) msg.eGet(ProtocolsPackage.Literals.MESSAGE__NAME), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); }//w w w. j a v a 2s . co m } else { cell.setText("-"); } } }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn4(ViewerCell cell, Object element) { if (element instanceof ServiceFlowRelationship) { ServiceFlowRelationship rel = (ServiceFlowRelationship) element; if (rel.eIsSet(ServicesPackage.Literals.SERVICE_FLOW_RELATIONSHIP__REFERENCE_RELATIONSHIP)) { ServiceFlowDirection direction = rel.getDirection(); if (direction != null) { switch (direction.getValue()) { case ServiceFlowDirection.LEFTTORIGHT_VALUE: { cell.setText("-->"); }// ww w.j a va 2 s .c o m break; case ServiceFlowDirection.RIGHTTOLEFT_VALUE: { cell.setText("<--"); } break; } } else { cell.setText("-"); } } } else if (element instanceof ReferenceRelationship) { ReferenceRelationship referenceRelationship = (ReferenceRelationship) element; if (referenceRelationship.eIsSet(LibraryPackage.Literals.REFERENCE_RELATIONSHIP__PROTOCOL_REF)) { Protocol protocolRef = referenceRelationship.getProtocolRef(); // Set the name of the Node Type. StyledString styledString = new StyledString(protocolRef.getName(), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else { cell.setText("-"); } } }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn2(ViewerCell cell, Object element) { if (element instanceof ServiceFlowRelationship) { ServiceFlowRelationship rel = (ServiceFlowRelationship) element; if (rel.eIsSet(ServicesPackage.Literals.SERVICE_FLOW_RELATIONSHIP__REFERENCE_RELATIONSHIP)) { ReferenceRelationship referenceRelationship = rel.getReferenceRelationship(); // Set the name of the Node Type. StyledString styledString = new StyledString(); NodeType nt1 = referenceRelationship.getRefInterface1Ref(); NodeType nt2 = referenceRelationship.getRefInterface2Ref(); StringBuffer buf = new StringBuffer(); buf.append(" ("); buf.append(nt1 != null ? nt1.getName() : " ?"); buf.append(" <--> "); buf.append(nt2 != null ? nt2.getName() : " ?"); buf.append(")"); String typedName = referenceRelationship.getName(); styledString.append(typedName != null && typedName.length() > 0 ? referenceRelationship.getName() + " :" + buf.toString() : buf.toString());/*w w w . ja v a 2s . c o m*/ // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); cell.setText(styledString.getString()); } else if (rel.eIsSet(ServicesPackage.Literals.SERVICE_FLOW_RELATIONSHIP__SERVICE_FLOW)) { ServiceFlow serviceFlow = rel.getServiceFlow(); StringBuffer buf = new StringBuffer(); buf.append("["); buf.append(serviceFlow.getName()); buf.append("]"); cell.setText(buf.toString()); } else { cell.setText("-"); } } else if (element instanceof ReferenceRelationship) { ReferenceRelationship referenceRelationship = (ReferenceRelationship) element; if (referenceRelationship.eIsSet(LibraryPackage.Literals.REFERENCE_RELATIONSHIP__REF_INTERFACE1_REF)) { NodeType nodeTypeRef = referenceRelationship.getRefInterface1Ref(); // Set the name of the Node Type. StyledString styledString = new StyledString(nodeTypeRef.getName(), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else { cell.setText("-"); } } }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn3(ViewerCell cell, Object element) { if (element instanceof ServiceFlowRelationship) { ServiceFlowRelationship rel = (ServiceFlowRelationship) element; if (rel.eIsSet(ServicesPackage.Literals.SERVICE_FLOW_RELATIONSHIP__REFERENCE_RELATIONSHIP)) { ReferenceRelationship referenceRelationship = rel.getReferenceRelationship(); // Check if the interface is set. if (referenceRelationship .eIsSet(LibraryPackage.Literals.REFERENCE_RELATIONSHIP__REF_INTERFACE1_REF)) { NodeType nodeTypeRef = referenceRelationship.getRefInterface1Ref(); // Set the name of the Node Type. StyledString styledString = new StyledString(nodeTypeRef.getName(), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); }/*from w ww .j a va 2 s . c o m*/ } else { cell.setText("-"); } } else if (element instanceof ReferenceRelationship) { ReferenceRelationship referenceRelationship = (ReferenceRelationship) element; if (referenceRelationship.eIsSet(LibraryPackage.Literals.REFERENCE_RELATIONSHIP__REF_INTERFACE2_REF)) { NodeType nodeTypeRef = referenceRelationship.getRefInterface2Ref(); // Set the name of the Node Type. StyledString styledString = new StyledString(nodeTypeRef.getName(), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else { cell.setText("-"); } } }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn1(ViewerCell cell, Object element) { if (element instanceof ServiceFlow) { ServiceFlow serviceFlow = (ServiceFlow) element; StyledString styledString = new StyledString(serviceFlow.getName(), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else if (element instanceof ReferenceRelationship) { ////from www . j a v a 2 s . co m ReferenceRelationship rel = (ReferenceRelationship) element; StyledString styledString = new StyledString(); if (rel.eIsSet(LibraryPackage.Literals.REFERENCE_RELATIONSHIP__NAME)) { styledString.append(rel.getName(), null); } // Styler metricColorStyler = // StyledString.createColorRegistryStyler( // YELLOW_COLOR_STYLER, null); NodeType nt1 = rel.getRefInterface1Ref(); NodeType nt2 = rel.getRefInterface2Ref(); StringBuffer buf = new StringBuffer(); buf.append(" ("); buf.append(nt1 != null ? nt1.getName() : " ?"); buf.append(" <--> "); buf.append(nt2 != null ? nt2.getName() : " ?"); buf.append(")"); // // Set the name of the Node Type. styledString.append(buf.toString(), StyledString.COUNTER_STYLER); // cell.setText(styledString.getString()); // // // Image img = ResourceManager.getPluginImage( // // // "com.netxforge.netxstudio.models.edit", // // // "icons/full/obj16/Company_H.png"); // // // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); cell.setText(styledString.getString()); } }
From source file:com.netxforge.netxstudio.callflow.screens.CallFlowsTreeLabelProvider.java
License:Open Source License
private void updateColumn0(ViewerCell cell, Object element) { if (element instanceof ServiceFlow) { ServiceFlow serviceFlow = (ServiceFlow) element; StyledString styledString = new StyledString(indexFor(null, serviceFlow), null); cell.setText(styledString.getString()); // Image img = ResourceManager.getPluginImage( // "com.netxforge.netxstudio.models.edit", // "icons/full/obj16/Company_H.png"); // cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else if (element instanceof ReferenceRelationship) { ReferenceRelationship relationship = (ReferenceRelationship) element; StyledString styledString = new StyledString( indexFor(LibraryPackage.Literals.REFERENCE_NETWORK__REF_RELATIONSHIPS, relationship), null); cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); }// w w w. j av a 2 s .com }
From source file:com.netxforge.netxstudio.callflow.screens.nodetypes.NodeTypeTreeLabelProvider.java
License:Open Source License
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); if (element instanceof ReferenceNetwork) { ReferenceNetwork network = (ReferenceNetwork) element; StyledString styledString = new StyledString(network.getName() != null ? network.getName() : "?", null); // String decoration = " (" + network.getFunctions().size() + // " Functions)" // + " (" + network.getFunctions().size() + " Equipments)"; // styledString.append(decoration, StyledString.COUNTER_STYLER); cell.setText(styledString.getString()); Image img = ResourceManager.getPluginImage("com.netxforge.netxstudio.models.edit", "icons/full/obj16/Network_H.png"); cell.setImage(img);//w ww. j a va 2 s. c o m cell.setStyleRanges(styledString.getStyleRanges()); } else if (element instanceof NodeType) { NodeType nt = (NodeType) element; // NodeTypeSummary tt = (NodeTypeSummary) stateModel.summary(nt); // tt.compute(null); StyledString styledString = new StyledString(nt.getName() != null ? nt.getName() : "?", null); // String decoration = " (" + tt.getFunctionCountAsString() + // " Functions)" // + " (" + tt.getEquipmentCountAsString() + " Equipments)"; // styledString.append(decoration, StyledString.COUNTER_STYLER); cell.setText(styledString.getString()); Image img = ResourceManager.getPluginImage("com.netxforge.netxstudio.models.edit", "icons/full/obj16/Node_H.png"); cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else if (element instanceof Function) { Function fc = (Function) element; StyledString styledString = new StyledString(fc.getName() != null ? fc.getName() : "?", null); String decoration = " (" + fc.getResourceRefs().size() + " Resources)"; styledString.append(decoration, StyledString.COUNTER_STYLER); cell.setText(styledString.getString()); Image img = ResourceManager.getPluginImage("com.netxforge.netxstudio.models.edit", "icons/full/obj16/Function_H.png"); cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else if (element instanceof Equipment) { Equipment eq = (Equipment) element; StyledString styledString = new StyledString( eq.getEquipmentCode() != null ? eq.getEquipmentCode() : "?", null); String decoration = " (" + eq.getResourceRefs().size() + " Resources)"; styledString.append(decoration, StyledString.COUNTER_STYLER); cell.setText(styledString.getString()); Image img = ResourceManager.getPluginImage("com.netxforge.netxstudio.models.edit", "icons/full/obj16/Equipment_H.png"); cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } else if (element instanceof NetXResource) { NetXResource eq = (NetXResource) element; StyledString styledString = new StyledString(eq.getShortName() != null ? eq.getShortName() : "?", null); // String decoration = " (" + eq.getResources().size() + // " Resources)"; // styledString.append(decoration, StyledString.COUNTER_STYLER); cell.setText(styledString.getString()); Image img = ResourceManager.getPluginImage("com.netxforge.netxstudio.models.edit", "icons/full/obj16/Resource_H.gif"); cell.setImage(img); cell.setStyleRanges(styledString.getStyleRanges()); } }