use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.
the class TypeEntityDefinitionTester method test.
/**
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
* java.lang.String, java.lang.Object[], java.lang.Object)
*/
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver == null)
return false;
if (property.equals(PROPERTY_TYPE_ALLOW_MARK_UNMAPPABLE) && receiver instanceof TypeEntityDefinition) {
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
TypeEntityDefinition entityDef = (TypeEntityDefinition) receiver;
return as.getAlignment().getCells(entityDef.getType(), entityDef.getSchemaSpace()).isEmpty();
}
return false;
}
use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.
the class ServiceSchemaExplorer method dispose.
/**
* Remove all service listeners.
*/
public void dispose() {
if (schemaListener != null) {
schemaService.removeSchemaServiceListener(schemaListener);
}
if (alignmentListener != null) {
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
as.removeListener(alignmentListener);
}
if (entityListener != null) {
EntityDefinitionService eds = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
eds.removeListener(entityListener);
}
if (geometryListener != null) {
GeometrySchemaService gss = PlatformUI.getWorkbench().getService(GeometrySchemaService.class);
gss.removeListener(geometryListener);
}
if (populationListener != null) {
PopulationService ps = PlatformUI.getWorkbench().getService(PopulationService.class);
ps.removeListener(populationListener);
}
}
use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.
the class TransformationView method dispose.
/**
* @see WorkbenchPart#dispose()
*/
@Override
public void dispose() {
if (alignmentListener != null) {
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
as.removeListener(alignmentListener);
}
if (instanceSampleObserver != null) {
InstanceSampleService iss = PlatformUI.getWorkbench().getService(InstanceSampleService.class);
iss.deleteObserver(instanceSampleObserver);
}
super.dispose();
}
use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.
the class SetPriorityContribution method fill.
/**
* @see AbstractFunctionWizardContribution#fill(Menu, int)
*/
@Override
public void fill(Menu menu, int index) {
if (getOriginalCell() == null)
return;
AlignmentService alignmentService = PlatformUI.getWorkbench().getService(AlignmentService.class);
Cell cell = getOriginalCell();
Priority oldPriority = cell.getPriority();
for (Priority priority : Priority.values()) {
if (priority != oldPriority) {
SetPriorityAction setPriorityAction = new SetPriorityAction(priority, cell.getId(), alignmentService);
IContributionItem item = new ActionContributionItem(setPriorityAction);
item.fill(menu, index++);
}
}
}
use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.
the class TypeCellSelectionDialog method setupViewer.
/**
* @see eu.esdihumboldt.hale.ui.util.selector.AbstractViewerSelectionDialog#setupViewer(org.eclipse.jface.viewers.StructuredViewer,
* java.lang.Object)
*/
@Override
protected void setupViewer(final GraphViewer viewer, Cell initialSelection) {
// content and label provider
viewer.setContentProvider(new ReverseCellGraphContentProvider());
viewer.setLabelProvider(new GraphLabelProvider(viewer, HaleUI.getServiceProvider()));
// layout
final TreeLayoutAlgorithm layout = new TreeLayoutAlgorithm(TreeLayoutAlgorithm.RIGHT_LEFT);
viewer.getControl().addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
int width = viewer.getControl().getSize().x;
layout.setNodeSpace(new Dimension((width - 10) / 3, 30));
}
});
viewer.setLayoutAlgorithm(layout, true);
viewer.applyLayout();
// input and selection
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
viewer.setInput(as.getAlignment().getTypeCells());
if (initialSelection != null)
viewer.setSelection(new StructuredSelection(initialSelection));
}
Aggregations