Search in sources :

Example 1 with IWorkbenchMenuInterceptorPlugin

use of org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin in project jo-client-platform by jo-source.

the class CapWorkbenchActionsProviderImpl method saveAction.

@Override
public IDataModelAction saveAction() {
    IDataModelAction result = Toolkit.getValue(SAVE_ACTION_KEY);
    if (result == null) {
        IDataModelActionBuilder builder = actionFactory.dataModelSaveActionBuilder();
        for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
            builder = plugin.getMenuInterceptor().saveAction(builder);
            if (builder == null) {
                break;
            }
        }
        if (builder != null) {
            result = builder.build();
        } else {
            result = null;
        }
        Toolkit.setValue(SAVE_ACTION_KEY, result);
    }
    return result;
}
Also used : IDataModelActionBuilder(org.jowidgets.cap.ui.api.command.IDataModelActionBuilder) IWorkbenchMenuInterceptorPlugin(org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Example 2 with IWorkbenchMenuInterceptorPlugin

use of org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin in project jo-client-platform by jo-source.

the class CapWorkbenchActionsProviderImpl method cancelAction.

@Override
public IDataModelAction cancelAction() {
    IDataModelAction result = Toolkit.getValue(CANCEL_ACTION_KEY);
    if (result == null) {
        IDataModelActionBuilder builder = actionFactory.dataModelCancelActionBuilder();
        for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
            builder = plugin.getMenuInterceptor().cancelAction(builder);
            if (builder == null) {
                break;
            }
        }
        if (builder != null) {
            result = builder.build();
        } else {
            result = null;
        }
        Toolkit.setValue(CANCEL_ACTION_KEY, result);
    }
    return result;
}
Also used : IDataModelActionBuilder(org.jowidgets.cap.ui.api.command.IDataModelActionBuilder) IWorkbenchMenuInterceptorPlugin(org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Example 3 with IWorkbenchMenuInterceptorPlugin

use of org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin in project jo-client-platform by jo-source.

the class CapWorkbenchActionsProviderImpl method loadAction.

@Override
public IDataModelAction loadAction() {
    IDataModelAction result = Toolkit.getValue(LOAD_ACTION_KEY);
    if (result == null) {
        IDataModelActionBuilder builder = actionFactory.dataModelLoadActionBuilder();
        for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
            builder = plugin.getMenuInterceptor().loadAction(builder);
            if (builder == null) {
                break;
            }
        }
        if (builder != null) {
            result = builder.build();
        } else {
            result = null;
        }
        Toolkit.setValue(LOAD_ACTION_KEY, result);
    }
    return result;
}
Also used : IDataModelActionBuilder(org.jowidgets.cap.ui.api.command.IDataModelActionBuilder) IWorkbenchMenuInterceptorPlugin(org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Example 4 with IWorkbenchMenuInterceptorPlugin

use of org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin 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;
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel) IAction(org.jowidgets.api.command.IAction) ISeparatorItemModel(org.jowidgets.api.model.item.ISeparatorItemModel) IMenuModel(org.jowidgets.api.model.item.IMenuModel) MenuModel(org.jowidgets.tools.model.item.MenuModel) IMenuItemModel(org.jowidgets.api.model.item.IMenuItemModel) IWorkbenchMenuInterceptorPlugin(org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Example 5 with IWorkbenchMenuInterceptorPlugin

use of org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin in project jo-client-platform by jo-source.

the class CapWorkbenchActionsProviderImpl method undoAction.

@Override
public IDataModelAction undoAction() {
    IDataModelAction result = Toolkit.getValue(UNDO_ACTION_KEY);
    if (result == null) {
        IDataModelActionBuilder builder = actionFactory.dataModelUndoActionBuilder();
        for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
            builder = plugin.getMenuInterceptor().undoAction(builder);
            if (builder == null) {
                break;
            }
        }
        if (builder != null) {
            result = builder.build();
        } else {
            result = null;
        }
        Toolkit.setValue(UNDO_ACTION_KEY, result);
    }
    return result;
}
Also used : IDataModelActionBuilder(org.jowidgets.cap.ui.api.command.IDataModelActionBuilder) IWorkbenchMenuInterceptorPlugin(org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Aggregations

IWorkbenchMenuInterceptorPlugin (org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin)7 IDataModelAction (org.jowidgets.cap.ui.api.command.IDataModelAction)6 IDataModelActionBuilder (org.jowidgets.cap.ui.api.command.IDataModelActionBuilder)4 IAction (org.jowidgets.api.command.IAction)2 ISeparatorItemModel (org.jowidgets.api.model.item.ISeparatorItemModel)2 IMenuItemModel (org.jowidgets.api.model.item.IMenuItemModel)1 IMenuModel (org.jowidgets.api.model.item.IMenuModel)1 IToolBarItemModel (org.jowidgets.api.model.item.IToolBarItemModel)1 IToolBarModel (org.jowidgets.api.model.item.IToolBarModel)1 IRefreshLookUpsActionBuilder (org.jowidgets.cap.ui.api.command.IRefreshLookUpsActionBuilder)1 MenuModel (org.jowidgets.tools.model.item.MenuModel)1 ToolBarModel (org.jowidgets.tools.model.item.ToolBarModel)1