use of eu.esdihumboldt.hale.ui.function.contribution.internal.AbstractWizardAction in project hale by halestudio.
the class AbstractFunctionWizardContribution method fill.
/**
* @see ContributionItem#fill(Menu, int)
*/
@Override
public void fill(Menu menu, int index) {
boolean added = false;
AlignmentService alignmentService = PlatformUI.getWorkbench().getService(AlignmentService.class);
List<AbstractWizardAction<?>> augmentationActions = new ArrayList<AbstractWizardAction<?>>();
for (FunctionWizardDescriptor<?> descriptor : getFunctionWizardDescriptors()) {
if (!descriptor.getFunction().isAugmentation() || showAugmentations) {
AbstractWizardAction<?> action = createWizardAction(descriptor, alignmentService);
if (action.isActive()) {
if (descriptor.getFunction().isAugmentation()) {
augmentationActions.add(action);
} else {
IContributionItem item = new ActionContributionItem(action);
item.fill(menu, index++);
added = true;
}
}
}
}
if (!augmentationActions.isEmpty()) {
if (added) {
new Separator().fill(menu, index++);
}
// get augmentation target name
// ISelection selection = selectionService.getSelection();
// AlignmentInfo info = null;
//
// if (selection instanceof DefaultSchemaSelection) {
// SchemaSelection schemaSelection = (SchemaSelection) selection;
// info = new SchemaSelectionInfo(schemaSelection, alignmentService);
// }
// else if (selection instanceof CellSelection) {
// CellSelection cellSelection = (CellSelection) selection;
// info = new CellSelectionInfo(cellSelection);
// }
//
String augmentations;
// if (info != null && info.getTargetItemCount() == 1) {
// augmentations = MessageFormat.format(Messages.FunctionWizardContribution_0, info.getFirstTargetItem().getName().getLocalPart());
// }
// else {
augmentations = Messages.FunctionWizardContribution_1;
// }
//
MenuItem augItem = new MenuItem(menu, SWT.PUSH, index++);
augItem.setText(augmentations);
augItem.setEnabled(false);
new Separator().fill(menu, index++);
for (AbstractWizardAction<?> action : augmentationActions) {
IContributionItem item = new ActionContributionItem(action);
item.fill(menu, index++);
added = true;
}
}
if (!added) {
MenuItem item = new MenuItem(menu, SWT.PUSH, index++);
// $NON-NLS-1$
item.setText(Messages.FunctionWizardContribution_2);
item.setEnabled(false);
}
}
Aggregations