Commit 8318b00d authored by Hernan Ponce de Leon's avatar Hernan Ponce de Leon
Browse files

Merge remote-tracking branch 'origin/master' into 3465-IStatementTerm_toZ3

parents 21c9ef64 a0269012
CCodeGeneratorEasyStartMenu.java 3e061ab97cbc4c74c0ed1a0d69e0c9f456fd8e8b GREEN
CCodeGeneratorEasyStartMenu.java aee60ea30cbe51832305ffd448cabc4fafab4452 GREEN
CGeneratorExecutionTarget.java 270fd30aaa67a294fd2bf4585044b46a54ee907f GREEN
FMUGeneratorEasyStartMenu.java f9f534a3cb2e4840f5e4a2979a849aae37abc4d0 GREEN
FMUGeneratorExecutionTarget.java 031c4ae2ff190b634241accc21510974d7356a94 RED
JavaCodeGeneratorEasyStartMenu.java 50ff3b512daecf41eaf39709a7e0b49892bf0c20 GREEN
FMUGeneratorEasyStartMenu.java 7bf75d51ef6763faae5a98188744a4d6ccc0c0b5 GREEN
FMUGeneratorExecutionTarget.java bf91d9e976b43ba70aaf7d436420307575502f07 GREEN
JavaCodeGeneratorEasyStartMenu.java f6f660fe4804d5229de9f729657116d6b821aaee GREEN
JavaGeneratorExecutionTarget.java dba521d1b700365c0522b7c70e49653fcced66cb GREEN
......@@ -15,6 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.component.ui.generator;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.containsReadOnlyBehaviorSpecification;
import static org.fortiss.af3.project.ui.AF3ProjectUIActivator.getImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
......@@ -56,7 +57,8 @@ public class CCodeGeneratorEasyStartMenu extends EasyStartMenuBase {
protected boolean acceptSelection(INamedElement selection,
ContextMenuContextProvider contextProvider) {
return (selection instanceof ComponentArchitecture) &&
INavigatorService.getInstance().isNavigatorView(contextProvider);
INavigatorService.getInstance().isNavigatorView(contextProvider) &&
!containsReadOnlyBehaviorSpecification(selection);
}
/** {@inheritDoc} */
......
......@@ -16,6 +16,7 @@
package org.fortiss.af3.component.ui.generator;
import static org.fortiss.af3.component.ui.AF3ComponentUIActivator.getImageDescriptor;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.containsReadOnlyBehaviorSpecification;
import org.eclipse.jface.resource.ImageDescriptor;
import org.fortiss.af3.component.model.ComponentArchitecture;
......@@ -56,7 +57,8 @@ public class FMUGeneratorEasyStartMenu extends EasyStartMenuBase {
protected boolean acceptSelection(INamedElement selection,
ContextMenuContextProvider contextProvider) {
return (selection instanceof ComponentArchitecture) &&
INavigatorService.getInstance().isNavigatorView(contextProvider);
INavigatorService.getInstance().isNavigatorView(contextProvider) &&
!containsReadOnlyBehaviorSpecification(selection);
}
/** {@inheritDoc} */
......
......@@ -15,6 +15,8 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.component.ui.generator;
import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace;
import static org.eclipse.core.runtime.Path.fromOSString;
import static org.eclipse.ui.PlatformUI.getWorkbench;
import static org.fortiss.af3.expression.utils.DataDictionaryUtils.findDataDictionary;
import static org.fortiss.af3.project.ui.utils.FolderOrProjectDialogUtils.openFolderDialog;
......@@ -49,6 +51,7 @@ import org.apache.commons.lang.ArrayUtils;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.dialogs.IInputValidator;
......@@ -70,6 +73,7 @@ import org.fortiss.af3.generator.common.textgen.c.FMUModelDescriptionTextGenerat
import org.fortiss.af3.generator.common.textgen.c.FMUTopCEntryTextGenerator;
import org.fortiss.af3.project.extension.base.ExecutionTargetBase;
import org.fortiss.af3.project.extension.data.Executable;
import org.fortiss.af3.project.model.execution.ExecutionConfiguration;
/**
* Execution target implementation for the FMU generator.
......@@ -94,19 +98,23 @@ public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
@Override
protected void doExecute(Executable executable) {
FMUArchivePackage fmuSource = (FMUArchivePackage)executable.getExecutableObject();
ExecutionConfiguration config = executable.getConfiguration();
Shell currentShell = getWorkbench().getActiveWorkbenchWindow().getShell();
DataDictionary dd = findDataDictionary(((ComponentArchitecture)executable.getSource()));
Double samplingTime = getSamplingTime(dd);
if(samplingTime == null) {
return;
Double samplingTime = null;
IResource targetFolder;
if(config == null) {
IPath path = fromOSString("AF3-Project-Directory/");
targetFolder = getWorkspace().getRoot().findMember(path);
} else {
samplingTime = getSamplingTime(dd);
if(samplingTime == null) {
return;
}
targetFolder = openFolderDialog();
fmuSource.setStepDuration(samplingTime.doubleValue());
}
System.out.print(samplingTime);
fmuSource.setStepDuration(samplingTime.doubleValue());
IResource targetFolder = openFolderDialog();
if(targetFolder == null) {
return;
}
......@@ -161,8 +169,10 @@ public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
} catch(CoreException cex) {
error(AF3ComponentUIActivator.getDefault(), cex.getMessage(), cex);
}
MessageDialog.openInformation(currentShell, "Successful FMU export", fmuSource
.getModelDescription().getName() + ".fmu was successfuly generated!");
if(config != null) {
MessageDialog.openInformation(currentShell, "Successful FMU export", fmuSource
.getModelDescription().getName() + ".fmu was successfuly generated!");
}
}
/**
......@@ -215,7 +225,6 @@ public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
System.lineSeparator() +
message +
System.lineSeparator() +
"As sampling time function is not (properly) defined, please provide the frequency of the component in Hertz:",
lastSelectedFrequency + "", new NumberValidator());
if(durationDlg.open() != Window.OK) {
......
......@@ -15,6 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.component.ui.generator;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.containsReadOnlyBehaviorSpecification;
import static org.fortiss.af3.project.ui.AF3ProjectUIActivator.getImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
......@@ -55,8 +56,8 @@ public class JavaCodeGeneratorEasyStartMenu extends EasyStartMenuBase {
@Override
protected boolean acceptSelection(INamedElement selection,
ContextMenuContextProvider contextProvider) {
return (selection instanceof ComponentArchitecture) &&
INavigatorService.getInstance().isNavigatorView(contextProvider);
return (selection instanceof ComponentArchitecture)&&INavigatorService.getInstance().isNavigatorView(contextProvider) &&
!containsReadOnlyBehaviorSpecification(selection);
}
/** {@inheritDoc} */
......
ComponentSpecificationPropertySection.java 13af2242556d94a2df9d0035b6f68b6921d90b80 GREEN
PortDataPropagation.java 41a54f4ce2d0de4e43f8da8a77cfdedf3fe7737c GREEN
ComponentSpecificationPropertySection.java ef532bab05b94016bef7c483ec1b42f189b03ab6 GREEN
PortDataPropagation.java e8a908f4d671efb353a8c3ed5384f529b2b27975 GREEN
PortInitValueSection.java 262ff93e8fcda571e0804705b952334fd074793d RED
PortSpecificationPropertySection.java 957c34cd9e85b2307217edb53b7dd31e0fbbe629 RED
TypeLabelProvider.java 5b0fcced122681125f7df55469ea19b3685eb8bd GREEN
......@@ -57,7 +57,6 @@ import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
* @author eder
*/
public final class ComponentSpecificationPropertySection extends PropertySectionBase {
/** Stores the current input. */
private Component component;
......
......@@ -17,6 +17,7 @@ package org.fortiss.af3.component.ui.properties;
import static org.eclipse.swt.SWT.HORIZONTAL;
import static org.eclipse.swt.SWT.PUSH;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.hasReadOnlyBehaviorSpecification;
import java.util.ArrayList;
import java.util.List;
......@@ -262,12 +263,51 @@ class PortDataPropagation implements SelectionListener {
*/
public void refresh(Port port) {
portsToPropagate = getPortsToPropagate(port, portDataAccess.getPart());
if(seenAsSource(port, portDataAccess.getPart())) {
propagateBackward.setEnabled(false);
propagateForward.setEnabled(!portsToPropagate.isEmpty());
if(isPortComponentHasExternalSpecification(port)) {
if(seenAsSource(port, portDataAccess.getPart())) {
propagateBackward.setEnabled(false);
propagateForward.setEnabled(!portsToPropagate.isEmpty());
} else {
propagateBackward.setEnabled(!portsToPropagate.isEmpty());
propagateForward.setEnabled(false);
}
}
}
/**
* Check if the port attached/connected to component has External Specifications then disable
* the propagation data
*/
private Boolean isPortComponentHasExternalSpecification(Port port) {
propagateForward.setEnabled(false);
propagateBackward.setEnabled(false);
boolean checkPortOut = true;
EList<Channel> channelsOut = port.getOutgoingChannels();
EList<Channel> channelsIn = port.getIncomingChannels();
if(!channelsOut.isEmpty()) {
for(Channel ch : channelsOut) {
Component targetComponent = ch.getTarget().getComponent();
if(hasReadOnlyBehaviorSpecification(targetComponent)) {
checkPortOut = false;
}
}
} else {
checkPortOut = false;
}
propagateForward.setEnabled(checkPortOut && seenAsSource(port, portDataAccess.getPart()));
boolean checkPortIn = true;
if(!channelsIn.isEmpty()) {
for(Channel ch : channelsIn) {
Component sourceComponent = ch.getSource().getComponent();
if(hasReadOnlyBehaviorSpecification(sourceComponent)) {
checkPortIn = false;
}
}
} else {
propagateBackward.setEnabled(!portsToPropagate.isEmpty());
propagateForward.setEnabled(false);
checkPortIn = false;
}
propagateBackward.setEnabled(checkPortIn && !seenAsSource(port, portDataAccess.getPart()));
return(checkPortOut && checkPortIn);
}
}
SimulationManager.java 9b1e4eb4ceafdb5c9dc7bf5f5150abe0e57dd8bf GREEN
SimulationPerspective.java 6d99ef287c75a0b0d40327a1ae5ddf9ff6003f2f GREEN
SimulationView.java 7bfea7cbe39aaa740058fac3ab5fcf66a0d1304e GREEN
SimulatorEasyStartMenu.java 75f777afc76a7713d10ebaffbb248b6c8af2ccdf GREEN
SimulatorEasyStartMenu.java ac7c0003cf48a80cd4b56c4b2b2a57d1207445cd GREEN
SimulatorExecutionTarget.java 658ec31aafe5b4474cdfa5de03a30c91f2196577 GREEN
SimulatorExecutionTargetBase.java eab5ff1d6b857d3b99c568860e6caff8e4509cb7 GREEN
......@@ -17,6 +17,7 @@ package org.fortiss.af3.component.ui.simulator;
import static org.conqat.ide.commons.ui.ui.WorkbenchUtils.getActiveWorkbenchPage;
import static org.fortiss.af3.component.ui.AF3ComponentUIActivator.getDefault;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.containsReadOnlyBehaviorSpecification;
import static org.fortiss.af3.component.utils.ComponentLibraryUtils.cleanTemporaryCopiedProject;
import static org.fortiss.af3.component.utils.ComponentLibraryUtils.copyComponentIntoNewProject;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
......@@ -73,7 +74,8 @@ public class SimulatorEasyStartMenu extends EasyStartMenuBase {
protected boolean acceptSelection(INamedElement selection,
ContextMenuContextProvider contextProvider) {
return (selection instanceof ComponentArchitecture || selection instanceof Component) &&
INavigatorService.getInstance().isNavigatorView(contextProvider);
INavigatorService.getInstance().isNavigatorView(contextProvider) &&
!containsReadOnlyBehaviorSpecification(selection);
}
/** {@inheritDoc} */
......
BehaviorComponentCompositor.java e8dcb90f31a9fb4ccadf5ae96483d5d30ed6703d GREEN
BehaviorComponentCompositorBase.java a14aaa09f49e6dfb9c5e0701cc4ce98cf96ea0c7 GREEN
BehaviorComponentCompositorBase.java b29fecf99dbb1ef8d7b57875f93804913a703662 GREEN
ComponentArchitectureCompositor.java ea69480c2f1e2f392eeabb31a9a8e450e350d196 GREEN
ComponentArchitectureFileProjectCompositor.java 0be29f5ed0eca54797c51c8a263c8bd77922d72b GREEN
ComponentCompositor.java 55c5e8c08f6e5d9a9998165bb9eba706c9e46998 GREEN
......
......@@ -18,9 +18,11 @@ package org.fortiss.af3.component.compose;
import static org.conqat.lib.commons.reflect.ReflectionUtils.pickInstanceOf;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.hasBehaviorDefinitionSpecification;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.isAtomicComponent;
import static org.fortiss.af3.component.utils.ComponentUtils.isTopComponent;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.IReadOnlyBehaviorSpecification;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
......@@ -41,17 +43,21 @@ public abstract class BehaviorComponentCompositorBase<T extends Component> exten
if(!isCorrectElementClass(contained)) {
return false;
}
boolean isRootComponent = true;
if(contained instanceof IReadOnlyBehaviorSpecification && !isTopComponent(container)) {
isRootComponent = isTopComponent(container.getParentComponent());
}
// @CodeFormatterOff
// 1) does not allow composition with component architecture root component
// 2) does not allow to add the same specification twice; however different specifications are allowed
// 3) does not allow behavior specification, if container has a subcomponent (https://af3.fortiss.org/issues/458)
// 4) does not allow behavior specification, if container already has one (https://af3.fortiss.org/issues/1175)
// 5) does not allow IReadOnlyBehaviorSpecification specification, if container's parent component in NOT component architecture root component
return container.eContainer() instanceof Component // 1
&& pickInstanceOf(contained.getClass(), container.getSpecifications()) == null // 2)
&& isAtomicComponent(container) // 3)
&& !hasBehaviorDefinitionSpecification(container); //4
&& !hasBehaviorDefinitionSpecification(container) //4
&& isRootComponent; //5
// @CodeFormatterOn
}
......
BehaviorModelElementFactory.java 5be68f9a2ae4fad663d6fb20f6c5c7b12c0647ab GREEN
ComponentArchitectureTransformationBase.java adb7d3e5f240e5b1aea15f35b458a136d8cb79d6 GREEN
ComponentArchitectureUtils.java 69af57a2bf19473f4202dc7fb95d64c4e93a7bd7 GREEN
ComponentArchitectureUtils.java 6fba78c1a5fae9ae9cd6c4f39ad1de30054fd5af GREEN
ComponentLibraryModelElementFactory.java b6c854e91d431fa3bc42fafdcf618a2040d23ab4 GREEN
ComponentLibraryUtils.java eacae09896dab81355565ae295c2c3400ab007b0 GREEN
ComponentModelElementFactory.java 520d0d3d3763dee16990d4d30792fbf315d10a8a GREEN
......
......@@ -350,4 +350,24 @@ public class ComponentArchitectureUtils {
// get(0): this is fine because of the check
return list.size() != 1 ? false : list.get(0) instanceof IReadOnlyBehaviorSpecification;
}
/**
* Check if the ComponentArchitecture has any component with the ReadOnlyBehaviorSpecification
* inside or if the selection is component then check if it has ReadOnlyBehaviorSpecification
*/
public static boolean containsReadOnlyBehaviorSpecification(EObject selection) {
if(selection instanceof Component) {
return hasReadOnlyBehaviorSpecification((Component)selection);
} else if(selection instanceof ComponentArchitecture) {
Component rootComponent = ((ComponentArchitecture)selection).getTopComponent();
EList<Component> subComponentsList = rootComponent.getSubComponents();
for(Component c : subComponentsList) {
if(hasReadOnlyBehaviorSpecification(c)) {
return true;
}
}
return false;
}
return true;
}
}
......@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/xchart-3.5.2.jar"/>
<classpathentry kind="output" path="build"/>
</classpath>
......@@ -9,7 +9,10 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="3.7.0";visibility:=reexport,
org.fortiss.tooling.base.ui;bundle-version="1.0.0";visibility:=reexport,
org.fortiss.af3.component,
org.fortiss.af3.cosimulation;bundle-version="1.0.0",
org.fortiss.af3.component.ui;bundle-version="2.13.0"
org.fortiss.af3.component.ui;bundle-version="2.13.0",
org.eclipse.fx.javafx
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: fortiss GmbH
Bundle-ClassPath: .,
lib/xchart-3.5.2.jar
# (c) 2017 fortiss GmbH
bin.includes = .,\
META-INF/,\
plugin.xml
bin.includes = META-INF/,\
plugin.xml,\
.,\
lib/xchart-3.5.2.jar
output.. = build/
source.. = src/
output.. = build/
\ No newline at end of file
......@@ -27,5 +27,17 @@
</modelElementClass>
</modelEditorBinding>
</extension>
<extension
point="org.fortiss.tooling.kernel.ui.contextMenuContribution">
<contextMenuContribution
contributor="org.fortiss.af3.cosimulation.ui.simulator.FMUSimulatorEasyStartMenu">
</contextMenuContribution>
</extension>
<extension
point="org.fortiss.af3.project.executionTarget">
<executionTarget
target="org.fortiss.af3.cosimulation.ui.simulator.FMUSimulatorExecutionTarget">
</executionTarget>
</extension>
</plugin>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment