use of eu.esdihumboldt.hale.common.schema.presets.extension.SchemaCategory in project hale by halestudio.
the class SchemaPresetLabelProvider method update.
@Override
public void update(ViewerCell cell) {
Object element = cell.getElement();
StyledString text = new StyledString();
if (element instanceof SchemaPreset) {
SchemaPreset schema = (SchemaPreset) element;
text.append(schema.getName());
}
if (element instanceof SchemaCategory) {
text.append(((SchemaCategory) element).getName());
}
if (element instanceof SchemaPreset) {
SchemaPreset preset = (SchemaPreset) element;
String version = preset.getVersion();
if (version != null) {
text.append(" " + version, StyledString.COUNTER_STYLER);
}
String tag = preset.getTag();
if (tag != null) {
text.append(" (" + tag + ")", StyledString.DECORATIONS_STYLER);
}
}
// NoObject.NONE)
if (element != null && (text.getString() == null || text.getString().isEmpty())) {
text.append(getText(element));
}
cell.setImage(getImage(element));
cell.setText(text.toString());
cell.setStyleRanges(text.getStyleRanges());
super.update(cell);
}
use of eu.esdihumboldt.hale.common.schema.presets.extension.SchemaCategory in project hale by halestudio.
the class SchemaPresetLabelProvider method getImage.
@Override
public Image getImage(Object element) {
if (element instanceof SchemaPreset) {
SchemaPreset schema = (SchemaPreset) element;
URL iconURL = schema.getIconURL();
if (iconURL != null) {
String key = iconURL.toString();
Image image = urlImages.get(key);
if (image == null) {
image = ImageDescriptor.createFromURL(iconURL).createImage();
urlImages.put(key, image);
}
return image;
}
return defImage;
}
if (element instanceof SchemaCategory) {
return categoryImage;
}
return null;
}
use of eu.esdihumboldt.hale.common.schema.presets.extension.SchemaCategory in project hale by halestudio.
the class PredefinedSchemaImpl method getCategoryId.
@Override
public String getCategoryId() {
String catId = element.getAttribute("category");
// check if category actually exists
SchemaCategory cat = SchemaCategoryExtension.getInstance().get(catId);
if (cat != null) {
return catId;
} else {
return null;
}
}
Aggregations