Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/core')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/AbstractSash.java95
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/Folder.java90
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/pagesmodel/HSash.java66
-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.java116
-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.java103
-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.java66
-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
15 files changed, 1099 insertions, 0 deletions
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..0d1cfcd8c1c
--- /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,95 @@
+/*****************************************************************************
+ * 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;
+ }
+
+ /**
+ *
+ * @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..abcae95d7db
--- /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,90 @@
+/*****************************************************************************
+ * 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;
+
+/**
+ * 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(");
+
+ if( getName() != null ) {
+ buff.append(getName()).append(", ");
+ }
+
+ 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..cbaedf11103
--- /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,66 @@
+/*****************************************************************************
+ * 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;
+
+
+/**
+ * @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..3d9ac3b46d1
--- /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 pagemodel structure.
+ *
+ * @author cedric dumoulin
+ *
+ * @param M Type of the models provided to visit() and walk(). This is the common
+ * ancestor of all types of the walked model.
+ *
+ */
+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..5bd2fa904bb
--- /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,116 @@
+/*****************************************************************************
+ * 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 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..a08aa1521f6
--- /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,103 @@
+/*****************************************************************************
+ * 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;
+
+/**
+ * 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..f3e020c216b
--- /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,66 @@
+/*****************************************************************************
+ * 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;
+
+
+/**
+ * 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