use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.
the class BeanRelationTreeDetailImpl method addTableActions.
private void addTableActions(final IBeanRelationNodeModel<Object, Object> relationNode, final boolean hasDeleterAction, final IBeanTable<Object> table) {
final IEntityLinkDescriptor link = getLinkDescriptor(relationNode);
int addedActions = 0;
if (link != null && link.getLinkCreatorService() != null) {
final IAction linkCreatorAction = createLinkCreatorAction(relationNode, table, link);
if (linkCreatorAction != null) {
table.getCellPopMenu().addAction(linkCreatorAction);
table.getTablePopupMenu().addAction(linkCreatorAction);
addedActions++;
}
}
if (hasCopyAction) {
final IAction copyAction = createCopyAction(table);
if (copyAction != null) {
table.getCellPopMenu().addAction(copyAction);
addedActions++;
}
}
if (hasPasteAction && link != null && link.getLinkCreatorService() != null) {
final IAction pasteLinkAction = createPasteLinkAction(relationNode, table, link);
if (pasteLinkAction != null) {
table.getCellPopMenu().addAction(pasteLinkAction);
table.getTablePopupMenu().addAction(pasteLinkAction);
addedActions++;
}
}
if (addedActions >= 2) {
table.getCellPopMenu().addSeparator();
}
if (link != null && link.getLinkDeleterService() != null) {
final IAction linkDeleterAction = createLinkDeleterAction(relationNode, table, link);
if (linkDeleterAction != null) {
table.getCellPopMenu().addAction(linkDeleterAction);
}
}
if (hasDeleterAction) {
table.getCellPopMenu().addAction(createDeleterAction(table, relationNode));
}
}
use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.
the class CapWorkbenchMenuFactoryImpl method dataMenu.
@Override
public IMenuModel dataMenu() {
IMenuModel result = new MenuModel(Messages.getString("CapWorkbenchMenuFactoryImpl.data"));
final IDataModelAction loadAction = CapWorkbenchActionsProvider.loadAction();
boolean separator = false;
if (loadAction != null) {
result.addAction(loadAction);
separator = true;
}
final IDataModelAction cancelAction = CapWorkbenchActionsProvider.cancelAction();
if (cancelAction != null) {
result.addAction(cancelAction);
separator = true;
}
if (separator) {
result.addSeparator();
separator = false;
}
final IDataModelAction undoAction = CapWorkbenchActionsProvider.undoAction();
if (undoAction != null) {
result.addAction(undoAction);
separator = true;
}
final IDataModelAction saveAction = CapWorkbenchActionsProvider.saveAction();
if (saveAction != null) {
result.addAction(saveAction);
separator = true;
}
if (separator) {
result.addSeparator();
}
final IAction refreshLookUpsAction = CapWorkbenchActionsProvider.refreshLookUpsAction();
if (refreshLookUpsAction != null) {
result.addAction(refreshLookUpsAction);
}
final int size = result.getChildren().size();
if (size > 0) {
final IMenuItemModel itemModel = result.getChildren().get(size - 1);
if (itemModel instanceof ISeparatorItemModel) {
result.removeItem(itemModel);
}
}
// Modify with plugins
for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
result = plugin.getMenuInterceptor().dataMenuModel(result);
if (result == null) {
break;
}
}
return result;
}
use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.
the class CreatorActionBuilderImpl method decorateActionWithPlugins.
private IAction decorateActionWithPlugins(final IAction action) {
IAction result = action;
final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, ICreatorService.class);
final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
for (final IServiceActionDecoratorPlugin plugin : plugins) {
result = plugin.decorate(result, creatorService);
if (result == null) {
return null;
}
}
return result;
}
use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.
the class DataModelActionBuilderImpl method build.
@Override
public IDataModelAction build() {
actionBuilder.setCommand(new CommandWrapper(abstractDataModelCommand, enabledCheckers));
final IAction action = actionBuilder.build();
return new DataModelAction(action);
}
use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.
the class ExecutorActionBuilderImpl method decorateActionWithPlugins.
private IAction decorateActionWithPlugins(final IAction action) {
IAction result = action;
final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, IExecutorService.class);
final IExecutorService<?> executorService = (IExecutorService<?>) executor;
final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
for (final IServiceActionDecoratorPlugin plugin : plugins) {
result = plugin.decorate(result, executorService);
if (result == null) {
return null;
}
}
return result;
}
Aggregations