Example usage for org.eclipse.jface.viewers ViewerCell setText

List of usage examples for org.eclipse.jface.viewers ViewerCell setText

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ViewerCell setText.

Prototype

public void setText(String text) 

Source Link

Document

Set the text for the cell.

Usage

From source file:org.bonitasoft.studio.actors.ui.section.StyledFilterLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    if (cell.getElement() instanceof ActorFilter) {
        ActorFilter filter = (ActorFilter) cell.getElement();
        ConnectorDefinition def = defStore.getDefinition(filter.getDefinitionId(),
                filter.getDefinitionVersion());
        StyledString styledString = new StyledString();

        styledString.append(getText(filter), null);
        styledString.append(" -- ", StyledString.QUALIFIER_STYLER);
        String connectorType = filter.getDefinitionId() + " (" + filter.getDefinitionVersion() + ")";
        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);
        }//w w w  . java  2 s. co m
        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() + ")"));
        }

        cell.setText(styledString.getString());
        cell.setImage(getImage(filter));
        cell.setStyleRanges(styledString.getStyleRanges());
    }
}

From source file:org.bonitasoft.studio.actors.ui.wizard.page.OrganizationLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    String orgaName = getText(cell.getElement());
    String activeOrganization = BonitaStudioPreferencesPlugin.getDefault().getPreferenceStore()
            .getString(ActorsPreferenceConstants.DEFAULT_ORGANIZATION);
    StyledString styledString = new StyledString();
    styledString.append(orgaName, null);
    if (orgaName.equals(activeOrganization)) {
        styledString.append("  (" + Messages.active + ")", boldgreen);
    }/*from   www.  j  av  a  2  s. c  o m*/
    cell.setText(styledString.getString());
    cell.setImage(null);
    cell.setStyleRanges(styledString.getStyleRanges());
}

From source file:org.bonitasoft.studio.businessobject.ui.BusinessObjectDataStyledLabelProvider.java

License:Open Source License

@Override
public void update(final ViewerCell cell) {
    super.update(cell);
    if (cell.getElement() instanceof BusinessObjectData) {
        final BusinessObjectData data = (BusinessObjectData) cell.getElement();
        if (!businessObjectDefinitionExists(data)) {
            final StyledString styledString = createStrikethroughStyle(cell.getText(), data.getClassName());
            cell.setText(styledString.getString());
            cell.setStyleRanges(styledString.getStyleRanges());
        }//from  ww  w.  ja  v a  2s  . c  om
    }
}

From source file:org.bonitasoft.studio.businessobject.ui.expression.ReferencedExpressionEditingSupport.java

License:Open Source License

@Override
protected void initializeCellEditorValue(final CellEditor cellEditor, final ViewerCell cell) {
    super.initializeCellEditorValue(cellEditor, cell);
    cell.setImage(null);//from ww  w  .ja v a 2 s  .  co m
    cell.setText("");
}

From source file:org.bonitasoft.studio.common.jface.DataStyledTreeLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    if (cell.getElement() instanceof Data) {
        Data d = (Data) cell.getElement();
        StyledString styledString = new StyledString();

        String decoration = " -- " + getTypeLabel(d);
        if (d.isTransient()) {
            styledString.append(d.getName(), italicGrey);
        } else {//from  w w w  . ja  v a  2s  .c  om
            styledString.append(d.getName(), null);
        }
        styledString.append(decoration, StyledString.DECORATIONS_STYLER);
        if (d.getDefaultValue() != null && d.getDefaultValue().getName() != null
                && !d.getDefaultValue().getName().isEmpty()) {
            String content = d.getDefaultValue().getName();
            content = Messages.defaultValue + ": " + content.replaceAll("\n", " ");
            styledString.append(" -- ", StyledString.DECORATIONS_STYLER);
            styledString.append(content, StyledString.QUALIFIER_STYLER);
        }

        cell.setText(styledString.getString());
        cell.setImage(getImage(d));
        cell.setStyleRanges(styledString.getStyleRanges());
    }
}

From source file:org.bonitasoft.studio.common.refactoring.DiffTreeLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    StyledString styledString = new StyledString();

    DiffNode node = (DiffNode) cell.getElement();
    if (node.getLeft() != null) {
        styledString.append(getText(cell.getElement()), boldgreen);
    } else {/*ww  w .  ja  v  a 2  s  .com*/
        styledString.append(getText(cell.getElement()));
    }
    cell.setText(styledString.getString());
    cell.setImage(getImage(cell.getElement()));
    cell.setStyleRanges(styledString.getStyleRanges());

}

From source file:org.bonitasoft.studio.connectors.ui.provider.DatabaseDriversLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    if (cell.getElement() instanceof String) {
        String s = (String) cell.getElement();
        StyledString styledString = new StyledString();
        styledString.append(s, null);/*from  ww  w  .j a  va2  s. c  om*/
        if (s.equals(defaultDriver)) {
            styledString.append(" (Active)", boldgreen);
        }
        cell.setText(styledString.getString());
        cell.setStyleRanges(styledString.getStyleRanges());
    }
}

From source file:org.bonitasoft.studio.connectors.ui.provider.StyledConnectorLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    if (cell.getElement() instanceof Connector) {
        Connector connector = (Connector) cell.getElement();
        ConnectorDefinition def = connectorDefStore.getDefinition(connector.getDefinitionId(),
                connector.getDefinitionVersion(), definitions);
        if (def == null) {
            def = connectorDefStore.getDefinition(connector.getDefinitionId(),
                    connector.getDefinitionVersion());
        }/*from  w  w w.j  a v a  2  s  .  c o m*/
        StyledString styledString = new StyledString();

        styledString.append(getText(connector), null);
        styledString.append(" -- ", StyledString.QUALIFIER_STYLER);
        String connectorType = connector.getDefinitionId() + " (" + connector.getDefinitionVersion() + ")";
        styledString.append(connectorType, StyledString.DECORATIONS_STYLER);
        EObject parent = connector.eContainer();
        if (!(parent instanceof Expression) && !(parent instanceof Form)
                && !(parent instanceof SubmitFormButton)) {
            if (connector.getEvent() != null && !connector.getEvent().isEmpty()) {
                styledString.append(" -- ", StyledString.QUALIFIER_STYLER);
                styledString.append(connector.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.connectorDefinitionNotFound,
                    connector.getDefinitionId() + " (" + connector.getDefinitionVersion() + ")"));
        }

        cell.setText(styledString.getString());
        cell.setImage(getImage(connector));
        cell.setStyleRanges(styledString.getStyleRanges());
    }
}

From source file:org.bonitasoft.studio.contract.ui.expression.ContractInputLabelProvider.java

License:Open Source License

@Override
public void update(final ViewerCell cell) {
    super.update(cell);
    final ContractInput element = (ContractInput) cell.getElement();
    final StyledString styledString = getStyledString(element);
    cell.setText(styledString.toString());
    cell.setStyleRanges(styledString.getStyleRanges());
    cell.setImage(getImage(element));//from   w  w w .  ja v  a  2s .c o m
}