Skip to content

Commit

Permalink
[2509] [Filtering VP] Transition raises NPE
Browse files Browse the repository at this point in the history
Bug: 2509
Change-Id: I04a81bc1e7048b36d80a6f48c7db922825696bdf
Signed-off-by: Tu Ton <[email protected]>
  • Loading branch information
minhtutonthat authored and pdulth committed Jun 20, 2019
1 parent 7a12029 commit aa4dce3
Show file tree
Hide file tree
Showing 10 changed files with 431 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,14 @@ public static Collection<Project> getMainAndReferencedVariantProjects(EObject ob
public static List<Project> getReferencedProjects(Project project) {
List<Project> res = new ArrayList<Project>();
Session session = SessionManager.INSTANCE.getSession(project);
TransactionalEditingDomain transactionalEditingDomain = session.getTransactionalEditingDomain();
IModel model = ILibraryManager.INSTANCE.getModel(project);
Collection<IModel> allReferences = LibraryManagerExt.getAllReferences(model);
for (IModel lib : allReferences) {
if (lib instanceof ICapellaModel) {
res.add(((ICapellaModel) lib).getProject(transactionalEditingDomain));
if (session != null) {
TransactionalEditingDomain transactionalEditingDomain = session.getTransactionalEditingDomain();
IModel model = ILibraryManager.INSTANCE.getModel(project);
Collection<IModel> allReferences = LibraryManagerExt.getAllReferences(model);
for (IModel lib : allReferences) {
if (lib instanceof ICapellaModel) {
res.add(((ICapellaModel) lib).getProject(transactionalEditingDomain));
}
}
}
return res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.polarsys.capella.core.data.capellamodeller.SystemEngineering;
import org.polarsys.capella.core.data.capellamodeller.Project;
import org.polarsys.capella.core.transition.common.constants.ITransitionConstants;
import org.polarsys.capella.core.transition.common.handlers.attachment.AttachmentHelper;
import org.polarsys.capella.core.transition.common.rules.AbstractUpdateRule;
Expand Down Expand Up @@ -52,12 +52,12 @@ protected void retrieveGoDeep(EObject source_p, List<EObject> result_p, IContext
*/
@Override
protected EObject getDefaultContainer(EObject element_p, EObject result_p, IContext context_p) {
return (SystemEngineering) context_p.get(ITransitionConstants.TRANSFORMATION_TARGET_ROOT);
return (Project) context_p.get(ITransitionConstants.TRANSFORMATION_TARGET_ROOT);
}

@Override
protected EObject getBestContainer(EObject element_p, EObject result_p, IContext context_p) {
return (SystemEngineering) context_p.get(ITransitionConstants.TRANSFORMATION_TARGET_ROOT);
return (Project) context_p.get(ITransitionConstants.TRANSFORMATION_TARGET_ROOT);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Require-Bundle: org.polarsys.capella.filtering.tools,
org.eclipse.emf.diffmerge.ui,
org.polarsys.capella.test.framework;bundle-version="1.2.1",
org.eclipse.emf.common,
org.polarsys.capella.filtering.sirius.analysis;bundle-version="1.2.0",
org.polarsys.capella.filtering.business.queries;bundle-version="1.2.0"
org.polarsys.capella.filtering.sirius.analysis,
org.polarsys.capella.filtering.business.queries,
org.polarsys.capella.test.transition.ju
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.polarsys.capella.filtering.tests.ju.tests.derivation,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Transition</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.polarsys.capella.project.nature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata:Metadata xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:metadata="http://www.polarsys.org/kitalpha/ad/metadata/1.0.0" id="_K6gXMJHCEem1yK30gj_gKA">
<viewpointReferences id="_K7_k8JHCEem1yK30gj_gKA" vpId="org.polarsys.capella.core.viewpoint" version="1.2.2"/>
<viewpointReferences id="_QoMSwJHCEem1yK30gj_gKA" vpId="org.polarsys.capella.filtering" version="1.2.0"/>
</metadata:Metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description" uid="_K6gXMZHCEem1yK30gj_gKA" selectedViews="_K8480JHCEem1yK30gj_gKA _LdOpwJHCEem1yK30gj_gKA _Ld0foJHCEem1yK30gj_gKA _LfAycJHCEem1yK30gj_gKA _LfUUcJHCEem1yK30gj_gKA _LfwZUJHCEem1yK30gj_gKA _Lf6KUJHCEem1yK30gj_gKA _QoyIoJHCEem1yK30gj_gKA" version="12.1.2.201804131029">
<semanticResources>Transition.afm</semanticResources>
<semanticResources>Transition.melodymodeller</semanticResources>
<ownedViews xmi:type="viewpoint:DView" uid="_K8480JHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.kitalpha.ad.integration.sirius/description/ad.odesign#//@ownedViewpoints[name='ad']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_LdOpwJHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/common.odesign#//@ownedViewpoints[name='Common']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_Ld0foJHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/context.odesign#//@ownedViewpoints[name='System%20Analysis']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_LfAycJHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/physical.odesign#//@ownedViewpoints[name='Physical%20Architecture']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_LfUUcJHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/logical.odesign#//@ownedViewpoints[name='Logical%20Architecture']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_LfwZUJHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/EPBS.odesign#//@ownedViewpoints[name='EPBS%20architecture']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_Lf6KUJHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/oa.odesign#//@ownedViewpoints[name='Operational%20Analysis']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_QoyIoJHCEem1yK30gj_gKA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.filtering.sirius.analysis/description/FilteringResults.odesign#//@ownedViewpoints[name='Filtering']"/>
</ownedViews>
</viewpoint:DAnalysis>
Loading

0 comments on commit aa4dce3

Please sign in to comment.