]> gerrit.simantics Code Review - simantics/interop.git/blob - org.simantics.interop.update/src/org/simantics/interop/update/editor/UpdateEditorInput.java
Three-way comparison: utilise old changes in the update step
[simantics/interop.git] / org.simantics.interop.update / src / org / simantics / interop / update / editor / UpdateEditorInput.java
1 package org.simantics.interop.update.editor;
2
3 import org.eclipse.ui.PartInitException;
4 import org.simantics.db.Resource;
5 import org.simantics.db.layer0.variable.RVI;
6 import org.simantics.ui.workbench.ResourceEditorInput2;
7 import org.simantics.utils.ui.workbench.WorkbenchUtils;
8
9 /**
10  * Editor input for ModelUpdateEditor
11  * 
12  * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
13  *
14  */
15 public class UpdateEditorInput extends ResourceEditorInput2{
16
17         private String editorID;
18         private Resource r1;
19         private Resource r2;
20         private Resource r3;
21         private boolean newDistinct = false;
22         
23         
24         public UpdateEditorInput(String editorID, Resource r1, Resource r2, RVI rvi) {
25                 this(editorID, r1, r2, null,rvi);
26         }
27         
28         /**
29          * 
30          * @param editorID
31          * @param r1  old model that is being updated
32          * @param r2  new model containing the changes that we want to apply
33          * @param r3  original model to detect user mace changes to the old model r1. This parameter can be 
34          * @param rvi
35          */
36         public UpdateEditorInput(String editorID, Resource r1, Resource r2, Resource r3, RVI rvi) {
37                 super(editorID, r1, r1, rvi);
38                 this.r1 = r1;
39                 this.r2 = r2;
40                 this.r3 = r3;
41                 this.editorID = editorID;
42         }
43
44         public Resource getR1() {
45                 return r1;
46         }
47         
48         public Resource getR2() {
49                 return r2;
50         }
51         
52         public Resource getR3() {
53                 return r3;
54         }
55         
56         
57         public void openEditor() throws PartInitException {
58                 WorkbenchUtils.openEditor(editorID, this);
59         }
60         
61         // With tree-way comparison, treat new resources for compared old and new models as distinct.
62         // default : false. Comparison may consider that new objects in models r1 and r2 are the same. 
63         public boolean isNewDistinct() {
64                 return newDistinct;
65         }
66         
67         public void setNewDistinct(boolean newDistinct) {
68                 this.newDistinct = newDistinct;
69         }
70         
71 }