cell.setImage(bundleFolderImg);
cell.setText("Required Bundles");
}
} else if (cell.getElement() instanceof ImportUsedByPackage) {
if (cell.getColumnIndex() == 0) {
StyledString styledString = new StyledString("Used By: ", UIConstants.ITALIC_QUALIFIER_STYLER);
styledString.append(((ImportUsedByPackage) cell.getElement()).usedByName);
cell.setText(styledString.getString());
cell.setStyleRanges(styledString.getStyleRanges());
}
} else if (cell.getElement() instanceof ImportUsedByClass) {
if (cell.getColumnIndex() == 0) {
ImportUsedByClass importUsedBy = (ImportUsedByClass) cell.getElement();
String fqn = importUsedBy.clazz.getFQN();
String className = fqn.substring(fqn.lastIndexOf('.') + 1);
cell.setText(className);
cell.setImage(classImg);
}
} else if (cell.getElement() instanceof ExportUsesPackage) {
if (cell.getColumnIndex() == 0) {
StyledString styledString = new StyledString("Uses: ", UIConstants.ITALIC_QUALIFIER_STYLER);
styledString.append(((ExportUsesPackage) cell.getElement()).name);
cell.setText(styledString.getString());
cell.setStyleRanges(styledString.getStyleRanges());
}
} else if (cell.getElement() instanceof RequiredBundle) {
RequiredBundle rb = (RequiredBundle) cell.getElement();
switch (cell.getColumnIndex()) {
case 0 :
StyledString label;
if (rb.isSatisfied())
label = new StyledString(rb.getName(), StyledString.QUALIFIER_STYLER);
else
label = new StyledString(rb.getName());
String version = rb.getAttribs().get(Constants.BUNDLE_VERSION_ATTRIBUTE);
if (version != null)
label.append(" " + version, StyledString.COUNTER_STYLER);
String resolution = rb.getAttribs().get(Constants.RESOLUTION_DIRECTIVE);
boolean optional = org.osgi.framework.Constants.RESOLUTION_OPTIONAL.equals(resolution);
if (resolution != null)
label.append(" <" + resolution + ">", UIConstants.ITALIC_QUALIFIER_STYLER);
cell.setText(label.getString());
cell.setStyleRanges(label.getStyleRanges());
if (optional)
cell.setImage(requiredBundleOptImg);
else if (rb.isSatisfied())
cell.setImage(requiredBundleSatisfiedImg);
else
cell.setImage(requiredBundleImg);
break;
case 1 :
cell.setText(formatAttribs(rb.getAttribs()));
break;
default :
break;
}
} else if (cell.getElement() instanceof ImportPackage || cell.getElement() instanceof ExportPackage) {
HeaderClause entry = (HeaderClause) cell.getElement();
switch (cell.getColumnIndex()) {
case 0 :
boolean selfImport = false;
if (entry instanceof ImportPackage) {
selfImport = ((ImportPackage) entry).isSelfImport();
}
StyledString styledString;
if (selfImport) {
styledString = new StyledString(entry.getName(), StyledString.QUALIFIER_STYLER);
} else {
styledString = new StyledString(entry.getName());
}
String version = entry.getAttribs().get(Constants.VERSION_ATTRIBUTE);
if (version != null)
styledString.append(" " + version, StyledString.COUNTER_STYLER);
String resolution = entry.getAttribs().get(Constants.RESOLUTION_DIRECTIVE);
boolean optional = org.osgi.framework.Constants.RESOLUTION_OPTIONAL.equals(resolution);
if (resolution != null) {
styledString.append(" <" + resolution + ">", UIConstants.ITALIC_QUALIFIER_STYLER);
}
cell.setText(styledString.getString());
cell.setStyleRanges(styledString.getStyleRanges());
if (optional) {
cell.setImage(packageOptImg);
} else if (selfImport) {
cell.setImage(packageImpExpImg);
} else {