use of eu.esdihumboldt.hale.ui.common.definition.viewer.DefinitionLabelProvider in project hale by halestudio.
the class DataSetTypeSelectionDialog method setupViewer.
@Override
protected void setupViewer(TreeViewer viewer, Pair<TypeDefinition, DataSet> initialSelection) {
viewer.setLabelProvider(new DefinitionLabelProvider(viewer) {
@Override
public String getText(Object element) {
if (element instanceof DataSet) {
switch((DataSet) element) {
case TRANSFORMED:
return "Transformed";
case SOURCE:
default:
return "Source";
}
}
if (element instanceof Pair) {
element = ((Pair<?, ?>) element).getFirst();
}
return super.getText(element);
}
@Override
public Image getImage(Object element) {
if (element instanceof DataSet) {
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
}
if (element instanceof Pair) {
element = ((Pair<?, ?>) element).getFirst();
}
return super.getImage(element);
}
});
viewer.setContentProvider(new TypeIndexContentProvider(viewer) {
@Override
public Object[] getElements(Object inputElement) {
return types.keySet().toArray();
}
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof DataSet) {
DataSet dataSet = (DataSet) parentElement;
List<Pair<TypeDefinition, DataSet>> typeList = new ArrayList<Pair<TypeDefinition, DataSet>>();
for (TypeDefinition type : types.get(dataSet)) {
typeList.add(new Pair<TypeDefinition, DataSet>(type, dataSet));
}
return typeList.toArray();
}
return new Object[] {};
}
@Override
public boolean hasChildren(Object parentElement) {
return parentElement instanceof DataSet && !types.get((DataSet) parentElement).isEmpty();
}
});
viewer.setAutoExpandLevel(2);
viewer.setInput(types);
if (initialSelection != null) {
viewer.setSelection(new StructuredSelection(initialSelection));
}
}
use of eu.esdihumboldt.hale.ui.common.definition.viewer.DefinitionLabelProvider in project hale by halestudio.
the class PropertyDefinitionDialog method setupViewer.
@Override
protected void setupViewer(TreeViewer viewer, EntityDefinition initialSelection) {
viewer.setLabelProvider(new DefinitionLabelProvider(viewer));
viewer.setContentProvider(new TreePathProviderAdapter(new TypePropertyContentProvider(viewer)));
viewer.setInput(parentType);
if (initialSelection != null) {
viewer.setSelection(new StructuredSelection(initialSelection));
}
}
use of eu.esdihumboldt.hale.ui.common.definition.viewer.DefinitionLabelProvider in project hale by halestudio.
the class TypeDefinitionDialog method setupViewer.
@Override
protected void setupViewer(TreeViewer viewer, TypeDefinition initialSelection) {
viewer.setLabelProvider(new DefinitionLabelProvider(viewer));
viewer.setContentProvider(new TypesContentProvider(viewer));
viewer.setInput(types);
if (initialSelection != null) {
viewer.setSelection(new StructuredSelection(initialSelection));
}
}
Aggregations