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

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

Introduction

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

Prototype

public void setImage(Image image) 

Source Link

Document

Set the Image for the cell.

Usage

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 w  ww. ja v  a2s . com*/
    cell.setText(styledString.getString());
    cell.setImage(null);
    cell.setStyleRanges(styledString.getStyleRanges());
}

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);
    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 {// ww w.  j  av a2  s . c  o  m
            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 {//from w  w  w. j  ava 2  s . c  o m
        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.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   ww  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 source file:org.bonitasoft.studio.debug.wizard.DebugConnectorLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    Object object = cell.getElement();
    if (object instanceof Connector) {
        super.update(cell);
    } else {// ww  w. j  a v  a2 s . co m
        cell.setText(getText(object));
        cell.setImage(getImage(object));
    }
}

From source file:org.bonitasoft.studio.diagram.custom.wizard.DiagramLabelProvider.java

License:Open Source License

@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.getMigrationReport() != null) {
            styledString.append(" -- ", StyledString.DECORATIONS_STYLER);
            styledString.append(Messages.migrationOngoing, StyledString.COUNTER_STYLER);
        }// www  .  j av  a  2s  . c  o  m

        cell.setText(styledString.getString());
        cell.setImage(fileStoreLabelProvider.getImage(filseStore));
        cell.setStyleRanges(styledString.getStyleRanges());
    }
    super.update(cell);
}

From source file:org.bonitasoft.studio.expression.editor.provider.ExpressionTypeLabelProvider.java

License:Open Source License

@Override
public void update(ViewerCell cell) {
    cell.setText(getText(cell.getElement()));
    cell.setImage(getImage(cell.getElement()));
}

From source file:org.bonitasoft.studio.expression.editor.viewer.ExpressionCollectionEditingSupport.java

License:Open Source License

@Override
protected void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) {
    super.initializeCellEditorValue(cellEditor, cell);
    cell.setImage(null);
    cell.setText("");
}