Commit da68a8d6 authored by Alexander Diewald's avatar Alexander Diewald

Merge branch '3838' into 'master'

3838

See merge request !330
parents db4d2bc6 bb9e76aa
AbstractComponentToImage.java 2da368d234415e072899b1827c83fa78b5523ffc GREEN
ExportComponentToImage.java 9f2c80bdb1af3bf3a6e6e7f8576785bd651e2d58 GREEN
ExportModelToDocument.java 4e13fb5d6bb0d264852bc490b51c3dd11b01f587 YELLOW
ExportModelToDocument.java 8365d2e970db8a4badd3324d0f14ad7aa8d340ec GREEN
......@@ -17,12 +17,13 @@
package eu.fbk.af3.tools.diagram.ui.commands;
import static java.util.Collections.emptyList;
import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace;
import static org.eclipse.ui.PlatformUI.getWorkbench;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
......@@ -36,7 +37,6 @@ import org.eclipse.ui.PlatformUI;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.ProjectUtils;
import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
import org.fortiss.tooling.kernel.ui.internal.views.NavigatorViewPart;
......@@ -81,7 +81,7 @@ public class ExportModelToDocument extends AbstractComponentToImage {
} else if(selection instanceof Component) {
selectedComponent = (Component)selection;
} else {
return Collections.emptyList();
return emptyList();
}
final List<IContributionItem> contributionItems = new ArrayList<IContributionItem>();
......@@ -90,7 +90,7 @@ public class ExportModelToDocument extends AbstractComponentToImage {
return contributionItems;
}
return Collections.emptyList();
return emptyList();
}
/** The action. */
......@@ -123,7 +123,8 @@ public class ExportModelToDocument extends AbstractComponentToImage {
return;
}
final FileProject fileProject = ProjectUtils.getFileProject(selectedComponent);
final FileProject fileProject =
getFirstParentWithType(selectedComponent, FileProject.class);
final DocumentGenerator documentGenerator = new DocumentGenerator();
documentGenerator.init(fileProject.getName(), parameterDialog.getDocumentFormat());
......
AllocationTableEditor.java f6f1c153cb555b7cf5b42fec63fce7ae217517f6 GREEN
ArchitectureParameterEditorBase.java c9e9a721f5b8aee62c39ae3307c9ad32a78bce4a GREEN
ArchitectureParameterTableEditorBase.java c5af213271a7a4e9d7d3bc18ab82879ef4030213 GREEN
ModelListenerEditorBase.java 0d0b5bc9c4385061cc69d30f7d9bcd19d5837324 GREEN
ArchitectureParameterTableEditorBase.java 1bf2f9273e4bbecc779cedcbce2d4742db0eb32c GREEN
ModelListenerEditorBase.java f8970c5917a9a4e71d86f739a60a21bcd10f2d93 GREEN
ParameterTableEditor.java 435231b3020dca1e20189a132439cc666cc72eb6 GREEN
......@@ -15,12 +15,13 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.allocation.ui.editor;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import java.util.Collection;
import org.fortiss.af3.allocation.model.ParameterEntry;
import org.fortiss.af3.allocation.model.ParameterTable;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.ProjectUtils;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
......@@ -62,7 +63,7 @@ public abstract class ArchitectureParameterTableEditorBase<A extends IProjectRoo
/** {@inheritDoc} */
@Override
protected FileProject getFileProject() {
return ProjectUtils.getFileProject(architecture);
return getFirstParentWithType(architecture, FileProject.class);
}
/** Performs a full update for the given {@link ParameterTable}. */
......
......@@ -23,6 +23,7 @@ import static org.fortiss.af3.allocation.model.AF3AllocationPackage.Literals.ALL
import static org.fortiss.af3.allocation.model.AF3AllocationPackage.Literals.ALLOCATION_TABLE__TARGET_VIEW;
import static org.fortiss.tooling.kernel.model.FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME;
import static org.fortiss.tooling.kernel.ui.util.SelectionUtils.checkAndPickFirst;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.runAsCommand;
import java.util.Collection;
......@@ -49,7 +50,6 @@ import org.eclipse.swt.widgets.Display;
import org.fortiss.af3.allocation.model.AllocationEntry;
import org.fortiss.af3.allocation.model.AllocationTable;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.ProjectUtils;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.editor.GEFEditorBase;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
......@@ -346,7 +346,7 @@ public abstract class ModelListenerEditorBase<T extends EObject> extends GEFEdit
* registered.
*/
protected FileProject getFileProject() {
return ProjectUtils.getFileProject(getEditedObject());
return getFirstParentWithType(getEditedObject(), FileProject.class);
}
/** {@inheritDoc} */
......
AllocationModelElementFactory.java 9aba183708290c741ebbbe2897bbfcc51ea33fb6 GREEN
AllocationUtils.java ef4a95f7373ef8013952535b91ffe1d334bc380b GREEN
AllocationUtils.java ad2c5fd704b4b72c38e2c52c9c88f22a10d47eec GREEN
......@@ -20,13 +20,13 @@ import static org.conqat.lib.commons.reflect.ReflectionUtils.isInstanceOfAny;
import static org.eclipse.emf.ecore.util.EcoreUtil.create;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.createAllocationEntry;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.createAllocationTableCollection;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.common.util.LambdaUtils.asStream;
import static org.fortiss.tooling.common.util.LambdaUtils.getFirst;
import static org.fortiss.tooling.common.util.LambdaUtils.isAssignableFromAny;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.copyToRefMap;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getEClassForClass;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.computeFullyQualifiedName;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
......@@ -722,7 +722,7 @@ public class AllocationUtils {
at.setTargetView(targetView);
atc.getContainedElements().add(at);
FileProject fileProject = getFileProject(modelRef);
FileProject fileProject = getFirstParentWithType(modelRef, FileProject.class);
if(IPersistencyService.getInstance().getTopLevelElementFor(fileProject) != null) {
IElementCompositorService cs = IElementCompositorService.getInstance();
cs.compose(fileProject, atc, null);
......
ComponentArchitectureTransformationMenuBase.java 368175b563d71779b3c3ba01f018f174f63fd8c9 GREEN
ComponentArchitectureTransformationMenuBase.java 22b6e8af5218780335c1ff938fc05140016cae21 GREEN
......@@ -18,10 +18,10 @@ package org.fortiss.af3.component.ui.commands;
import static java.util.Collections.emptyList;
import static org.eclipse.jface.dialogs.MessageDialog.openConfirm;
import static org.eclipse.swt.widgets.Display.getCurrent;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.service.IElementCompositorService.getInstance;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstChildWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import java.util.ArrayList;
import java.util.List;
......@@ -99,7 +99,7 @@ public abstract class ComponentArchitectureTransformationMenuBase<A extends IPro
/** {@inheritDoc} */
@Override
public void run() {
FileProject fileProject = getFileProject(ca);
FileProject fileProject = getFirstParentWithType(ca, FileProject.class);
ITopLevelElement topLevelElement =
IPersistencyService.getInstance().getTopLevelElementFor(fileProject);
......
BehaviorModelElementFactory.java 5be68f9a2ae4fad663d6fb20f6c5c7b12c0647ab GREEN
ComponentArchitectureTransformationBase.java ad6f06093cb813a05d13e87bbd0d620b43d2a5ab GREEN
ComponentArchitectureUtils.java 11ecb39b4ad807a9b6c37a3e485bde56dab377dc GREEN
ComponentArchitectureTransformationBase.java da3a674974ee3304af109357e674ab7d6e0dde86 GREEN
ComponentArchitectureUtils.java 8a894320e5aa34ea2078601ca47ccabdd082d544 GREEN
ComponentLibraryModelElementFactory.java b6c854e91d431fa3bc42fafdcf618a2040d23ab4 GREEN
ComponentLibraryUtils.java dd5fb918e37c98c885b59ea1a7915b8cdf149997 GREEN
ComponentLibraryUtils.java 93a2e01745d94438cb4c06b75fc9032b3d7a521d GREEN
ComponentModelElementFactory.java 7d73764f4ebc3a45bcd2833c68a06213109784a0 GREEN
ComponentProgramUtils.java 71faad6256159ee2d59843fcde83ac6995dff0fe GREEN
ComponentUtils.java e2ae1c22731f28dfcb6ddfde1518974d819e20f1 GREEN
......
......@@ -20,8 +20,8 @@ import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.cre
import static org.fortiss.af3.allocation.utils.AllocationUtils.addAllocationEntry;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.isAtomicComponent;
import static org.fortiss.af3.component.utils.ComponentUtils.getAllSubComponentsRecursively;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.base.utils.AnnotationUtils.instantiateAnnotationsRecursive;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.fixMissingIDs;
......@@ -97,7 +97,7 @@ public abstract class ComponentArchitectureTransformationBase<A extends IHierarc
ComponentArchitecture componentArchitecture =
getParentElement(topLevelComponent, ComponentArchitecture.class, false);
FileProject fileProject = getFileProject(topLevelComponent);
FileProject fileProject = getFirstParentWithType(topLevelComponent, FileProject.class);
boolean hasModelContext =
IPersistencyService.getInstance().getTopLevelElementFor(fileProject) != null;
if(atc == null) {
......
......@@ -23,9 +23,9 @@ import static org.fortiss.af3.component.utils.ComponentModelElementFactory.creat
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.createMicroTypesystem;
import static org.fortiss.af3.project.utils.ProjectModelElementFactory.createFileProject;
import static org.fortiss.af3.project.utils.ProjectModelElementFactory.createProjectConfiguration;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.copy;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.findContentElementByNameAndClass;
......@@ -332,7 +332,7 @@ public class ComponentArchitectureUtils {
* @return the data dictionary.
*/
public static DataDictionary findDataDictionary(Component comp) {
FileProject fp = getFileProject(comp);
FileProject fp = getFirstParentWithType(comp, FileProject.class);
return DataDictionaryUtils.findDataDictionary(fp);
}
......
......@@ -19,9 +19,9 @@ import static org.fortiss.af3.component.utils.ComponentModelElementFactory.creat
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.createMicroTypesystem;
import static org.fortiss.af3.project.utils.ProjectModelElementFactory.createFileProject;
import static org.fortiss.af3.project.utils.ProjectModelElementFactory.createProjectConfiguration;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.copy;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.findElementById;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
......@@ -76,7 +76,7 @@ public class ComponentLibraryUtils {
createProjectConfiguration(createMicroTypesystem());
FileProject newFp = createFileProject("Temporary", projectConfiguration);
FileProject fp = getFileProject(comp);
FileProject fp = getFirstParentWithType(comp, FileProject.class);
Component top = comp.getTopComponentParent();
ModelElementLibraryService.getInstance().ensureChildrenLibraryReferenceAreUpToDate(top);
......@@ -121,7 +121,8 @@ public class ComponentLibraryUtils {
public static <T extends IIdLabeled> T findOriginalElement(EObject originalScope,
T copiedElement) {
// Find original file project
FileProject originalProject = findOriginalProject(getFileProject(originalScope));
FileProject originalProject =
findOriginalProject(getFirstParentWithType(originalScope, FileProject.class));
// Cannot find original file project
if(originalProject == null) {
......
......@@ -17,7 +17,7 @@ package test.org.fortiss.af3.component.generator;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.findComponentArchitecture;
import static org.fortiss.af3.project.utils.ProjectUtils.findOrCreateExecutionConfigurationFor;
import static org.fortiss.af3.project.utils.ProjectUtils.loadProjectFromPlugin;
import static org.fortiss.af3.project.utils.TestCaseProjectUtils.loadTestProject;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.findContentElementByNameAndClass;
import org.fortiss.af3.component.AF3ComponentActivator;
......@@ -39,8 +39,7 @@ public abstract class CCodeGeneratorTestsBase {
/** Compiles the computer architecture located in AF3 file to C. */
protected SourcePackage compileComponentArchitectureToC(String fileName) {
FileProject project =
loadProjectFromPlugin(AF3ComponentActivator.PLUGIN_ID, fileName, true);
FileProject project = loadTestProject(AF3ComponentActivator.PLUGIN_ID, fileName);
ComponentArchitecture ca = findComponentArchitecture(project, "Component Architecture");
ComponentArchitectureToCSourcePackageTransformation trans =
......
......@@ -15,21 +15,21 @@
+--------------------------------------------------------------------------*/
package test.org.fortiss.af3.component.library;
import static org.fortiss.af3.component.AF3ComponentActivator.PLUGIN_ID;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.findComponentArchitecture;
import static org.fortiss.af3.project.utils.ProjectUtils.loadProjectFromPlugin;
import static org.fortiss.tooling.kernel.utils.PrototypesUtils.findPrototypeComposableWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.fortiss.af3.component.AF3ComponentActivator;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.component.model.ComponentRef;
import org.fortiss.af3.component.model.LibraryComponent;
import org.fortiss.af3.component.model.behavior.code.CodeSpecification;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.TestCaseProjectUtils;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.model.ILibraryPackage;
......@@ -56,10 +56,7 @@ public class SmokeComponentLibraryTest extends LibraryTestBase {
/** Setup a fake context for the verification. */
@Before
public void setUp() throws Exception {
// Bring up persistence service for this test
IPersistencyService.getInstance().getClass();
project = loadProjectFromPlugin(AF3ComponentActivator.PLUGIN_ID,
"test-data/LibraryTests.af3_23", true);
project = TestCaseProjectUtils.loadTestProject(PLUGIN_ID, "test-data/LibraryTests.af3_23");
createAndSaveLibrary("default", "default");
......
......@@ -16,7 +16,7 @@
package test.org.fortiss.af3.component.model;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.findFirstComponentArchitecture;
import static org.fortiss.af3.project.utils.ProjectUtils.loadProjectFromPlugin;
import static org.fortiss.af3.project.utils.TestCaseProjectUtils.loadTestProject;
import org.fortiss.af3.component.AF3ComponentActivator;
import org.fortiss.af3.project.model.FileProject;
......@@ -43,9 +43,7 @@ public class FileLoadedTestModel extends ComponentTestModelBase {
public void setupModel() {
super.setupModel();
ICommandStackService.getInstance().runAsCommand(project, () -> {
FileProject project =
loadProjectFromPlugin(AF3ComponentActivator.PLUGIN_ID, fileToLoad, true);
FileProject project = loadTestProject(AF3ComponentActivator.PLUGIN_ID, fileToLoad);
componentArchitecture = findFirstComponentArchitecture(project);
rootComponent = componentArchitecture.getTopComponent();
......
......@@ -15,14 +15,14 @@
+--------------------------------------------------------------------------*/
package test.org.fortiss.af3.component.semantics;
import static org.fortiss.af3.component.AF3ComponentActivator.PLUGIN_ID;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.findComponentArchitecture;
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.createVar;
import static org.fortiss.af3.project.utils.ProjectUtils.loadProjectFromPlugin;
import static org.fortiss.af3.project.utils.TestCaseProjectUtils.loadTestProject;
import static org.fortiss.af3.project.utils.VariableScopeUtils.getVarDefinition;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.fortiss.af3.component.AF3ComponentActivator;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.project.model.FileProject;
......@@ -43,8 +43,7 @@ public class ComponentScopingTest {
/** Setup. */
@Before
public void setUp() {
FileProject project = loadProjectFromPlugin(AF3ComponentActivator.PLUGIN_ID,
"test-data/ComponentBasicTests.af3_23", true);
FileProject project = loadTestProject(PLUGIN_ID, "test-data/ComponentBasicTests.af3_23");
ComponentArchitecture ca = findComponentArchitecture(project, "Component Architecture");
top = ca.getTopComponent();
......
ExternalSpecificationEditor.java 23933c23e9d7561c717e091ff385838db474d177 GREEN
ExternalSpecificationEditor.java ed5f4f48c934c9532c3276a93947844c2b9a76c3 GREEN
ExternalSpecificationEditorBinding.java 0977f2e76e70305e3c074589657ffe4315c54c80 GREEN
......@@ -27,9 +27,9 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.cre
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.doubleType;
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.intType;
import static org.fortiss.af3.project.utils.FileUtils.getAF3EclipseProject;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.bind;
import static org.fortiss.tooling.kernel.ui.util.WidgetsFactory.createTextWithUndo;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.generateAllIDs;
import java.io.BufferedOutputStream;
......@@ -66,6 +66,7 @@ import org.fortiss.af3.cosimulation.model.AF3CosimulationPackage;
import org.fortiss.af3.cosimulation.model.FMUSpecification;
import org.fortiss.af3.cosimulation.model.IExternalBehaviorSpecification;
import org.fortiss.af3.cosimulation.model.SimulinkSpecification;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.model.typesystem.IType;
import org.fortiss.tooling.base.ui.editor.FormsEditorBase;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
......@@ -182,7 +183,7 @@ public class ExternalSpecificationEditor extends FormsEditorBase<IExternalBehavi
DefaultHandler handler =
parseXMLAndCreateOrModifyPorts(container, newOutputPorts, newInputPorts);
saxParser.parse(tempBuildDirectoryPath + File.separator + xmlName, handler);
generateAllIDs(getFileProject(container));
generateAllIDs(getFirstParentWithType(container, FileProject.class));
deleteExtraPorts(newInputPorts, newOutputPorts, container);
} catch(Exception e) {
MessageDialog.openInformation(currentShell,
......
ExternalSpecificationFXController.java 93296c80f8331d5ef5db210c113d6a29f0e2b5e6 GREEN
ExternalSpecificationFXController.java 2078c5cf3d028c87767cf1c90671c7ad5b340ef2 GREEN
ExternalSpecificationFXEditor.java f96392509542fa312b9d535dd441644c4c591e2b GREEN
ExternalSpecificationFXEditorBinding.java 15ee822f8428aadf70f8b6307298a96630972124 GREEN
......@@ -27,7 +27,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.cre
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.doubleType;
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.intType;
import static org.fortiss.af3.project.utils.FileUtils.getAF3EclipseProject;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.generateAllIDs;
import java.io.BufferedOutputStream;
......@@ -50,6 +50,7 @@ import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.cosimulation.model.FMUSpecification;
import org.fortiss.af3.cosimulation.model.IExternalBehaviorSpecification;
import org.fortiss.af3.cosimulation.model.SimulinkSpecification;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.model.typesystem.IType;
import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
......@@ -177,7 +178,7 @@ public class ExternalSpecificationFXController extends CompositeFXControllerBase
DefaultHandler handler =
parseXMLAndCreateOrModifyPorts(container, newOutputPorts, newInputPorts);
saxParser.parse(tempBuildDirectoryPath + File.separator + xmlName, handler);
generateAllIDs(getFileProject(container));
generateAllIDs(getFirstParentWithType(container, FileProject.class));
deleteExtraPorts(newInputPorts, newOutputPorts, container);
} catch(Exception e) {
showError(
......
......@@ -19,8 +19,8 @@ import static org.fortiss.af3.exploration.smt.modeltransformation.BasicDeploSche
import static org.fortiss.af3.exploration.smt.modeltransformation.BasicScheduleConstraint.generatePureScheduleConstraints;
import static org.fortiss.af3.exploration.smt.modeltransformation.ConstraintDefinitionUtils.createResourceAllocations;
import static org.fortiss.af3.exploration.smt.modeltransformation.TimingConstraintDefinition.generateTimingConstraints;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstChildWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import java.util.Collection;
......@@ -31,6 +31,7 @@ import org.fortiss.af3.exploration.smt.modeltransformation.ScheduleRun;
import org.fortiss.af3.exploration.smt.modeltransformation.SolverRun;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.Route;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.schedule.model.ResourceAllocation;
import org.fortiss.af3.task.model.Signal;
import org.fortiss.af3.task.model.Task;
......@@ -52,8 +53,8 @@ public class ScheduleTestRun implements TestRun {
@Override
public void addBasicConstraints(DSE dse, SuperSetMap superSetMap,
Collection<ExplorationTarget<?>> explorationTargets) throws Exception {
TimingSpecification timingSpecification =
getFirstChildWithType(getFileProject(dse), TimingSpecification.class);
TimingSpecification timingSpecification = getFirstChildWithType(
getFirstParentWithType(dse, FileProject.class), TimingSpecification.class);
superSetMap.put(ResourceAllocation.class,
createResourceAllocations(superSetMap.get(Task.class), timingSpecification));
......
......@@ -25,10 +25,9 @@ import static org.fortiss.af3.exploration.util.ModelSnapshotExtractUtils.createA
import static org.fortiss.af3.exploration.util.ModelSnapshotExtractUtils.createComponentArchitectureSnapshot;
import static org.fortiss.af3.exploration.util.ModelSnapshotExtractUtils.createTaskArchitectureSnapshot;
import static org.fortiss.af3.platform.utils.RouteUtils.extractRoutes;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.af3.project.utils.ProjectUtils.loadProjectFromPlugin;
import static org.fortiss.tooling.common.util.LambdaUtils.getFirst;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstChildWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.runAsCommand;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.fixMissingIDs;
......@@ -58,6 +57,7 @@ import org.fortiss.af3.platform.model.Route;
import org.fortiss.af3.platform.model.TransmissionUnit;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.storage.LocationProvider;
import org.fortiss.af3.project.utils.TestCaseProjectUtils;
import org.fortiss.af3.task.model.Task;
import org.fortiss.af3.task.model.TaskArchitecture;
import org.fortiss.tooling.base.model.element.IModelElement;
......@@ -137,7 +137,7 @@ public class TestDSEUtils {
* {@link PlatformArchitecture}.
*/
public static void createRoutes(DSE dse) {
FileProject fileProject = getFileProject(dse);
FileProject fileProject = getFirstParentWithType(dse, FileProject.class);
PlatformArchitecture platformArchitecture =
getFirstChildWithType(fileProject, PlatformArchitecture.class);
......@@ -177,7 +177,7 @@ public class TestDSEUtils {
public static FileProject loadTestProject(String name) {
String extension = "." + LocationProvider.CURRENT_AF3_PROJECT_FILES_EXTENSION;
String path = "test-data/" + name + (name.endsWith(extension) ? "" : extension);
return loadProjectFromPlugin(AF3ExplorationSMTActivator.PLUGIN_ID, path, true);
return TestCaseProjectUtils.loadTestProject(AF3ExplorationSMTActivator.PLUGIN_ID, path);
}
/** Get a reference to the {@link Task} derived from the given {@link Component}. */
......
DeploymentValidatorStartMenu.java 6d9269a6044a97986be2c6b549a3825a594e8227 GREEN
DeploymentValidatorStartMenu.java 2bf569c700307cfb8797d9421b0eae7d85438fdd GREEN
......@@ -19,8 +19,8 @@ import static java.util.Collections.emptyList;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.showInfo;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.showWarning;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.RIGHT_ARROW;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.util.ArrayList;
......@@ -97,7 +97,7 @@ public class DeploymentValidatorStartMenu implements IContextMenuContributor {
/** {@inheritDoc} */
@Override
public void run() {
FileProject fp = getFileProject(ta2hw);
FileProject fp = getFirstParentWithType(ta2hw, FileProject.class);
List<RuleSet> rsList = getChildrenWithType(fp, RuleSet.class);
ListSelectionDialog<RuleSet> dialog = new ListSelectionDialog<>(null, rsList);
......
......@@ -15,15 +15,15 @@
+--------------------------------------------------------------------------*/
package test.org.fortiss.af3.mira.model;
import static org.fortiss.af3.mira.AF3MiraActivator.PLUGIN_ID;
import static org.fortiss.af3.project.utils.TestCaseProjectUtils.loadTestProject;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.findContentElementByNameAndClass;
import static org.junit.Assert.assertNotNull;
import org.fortiss.af3.mira.AF3MiraActivator;
import org.fortiss.af3.mira.model.Analysis;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.glossary.GlossaryEntry;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.ProjectUtils;
import org.junit.Before;
/**
......@@ -39,8 +39,8 @@ public class MiraLoadingTest {
/** set-up */
@Before
public void setup() {
FileProject project = ProjectUtils.loadProjectFromPlugin(AF3MiraActivator.PLUGIN_ID,
"test-data/SimpleTrafficLightsExample.af3_20", true);
FileProject project =
loadTestProject(PLUGIN_ID, "test-data/SimpleTrafficLightsExample.af3_20");
tlcAnalysis = findContentElementByNameAndClass(project, "TL-Requirements", Analysis.class);
......
ExportProjectUtils.java 95b02d271335e46ce89f78c912f85236fc852988 GREEN
FileNameValidatorUtil.java c566595d083e756c20c919458d81e8a91ab0e10e GREEN
FolderOrProjectDialogUtils.java 14823ea1da085d019e21e50703f6f4e3fff8aa83 GREEN
ImportProjectUtils.java 87216991e47e14846f7affb49139a3dd2a71aba3 GREEN
ImportProjectUtils.java 0acc94710654741db24297a204761f465a2b1cc2 GREEN
NewProjectUiUtils.java cd17cec67769d1c62c9923869c43293036d103e4 GREEN
ParsingUtils.java 7bbc27436511ee9d88f8a31f0b19462406d01517 GREEN
......@@ -24,6 +24,7 @@ import static org.fortiss.af3.project.storage.LocationProvider.CURRENT_AF3_PROJE
import static org.fortiss.af3.project.ui.AF3ProjectUIActivator.getDefault;
import static org.fortiss.af3.project.ui.utils.NewProjectUiUtils.requestFileNameDialog;
import static org.fortiss.af3.project.utils.FileUtils.getDefaultGeneralProjectURI;
import static org.fortiss.af3.project.utils.ProjectUtils.importFileProject;
import static org.fortiss.tooling.kernel.ui.util.MessageUtilsExtended.showErrorInUIThread;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.showError;
......@@ -37,7 +38,6 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import org.fortiss.af3.project.utils.ProjectUtils;
/**
* Utility methods for importing projects into workspace.
......@@ -111,28 +111,6 @@ public class ImportProjectUtils {
return fileURI;
}
/**
* Imports the given {@link File} at the given {@link URI}. Resources that are referenced from
* the project are also copied to the target location.
* NOTE: Libraries are ignored during the import.
*
* @param sourceFileURI
* {@link File} that will be imported.
* @throws IOException
* if any error occurred when writing to the target location or inconsistencies in
* the project file w.r.t. to referenced files were detected.
*/
public static void importFileProject(URI sourceFileURI) throws IOException {
// Isolate the file name from the path to it.
String sourceFileName = sourceFileURI.lastSegment();
// Determine the file location of the target file.
URI targetFileURI = determineTargetFileLocation(
getDefaultGeneralProjectURI().appendSegment(sourceFileName));
ProjectUtils.importFileProject(sourceFileURI, targetFileURI);
}
/**
* Imports a selected file into the AF3 workspace.
*
......@@ -177,7 +155,7 @@ public class ImportProjectUtils {
// Copy the file, its associated library, and external documents.
try {
ProjectUtils.importFileProject(sourceFileURI, targetFileURI);
importFileProject(sourceFileURI, targetFileURI);
} catch(IOException e) {
error(getDefault(), "Error, cannot import AF3 project!", e);
showErrorInUIThread("Error, cannot import AF3 project!",
......