blob: 38c01cab1e425c638dae2a555b8de6bef6ed8310 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*
* This copyright notice shows up in the generated Java code
*/
package org.eclipse.osbp.xtext.action.jvmmodel;
import com.google.common.base.Objects;
import java.util.Arrays;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.Active;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.osbp.core.api.persistence.IPersistenceService;
import org.eclipse.osbp.datainterchange.api.IDataInterchange;
import org.eclipse.osbp.runtime.common.event.IEventDispatcher;
import org.eclipse.osbp.ui.api.contextfunction.ICommandsProvider;
import org.eclipse.osbp.ui.api.customfields.IBlobService;
import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
import org.eclipse.osbp.ui.api.user.IUser;
import org.eclipse.osbp.utils.annotation.CommonUtils;
import org.eclipse.osbp.vaaclipse.api.VaadinExecutorService;
import org.eclipse.osbp.xtext.action.ActionButton;
import org.eclipse.osbp.xtext.action.ActionChart;
import org.eclipse.osbp.xtext.action.ActionCommand;
import org.eclipse.osbp.xtext.action.ActionDatainterchange;
import org.eclipse.osbp.xtext.action.ActionDialog;
import org.eclipse.osbp.xtext.action.ActionFunction;
import org.eclipse.osbp.xtext.action.ActionPackage;
import org.eclipse.osbp.xtext.action.ActionReport;
import org.eclipse.osbp.xtext.action.ActionSelectWorkload;
import org.eclipse.osbp.xtext.action.ActionSpacer;
import org.eclipse.osbp.xtext.action.ActionTask;
import org.eclipse.osbp.xtext.action.ActionToolbar;
import org.eclipse.osbp.xtext.action.ActionToolbarItem;
import org.eclipse.osbp.xtext.action.ActionType;
import org.eclipse.osbp.xtext.action.ActionUI;
import org.eclipse.osbp.xtext.action.ActionWorkflow;
import org.eclipse.osbp.xtext.action.DialogActionEnum;
import org.eclipse.osbp.xtext.action.UIActionEnum;
import org.eclipse.osbp.xtext.action.common.IToolbarAction;
import org.eclipse.osbp.xtext.datainterchange.DataInterchange;
import org.eclipse.osbp.xtext.datainterchange.jvmmodel.DataDSLJvmModelInferrer;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryPackage;
import org.eclipse.osbp.xtext.messagedsl.MessagePackage;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.common.types.JvmAnnotationReference;
import org.eclipse.xtext.common.types.JvmConstructor;
import org.eclipse.xtext.common.types.JvmDeclaredType;
import org.eclipse.xtext.common.types.JvmField;
import org.eclipse.xtext.common.types.JvmFormalParameter;
import org.eclipse.xtext.common.types.JvmGenericType;
import org.eclipse.xtext.common.types.JvmMember;
import org.eclipse.xtext.common.types.JvmOperation;
import org.eclipse.xtext.common.types.JvmTypeReference;
import org.eclipse.xtext.common.types.JvmVisibility;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.xbase.compiler.output.ITreeAppendable;
import org.eclipse.xtext.xbase.jvmmodel.AbstractModelInferrer;
import org.eclipse.xtext.xbase.jvmmodel.IJvmDeclaredTypeAcceptor;
import org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
/**
* <p>Infers a JVM model from the source model.</p>
*
* <p>The JVM model should contain all elements that would appear in the Java code
* which is generated from the source model. Other models link against the JVM model rather than the source model.</p>
*/
@SuppressWarnings("all")
public class ActionDSLJvmModelInferrer extends AbstractModelInferrer {
@Inject
@Extension
private JvmTypesBuilder _jvmTypesBuilder;
@Inject
@Extension
private IQualifiedNameProvider _iQualifiedNameProvider;
@Inject
@Extension
private DataDSLJvmModelInferrer data;
@Inject
@Extension
private CommonUtils _commonUtils;
@Inject
private String contextClassName = "";
private String clsName = "";
protected void _infer(final ActionPackage pkg, final IJvmDeclaredTypeAcceptor acceptor, final boolean isPreIndexingPhase) {
EList<ActionToolbar> _toolbars = pkg.getToolbars();
for (final ActionToolbar toolbar : _toolbars) {
{
JvmGenericType toolbarClass = this._jvmTypesBuilder.toClass(toolbar, this.className(toolbar));
final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
EList<JvmTypeReference> _superTypes = it.getSuperTypes();
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(IToolbarAction.class);
this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
this.toToolbarConstructor(it, toolbar);
this.toToolbarFields(it, toolbar);
this.toToolbarOperations(it, toolbar);
this._jvmTypesBuilder.setFileHeader(it, this._jvmTypesBuilder.getDocumentation(pkg));
};
acceptor.<JvmGenericType>accept(toolbarClass, _function);
}
}
EList<ActionCommand> _commands = pkg.getCommands();
for (final ActionCommand command : _commands) {
{
JvmGenericType handlerClass = this._jvmTypesBuilder.toClass(command, this.className(command));
final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
this.toHandlerFields(it, command);
this.toHandlerOperations(it, command);
this._jvmTypesBuilder.setFileHeader(it, this._jvmTypesBuilder.getDocumentation(pkg));
};
acceptor.<JvmGenericType>accept(handlerClass, _function);
}
}
boolean _isWithouCommandProvider = pkg.isWithouCommandProvider();
boolean _not = (!_isWithouCommandProvider);
if (_not) {
this.clsName = pkg.getName().toString().concat(".").concat("CommandsProvider");
final JvmGenericType cls = this._jvmTypesBuilder.toClass(pkg, this.clsName);
cls.getSuperTypes().add(this._typeReferenceBuilder.typeRef(ICommandsProvider.class));
final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
JvmAnnotationReference annotationRef = this._annotationTypesBuilder.annotationRef(Component.class);
JvmTypeReference _typeRef = this._typeReferenceBuilder.typeRef(ICommandsProvider.class);
this._commonUtils.addAnnAttr(annotationRef, pkg, "service", ((JvmTypeReference) _typeRef));
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, annotationRef);
this.toCommandsConstructor(it, pkg);
this.toCommandsOperations(it, pkg);
};
acceptor.<JvmGenericType>accept(cls, _function);
}
}
public void toCommandsOperations(final JvmGenericType type, final ActionPackage pkg) {
EList<JvmMember> _members = type.getMembers();
final Procedure1<JvmOperation> _function = (JvmOperation it) -> {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Override.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(pkg, "application", this._typeReferenceBuilder.typeRef(MApplication.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
String _init = this.init(pkg);
_builder.append(_init);
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_1);
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(pkg, "init", this._typeReferenceBuilder.typeRef(Void.TYPE), _function);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
}
public String init(final ActionPackage pkg) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("if(!application.getBindingTables().isEmpty()) {");
_builder.newLine();
_builder.append("\t");
_builder.append("MBindingTable bindingTable = application.getBindingTables().get(0);");
_builder.newLine();
_builder.append("\t");
_builder.append("MKeyBinding keyBinding;");
_builder.newLine();
_builder.append("\t");
_builder.append("MCommand command;");
_builder.newLine();
_builder.append("\t");
_builder.append("MHandler commandHandler;");
_builder.newLine();
String body = _builder.toString();
EList<ActionCommand> _commands = pkg.getCommands();
for (final ActionCommand command : _commands) {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(body);
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("command = CommandsFactoryImpl.eINSTANCE.createCommand();");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("command.setElementId(\"");
QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(pkg);
_builder_1.append(_fullyQualifiedName, "\t");
_builder_1.append(".");
String _name = command.getName();
_builder_1.append(_name, "\t");
_builder_1.append("\");");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("command.setCommandName(\"");
String _name_1 = command.getName();
_builder_1.append(_name_1, "\t");
_builder_1.append("\");");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
{
boolean _isHasDescription = command.isHasDescription();
if (_isHasDescription) {
_builder_1.append("command.setDescription(\"");
String _description = command.getDescription();
_builder_1.append(_description, "\t");
_builder_1.append("\");");
}
}
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("application.getCommands().add(command);");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("commandHandler = CommandsFactoryImpl.eINSTANCE.createHandler();");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("commandHandler.setElementId(\"");
QualifiedName _fullyQualifiedName_1 = this._iQualifiedNameProvider.getFullyQualifiedName(pkg);
_builder_1.append(_fullyQualifiedName_1, "\t");
_builder_1.append(".");
String _name_2 = command.getName();
_builder_1.append(_name_2, "\t");
_builder_1.append("Handler\");");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("commandHandler.setCommand(command);");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("commandHandler.setContributionURI(\"bundleclass://\"+FrameworkUtil.getBundle(");
String _className = this.className(command);
_builder_1.append(_className, "\t");
_builder_1.append(".class).getSymbolicName()+\"/");
String _className_1 = this.className(command);
_builder_1.append(_className_1, "\t");
_builder_1.append("\");");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("application.getHandlers().add(commandHandler);");
_builder_1.newLine();
{
boolean _isHasKeyBinding = command.isHasKeyBinding();
if (_isHasKeyBinding) {
_builder_1.append("\t");
_builder_1.append("keyBinding = CommandsFactoryImpl.eINSTANCE.createKeyBinding();");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("keyBinding.setElementId(\"");
QualifiedName _fullyQualifiedName_2 = this._iQualifiedNameProvider.getFullyQualifiedName(pkg);
_builder_1.append(_fullyQualifiedName_2, "\t");
_builder_1.append(".");
String _name_3 = command.getName();
_builder_1.append(_name_3, "\t");
_builder_1.append("Keybinding\");");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("keyBinding.setKeySequence(\"");
String _replace = command.getKeyBinding().replace(" ", "+");
_builder_1.append(_replace, "\t");
_builder_1.append("\");");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("keyBinding.setCommand(command);");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("bindingTable.getBindings().add(keyBinding);");
}
}
_builder_1.newLineIfNotEmpty();
body = _builder_1.toString();
}
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append(body);
_builder_2.newLineIfNotEmpty();
_builder_2.append("}");
_builder_2.newLine();
body = _builder_2.toString();
return body;
}
public void toCommandsConstructor(final JvmGenericType type, final ActionPackage pkg) {
EList<JvmMember> _members = type.getMembers();
final Procedure1<JvmConstructor> _function = (JvmConstructor it) -> {
final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_1);
};
JvmConstructor _constructor = this._jvmTypesBuilder.toConstructor(pkg, _function);
this._jvmTypesBuilder.<JvmConstructor>operator_add(_members, _constructor);
}
/**
* <p>build the constructors including the uuid.</p>
*/
public void toToolbarConstructor(final JvmGenericType type, final ActionToolbar toolbar) {
EList<JvmMember> _members = type.getMembers();
final Procedure1<JvmConstructor> _function = (JvmConstructor it) -> {
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(toolbar, "uuid", this._typeReferenceBuilder.typeRef(String.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("super();");
_builder.newLine();
_builder.append("this.uuid = uuid;");
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_1);
};
JvmConstructor _constructor = this._jvmTypesBuilder.toConstructor(toolbar, _function);
this._jvmTypesBuilder.<JvmConstructor>operator_add(_members, _constructor);
}
public String className(final ActionToolbar toolbar) {
EObject _eContainer = toolbar.eContainer();
ActionPackage pkg = ((ActionPackage) _eContainer);
return pkg.getName().toString().concat(".").concat(StringExtensions.toFirstUpper(toolbar.getName())).concat("Toolbar");
}
public String className(final ActionCommand actionCommand) {
EObject _eContainer = actionCommand.eContainer();
ActionPackage pkg = ((ActionPackage) _eContainer);
return pkg.getName().toString().concat(".").concat(StringExtensions.toFirstUpper(actionCommand.getName())).concat("Action");
}
public void toToolbarOperations(final JvmGenericType type, final ActionToolbar toolbar) {
EList<JvmMember> _members = type.getMembers();
final Procedure1<JvmOperation> _function = (JvmOperation it) -> {
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(toolbar, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(toolbar, "renderingEngine", this._typeReferenceBuilder.typeRef(IPresentationEngine.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
EList<JvmFormalParameter> _parameters_2 = it.getParameters();
JvmFormalParameter _parameter_2 = this._jvmTypesBuilder.toParameter(toolbar, "themeResourceService", this._typeReferenceBuilder.typeRef(IThemeResourceService.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_2, _parameter_2);
it.setVisibility(JvmVisibility.PUBLIC);
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Override.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
String _createToolbar = this.createToolbar(toolbar);
_builder.append(_createToolbar);
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_1);
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(toolbar, "createToolbar", this._typeReferenceBuilder.typeRef(Void.TYPE), _function);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
EList<JvmMember> _members_1 = type.getMembers();
final Procedure1<JvmOperation> _function_1 = (JvmOperation it) -> {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Override.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
final Procedure1<ITreeAppendable> _function_2 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("return toolbar;");
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_2);
};
JvmOperation _method_1 = this._jvmTypesBuilder.toMethod(toolbar, "getToolBar", this._typeReferenceBuilder.typeRef(MToolBar.class), _function_1);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _method_1);
EList<JvmMember> _members_2 = type.getMembers();
final Procedure1<JvmOperation> _function_2 = (JvmOperation it) -> {
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(toolbar, "commandName", this._typeReferenceBuilder.typeRef(String.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(toolbar, "toolItem", this._typeReferenceBuilder.typeRef(MHandledToolItem.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
EList<JvmFormalParameter> _parameters_2 = it.getParameters();
JvmFormalParameter _parameter_2 = this._jvmTypesBuilder.toParameter(toolbar, "application", this._typeReferenceBuilder.typeRef(MApplication.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_2, _parameter_2);
it.setVisibility(JvmVisibility.PRIVATE);
final Procedure1<ITreeAppendable> _function_3 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("for(MCommand command:application.getCommands()) {");
_builder.newLine();
_builder.append("\t");
_builder.append("if(command.getCommandName().equals(commandName)) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("toolItem.setCommand(command);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("break;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_3);
};
JvmOperation _method_2 = this._jvmTypesBuilder.toMethod(toolbar, "setCommand", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_2);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, _method_2);
}
public String createToolbar(final ActionToolbar toolbar) {
String body = "";
StringConcatenation _builder = new StringConcatenation();
_builder.append(body);
_builder.newLineIfNotEmpty();
_builder.append("MenuFactoryImpl factory = MenuFactoryImpl.eINSTANCE;");
_builder.newLine();
_builder.append("MHandledToolItem toolItem = null;");
_builder.newLine();
_builder.append("MToolBarSeparator separator = null;");
_builder.newLine();
_builder.newLine();
_builder.append("MApplication application = (MApplication)eclipseContext.get(MApplication.class);");
_builder.newLine();
_builder.append("MPart part = (MPart)eclipseContext.get(MPart.class);");
_builder.newLine();
_builder.append("if(part != null) {");
_builder.newLine();
_builder.append("\t");
_builder.append("toolbar = part.getToolbar();");
_builder.newLine();
_builder.append("\t");
_builder.append("if (toolbar == null) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("toolbar = factory.createToolBar();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("toolbar.setElementId(uuid);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("part.getContext().set(\"");
_builder.append(IToolbarAction.TOOLBAR_UUID, "\t\t");
_builder.append("\", toolbar.getElementId());");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("toolbar.setToBeRendered(true);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("part.setToolbar(toolbar);");
_builder.newLine();
_builder.append("\t\t");
_builder.newLine();
_builder.append("\t\t");
_builder.append("Panel panel = (Panel) part.getWidget();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (panel != null) {\t\t// it is already visible in terms of vaadin");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("//create toolbar area");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("VerticalLayout rootContainer = (VerticalLayout)panel.getContent();");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("CssLayout toolbarArea = new CssLayout();");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("toolbarArea.setStyleName(EnumCssClass.MPARTTOOLBARAREA.toString());");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("toolbarArea.setSizeUndefined();");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("toolbarArea.setWidth(\"100%\");");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("rootContainer.addComponentAsFirst(toolbarArea);");
_builder.newLine();
_builder.append("\t\t\t");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("//create toolbar");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("Component toolbarWidget = (Component) renderingEngine.createGui(toolbar);");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("((AbstractLayout)toolbarWidget).setSizeUndefined();");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("toolbarWidget.setStyleName(EnumCssClass.MPARTTOOLBAR.toString());");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("toolbarArea.addComponent(toolbarWidget);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("else {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("toolbar.getChildren().removeIf(c -> c.isToBeRendered());");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
body = _builder.toString();
EList<ActionToolbarItem> _actions = toolbar.getActions();
for (final ActionToolbarItem action : _actions) {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(body);
String _createToolItem = this.createToolItem(toolbar, action);
_builder_1.append(_createToolItem);
body = _builder_1.toString();
}
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append(body);
_builder_2.newLineIfNotEmpty();
_builder_2.append("}");
body = _builder_2.toString();
return body;
}
public String createToolItem(final ActionToolbar toolbar, final ActionToolbarItem action) {
if ((action instanceof ActionButton)) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("toolItem = factory.createHandledToolItem();");
_builder.newLine();
_builder.append("toolItem.setElementId(UUID.randomUUID().toString());");
_builder.newLine();
_builder.append("toolItem.setType(ItemType.PUSH);");
_builder.newLine();
_builder.append("toolItem.setTooltip(\"");
{
if (((((ActionButton)action).getCommand().getActionType() instanceof ActionDatainterchange) && ((ActionDatainterchange) ((ActionButton)action).getCommand().getActionType()).getDataRef().isDescription())) {
ActionType _actionType = ((ActionButton)action).getCommand().getActionType();
String _descriptionValue = ((ActionDatainterchange) _actionType).getDataRef().getDescriptionValue();
_builder.append(_descriptionValue);
} else {
String _name = ((ActionButton)action).getName();
_builder.append(_name);
}
}
{
boolean _isHasKeyBinding = ((ActionButton)action).getCommand().isHasKeyBinding();
if (_isHasKeyBinding) {
_builder.append(".keybinding.");
String _keyBinding = ((ActionButton)action).getCommand().getKeyBinding();
_builder.append(_keyBinding);
}
}
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("toolItem.setIconURI(themeResourceService.getThemeURI(\"");
String _iconURI = ((ActionButton)action).getIconURI();
_builder.append(_iconURI);
_builder.append("\", ThemeResourceType.ICON));");
_builder.newLineIfNotEmpty();
_builder.append("toolItem.setEnabled(true);");
_builder.newLine();
_builder.append("toolItem.setToBeRendered(true);");
_builder.newLine();
_builder.append("toolItem.setVisible(true);");
_builder.newLine();
_builder.append("setCommand(\"");
String _name_1 = ((ActionButton)action).getCommand().getName();
_builder.append(_name_1);
_builder.append("\", toolItem, application);");
_builder.newLineIfNotEmpty();
_builder.append("toolbar.getChildren().add(toolItem);");
_builder.newLine();
{
ActionType _actionType_1 = ((ActionButton)action).getCommand().getActionType();
if ((_actionType_1 instanceof ActionReport)) {
_builder.append("toolItem.getTags().add(\"");
ActionType _actionType_2 = ((ActionButton)action).getCommand().getActionType();
String _literal = ((ActionReport) _actionType_2).getAction().getLiteral();
_builder.append(_literal);
_builder.append("\");");
_builder.newLineIfNotEmpty();
}
}
return _builder.toString();
} else {
if ((action instanceof ActionSpacer)) {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("separator = factory.createToolBarSeparator();");
_builder_1.newLine();
_builder_1.append("toolbar.getChildren().add(separator);");
_builder_1.newLine();
return _builder_1.toString();
}
}
return null;
}
public void toToolbarFields(final JvmGenericType type, final ActionToolbar toolbar) {
JvmField field = null;
final Procedure1<JvmField> _function = (JvmField it) -> {
final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("org.slf4j.LoggerFactory.getLogger(\"toolbar\")");
it_1.append(_builder);
};
this._jvmTypesBuilder.setInitializer(it, _function_1);
};
field = this._jvmTypesBuilder.toField(toolbar, "log", this._typeReferenceBuilder.typeRef(Logger.class), _function);
field.setStatic(true);
field.setVisibility(JvmVisibility.PRIVATE);
EList<JvmMember> _members = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members, field);
field = this._jvmTypesBuilder.toField(toolbar, "uuid", this._typeReferenceBuilder.typeRef(String.class));
field.setVisibility(JvmVisibility.PRIVATE);
EList<JvmMember> _members_1 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_1, field);
field = this._jvmTypesBuilder.toField(toolbar, "toolbar", this._typeReferenceBuilder.typeRef(MToolBar.class));
EList<JvmMember> _members_2 = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members_2, field);
}
public void toHandlerFields(final JvmGenericType type, final ActionCommand action) {
JvmField field = null;
final Procedure1<JvmField> _function = (JvmField it) -> {
final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("org.slf4j.LoggerFactory.getLogger(\"action\")");
it_1.append(_builder);
};
this._jvmTypesBuilder.setInitializer(it, _function_1);
};
field = this._jvmTypesBuilder.toField(action, "log", this._typeReferenceBuilder.typeRef(Logger.class), _function);
field.setStatic(true);
field.setVisibility(JvmVisibility.PRIVATE);
EList<JvmMember> _members = type.getMembers();
this._jvmTypesBuilder.<JvmField>operator_add(_members, field);
EList<JvmMember> _members_1 = type.getMembers();
JvmField _field = this._jvmTypesBuilder.toField(action, "activePart", this._typeReferenceBuilder.typeRef(MUIElement.class));
this._jvmTypesBuilder.<JvmField>operator_add(_members_1, _field);
EList<JvmMember> _members_2 = type.getMembers();
final Procedure1<JvmOperation> _function_1 = (JvmOperation it) -> {
final Procedure1<ITreeAppendable> _function_2 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("return activePart;");
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_2);
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(action, "getActivePart", this._typeReferenceBuilder.typeRef(MUIElement.class), _function_1);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, _method);
}
public CharSequence activatePart() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("if (part == null) {");
_builder.newLine();
_builder.append("\t");
_builder.append("return;");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("if(activePart != null && activePart.getWidget() instanceof Panel) {");
_builder.newLine();
_builder.append("\t");
_builder.append("((Panel)activePart.getWidget()).removeStyleName(EnumCssClass.HAS_FOCUS.styleName());");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("if(part.getWidget() instanceof Panel) {");
_builder.newLine();
_builder.append("\t");
_builder.append("activePart = part;");
_builder.newLine();
_builder.append("\t");
_builder.append("((Panel)activePart.getWidget()).addStyleName(EnumCssClass.HAS_FOCUS.styleName());");
_builder.newLine();
_builder.append("\t ");
_builder.append("IE4Dialog dialog = part.getContext().get(IE4Dialog.class);");
_builder.newLine();
_builder.append("\t ");
_builder.append("if (dialog != null) {");
_builder.newLine();
_builder.append("\t ");
_builder.append("ContextInjectionFactory.invoke(dialog, Focus.class, part.getContext());");
_builder.newLine();
_builder.append("\t ");
_builder.append("}");
_builder.newLine();
_builder.append("\t ");
_builder.append("IE4Table table = part.getContext().get(IE4Table.class);");
_builder.newLine();
_builder.append("\t ");
_builder.append("if (table != null) {");
_builder.newLine();
_builder.append("\t ");
_builder.append("ContextInjectionFactory.invoke(table, Focus.class, part.getContext());");
_builder.newLine();
_builder.append("\t ");
_builder.append("}");
_builder.newLine();
_builder.append("\t ");
_builder.append("IE4Focusable focusable = part.getContext().get(IE4Focusable.class);");
_builder.newLine();
_builder.append("\t ");
_builder.append("if (focusable != null) {");
_builder.newLine();
_builder.append("\t ");
_builder.append("ContextInjectionFactory.invoke(focusable, Focus.class, part.getContext());");
_builder.newLine();
_builder.append("\t ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
return _builder;
}
/**
* <p>build the methods to be used as toolbar handlers by an e4 application.</p>
*/
public void toHandlerOperations(final JvmDeclaredType type, final ActionCommand action) {
if (((action.getActionType() instanceof ActionUI) && (Objects.equal(((ActionUI) action.getActionType()).getAction(), UIActionEnum.NEXT_PART) || Objects.equal(((ActionUI) action.getActionType()).getAction(), UIActionEnum.PREVIOUS_PART)))) {
EList<JvmMember> _members = type.getMembers();
final Procedure1<JvmOperation> _function = (JvmOperation it) -> {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Inject.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
JvmFormalParameter para = this._jvmTypesBuilder.toParameter(action, "part", this._typeReferenceBuilder.typeRef(MPart.class));
EList<JvmAnnotationReference> _annotations_1 = para.getAnnotations();
JvmAnnotationReference _annotationRef_1 = this._annotationTypesBuilder.annotationRef(Active.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations_1, _annotationRef_1);
EList<JvmAnnotationReference> _annotations_2 = para.getAnnotations();
JvmAnnotationReference _annotationRef_2 = this._annotationTypesBuilder.annotationRef(Optional.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations_2, _annotationRef_2);
EList<JvmFormalParameter> _parameters = it.getParameters();
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, para);
final Procedure1<ITreeAppendable> _function_1 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
CharSequence _activatePart = this.activatePart();
_builder.append(_activatePart);
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_1);
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(action, "activePart", this._typeReferenceBuilder.typeRef(Void.TYPE), _function);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members, _method);
}
EList<JvmMember> _members_1 = type.getMembers();
final Procedure1<JvmOperation> _function_1 = (JvmOperation it) -> {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(CanExecute.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
ActionType _actionType = action.getActionType();
boolean _matched = false;
if (_actionType instanceof ActionTask) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
}
if (!_matched) {
if (_actionType instanceof ActionSelectWorkload) {
_matched=true;
}
}
if (!_matched) {
if (_actionType instanceof ActionDialog) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
}
}
if (!_matched) {
if (_actionType instanceof ActionReport) {
_matched=true;
}
}
if (!_matched) {
if (_actionType instanceof ActionChart) {
_matched=true;
}
}
if (!_matched) {
if (_actionType instanceof ActionWorkflow) {
_matched=true;
}
}
if (!_matched) {
if (_actionType instanceof ActionDatainterchange) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "dataInterchange", this._typeReferenceBuilder.typeRef(IDataInterchange.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
}
}
if (!_matched) {
if (_actionType instanceof ActionFunction) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
}
}
if (!_matched) {
if (_actionType instanceof ActionUI) {
_matched=true;
ActionType _actionType_1 = action.getActionType();
UIActionEnum _action = ((ActionUI) _actionType_1).getAction();
boolean _equals = Objects.equal(_action, UIActionEnum.DATABASE_INFO);
if (_equals) {
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
}
}
}
final Procedure1<ITreeAppendable> _function_2 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
String _canExecute = this.canExecute(action);
_builder.append(_canExecute);
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_2);
};
JvmOperation _method_1 = this._jvmTypesBuilder.toMethod(action, "canExecute", this._typeReferenceBuilder.typeRef(boolean.class), _function_1);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _method_1);
EList<JvmMember> _members_2 = type.getMembers();
final Procedure1<JvmOperation> _function_2 = (JvmOperation it) -> {
EList<JvmAnnotationReference> _annotations = it.getAnnotations();
JvmAnnotationReference _annotationRef = this._annotationTypesBuilder.annotationRef(Execute.class);
this._jvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef);
ActionType _actionType = action.getActionType();
boolean _matched = false;
if (_actionType instanceof ActionTask) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
}
if (!_matched) {
if (_actionType instanceof ActionSelectWorkload) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
}
}
if (!_matched) {
if (_actionType instanceof ActionDialog) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
}
}
if (!_matched) {
if (_actionType instanceof ActionReport) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
}
}
if (!_matched) {
if (_actionType instanceof ActionChart) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
}
}
if (!_matched) {
if (_actionType instanceof ActionWorkflow) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
}
}
if (!_matched) {
if (_actionType instanceof ActionDatainterchange) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "persistenceService", this._typeReferenceBuilder.typeRef(IPersistenceService.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
EList<JvmFormalParameter> _parameters_2 = it.getParameters();
JvmFormalParameter _parameter_2 = this._jvmTypesBuilder.toParameter(action, "dataInterchange", this._typeReferenceBuilder.typeRef(IDataInterchange.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_2, _parameter_2);
EList<JvmFormalParameter> _parameters_3 = it.getParameters();
JvmFormalParameter _parameter_3 = this._jvmTypesBuilder.toParameter(action, "executorService", this._typeReferenceBuilder.typeRef(VaadinExecutorService.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_3, _parameter_3);
EList<JvmFormalParameter> _parameters_4 = it.getParameters();
JvmFormalParameter _parameter_4 = this._jvmTypesBuilder.toParameter(action, "dslMetadataService", this._typeReferenceBuilder.typeRef(IDSLMetadataService.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_4, _parameter_4);
EList<JvmFormalParameter> _parameters_5 = it.getParameters();
JvmFormalParameter _parameter_5 = this._jvmTypesBuilder.toParameter(action, "blobService", this._typeReferenceBuilder.typeRef(IBlobService.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_5, _parameter_5);
EList<JvmFormalParameter> _parameters_6 = it.getParameters();
JvmFormalParameter _parameter_6 = this._jvmTypesBuilder.toParameter(action, "user", this._typeReferenceBuilder.typeRef(IUser.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_6, _parameter_6);
}
}
if (!_matched) {
if (_actionType instanceof ActionFunction) {
_matched=true;
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
ActionType _actionType_1 = action.getActionType();
boolean _isHasExecuteLater = ((ActionFunction) _actionType_1).isHasExecuteLater();
if (_isHasExecuteLater) {
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "executorService", this._typeReferenceBuilder.typeRef(VaadinExecutorService.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
}
if ((((ActionFunction) action.getActionType()).isHasMessage() || ((ActionFunction) action.getActionType()).isHasStartedMessage())) {
EList<JvmFormalParameter> _parameters_2 = it.getParameters();
JvmFormalParameter _parameter_2 = this._jvmTypesBuilder.toParameter(action, "dslMetadataService", this._typeReferenceBuilder.typeRef(IDSLMetadataService.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_2, _parameter_2);
EList<JvmFormalParameter> _parameters_3 = it.getParameters();
JvmFormalParameter _parameter_3 = this._jvmTypesBuilder.toParameter(action, "user", this._typeReferenceBuilder.typeRef(IUser.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_3, _parameter_3);
}
}
}
if (!_matched) {
if (_actionType instanceof ActionUI) {
_matched=true;
ActionType _actionType_1 = action.getActionType();
UIActionEnum _action = ((ActionUI) _actionType_1).getAction();
boolean _equals = Objects.equal(_action, UIActionEnum.DATABASE_INFO);
if (_equals) {
EList<JvmFormalParameter> _parameters = it.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
EList<JvmFormalParameter> _parameters_1 = it.getParameters();
JvmFormalParameter _parameter_1 = this._jvmTypesBuilder.toParameter(action, "eventDispatcher", this._typeReferenceBuilder.typeRef(IEventDispatcher.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_1, _parameter_1);
} else {
ActionType _actionType_2 = action.getActionType();
UIActionEnum _action_1 = ((ActionUI) _actionType_2).getAction();
boolean _equals_1 = Objects.equal(_action_1, UIActionEnum.MDX_QUERY);
if (_equals_1) {
EList<JvmFormalParameter> _parameters_2 = it.getParameters();
JvmFormalParameter _parameter_2 = this._jvmTypesBuilder.toParameter(action, "eclipseContext", this._typeReferenceBuilder.typeRef(IEclipseContext.class));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters_2, _parameter_2);
}
}
}
}
final Procedure1<ITreeAppendable> _function_3 = (ITreeAppendable it_1) -> {
StringConcatenation _builder = new StringConcatenation();
CharSequence _execute = this.execute(action);
_builder.append(_execute);
it_1.append(_builder);
};
this._jvmTypesBuilder.setBody(it, _function_3);
};
JvmOperation _method_2 = this._jvmTypesBuilder.toMethod(action, "execute", this._typeReferenceBuilder.typeRef(Void.TYPE), _function_2);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, _method_2);
}
public CharSequence execute(final ActionCommand command) {
CharSequence _switchResult = null;
ActionType _actionType = command.getActionType();
boolean _matched = false;
if (_actionType instanceof ActionDatainterchange) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
DataInterchange _dataRef = ((ActionDatainterchange) _actionType_1).getDataRef();
CharSequence _doInterchange = null;
if (((DataInterchange) _dataRef)!=null) {
ActionType _actionType_2 = command.getActionType();
DataInterchange _dataRef_1 = ((ActionDatainterchange) _actionType_1).getDataRef();
_doInterchange=this.doInterchange(((DataInterchange) _dataRef_1), command);
}
_switchResult = _doInterchange;
}
if (!_matched) {
_switchResult = this.doExecute(command);
}
return _switchResult;
}
public CharSequence doInterchange(final DataInterchange dataInterchange, final ActionCommand action) {
StringConcatenation _builder = new StringConcatenation();
ActionType _actionType = action.getActionType();
String _basicRunConfiguration = this.data.getBasicRunConfiguration(dataInterchange, true, this.data.getFileURL(dataInterchange), ((ActionDatainterchange) _actionType).getAction().getLiteral());
_builder.append(_basicRunConfiguration);
_builder.newLineIfNotEmpty();
String _defaultVariableName = this.data.getDefaultVariableName(dataInterchange);
_builder.append(_defaultVariableName);
_builder.append(".setDirection(WorkerThreadRunnable.Direction.");
ActionType _actionType_1 = action.getActionType();
String _upperCase = ((ActionDatainterchange) _actionType_1).getAction().getLiteral().toUpperCase();
_builder.append(_upperCase);
_builder.append(");");
_builder.newLineIfNotEmpty();
String _defaultVariableName_1 = this.data.getDefaultVariableName(dataInterchange);
_builder.append(_defaultVariableName_1);
_builder.append(".setEventDispatcher(eventDispatcher);");
_builder.newLineIfNotEmpty();
String _defaultVariableName_2 = this.data.getDefaultVariableName(dataInterchange);
_builder.append(_defaultVariableName_2);
_builder.append(".setBlobService(blobService);");
_builder.newLineIfNotEmpty();
_builder.append("Notification.show(dslMetadataService.translate(user.getLocale().toLanguageTag(), \"datainterchangeStarted\"),Notification.Type.HUMANIZED_MESSAGE);");
_builder.newLine();
_builder.append("executorService.invokeLater(null, new Runnable() {");
_builder.newLine();
_builder.append("\t");
_builder.append("@Override");
_builder.newLine();
_builder.append("\t");
_builder.append("public void run() {");
_builder.newLine();
_builder.append("\t\t");
String _defaultVariableName_3 = this.data.getDefaultVariableName(dataInterchange);
_builder.append(_defaultVariableName_3, "\t\t");
_builder.append(".run();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("});");
return _builder;
}
public String doExecute(final ActionCommand command) {
String actionEnumStr = null;
ActionType _actionType = command.getActionType();
boolean _matched = false;
if (_actionType instanceof ActionTask) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
actionEnumStr = this.getEnumString(((ActionTask) _actionType_1).getAction()).toString();
}
if (!_matched) {
if (_actionType instanceof ActionSelectWorkload) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
actionEnumStr = this.getEnumString(((ActionSelectWorkload) _actionType_1).getAction()).toString();
}
}
if (!_matched) {
if (_actionType instanceof ActionDialog) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
actionEnumStr = this.getEnumString(((ActionDialog) _actionType_1).getAction()).toString();
}
}
if (!_matched) {
if (_actionType instanceof ActionReport) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
actionEnumStr = this.getEnumString(((ActionReport) _actionType_1).getAction()).toString();
}
}
if (!_matched) {
if (_actionType instanceof ActionChart) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
actionEnumStr = this.getEnumString(((ActionChart) _actionType_1).getAction()).toString();
}
}
if (!_matched) {
if (_actionType instanceof ActionWorkflow) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
actionEnumStr = this.getEnumString(((ActionWorkflow) _actionType_1).getAction()).toString();
}
}
if (!_matched) {
if (_actionType instanceof ActionFunction) {
_matched=true;
actionEnumStr = "Execute";
}
}
if (!_matched) {
if (_actionType instanceof ActionUI) {
_matched=true;
ActionType _actionType_1 = command.getActionType();
actionEnumStr = this.getEnumString(((ActionUI) _actionType_1).getAction()).toString();
}
}
ActionType _actionType_1 = command.getActionType();
if ((_actionType_1 instanceof ActionFunction)) {
ActionType _actionType_2 = command.getActionType();
ActionFunction func = ((ActionFunction) _actionType_2);
boolean _isHasExecuteImmediate = func.isHasExecuteImmediate();
if (_isHasExecuteImmediate) {
StringConcatenation _builder = new StringConcatenation();
{
boolean _isHasMessage = func.isHasMessage();
if (_isHasMessage) {
_builder.append("boolean result = ");
}
}
EObject _eContainer = func.getActionGroup().eContainer();
QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(((FunctionLibraryPackage) _eContainer));
_builder.append(_fullyQualifiedName);
_builder.append(".");
String _firstUpper = StringExtensions.toFirstUpper(func.getActionGroup().getName().toString());
_builder.append(_firstUpper);
_builder.append(".");
String _string = func.getExecuteImmediate().getName().toString();
_builder.append(_string);
_builder.append("(eclipseContext);");
_builder.newLineIfNotEmpty();
{
boolean _isHasMessage_1 = func.isHasMessage();
if (_isHasMessage_1) {
_builder.append("if(!result) {");
_builder.newLine();
_builder.append("\t");
_builder.append("Notification.show(");
EObject _eContainer_1 = func.getMessageCategory().eContainer();
QualifiedName _fullyQualifiedName_1 = this._iQualifiedNameProvider.getFullyQualifiedName(((MessagePackage) _eContainer_1));
_builder.append(_fullyQualifiedName_1, "\t");
_builder.append(".");
String _name = func.getMessageCategory().getName();
_builder.append(_name, "\t");
_builder.append("Message.");
String _firstLower = StringExtensions.toFirstLower(func.getOnFailMessage().getName());
_builder.append(_firstLower, "\t");
_builder.append("().getShowMessage(dslMetadataService, user),Notification.Type.ERROR_MESSAGE);");
_builder.newLineIfNotEmpty();
_builder.append("} ");
{
boolean _isHasSuccessMessage = func.isHasSuccessMessage();
if (_isHasSuccessMessage) {
_builder.append("else {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("Notification.show(");
EObject _eContainer_2 = func.getMessageCategory().eContainer();
QualifiedName _fullyQualifiedName_2 = this._iQualifiedNameProvider.getFullyQualifiedName(((MessagePackage) _eContainer_2));
_builder.append(_fullyQualifiedName_2, "\t");
_builder.append(".");
String _name_1 = func.getMessageCategory().getName();
_builder.append(_name_1, "\t");
_builder.append("Message.");
String _firstLower_1 = StringExtensions.toFirstLower(func.getOnSuccessMessage().getName());
_builder.append(_firstLower_1, "\t");
_builder.append("().getShowMessage(dslMetadataService, user), Notification.Type.HUMANIZED_MESSAGE);");
_builder.newLineIfNotEmpty();
_builder.append("}");
}
}
}
}
return _builder.toString();
}
boolean _isHasExecuteLater = func.isHasExecuteLater();
if (_isHasExecuteLater) {
StringConcatenation _builder_1 = new StringConcatenation();
{
boolean _isHasStartedMessage = func.isHasStartedMessage();
if (_isHasStartedMessage) {
_builder_1.append("Notification.show(");
EObject _eContainer_3 = func.getMessageCategory().eContainer();
QualifiedName _fullyQualifiedName_3 = this._iQualifiedNameProvider.getFullyQualifiedName(((MessagePackage) _eContainer_3));
_builder_1.append(_fullyQualifiedName_3);
_builder_1.append(".");
String _name_2 = func.getMessageCategory().getName();
_builder_1.append(_name_2);
_builder_1.append("Message.");
String _firstLower_2 = StringExtensions.toFirstLower(func.getOnStartedMessage().getName());
_builder_1.append(_firstLower_2);
_builder_1.append("().getShowMessage(dslMetadataService, user),Notification.Type.HUMANIZED_MESSAGE);");
_builder_1.newLineIfNotEmpty();
}
}
_builder_1.append("executorService.invokeLater(eclipseContext, new Runnable() {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("@Override");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("public void run() {");
_builder_1.newLine();
_builder_1.append("\t\t");
EObject _eContainer_4 = func.getActionGroup().eContainer();
QualifiedName _fullyQualifiedName_4 = this._iQualifiedNameProvider.getFullyQualifiedName(((FunctionLibraryPackage) _eContainer_4));
_builder_1.append(_fullyQualifiedName_4, "\t\t");
_builder_1.append(".");
String _firstUpper_1 = StringExtensions.toFirstUpper(func.getActionGroup().getName().toString());
_builder_1.append(_firstUpper_1, "\t\t");
_builder_1.append(".");
String _string_1 = func.getExecuteLater().getName().toString();
_builder_1.append(_string_1, "\t\t");
_builder_1.append("(eclipseContext);");
_builder_1.newLineIfNotEmpty();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("});");
return _builder_1.toString();
}
} else {
if (((command.getActionType() instanceof ActionUI) && Objects.equal(((ActionUI) command.getActionType()).getAction(), UIActionEnum.NEXT_PART))) {
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("log.debug(\"execute next part\");");
_builder_2.newLine();
_builder_2.append("MUIElement newActivePart = E4Helper.getPart(true, getActivePart(), true);");
_builder_2.newLine();
_builder_2.append("if(newActivePart != null && newActivePart instanceof MPart) {");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("((MPart)newActivePart).getContext().activate();");
_builder_2.newLine();
_builder_2.append("}");
return _builder_2.toString();
} else {
if (((command.getActionType() instanceof ActionUI) && Objects.equal(((ActionUI) command.getActionType()).getAction(), UIActionEnum.PREVIOUS_PART))) {
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("log.debug(\"execute previous part\");");
_builder_3.newLine();
_builder_3.append("MUIElement newActivePart = E4Helper.getPart(false, getActivePart(), true);");
_builder_3.newLine();
_builder_3.append("if(newActivePart != null && newActivePart instanceof MPart) {");
_builder_3.newLine();
_builder_3.append("\t");
_builder_3.append("((MPart)newActivePart).getContext().activate();");
_builder_3.newLine();
_builder_3.append("}");
return _builder_3.toString();
} else {
if (((command.getActionType() instanceof ActionUI) && Objects.equal(((ActionUI) command.getActionType()).getAction(), UIActionEnum.MDX_QUERY))) {
StringConcatenation _builder_4 = new StringConcatenation();
_builder_4.append("UI.getCurrent().addWindow(new MDXDialog(eclipseContext));");
_builder_4.newLine();
return _builder_4.toString();
} else {
StringConcatenation _builder_5 = new StringConcatenation();
_builder_5.append("log.debug(\"action execute called for ");
String _name_3 = command.getName();
_builder_5.append(_name_3);
_builder_5.append("\");");
_builder_5.newLineIfNotEmpty();
_builder_5.append("String uuid = (String)eclipseContext.get(\"");
_builder_5.append(IToolbarAction.TOOLBAR_UUID);
_builder_5.append("\");");
_builder_5.newLineIfNotEmpty();
_builder_5.append("EventDispatcherEvent evnt = new EventDispatcherEvent(EventDispatcherCommand.ACTION, uuid, \"");
QualifiedName _fullyQualifiedName_5 = this._iQualifiedNameProvider.getFullyQualifiedName(command);
_builder_5.append(_fullyQualifiedName_5);
_builder_5.append("\");");
_builder_5.newLineIfNotEmpty();
_builder_5.append("evnt.addItem(EventDispatcherDataTag.BUTTON_ID, ");
_builder_5.append(actionEnumStr);
_builder_5.append(");");
_builder_5.newLineIfNotEmpty();
{
ActionType _actionType_3 = command.getActionType();
if ((_actionType_3 instanceof ActionTask)) {
_builder_5.append("evnt.addItem(EventDispatcherDataTag.TASK_ID, TaskHelper.getTaskId(eclipseContext));");
_builder_5.newLine();
}
}
_builder_5.append("eventDispatcher.sendEvent(evnt);");
return _builder_5.toString();
}
}
}
}
return null;
}
public CharSequence getEnumString(final Enumerator actionEnum) {
StringConcatenation _builder = new StringConcatenation();
String _simpleName = actionEnum.getClass().getSimpleName();
_builder.append(_simpleName);
_builder.append(".");
String _name = actionEnum.getName();
_builder.append(_name);
return _builder;
}
public String canExecute(final ActionCommand action) {
ActionType _actionType = action.getActionType();
boolean _matched = false;
if (_actionType instanceof ActionTask) {
_matched=true;
StringConcatenation _builder = new StringConcatenation();
_builder.append("return TaskHelper.");
ActionType _actionType_1 = action.getActionType();
String _firstLower = StringExtensions.toFirstLower(((ActionTask) _actionType_1).getAction().getLiteral());
_builder.append(_firstLower);
_builder.append("CanExecute(eclipseContext);");
return _builder.toString();
}
if (!_matched) {
if (_actionType instanceof ActionUI) {
_matched=true;
ActionType _actionType_1 = action.getActionType();
UIActionEnum _action = ((ActionUI) _actionType_1).getAction();
boolean _equals = Objects.equal(_action, UIActionEnum.DATABASE_INFO);
if (_equals) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("IE4Dialog dialog = eclipseContext.get(IE4Dialog.class);");
_builder.newLine();
_builder.append("if (dialog == null) {");
_builder.newLine();
_builder.append("\t");
_builder.append("return false;");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("boolean result = !(boolean) ContextInjectionFactory.invoke(dialog, IsNew.class, eclipseContext);");
_builder.newLine();
_builder.append("return result;");
return _builder.toString();
} else {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("return true;");
_builder_1.newLine();
return _builder_1.toString();
}
}
}
if (!_matched) {
if (_actionType instanceof ActionDialog) {
_matched=true;
if (((Objects.equal(((ActionDialog) action.getActionType()).getAction(), DialogActionEnum.DIALOG_ACTION_SAVE) ||
Objects.equal(((ActionDialog) action.getActionType()).getAction(), DialogActionEnum.DIALOG_ACTION_SAVE_AND_NEW)) ||
Objects.equal(((ActionDialog) action.getActionType()).getAction(), DialogActionEnum.DIALOG_ACTION_SAVE_AS_NEW))) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("IE4Dialog dialog = eclipseContext.get(IE4Dialog.class);");
_builder.newLine();
_builder.append("if (dialog == null) {");
_builder.newLine();
_builder.append("\t");
_builder.append("return false;");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("boolean result1 = (boolean) ContextInjectionFactory.invoke(dialog, IsValid.class, eclipseContext);");
_builder.newLine();
_builder.append("boolean result2 = (boolean) ContextInjectionFactory.invoke(dialog, IsDirty.class, eclipseContext);");
_builder.newLine();
_builder.append("return result1 && result2;");
return _builder.toString();
} else {
ActionType _actionType_1 = action.getActionType();
DialogActionEnum _action = ((ActionDialog) _actionType_1).getAction();
boolean _equals = Objects.equal(_action, DialogActionEnum.DIALOG_ACTION_NEW);
if (_equals) {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("IE4Dialog dialog = eclipseContext.get(IE4Dialog.class);");
_builder_1.newLine();
_builder_1.append("if (dialog == null) {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("return false;");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("boolean result = !(boolean) ContextInjectionFactory.invoke(dialog, IsDirty.class, eclipseContext);");
_builder_1.newLine();
_builder_1.append("return result;");
return _builder_1.toString();
} else {
ActionType _actionType_2 = action.getActionType();
DialogActionEnum _action_1 = ((ActionDialog) _actionType_2).getAction();
boolean _equals_1 = Objects.equal(_action_1, DialogActionEnum.DIALOG_ACTION_DELETE);
if (_equals_1) {
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("IE4Dialog dialog = eclipseContext.get(IE4Dialog.class);");
_builder_2.newLine();
_builder_2.append("if (dialog == null) {");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("return false;");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
_builder_2.append("boolean result1 = !(boolean) ContextInjectionFactory.invoke(dialog, IsNew.class, eclipseContext);");
_builder_2.newLine();
_builder_2.append("boolean result2 = (boolean) ContextInjectionFactory.invoke(dialog, IsPositioned.class, eclipseContext);");
_builder_2.newLine();
_builder_2.append("return result1 && result2;");
return _builder_2.toString();
} else {
ActionType _actionType_3 = action.getActionType();
DialogActionEnum _action_2 = ((ActionDialog) _actionType_3).getAction();
boolean _equals_2 = Objects.equal(_action_2, DialogActionEnum.DIALOG_ACTION_CANCEL);
if (_equals_2) {
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("IE4Dialog dialog = eclipseContext.get(IE4Dialog.class);");
_builder_3.newLine();
_builder_3.append("if (dialog == null) {");
_builder_3.newLine();
_builder_3.append("\t");
_builder_3.append("return false;");
_builder_3.newLine();
_builder_3.append("}");
_builder_3.newLine();
_builder_3.append("boolean result = (boolean) ContextInjectionFactory.invoke(dialog, IsDirty.class, eclipseContext);");
_builder_3.newLine();
_builder_3.append("return result;");
return _builder_3.toString();
} else {
StringConcatenation _builder_4 = new StringConcatenation();
_builder_4.append("return true;");
return _builder_4.toString();
}
}
}
}
}
}
if (!_matched) {
if (_actionType instanceof ActionFunction) {
_matched=true;
ActionType _actionType_1 = action.getActionType();
EObject _eContainer = ((ActionFunction) _actionType_1).getActionGroup().eContainer();
FunctionLibraryPackage pkg = ((FunctionLibraryPackage) _eContainer);
StringConcatenation _builder = new StringConcatenation();
_builder.append("return ");
String _string = this._iQualifiedNameProvider.getFullyQualifiedName(pkg).toString();
_builder.append(_string);
_builder.append(".");
ActionType _actionType_2 = action.getActionType();
String _firstUpper = StringExtensions.toFirstUpper(((ActionFunction) _actionType_2).getActionGroup().getName().toString());
_builder.append(_firstUpper);
_builder.append(".");
ActionType _actionType_3 = action.getActionType();
String _string_1 = ((ActionFunction) _actionType_3).getCanExecute().getName().toString();
_builder.append(_string_1);
_builder.append("(eclipseContext);");
return _builder.toString();
}
}
if (!_matched) {
if (_actionType instanceof ActionDatainterchange) {
_matched=true;
StringConcatenation _builder = new StringConcatenation();
_builder.append("return ");
{
ActionType _actionType_1 = action.getActionType();
if ((_actionType_1 instanceof ActionDatainterchange)) {
_builder.append("(dataInterchange!=null)");
} else {
_builder.append("true");
}
}
_builder.append(";");
return _builder.toString();
}
}
StringConcatenation _builder = new StringConcatenation();
_builder.append("return true;");
return _builder.toString();
}
public void infer(final EObject pkg, final IJvmDeclaredTypeAcceptor acceptor, final boolean isPreIndexingPhase) {
if (pkg instanceof ActionPackage) {
_infer((ActionPackage)pkg, acceptor, isPreIndexingPhase);
return;
} else if (pkg != null) {
_infer(pkg, acceptor, isPreIndexingPhase);
return;
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(pkg, acceptor, isPreIndexingPhase).toString());
}
}
}