use of org.jowidgets.api.model.item.ISeparatorItemModel 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.model.item.ISeparatorItemModel in project jo-client-platform by jo-source.
the class CapWorkbenchMenuFactoryImpl method toolBar.
@Override
public IToolBarModel toolBar() {
IToolBarModel result = new ToolBarModel();
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);
}
final IDataModelAction saveAction = CapWorkbenchActionsProvider.saveAction();
if (saveAction != null) {
result.addAction(saveAction);
}
final int size = result.getItems().size();
if (size > 0) {
final IToolBarItemModel itemModel = result.getItems().get(size - 1);
if (itemModel instanceof ISeparatorItemModel) {
result.removeItem(itemModel);
}
}
// Modify with plugins
for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
result = plugin.getMenuInterceptor().toolBarModel(result);
if (result == null) {
break;
}
}
if (result != null) {
return result;
} else {
return new ToolBarModel();
}
}
Aggregations