use of eu.esdihumboldt.hale.ui.util.bbr.Documentation in project hale by halestudio.
the class AbstractDocumentationTextSection method refresh.
/**
* @see AbstractPropertySection#refresh()
*/
@Override
public void refresh() {
DocumentationService ds = PlatformUI.getWorkbench().getService(DocumentationService.class);
Documentation doc = ds.getDocumentation(getDefinition());
String desc = (doc == null) ? (null) : (getDocumentationText(doc));
if (desc == null) {
desc = "";
}
descriptionText.setText(desc);
}
use of eu.esdihumboldt.hale.ui.util.bbr.Documentation in project hale by halestudio.
the class AbstractDocumentationFilter method isFiltered.
@Override
public boolean isFiltered(Definition<?> input) {
if (!input.getName().getNamespaceURI().equals(DocumentationServiceImpl.NS_URI_AGEOBW)) {
// namespace does not match
return true;
}
DocumentationService ds = PlatformUI.getWorkbench().getService(DocumentationService.class);
Documentation doc = ds.getDocumentation(input);
if (doc == null) {
return true;
}
return !accept(doc);
}
use of eu.esdihumboldt.hale.ui.util.bbr.Documentation in project hale by halestudio.
the class ValuesSection method refresh.
/**
* @see AbstractPropertySection#refresh()
*/
@Override
public void refresh() {
DocumentationService ds = PlatformUI.getWorkbench().getService(DocumentationService.class);
Documentation doc = ds.getDocumentation(getDefinition());
if (doc != null) {
values.setInput(doc.getValues());
if (!doc.getValues().isEmpty()) {
// select the first entry
values.setSelection(new StructuredSelection(doc.getValues().iterator().next()));
}
} else {
values.setInput(null);
}
}
use of eu.esdihumboldt.hale.ui.util.bbr.Documentation in project hale by halestudio.
the class ValuesSection method createControls.
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
Composite composite = getWidgetFactory().createFlatFormComposite(parent);
FormData data;
descriptionText = // $NON-NLS-1$
getWidgetFactory().createText(// $NON-NLS-1$
composite, // $NON-NLS-1$
"", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
descriptionText.setEditable(false);
data = new FormData();
data.width = 100;
data.height = 100;
// STANDARD_LABEL_WIDTH);
data.left = new FormAttachment(0, 250);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
data.bottom = new FormAttachment(100, -ITabbedPropertyConstants.VSPACE);
descriptionText.setLayoutData(data);
values = new ListViewer(getWidgetFactory().createList(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL));
data = new FormData();
data.height = 100;
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(descriptionText, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(descriptionText, 0, SWT.TOP);
values.getControl().setLayoutData(data);
values.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof Documentation) {
Documentation doc = (Documentation) element;
StringBuilder result = new StringBuilder();
boolean usable = (doc.isInUse() && !doc.getUseDiffers()) || (!doc.isInUse() && doc.getUseDiffers());
if (usable) {
result.append(doc.getCode());
} else {
// display values that are not in use in brackets
result.append('(');
result.append(doc.getCode());
result.append(')');
}
/*
* Mark use conflict with an asterisk. Only a conflict if
* something is wrongly classified as not in use.
*/
if (!doc.isInUse() && doc.getUseDiffers()) {
result.append('*');
}
return result.toString();
}
return super.getText(element);
}
});
values.setContentProvider(ArrayContentProvider.getInstance());
values.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
// display documentation on selected value
ISelection sel = event.getSelection();
if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
Documentation doc = (Documentation) ((IStructuredSelection) sel).getFirstElement();
String text = getDocumentationText(doc);
if (text != null) {
descriptionText.setText(text);
} else {
descriptionText.setText("");
}
descriptionText.setEnabled(text != null);
} else {
descriptionText.setText("");
descriptionText.setEnabled(false);
}
}
});
}
Aggregations