Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcdumoulin2013-03-18 19:49:31 -0400
committercdumoulin2013-03-18 19:49:31 -0400
commit046899cd66953b34694dce6a179ee343505719fa (patch)
tree99ac93db4bd9ffdb7becd5bcfd9dc884672d0208 /tests/junit/plugins/core
parent2c015dcd8fdc5d0bdc56a2669d4cf30dd52f68d9 (diff)
downloadorg.eclipse.papyrus-046899cd66953b34694dce6a179ee343505719fa.tar.gz
org.eclipse.papyrus-046899cd66953b34694dce6a179ee343505719fa.tar.xz
org.eclipse.papyrus-046899cd66953b34694dce6a179ee343505719fa.zip
ASSIGNED - bug 401107: [IPageManager] selectPage does not work
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401107 Add test to check the selectPage() method.
Diffstat (limited to 'tests/junit/plugins/core')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/sashmodel/query/SashModelQuery.java2
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CheckVisitor.java109
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CreateModelInSimpleContentProviderVisitor.java155
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/QueryVisitor.java134
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleContentProviderBaseVisitor.java313
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtils.java148
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtilsTest.java115
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/editor/SashMultiPageEditorTest.java3
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainerTest.java202
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/AbstractSash.java96
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java88
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/HSash.java67
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelExp.java28
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelObject.java38
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IPagesModelVisitor.java68
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/NoMatchException.java77
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Page.java117
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PagesModelException.java78
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PanelTerm.java74
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModel.java106
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModelFactory.java98
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/VSash.java67
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/WindowTerm.java83
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/package-info.java19
24 files changed, 2267 insertions, 18 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/sashmodel/query/SashModelQuery.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/sashmodel/query/SashModelQuery.java
index fe8bc5d27d8..7d98b85d88b 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/sashmodel/query/SashModelQuery.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/sashmodel/query/SashModelQuery.java
@@ -158,7 +158,7 @@ public class SashModelQuery {
*/
public void createModel(IQueryExp query) throws QueryException {
- Window first = sashModel.getWindows().get(0);
+ Window first;
if( query instanceof PanelTerm) {
first = getFirstWindowModel();
}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CheckVisitor.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CheckVisitor.java
new file mode 100644
index 00000000000..1c33b4ae10d
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CheckVisitor.java
@@ -0,0 +1,109 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Folder;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.HSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IPagesModelVisitor;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.NoMatchException;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Page;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.PagesModelException;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.VSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.WindowTerm;
+
+
+/**
+ * @author cedric dumoulin
+ *
+ */
+public class CheckVisitor extends SimpleContentProviderBaseVisitor implements IPagesModelVisitor<Object> {
+
+ /**
+ * @return the isVisitingParentFirst
+ */
+ @Override
+ public boolean isVisitingParentFirst() {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.WindowTerm, org.eclipse.papyrus.infra.core.sashwindows.di.Window)
+ *
+ * @param windowTerm
+ * @param windowModel
+ */
+ @Override
+ public void visit(WindowTerm windowTerm, RootModel windowModel) {
+ // TODO Auto-generated method stub
+
+ }
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.Folder)
+ *
+ * @param folder
+ */
+ @Override
+ public void visit(Folder folder, TabFolderModel folderModel) {
+ // Check name
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.HSash)
+ *
+ * @param sash
+ */
+ @Override
+ public void visit(HSash sash, SashPanelModel sashModel) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.VSash)
+ *
+ * @param sash
+ */
+ @Override
+ public void visit(VSash sash , SashPanelModel sashModel) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.Page)
+ *
+ * @param page
+ * @throws NoMatchException
+ */
+ @Override
+ public void visit(Page page, IPageModel pageModel) throws PagesModelException {
+ //check name
+ if(page.getIdentifier() != null) {
+ checkName(page.getIdentifier(), pageModel.getTabTitle()) ;
+ }
+ else if(page.getName() != null) {
+ checkName(page.getName(), pageModel.getTabTitle()) ;
+ }
+ }
+
+
+ protected void checkName( Object expectedName, Object foundName) throws NoMatchException {
+ if( expectedName != foundName )
+ throw new NoMatchException( "Names do not match (expected="
+ + expectedName + ", found="+ foundName );
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CreateModelInSimpleContentProviderVisitor.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CreateModelInSimpleContentProviderVisitor.java
new file mode 100644
index 00000000000..577ac4ef644
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/CreateModelInSimpleContentProviderVisitor.java
@@ -0,0 +1,155 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.AbstractPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SashPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.TabFolderModel;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.MessagePartModel;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Folder;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.HSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelExp;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IPagesModelVisitor;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Page;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.PanelTerm;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.VSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.WindowTerm;
+import org.eclipse.swt.SWT;
+
+/**
+ * This visitor is used with {@link IModelExp} to create a pages model in a {@link SimpleContentProvider} instancied
+ * with the Sash, folders and pages specified in the expr.
+ *
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class CreateModelInSimpleContentProviderVisitor extends SimpleContentProviderBaseVisitor implements IPagesModelVisitor<Object> {
+
+ /**
+ * {@link SimpleSashWindowsContentProvider} into which model is created.
+ */
+ private SimpleSashWindowsContentProvider contentProvider;
+
+ /**
+ * Constructor.
+ *
+ * @param contentProvider
+ */
+ public CreateModelInSimpleContentProviderVisitor(SimpleSashWindowsContentProvider contentProvider) {
+ this.contentProvider = contentProvider;
+ }
+
+ /**
+ * @return the isVisitingParentFirst
+ */
+ public boolean isVisitingParentFirst() {
+ return true;
+ }
+
+ /**
+ * There is no windowTerm counterpart in {@link SimpleSashWindowsContentProvider}.
+ * @param windowTerm
+ * @param windowModel
+ */
+ @Override
+ public void visit(WindowTerm windowTerm, RootModel windowModel) {
+ // Create children of the window
+ PanelTerm panel = windowTerm.getPanel();
+
+ AbstractPanelModel childPanel = createPanelOrFolder(panel, windowModel);
+ windowModel.replaceChild(windowModel.getChild(), childPanel);
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.Folder, org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder)
+ *
+ * @param folder
+ * @param folderModel
+ */
+ @Override
+ public void visit(Folder folder, TabFolderModel folderModel) {
+
+ // Create children of the folder
+ for( Page page : folder.getPages() ) {
+ // Create a page of type "MessagePartModel".
+ folderModel.getChildren().add( new MessagePartModel( page.getName(), page.getName() ));
+ }
+
+ }
+
+ /**
+ *
+ * @param sashQuery
+ * @param sashModel
+ */
+ public void visit(HSash sashQuery, SashPanelModel sashModel) {
+
+ // Create children of the sash
+ AbstractPanelModel leftChild = createPanelOrFolder(sashQuery.getLeftup(), sashModel);
+ sashModel.setLeftChild( leftChild ) ;
+ AbstractPanelModel rightChild = createPanelOrFolder(sashQuery.getRightdown(), sashModel);
+ sashModel.setRightChild(rightChild);
+ }
+
+ /**
+ * @param sashModel
+ * @param panel
+ */
+ private AbstractPanelModel createPanelOrFolder(PanelTerm panel, AbstractModel parent ) {
+ if(panel instanceof HSash) {
+ // Create a sash with null children.
+ // This is not a good example of how to proceed. Avoid to use it like this.
+ // Here we can do this because we know that we create the children soon.
+ return new SashPanelModel(parent, null, null, SWT.HORIZONTAL);
+ }
+ else if(panel instanceof VSash) {
+ return new SashPanelModel(parent, null, null, SWT.VERTICAL);
+ }
+ else /*if (panel instanceof Folder)*/ {
+ return new TabFolderModel(contentProvider);
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.VSash, org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel)
+ *
+ * @param sash
+ * @param sashModel
+ */
+ public void visit(VSash sashQuery, SashPanelModel sashModel) {
+ // Create children of the sash
+ AbstractPanelModel leftChild = createPanelOrFolder(sashQuery.getLeftup(), sashModel);
+ sashModel.setLeftChild( leftChild ) ;
+ AbstractPanelModel rightChild = createPanelOrFolder(sashQuery.getRightdown(), sashModel);
+ sashModel.setRightChild(rightChild);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.Page, org.eclipse.papyrus.infra.core.sashwindows.di.PageRef)
+ *
+ * @param page
+ * @param pageModel
+ */
+ public void visit(Page page, IPageModel pageModel) {
+ // Page is created and identifier already set.
+ // Nothing to do
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/QueryVisitor.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/QueryVisitor.java
new file mode 100644
index 00000000000..a44ba367f40
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/QueryVisitor.java
@@ -0,0 +1,134 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Folder;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.HSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelObject;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IPagesModelVisitor;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Page;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.VSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.WindowTerm;
+
+/**
+ * Visitor used to collect element in the model.
+ * Each element in the model associated with a{@link IQueryTerm} whose name is set is collectted.
+ * The collected element is then accessible from the result map, using the name set in the IQueryTerm.
+ *
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class QueryVisitor extends SimpleContentProviderBaseVisitor implements IPagesModelVisitor<Object> {
+
+ /**
+ * The result map.
+ */
+ protected Map<String, Object>result = new HashMap<String, Object>();
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.WindowTerm, org.eclipse.papyrus.infra.core.sashwindows.di.Window)
+ *
+ * @param windowTerm
+ * @param windowModel
+ */
+ @Override
+ public void visit(WindowTerm windowTerm, RootModel windowModel) {
+ collect( windowTerm, windowModel);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.Folder, org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder)
+ *
+ * @param folder
+ * @param folderModel
+ */
+ @Override
+ public void visit(Folder folder, TabFolderModel folderModel) {
+ collect(folder, folderModel);
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.HSash, org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel)
+ *
+ * @param sash
+ * @param sashModel
+ */
+ @Override
+ public void visit(HSash sash, SashPanelModel sashModel) {
+ collect(sash, sashModel);
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.VSash, org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel)
+ *
+ * @param sash
+ * @param sashModel
+ */
+ @Override
+ public void visit(VSash sash, SashPanelModel sashModel) {
+ collect(sash, sashModel);
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#visit(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.Page, org.eclipse.papyrus.infra.core.sashwindows.di.PageRef)
+ *
+ * @param page
+ * @param pageModel
+ */
+ @Override
+ public void visit(Page page, IPageModel pageModel) {
+ collect(page, pageModel);
+
+ }
+
+ /**
+ * Add the element associated to the query to the result, if the query has a name.
+ * @param iQueryTerm
+ * @param element
+ */
+ protected void collect( IModelObject iQueryTerm, Object element) {
+
+ if( iQueryTerm.getName() == null) {
+ return;
+ }
+
+ result.put(iQueryTerm.getName(), element);
+ }
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryVisitor#isVisitingParentFirst()
+ *
+ * @return
+ */
+ @Override
+ public boolean isVisitingParentFirst() {
+ return true;
+ }
+
+ /**
+ * @return the result
+ */
+ public Map<String, Object> getResult() {
+ return result;
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleContentProviderBaseVisitor.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleContentProviderBaseVisitor.java
new file mode 100644
index 00000000000..44c9f77204b
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleContentProviderBaseVisitor.java
@@ -0,0 +1,313 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
+import java.util.Iterator;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.AbstractPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.RootModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SashPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.TabFolderModel;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Folder;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.HSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IPagesModelVisitor;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.NoMatchException;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.Page;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.PagesModelException;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.SashPagesModel;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.VSash;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.WindowTerm;
+import org.eclipse.swt.SWT;
+
+/**
+ * A base implementation of {@link IPagesModelVisitor} to visit conjointly SashPagesModel and
+ * SimpleContentProvider.
+ *
+ * This implementation separate the navigation part (walk(term, contentProviderModel)) and
+ * the visit part (visit(term, contentProviderModel)). It implements the navigation part.
+ * <br>
+ * The visit part should be implemented by subclasses.
+ *
+ *
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class SimpleContentProviderBaseVisitor implements IPagesModelVisitor<Object> {
+
+ /**
+ * @return the isVisitingParentFirst
+ */
+ public boolean isVisitingParentFirst() {
+ return true;
+ }
+
+ /**
+ * Visit the model. Actually, there is no counterpart for {@link SashPagesModel} in {@link SimpleContentProvider}.
+ *
+ * @param windowTerm
+ * @param windowModel
+ * @throws PagesModelException
+ */
+ public void walk(SashPagesModel pagesModel, Object contentProviderModel) throws PagesModelException {
+ // Check associated model type
+ if(! (contentProviderModel instanceof SimpleSashWindowsContentProvider) ) {
+ throw new NoMatchException( "ContentProvider type ("+ contentProviderModel.getClass().getName()+ ") does not match to WindowTerm" );
+ }
+
+ SimpleSashWindowsContentProvider contentProvider = (SimpleSashWindowsContentProvider)contentProviderModel;
+
+ if( isVisitingParentFirst() ) {
+ visit(pagesModel, contentProvider);
+ }
+ // visit children
+ for( WindowTerm windowTerm : pagesModel.getWindows() ) {
+ // Only one window
+ RootModel windowModel = (RootModel) ((AbstractPanelModel)contentProvider.getRootModel()).getParent();
+ windowTerm.getPanel().accept(this, windowModel);
+ }
+ if( ! isVisitingParentFirst() ) {
+ visit(pagesModel, contentProvider);
+ }
+ }
+
+ /**
+ * Walk the WindowTerm and its child.
+ * @param windowTerm
+ * @param windowModel
+ * @throws PagesModelException
+ */
+ public void walk(WindowTerm windowTerm, Object windowModel) throws PagesModelException {
+ // Check associated model type
+ if(! (windowModel instanceof RootModel) ) {
+ throw new NoMatchException( "ContentProvider type ("+ windowModel.getClass().getName()+ ") does not match to WindowTerm" );
+ }
+
+ RootModel window = (RootModel)windowModel;
+
+ if( isVisitingParentFirst() ) {
+ visit(windowTerm, window);
+ }
+ // visit children
+ windowTerm.getPanel().accept(this, window.getChild());
+
+ if( ! isVisitingParentFirst() ) {
+ visit(windowTerm, window);
+ }
+ }
+
+ /**
+ * Walk folder and its children.
+ *
+ * @param folder
+ * @param folderModel
+ * @throws PagesModelException
+ */
+ public void walk(Folder folder, Object model) throws PagesModelException {
+ // Check associated model type
+ if(! (model instanceof TabFolderModel) ) {
+ throw new NoMatchException( this.toString() + " - Model object type does not match to FolderQueryPart" );
+ }
+ TabFolderModel folderModel = (TabFolderModel)model;
+
+ // Visit this
+ if( isVisitingParentFirst() ) {
+ visit(folder, folderModel);
+ }
+
+ // visit children
+ Iterator<IPageModel> pageRefs = folderModel.getChildren().iterator();
+ Iterator<Page> pageQueries = folder.getPages().iterator();
+ while (pageRefs.hasNext() && pageQueries.hasNext() ) {
+ IPageModel pageRef = pageRefs.next();
+ Page query = pageQueries.next();
+
+ query.accept(this, pageRef);
+ }
+ if (pageRefs.hasNext()) {
+ // some page left
+ throw new NoMatchException( "Folder matching - "
+ + this.toString()
+ +" folder model have more pages than folder query." );
+ } else if (pageQueries.hasNext() ) {
+ // some queries left
+ throw new NoMatchException( "Folder matching - "
+ + this.toString()
+ +" folder query have more page than folder model." );
+ }
+
+ // Visit this
+ if( ! isVisitingParentFirst() ) {
+ visit(folder, folderModel);
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IPagesModelVisitor#walk(org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.HSash, java.lang.Object)
+ *
+ * @param sash
+ * @param sashModel
+ * @throws PagesModelException
+ */
+ public void walk(HSash sash, Object model) throws PagesModelException {
+ // Check associated model type
+ if(! (model instanceof SashPanelModel) ) {
+ throw new NoMatchException( this.toString() + " - Model object type does not match to SashPanel (found "
+ + model.getClass()
+ + " )");
+ }
+
+ SashPanelModel sashModel = (SashPanelModel)model;
+
+ // Check orientation
+ if( sashModel.getSashDirection() != SWT.HORIZONTAL) {
+ throw new NoMatchException( this.toString() + " - SashOrientation does not match 'HORIZONTAL'" );
+ }
+ // Visit this
+ if( isVisitingParentFirst() ) {
+ visit(sash, sashModel);
+ }
+
+ // Visit children
+ sash.getLeftup().accept(this, sashModel.getChildren().get(0));
+ sash.getRightdown().accept(this, sashModel.getChildren().get(1));
+
+ if( !isVisitingParentFirst() ) {
+ visit(sash, sashModel);
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IPagesModelVisitor#walk(org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.VSash, java.lang.Object)
+ *
+ * @param sash
+ * @param sashModel
+ * @throws PagesModelException
+ */
+ public void walk(VSash sash, Object model) throws PagesModelException {
+ // Check associated model type
+ if(! (model instanceof SashPanelModel) ) {
+ throw new NoMatchException( this.toString() + " - Model object type does not match to SashPanel (found "
+ + model.getClass()
+ + " )");
+ }
+
+ SashPanelModel sashModel = (SashPanelModel)model;
+
+ // Check orientation
+ if( sashModel.getSashDirection() != SWT.VERTICAL) {
+ throw new NoMatchException( this.toString() + " - SashOrientation does not match 'VERTICAL'" );
+ }
+ // Visit this
+ if( isVisitingParentFirst() ) {
+ visit(sash, sashModel);
+ }
+
+ // Visit children
+ sash.getLeftup().accept(this, sashModel.getChildren().get(0));
+ sash.getRightdown().accept(this, sashModel.getChildren().get(1));
+
+ if( !isVisitingParentFirst() ) {
+ visit(sash, sashModel);
+ }
+ }
+
+ /**
+ * Walk the page. Simply call the corresponding {@link SimpleContentProviderBaseVisitor#visit(Page, IPageModel)} method.
+ * @param page
+ * @param pageModel
+ * @throws PagesModelException
+ */
+ public void walk(Page page, Object model) throws PagesModelException {
+ // Check associated model type
+ if(! (model instanceof IPageModel) ) {
+ throw new NoMatchException( this.toString() + " - Model object type does not match to PageRef" );
+ }
+ IPageModel pageModel = (IPageModel)model;
+ visit(page, pageModel);
+ }
+
+
+ /**
+ * Visit the model. Actually, there is no counterpart for {@link SashPagesModel} in {@link SimpleContentProvider}.
+ *
+ * @param windowTerm
+ * @param windowModel
+ * @throws PagesModelException
+ */
+ public void visit(SashPagesModel pagesModel, Object windowModel) throws PagesModelException {
+
+ }
+
+ /**
+ * Visit the corresponding node.
+ * To be implemented by subclass.
+ *
+ *
+ * @param windowTerm
+ * @param windowModel
+ */
+ public void visit(WindowTerm windowTerm, RootModel windowModel) throws PagesModelException {
+ // To be implemented by subclass.
+ }
+
+ /**
+ * Visit the corresponding node.
+ * To be implemented by subclass.
+ *
+ * @param folder
+ * @param folderModel
+ */
+ public void visit(Folder folder, TabFolderModel folderModel) throws PagesModelException{
+
+ }
+
+ /**
+ * Visit the corresponding node.
+ * To be implemented by subclass.
+ *
+ * @param sashQuery
+ * @param sashModel
+ */
+ public void visit(HSash sashQuery, SashPanelModel sashModel) throws PagesModelException {
+
+ }
+
+ /**
+ * Visit the corresponding node.
+ * To be implemented by subclass.
+ *
+ *
+ * @param sash
+ * @param sashModel
+ */
+ public void visit(VSash sashQuery, SashPanelModel sashModel) throws PagesModelException{
+ }
+
+ /**
+ * Visit the corresponding node.
+ * To be implemented by subclass.
+ *
+ *
+ * @param page
+ * @param pageModel
+ */
+ public void visit(Page page, IPageModel pageModel) throws PagesModelException {
+
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtils.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtils.java
new file mode 100644
index 00000000000..8742d3c4071
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtils.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
+import java.util.Map;
+
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelExp;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.PagesModelException;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.PanelTerm;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.WindowTerm;
+
+/**
+ * Class providing some utilities to check the {@link SimpleSashWindowsContentProvider} class.
+ * <br>
+ * This utilities allow to: populate a contentProvider, compare the contentProvider structure
+ * query the contentProvider structure.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class SimpleSashWindowContentProviderUtils {
+
+ /**
+ * ContentProvider used .
+ */
+ protected SimpleSashWindowsContentProvider contentProvider;
+
+ /**
+ * Constructor.
+ *
+ * @param modelMngr
+ */
+ public SimpleSashWindowContentProviderUtils(SimpleSashWindowsContentProvider contentProvider) {
+ this.contentProvider = contentProvider;
+ }
+
+
+ /**
+ * Check if the sashModel is conformed to the specified query.
+ * @param query
+ * @throws QueryException
+ */
+ public void assertConform(IModelExp query) throws PagesModelException {
+
+ Object first;
+ if( query instanceof WindowTerm) {
+ first = getFirstWindowModel();
+ }
+ else if( query instanceof PanelTerm) {
+ first = getFirstPanelModel();
+ }
+ else {
+ throw new PagesModelException("Don't know how to get the model associated to the first term of the expression (" + query.toString() + ")");
+ }
+
+ CheckVisitor visitor = new CheckVisitor();
+ query.accept(visitor, first);
+ }
+
+ /**
+ * Create an internal model conform to the specified query.
+ * Any previous model is disguarded.
+ *
+ * This method should only be called once on a {@link SimpleSashWindowsContentProvider}.
+ *
+ * @param query Should be a subtype PanelTerm (Folder, HSash, VSash)
+ * @throws QueryException
+ *
+ * TODO Ensure that the method can only be called once. For example,
+ * let this class extends {@link SimpleSashWindowsContentProvider}, and the constructor
+ * call this method.
+ */
+ public void createModel(IModelExp query) throws PagesModelException {
+
+ Object first ;
+ if( query instanceof PanelTerm) {
+ first = getFirstWindowModel();
+ }
+ else {
+ throw new PagesModelException("Don't know how to get the model associated to the first term of the expression (" + query.toString() + ")");
+ }
+
+ // Create a surrounding WindowTerm
+ WindowTerm windowTerm = new WindowTerm((PanelTerm)query);
+
+ CreateModelInSimpleContentProviderVisitor visitor = new CreateModelInSimpleContentProviderVisitor(contentProvider);
+ windowTerm.accept(visitor, first);
+ }
+
+ /**
+ * Get element in the model.
+ * Each model element whose corresponding model query part as a name is added to the result map.
+ * The element is then accessible with the name set in the query part.
+ *
+ * @param query
+ * @return
+ * @throws QueryException
+ */
+ public Map<String, Object> queryModel(IModelExp query) throws PagesModelException {
+
+ Object first;
+ if( query instanceof WindowTerm) {
+ first = getFirstWindowModel();
+ }
+ else if( query instanceof PanelTerm) {
+ first = getFirstPanelModel();
+ }
+ else {
+ throw new PagesModelException("Don't know how to get the model associated to the first term of the expression (" + query.toString() + ")");
+ }
+
+ QueryVisitor visitor = new QueryVisitor();
+ query.accept(visitor, first);
+
+ return visitor.getResult();
+ }
+
+ /**
+ * Get the model of the first the first window (in actual implementation their is only one window).
+ * @return
+ */
+ private RootModel getFirstWindowModel() {
+ // Silly method to get the RootModel
+ return (RootModel)((AbstractPanelModel)contentProvider.getRootModel()).getParent();
+ }
+
+ /**
+ * Get the panel of the first window (in actual implementation their is only one window).
+ * @return
+ */
+ private AbstractPanelModel getFirstPanelModel() {
+ // In this implementation, the root is always of type AbstractPanelModel
+ return (AbstractPanelModel)contentProvider.getRootModel();
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtilsTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtilsTest.java
new file mode 100644
index 00000000000..2c3ee148e8d
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowContentProviderUtilsTest.java
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
+import static org.junit.Assert.*;
+
+import java.util.Map;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelExp;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.PagesModelException;
+
+import static org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.SashPagesModelFactory.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * @author dumoulin
+ *
+ */
+public class SimpleSashWindowContentProviderUtilsTest {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SimpleSashWindowContentProviderUtils#assertConform(org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelExp)}.
+ * @throws PagesModelException
+ */
+ @Test
+ public void testAssertConform() throws PagesModelException {
+ SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
+ SimpleSashWindowContentProviderUtils helper = new SimpleSashWindowContentProviderUtils(contentProvider);
+
+ assertNotNull("helper created", helper);
+ // Create a query
+ IModelExp expr = vSash( folder( "f1", page("p1")), folder( "f2", page("p2")));
+ // Try to create the model
+ helper.createModel(expr);
+
+ // Try to check model
+ helper.assertConform(expr);
+
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SimpleSashWindowContentProviderUtils#createModel(org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelExp)}.
+ * @throws PagesModelException
+ */
+ @Test
+ public void testCreateModel() throws PagesModelException {
+ SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
+ SimpleSashWindowContentProviderUtils helper = new SimpleSashWindowContentProviderUtils(contentProvider);
+
+ assertNotNull("helper created", helper);
+ // Create a query
+ IModelExp expr = vSash( folder( "f1", page("p1")), folder( "f2", page("p2")));
+ // Try to create the model
+ helper.createModel(expr);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SimpleSashWindowContentProviderUtils#queryModel(org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelExp)}.
+ * @throws PagesModelException
+ */
+ @Test
+ public void testQueryModel() throws PagesModelException {
+ SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
+ SimpleSashWindowContentProviderUtils helper = new SimpleSashWindowContentProviderUtils(contentProvider);
+
+ assertNotNull("helper created", helper);
+ // Create a query
+ IModelExp expr = vSash( folder( "f1", page("p1")), folder( "f2", page("p2")));
+ // Try to create the model
+ helper.createModel(expr);
+
+ // Query model
+ Map<String, Object> res = helper.queryModel(expr);
+ assertNotNull("found f1", res.get("f1"));
+ assertTrue("right type", res.get("f1") instanceof TabFolderModel );
+
+ assertNotNull("found f2", res.get("f2"));
+ assertTrue("right type", res.get("f2") instanceof TabFolderModel );
+
+ assertNotNull("found p2", res.get("p2"));
+ assertTrue("right type", res.get("p2") instanceof IPageModel );
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/editor/SashMultiPageEditorTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/editor/SashMultiPageEditorTest.java
index 3f99ef889f8..ea1526214a2 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/editor/SashMultiPageEditorTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/editor/SashMultiPageEditorTest.java
@@ -3,13 +3,12 @@
*/
package org.eclipse.papyrus.infra.core.sasheditor.editor;
-import junit.framework.TestCase;
/**
* @author dumoulin
*/
-public class SashMultiPageEditorTest extends TestCase {
+public class SashMultiPageEditorTest {
/**
* Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.editor.AbstractMultiPageSashEditor#refreshTabs()}.
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainerTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainerTest.java
index e10cead8a77..ff86a968633 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainerTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainerTest.java
@@ -1,39 +1,60 @@
-/**
- *
- */
+/*****************************************************************************
+ * Copyright (c) 2009-2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.infra.core.sasheditor.internal;
+import static org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.SashPagesModelFactory.folder;
+import static org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.SashPagesModelFactory.page;
+import static org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.SashPagesModelFactory.vSash;
+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 java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-
-import junit.framework.TestCase;
+import java.util.Map;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SimpleSashWindowContentProviderUtils;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple.SimpleSashWindowsContentProvider;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IComponentPage;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageVisitor;
import org.eclipse.papyrus.infra.core.sasheditor.editor.MessagePartModel;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.IModelExp;
+import org.eclipse.papyrus.infra.core.sasheditor.pagesmodel.PagesModelException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.junit.After;
import org.junit.Before;
+import org.junit.Test;
/**
* Run as normal test.
*
- * @author dumoulin
+ * @author cedric dumoulin
*
*/
-public class SashWindowsContainerTest extends TestCase {
+public class SashWindowsContainerTest {
protected Display display;
@@ -43,8 +64,7 @@ public class SashWindowsContainerTest extends TestCase {
*
* @param name
*/
- public SashWindowsContainerTest(String name) {
- super(name);
+ public SashWindowsContainerTest() {
}
/**
@@ -52,10 +72,8 @@ public class SashWindowsContainerTest extends TestCase {
* @throws java.lang.Exception
*
*/
- @Override
@Before
- protected void setUp() throws Exception {
- super.setUp();
+ public void setUp() throws Exception {
display = Display.getCurrent();
if(display == null) {
display = new Display();
@@ -68,10 +86,8 @@ public class SashWindowsContainerTest extends TestCase {
* @throws java.lang.Exception
*
*/
- @Override
@After
- protected void tearDown() throws Exception {
- super.tearDown();
+ public void tearDown() throws Exception {
//display.dispose();
}
@@ -119,6 +135,7 @@ public class SashWindowsContainerTest extends TestCase {
* Test the method on a model with several folders and page.
* Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
*/
+ @Test
public void testGetActiveEditor() {
// Create
SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
@@ -144,7 +161,33 @@ public class SashWindowsContainerTest extends TestCase {
/**
* Test the method on a model with several folders and page.
* Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
+ * Use new implementation to populate contentProvider
+ * @throws PagesModelException
*/
+ @Test
+ public void testGetActiveEditor2() throws PagesModelException {
+
+ // Create populated content provider
+ SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
+ SimpleSashWindowContentProviderUtils helper = new SimpleSashWindowContentProviderUtils(contentProvider);
+
+ // define how to populate contentProvider
+ IModelExp expr = vSash( folder( "f1", page("p11"), page("p12")), folder( "f2", page("p21")));
+ // Try to create the model
+ helper.createModel(expr);
+
+
+ // Get the active editor
+ SashWindowsContainer container = createSashWindowsContainer(contentProvider);
+ IPage page = container.getActiveSashWindowsPage();
+ assertNotNull("Page exist", page);
+ }
+
+ /**
+ * Test the method on a model with several folders and page.
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
+ */
+ @Test
public void testGetVisiblePages() {
// Create
SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
@@ -184,9 +227,86 @@ public class SashWindowsContainerTest extends TestCase {
}
/**
+ * Test the method on a model with several folders and page.
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
+ * Use new implementation to populate contentProvider
+ * @throws PagesModelException
+ */
+ @Test
+ public void testGetVisiblePages2() throws PagesModelException {
+ // Create populated content provider
+ SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
+ SimpleSashWindowContentProviderUtils helper = new SimpleSashWindowContentProviderUtils(contentProvider);
+
+ // define how to populate contentProvider
+ IModelExp expr = vSash( folder( "f1", page("p11"), page("p12")), folder( "f2", page("p21"), page("p22")));
+ // Try to create the model
+ helper.createModel(expr);
+ // Get the references
+ Map<String, Object> models = helper.queryModel(expr);
+
+
+ // Create the container
+ SashWindowsContainer container = createSashWindowsContainer(contentProvider);
+ // Get visible pages
+ List<IPage> pages = container.getVisiblePages();
+ // Build a list of raw models
+ List<Object> visibleModels = new ArrayList<Object>();
+ for( IPage page : pages) {
+ visibleModels.add(page.getRawModel());
+ }
+
+ assertEquals("2 pages visible", 2, pages.size());
+ assertTrue("contains active page from folder 1", visibleModels.contains(models.get("p11")));
+ assertTrue("contains active page from folder 2", visibleModels.contains(models.get("p22")));
+
+ // Check orders
+ assertEquals(models.get("p11"), pages.get(0).getRawModel());
+ assertEquals(models.get("p22"), pages.get(1).getRawModel());
+ }
+
+ /**
+ * Test the method on a model with only one folder.
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
+ * Use new implementation to populate contentProvider
+ * @throws PagesModelException
+ */
+ @Test
+ public void testGetVisiblePagesOneFoler() throws PagesModelException {
+ // Create populated content provider
+ SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
+ SimpleSashWindowContentProviderUtils helper = new SimpleSashWindowContentProviderUtils(contentProvider);
+
+ // define how to populate contentProvider
+ IModelExp expr = folder( "f1", page("p11"), page("p12"), page("p13"));
+ // Try to create the model
+ helper.createModel(expr);
+ // Get the references
+ Map<String, Object> models = helper.queryModel(expr);
+
+
+ // Create the container
+ SashWindowsContainer container = createSashWindowsContainer(contentProvider);
+ // Get visible pages
+ List<IPage> pages = container.getVisiblePages();
+ // Build a list of raw models
+ List<Object> visibleModels = new ArrayList<Object>();
+ for( IPage page : pages) {
+ visibleModels.add(page.getRawModel());
+ }
+
+ assertEquals("1 pages visible", 1, pages.size());
+ assertTrue("contains active page from folder 1", visibleModels.contains(models.get("p11")));
+
+ // Check orders
+ assertEquals(models.get("p11"), pages.get(0).getRawModel());
+ }
+
+ /**
* Test the method on a model with no pages.
* Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#getActiveEditor()}.
*/
+ @Test
public void testGetActiveEditorNoPage() {
// Create
SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
@@ -198,10 +318,53 @@ public class SashWindowsContainerTest extends TestCase {
assertNull("No Page exist", page);
}
+ /**
+ * Test the method on a model with several folders and page.
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#selectPage(IPage)}.
+ * Use new implementation to populate contentProvider
+ * @throws PagesModelException
+ */
+ @Test
+ public void testSelectPage() throws PagesModelException {
+ // Create populated content provider
+ SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
+ SimpleSashWindowContentProviderUtils helper = new SimpleSashWindowContentProviderUtils(contentProvider);
+
+ // define how to populate contentProvider
+ IModelExp expr = vSash( folder( "f1", page("p11"), page("p12"), page("p13"), page("p14")), folder( "f2", page("p21"), page("p22")));
+ // Try to create the model
+ helper.createModel(expr);
+ // Get the references
+ Map<String, Object> models = helper.queryModel(expr);
+
+
+ // Create the container
+ SashWindowsContainer container = createSashWindowsContainer(contentProvider);
+
+ // Check if we have an active page
+ assertNotNull("active page set", container.getActiveSashWindowsPage());
+
+ // Try to set active page
+ IPage p12 = container.lookupModelPage(models.get("p12"));
+ container.selectPage(p12);
+ assertEquals("page selected", p12, container.getActiveSashWindowsPage() );
+
+ // Try to set active page
+ IPage p22 = container.lookupModelPage(models.get("p22"));
+ container.selectPage(p22);
+ assertEquals("page selected", p22, container.getActiveSashWindowsPage() );
+
+ // Try to set active page
+ IPage p11 = container.lookupModelPage(models.get("p11"));
+ container.selectPage(p11);
+ assertEquals("page selected", p11, container.getActiveSashWindowsPage() );
+}
+
/**
* Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#refreshTabs()}.
*/
+ @Test
public void testRefreshTabs() {
ISashWindowsContentProvider contentProvider = createContentProvider();
@@ -215,6 +378,7 @@ public class SashWindowsContainerTest extends TestCase {
/**
* Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer#refreshTabs()}.
*/
+ @Test
public void testRefreshTabs2() {
// Test 2 folders, one tab each. Then supress one tabs.
@@ -243,6 +407,7 @@ public class SashWindowsContainerTest extends TestCase {
/**
* Test method for {@link SashWindowsContainer#visit(org.eclipse.papyrus.infra.core.sasheditor.editor.IPageVisitor)}
*/
+ @Test
public void testVisit() {
// Create
SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
@@ -290,6 +455,7 @@ public class SashWindowsContainerTest extends TestCase {
* Test the lookup of a page by its raw model
* Test method for {@link SashWindowsContainer#lookupModelPage(Object)}
*/
+ @Test
public void testlookupModelPage() {
// Create
SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
@@ -317,6 +483,7 @@ public class SashWindowsContainerTest extends TestCase {
/**
* Test method for {@link SashWindowsContainer#setFolderTabMenuManager(MenuManager)}
*/
+ @Test
public void testSetFolderTabMenuManager_MenuManager() {
// Create
SimpleSashWindowsContentProvider contentProvider = new SimpleSashWindowsContentProvider();
@@ -365,6 +532,11 @@ public class SashWindowsContainerTest extends TestCase {
}
+ @Test
+ public void testSelectPagePageId() {
+
+ }
+
protected TabFolderPart lookupTabFolderPart(SashWindowsContainer container, Object rawModel) {
LookupFolderPartByRawModelVisitor visitor = new LookupFolderPartByRawModelVisitor(rawModel);
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/AbstractSash.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/AbstractSash.java
new file mode 100644
index 00000000000..3f0cfa870cd
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/AbstractSash.java
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+
+/**
+ * Base class for structure representing sash in Checker
+ * @author cedric dumoulin
+ *
+ */
+public abstract class AbstractSash extends PanelTerm {
+
+ protected PanelTerm leftup;
+ protected PanelTerm rightdown;
+
+ /**
+ * Constructor.
+ *
+ */
+ public AbstractSash(PanelTerm left, PanelTerm right) {
+ this.leftup = left;
+ this.rightdown = right;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * @param up
+ * @param down
+ */
+ public AbstractSash(String name, PanelTerm left, PanelTerm right) {
+ super(name);
+ this.leftup = left;
+ this.rightdown = right;
+ }
+
+ /**
+ * @return the leftup
+ */
+ public PanelTerm getLeftup() {
+ return leftup;
+ }
+
+ /**
+ * @return the rightdown
+ */
+ public PanelTerm getRightdown() {
+ return rightdown;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#visit(org.eclipse.papyrus.infra.core.sasheditor.IPagesModelVisitor.sashmodel.query.IQueryVisitor)
+ *
+ * @param visitor
+ * @throws PagesModelException
+ */
+ abstract public <M> void accept(IPagesModelVisitor<M> visitor, M modelObject) throws PagesModelException ;
+
+ /**
+ * @return The name used in toString
+ */
+ protected abstract String getStringName();
+
+ /**
+ * @see java.lang.Object#toString()
+ *
+ * @return
+ */
+ @Override
+ public String toString() {
+
+ StringBuffer buff = new StringBuffer(getStringName());
+
+ buff.append("(");
+ buff.append(leftup.toString());
+ buff.append(", ");
+ buff.append(rightdown.toString());
+ buff.append(")");
+
+ return buff.toString();
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java
new file mode 100644
index 00000000000..e3d82f748dc
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * This represent a Folder in the Checker query.
+ *
+ * @author cedric dumoulin
+ */
+public class Folder extends PanelTerm implements IModelObject {
+
+ protected List<Page> pages;
+
+ /**
+ * Constructor.
+ *
+ */
+ public Folder(Page ... pages) {
+ this.pages = Arrays.asList(pages);
+ }
+
+ /**
+ * Constructor.
+ *
+ */
+ public Folder(String name, Page ... pages) {
+ super(name);
+ this.pages = Arrays.asList(pages);
+ }
+
+ /**
+ * @return the pages
+ */
+ public List<Page> getPages() {
+ return pages;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(IPagesModelVisitor, EObject)
+ *
+ * @param visitor
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M modelObject) throws PagesModelException {
+
+ visitor.walk(this, modelObject);
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ *
+ * @return
+ */
+ @Override
+ public String toString() {
+
+ StringBuffer buff = new StringBuffer("Folder(");
+
+ for(Page page : pages ) {
+ buff.append(page.toString()).append(", ");
+ }
+ // Remove extra ,
+ int length = buff.length();
+ if(buff.charAt(length-1) == ' ') {
+ buff.delete(length-2, length );
+ }
+ buff.append(")");
+
+ return buff.toString();
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/HSash.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/HSash.java
new file mode 100644
index 00000000000..eaa05fc4e81
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/HSash.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @author dumoulin
+ *
+ */
+public class HSash extends AbstractSash {
+
+ /**
+ * Constructor.
+ *
+ * @param leftup
+ * @param rightdown
+ */
+ public HSash(PanelTerm up, PanelTerm down) {
+ super(up, down);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param leftup
+ * @param rightdown
+ */
+ public HSash(String name, PanelTerm up, PanelTerm down) {
+ super(name, up, down);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(IPagesModelVisitor, EObject)
+ *
+ * @param visitor
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M modelObject) throws PagesModelException {
+
+ visitor.walk(this, modelObject);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.AbstractSash#getStringName()
+ *
+ * @return
+ */
+ @Override
+ protected String getStringName() {
+ return "HSash";
+ }
+
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelExp.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelExp.java
new file mode 100644
index 00000000000..83654ea81f8
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelExp.java
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+/**
+ * A Model Expression represent an expression used to describe a PagesModel.
+ * Term implementing this interface can be used as starting point of expression.
+ * <br>
+ * Following classses are expressions: {@link PanelTerm}, {@link WindowTerm}, {@link PagesModel}.
+ *
+ * @author cedric dumoulin
+ * TODO Rename to IModelExp
+ */
+public interface IModelExp extends IModelObject {
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelObject.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelObject.java
new file mode 100644
index 00000000000..e16bfd38324
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IModelObject.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+
+/**
+ * Common ancestor of all object in the Model.
+ * All object that can be used in a query should implement this interface.
+ *
+ * @author cedric dumoulin
+ */
+public interface IModelObject {
+
+ /**
+ * Visit the query.
+ * @param visitor
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M panel) throws PagesModelException;
+
+ /**
+ * Get the name associated to the query part.
+ * Can return null;
+ */
+ public String getName();
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IPagesModelVisitor.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IPagesModelVisitor.java
new file mode 100644
index 00000000000..a87f02e2fff
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/IPagesModelVisitor.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+/**
+ * Visitor used to visit query structure.
+ *
+ * @author cedric dumoulin
+ *
+ * @param M Type of the models provided to visit() and walk(). This is the common
+ * ancestor of the provided types.
+ *
+ */
+public interface IPagesModelVisitor <M>{
+
+ /**
+ * If true, parent are visited before children.
+ * If false, parent are visited after children.
+ * @return
+ */
+ public boolean isVisitingParentFirst();
+
+ /**
+ * Walk the node and its children. Call visit visit method appropiatly.
+ * This method encapsulate the navigation between nodes.
+ *
+ * @param windowTerm The term to navigate
+ * @param windowModel the model that maybe correspond to the term.
+ * @throws PagesModelException
+ *
+ */
+ public void walk( SashPagesModel windowTerm, M windowModel ) throws PagesModelException;
+ public void walk( WindowTerm windowTerm, M windowModel ) throws PagesModelException;
+ public void walk( Folder folder, M folderModel ) throws PagesModelException;
+
+ public void walk(HSash sash, M sashModel) throws PagesModelException;
+ public void walk(VSash sash, M sashModel) throws PagesModelException;
+
+ public void walk(Page page, M pageModel) throws PagesModelException;
+
+
+ /**
+ * Visit the corresponding term.
+ * @param windowTerm The term to visit
+ * @param windowModel The corresponding model found while walking the expr.
+ */
+// public void visit( SashPagesModel windowTerm, M windowModel ) throws PagesModelException;
+// public void visit( WindowTerm windowTerm, M windowModel ) throws PagesModelException;
+// public void visit( Folder folder, M folderModel ) throws PagesModelException;
+//
+// public void visit(HSash sash, M sashModel) throws PagesModelException;
+// public void visit(VSash sash, M sashModel) throws PagesModelException;
+//
+// public void visit(Page page, M pageModel) throws PagesModelException;
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/NoMatchException.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/NoMatchException.java
new file mode 100644
index 00000000000..3a3fcc211f7
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/NoMatchException.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+/**
+ * Exception thrown when a query part does not match a modelpart.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class NoMatchException extends PagesModelException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ *
+ */
+ public NoMatchException() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ */
+ public NoMatchException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ */
+ public NoMatchException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ * @param arg1
+ */
+ public NoMatchException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ * @param arg1
+ * @param arg2
+ * @param arg3
+ */
+ public NoMatchException(String arg0, Throwable arg1, boolean arg2, boolean arg3) {
+ super(arg0, arg1, arg2, arg3);
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Page.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Page.java
new file mode 100644
index 00000000000..650ea9aa0cd
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Page.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * This represent a page in the Checker query.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class Page implements IModelObject {
+
+ protected Object identifier;
+
+ protected String name;
+
+ /** To generate automatic name */
+ static int count=1;
+
+ /**
+ * Constructor.
+ *
+ */
+ public Page() {
+ // Automatic name generation
+ this( "page"+count++);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param identifier
+ */
+ public Page(Object identifier) {
+ this.identifier = identifier;
+ this.name = identifier.toString();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * @param identifier
+ */
+ public Page(String name) {
+ this.name = name;
+ this.identifier = name;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * @param identifier
+ */
+ public Page(String name, Object identifier) {
+ this.name = name;
+ this.identifier = identifier;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(IPagesModelVisitor, EObject)
+ *
+ * @param visitor
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M modelObject) throws PagesModelException {
+
+ visitor.walk(this, modelObject);
+ }
+
+ /**
+ * @return the identifier
+ */
+ public Object getIdentifier() {
+ return identifier;
+ }
+
+ /**
+ * @param identifier the identifier to set
+ */
+ public void setIdentifier(Object identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ *
+ * @return
+ */
+ @Override
+ public String toString() {
+
+ return "Page()";
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PagesModelException.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PagesModelException.java
new file mode 100644
index 00000000000..912da20781e
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PagesModelException.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+/**
+ * Root Exception of the pagesmodel package
+ *
+ * @author cedric dumoulin
+ *
+ * TODO Rename to PagesModelException
+ */
+public class PagesModelException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ *
+ */
+ public PagesModelException() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ */
+ public PagesModelException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ */
+ public PagesModelException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ * @param arg1
+ */
+ public PagesModelException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg0
+ * @param arg1
+ * @param arg2
+ * @param arg3
+ */
+ public PagesModelException(String arg0, Throwable arg1, boolean arg2, boolean arg3) {
+ super(arg0, arg1);//, arg2, arg3);
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PanelTerm.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PanelTerm.java
new file mode 100644
index 00000000000..bd1d79b05bf
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/PanelTerm.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+
+/**
+ * Common ancestor of Panel (Folder and Sash) in queries structure.
+ * <br>
+ * This class can also be used a starting point of query expression (and so Folder, VSash and HSash).
+ *
+ * @author cedric dumoulin
+ *
+ */
+public abstract class PanelTerm implements IModelExp {
+
+ protected String name;
+
+
+ /**
+ * Constructor.
+ *
+ */
+ public PanelTerm() {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ */
+ public PanelTerm(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(org.eclipse.papyrus.infra.core.sasheditor.IPagesModelVisitor.sashmodel.query.IQueryVisitor, org.eclipse.emf.ecore.EObject)
+ *
+ * @param visitor
+ * @param panel
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M panel)
+ throws PagesModelException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModel.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModel.java
new file mode 100644
index 00000000000..f7021254e4c
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModel.java
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer;
+
+/**
+ * Sash Pages model allow to create a models of the pages represented by the {@link SashWindowsContainer}.
+ * Such model can then be used to create corresponding pages and intermediate artifact in a {@link ISashWindowsContentProvider},
+ * or to check the structure, ....
+ *
+ * <br>
+ * The model contains windows. Actually, the {@link SashWindowsContainer} only support one window.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class SashPagesModel implements IModelExp {
+
+ /**
+ * A window have only one panel.
+ */
+ protected List<WindowTerm> windows = new ArrayList<WindowTerm>();
+
+ protected String name;
+
+ /**
+ * Constructor.
+ *
+ * @param panel
+ */
+ public SashPagesModel(WindowTerm window) {
+ this.windows.add(window);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * @param panel
+ */
+ public SashPagesModel(String name, WindowTerm window) {
+ this.name = name;
+ this.windows.add(window);
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(org.eclipse.papyrus.infra.core.sasheditor.IPagesModelVisitor.sashmodel.query.IQueryVisitor, org.eclipse.emf.ecore.EObject)
+ *
+ * @param visitor
+ * @param panel
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M model) throws PagesModelException {
+
+ visitor.walk(this, model);
+
+ }
+
+
+ /**
+ * @return the panel
+ * @throws PagesModelException
+ */
+ public WindowTerm getFirstWindow() throws PagesModelException {
+ if( windows.size() >0) {
+ return windows.get(0);
+ }
+
+ // no elements
+ throw new PagesModelException("No window found in model.");
+ }
+
+ /**
+ * @return the panel
+ */
+ public List<WindowTerm> getWindows() {
+ return windows;
+ }
+
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModelFactory.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModelFactory.java
new file mode 100644
index 00000000000..c29154cafd3
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/SashPagesModelFactory.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+
+/**
+ * This class provides a set of static constructor helping in writing model.
+ * <br>
+ * Examples:
+ * <ul>
+ * <li>PanelTerm query = folder("a", page(), page() );</li>
+ * <li>query = hSash( folder( page("p1"), page() ), vSash("s2", folder( page() ), folder( page() )) );</li>
+ * <li>PanelTerm query = hSash( folder("f1", page("p1"), page("p2"), page("p3") ), folder("f2", page("p4") ) );</li>
+ * <li></li>
+ * </ul>
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class SashPagesModelFactory {
+
+ /**
+ * Static constructor for {@link Page}.
+ * @return
+ */
+ static public Page page() {
+ return new Page();
+ }
+
+ /**
+ * Static constructor for {@link Page}.
+ * @return
+ */
+ static public Page page(String name) {
+ return new Page(name);
+ }
+
+ /**
+ * Static constructor for {@link Folder}.
+ * @return
+ */
+ static public Folder folder( Page ...pages ) {
+ return new Folder(pages);
+ }
+
+ /**
+ * Static constructor for {@link Folder}.
+ * @return
+ */
+ static public Folder folder( String name, Page ...pages ) {
+ return new Folder(name, pages);
+ }
+
+ /**
+ * Static constructor for {@link VSash}.
+ * @return
+ */
+ static public VSash vSash( String name, PanelTerm up, PanelTerm down) {
+ return new VSash(name, up, down);
+ }
+
+ /**
+ * Static constructor for {@link VSash}.
+ * @return
+ */
+ static public VSash vSash( PanelTerm up, PanelTerm down) {
+ return new VSash(up, down);
+ }
+
+ /**
+ * Static constructor for {@link HSash}.
+ * @return
+ */
+ static public HSash hSash( String name, PanelTerm left, PanelTerm right) {
+ return new HSash(name, left, right);
+ }
+
+ /**
+ * Static constructor for {@link HSash}.
+ * @return
+ */
+ static public HSash hSash( PanelTerm left, PanelTerm right) {
+ return new HSash(left, right);
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/VSash.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/VSash.java
new file mode 100644
index 00000000000..ec701ef9a4b
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/VSash.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Class for structure representing vertical sash in Checker
+ *
+ * @author dumoulin
+ *
+ */
+public class VSash extends AbstractSash {
+
+ /**
+ * Constructor.
+ *
+ * @param leftup
+ * @param rightdown
+ */
+ public VSash(PanelTerm left, PanelTerm right) {
+ super(left, right);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param leftup
+ * @param rightdown
+ */
+ public VSash(String name, PanelTerm left, PanelTerm right) {
+ super(name, left, right);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(IPagesModelVisitor, EObject)
+ *
+ * @param visitor
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M modelObject) throws PagesModelException {
+ visitor.walk(this, modelObject);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.AbstractSash#getStringName()
+ *
+ * @return
+ */
+ @Override
+ protected String getStringName() {
+ return "VSash";
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/WindowTerm.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/WindowTerm.java
new file mode 100644
index 00000000000..27399c58c99
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/WindowTerm.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel;
+
+
+/**
+ * A term representing a Window in the query
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class WindowTerm implements IModelExp {
+
+ /**
+ * A window have only one panel.
+ */
+ protected PanelTerm panel;
+
+ protected String name;
+
+ /**
+ * Constructor.
+ *
+ * @param panel
+ */
+ public WindowTerm(PanelTerm panel) {
+ this.panel = panel;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * @param panel
+ */
+ public WindowTerm(String name, PanelTerm panel) {
+ this.name = name;
+ this.panel = panel;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.IModelObject.sashmodel.query.IQueryTerm#accept(org.eclipse.papyrus.infra.core.sasheditor.IPagesModelVisitor.sashmodel.query.IQueryVisitor, org.eclipse.emf.ecore.EObject)
+ *
+ * @param visitor
+ * @param panel
+ * @throws PagesModelException
+ */
+ public <M> void accept(IPagesModelVisitor<M> visitor, M windowModel) throws PagesModelException {
+
+ visitor.walk(this, windowModel);
+
+ }
+
+
+ /**
+ * @return the panel
+ */
+ public PanelTerm getPanel() {
+ return panel;
+ }
+
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/package-info.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/package-info.java
new file mode 100644
index 00000000000..cdc2289dac8
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/package-info.java
@@ -0,0 +1,19 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+/**
+ * @author cedric dumoulin
+ *
+ */
+package org.eclipse.papyrus.infra.core.sasheditor.pagesmodel; \ No newline at end of file

Back to the top