Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Dumoulin2013-10-29 13:12:45 +0000
committerCedric Dumoulin2014-01-27 13:54:21 +0000
commit8a90e1eda0a789fea36d7250d55b718d46083eb6 (patch)
tree15e262b232b465297af40534479ea58f44b06ad1 /extraplugins/layers/org.eclipse.papyrus.layers.stackmodel
parent011aecb533b6240e9203bace7a397ec561faab1c (diff)
downloadorg.eclipse.papyrus-8a90e1eda0a789fea36d7250d55b718d46083eb6.tar.gz
org.eclipse.papyrus-8a90e1eda0a789fea36d7250d55b718d46083eb6.tar.xz
org.eclipse.papyrus-8a90e1eda0a789fea36d7250d55b718d46083eb6.zip
organize imports
Diffstat (limited to 'extraplugins/layers/org.eclipse.papyrus.layers.stackmodel')
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoader.java234
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/RegistriesLoader.java194
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoaderTest.java201
3 files changed, 318 insertions, 311 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoader.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoader.java
index b9a38f6b51f..bb14d6d123e 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoader.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoader.java
@@ -1,116 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
- * 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
- ******************************************************************************/
-package org.eclipse.papyrus.layers.stackmodel.layers.loaders;
-
-import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
-import org.eclipse.papyrus.layers.stackmodel.layers.CustomPropertyOperator;
-import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptor;
-import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry;
-import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
-import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
-import org.eclipse.papyrus.layers.stackmodel.operators.BooleanAndOperator;
-import org.eclipse.papyrus.layers.stackmodel.operators.BooleanOrOperator;
-
-
-/**
- * Class used to load a {@link LayerOperatorDescriptorRegistry}.
- *
- * @author cedric dumoulin
- *
- */
-public class LayerOperatorDescriptorRegistryLoader implements ILayerOperatorDescriptorRegistryLoader {
-
- /**
- * Load the specified registry. Initialize its Descriptors and its Operators.
- *
- * @param layerOperatorDescriptorRegistry
- * @param propertyRegistry
- */
- public void loadRegistryOld(LayerOperatorDescriptorRegistry descriptorRegistry, PropertyRegistry propertyRegistry) {
-
- // Custom operator declarations
- // operatorName, operatorImplementationClass
- String[] operatorDeclarations = new String[] {
- "booleanOr", BooleanOrOperator.class.getName(),
- "booleanAnd", BooleanAndOperator.class.getName(),
-
- };
-
- // Load operators
- for( int i=0; i<operatorDeclarations.length; i+=2) {
- CustomPropertyOperator operator = LayersFactory.eINSTANCE.createCustomPropertyOperator();
- operator.setName(operatorDeclarations[i]);
- operator.setClassname(operatorDeclarations[i+1]);
- descriptorRegistry.addPropertyOperator(operator);
- }
-
- // AndLayerStackOperatorDescriptor
- // propertyName, operatorName
- String[] andDescriptorDeclarations = new String [] {
- "isVisible", "booleanAnd",
- };
-
- LayerOperatorDescriptor andDescriptor = LayersFactory.eINSTANCE.createAndStackedLayerOperatorDescriptor();
- descriptorRegistry.addLayerOperatorDescriptor(andDescriptor);
-
- // attach operator to layer and property
- String descriptorName = andDescriptor.getName();
- for( int i=0; i<andDescriptorDeclarations.length; i+=2) {
- try {
- descriptorRegistry.attachOperatorToDescriptor(propertyRegistry.getProperty(andDescriptorDeclarations[i]), andDescriptorDeclarations[i+1], descriptorName);
- } catch (NotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // OrLayerStackOperatorDescriptor
- // propertyName, operatorName
- String[] orDescriptorDeclarations = new String [] {
- "isVisible", "booleanOr",
- };
-
- LayerOperatorDescriptor orDescriptor = LayersFactory.eINSTANCE.createOrStackedLayerOperatorDescriptor();
- descriptorRegistry.addLayerOperatorDescriptor(orDescriptor);
-
- // attach operator to layer and property
- descriptorName = orDescriptor.getName();
- for( int i=0; i<orDescriptorDeclarations.length; i+=2) {
- try {
- descriptorRegistry.attachOperatorToDescriptor(propertyRegistry.getProperty(orDescriptorDeclarations[i]), orDescriptorDeclarations[i+1], descriptorName);
- } catch (NotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- /**
- * @see org.eclipse.papyrus.layers.stackmodel.layers.loaders.ILayerOperatorDescriptorRegistryLoader#loadLayerOperatorDescriptorRegistry(org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry, org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry)
- *
- * @param descriptorRegistry
- * @param propertyRegistry
- */
- public void loadLayerOperatorDescriptorRegistry(LayerOperatorDescriptorRegistry descriptorRegistry, PropertyRegistry propertyRegistry) {
-
- createLayersConfigModel();
-
- }
-
- /**
- * Create a Model
- */
- private void createLayersConfigModel() {
- // TODO Auto-generated method stub
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ * 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
+ ******************************************************************************/
+package org.eclipse.papyrus.layers.stackmodel.layers.loaders;
+
+import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
+import org.eclipse.papyrus.layers.stackmodel.layers.CustomPropertyOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptor;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
+import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
+import org.eclipse.papyrus.layers.stackmodel.operators.BooleanAndOperator;
+import org.eclipse.papyrus.layers.stackmodel.operators.BooleanOrOperator;
+
+
+/**
+ * Class used to load a {@link LayerOperatorDescriptorRegistry}.
+ *
+ * @author cedric dumoulin
+ *
+ *@deprecated use {@link RegistriesLoader} instead.
+ *
+ */
+public class LayerOperatorDescriptorRegistryLoader implements ILayerOperatorDescriptorRegistryLoader {
+
+ /**
+ * Load the specified registry. Initialize its Descriptors and its Operators.
+ *
+ * @param layerOperatorDescriptorRegistry
+ * @param propertyRegistry
+ */
+ public void loadRegistryOld(LayerOperatorDescriptorRegistry descriptorRegistry, PropertyRegistry propertyRegistry) {
+
+ // Custom operator declarations
+ // operatorName, operatorImplementationClass
+ String[] operatorDeclarations = new String[] {
+ "booleanOr", BooleanOrOperator.class.getName(),
+ "booleanAnd", BooleanAndOperator.class.getName(),
+
+ };
+
+ // Load operators
+ for( int i=0; i<operatorDeclarations.length; i+=2) {
+ CustomPropertyOperator operator = LayersFactory.eINSTANCE.createCustomPropertyOperator();
+ operator.setName(operatorDeclarations[i]);
+ operator.setClassname(operatorDeclarations[i+1]);
+ descriptorRegistry.addPropertyOperator(operator);
+ }
+
+ // AndLayerStackOperatorDescriptor
+ // propertyName, operatorName
+ String[] andDescriptorDeclarations = new String [] {
+ "isVisible", "booleanAnd",
+ };
+
+ LayerOperatorDescriptor andDescriptor = LayersFactory.eINSTANCE.createAndStackedLayerOperatorDescriptor();
+ descriptorRegistry.addLayerOperatorDescriptor(andDescriptor);
+
+ // attach operator to layer and property
+ String descriptorName = andDescriptor.getName();
+ for( int i=0; i<andDescriptorDeclarations.length; i+=2) {
+ try {
+ descriptorRegistry.attachOperatorToDescriptor(propertyRegistry.getProperty(andDescriptorDeclarations[i]), andDescriptorDeclarations[i+1], descriptorName);
+ } catch (NotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ // OrLayerStackOperatorDescriptor
+ // propertyName, operatorName
+ String[] orDescriptorDeclarations = new String [] {
+ "isVisible", "booleanOr",
+ };
+
+ LayerOperatorDescriptor orDescriptor = LayersFactory.eINSTANCE.createOrStackedLayerOperatorDescriptor();
+ descriptorRegistry.addLayerOperatorDescriptor(orDescriptor);
+
+ // attach operator to layer and property
+ descriptorName = orDescriptor.getName();
+ for( int i=0; i<orDescriptorDeclarations.length; i+=2) {
+ try {
+ descriptorRegistry.attachOperatorToDescriptor(propertyRegistry.getProperty(orDescriptorDeclarations[i]), orDescriptorDeclarations[i+1], descriptorName);
+ } catch (NotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.loaders.ILayerOperatorDescriptorRegistryLoader#loadLayerOperatorDescriptorRegistry(org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry, org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry)
+ *
+ * @param descriptorRegistry
+ * @param propertyRegistry
+ */
+ public void loadLayerOperatorDescriptorRegistry(LayerOperatorDescriptorRegistry descriptorRegistry, PropertyRegistry propertyRegistry) {
+
+ createLayersConfigModel();
+
+ }
+
+ /**
+ * Create a Model
+ */
+ private void createLayersConfigModel() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/RegistriesLoader.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/RegistriesLoader.java
index 1a071d622e2..a5214e40c83 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/RegistriesLoader.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/loaders/RegistriesLoader.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
- * 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
- ******************************************************************************/
-package org.eclipse.papyrus.layers.stackmodel.layers.loaders;
-
-import org.eclipse.papyrus.layers.configmodel.layersconfig.LayerOperatorConfig;
-import org.eclipse.papyrus.layers.configmodel.layersconfig.OperatorBinding;
-import org.eclipse.papyrus.layers.configmodel.layersconfig.OperatorConfig;
-import org.eclipse.papyrus.layers.stackmodel.InstanciationException;
-import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
-import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptor;
-import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry;
-import org.eclipse.papyrus.layers.stackmodel.layers.Property;
-import org.eclipse.papyrus.layers.stackmodel.layers.PropertyOperator;
-import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
-
-
-/**
- * A loader used to load various Registries from a unique {@link LayersConfigModel}.
- * @author cedric dumoulin
- *
- */
-public class RegistriesLoader implements ILayerOperatorDescriptorRegistryLoader {
-
- /**
- * The model used to load the registries.
- *
- */
- protected LayersConfigModel model;
-
- /**
- * Constructor.
- *
- * @param model
- */
- public RegistriesLoader(LayersConfigModel model) {
- this.model = model;
- }
-
- /**
- * Load the {@link LayerOperatorDescriptorRegistryLoader} from the {@link LayersConfigModel}.
- *
- * @see org.eclipse.papyrus.layers.stackmodel.layers.loaders.ILayerOperatorDescriptorRegistryLoader#loadLayerOperatorDescriptorRegistry(org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry, org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry)
- *
- * @param descriptorRegistry
- * @param propertyRegistry
- */
- @Override
- public void loadLayerOperatorDescriptorRegistry(LayerOperatorDescriptorRegistry descriptorRegistry, PropertyRegistry propertyRegistry) {
-
- // Load LayerOperators
- for( LayerOperatorConfig layerOperatorConfig : model.getAllLayerOperatorConfig() ) {
- try {
- LayerOperatorDescriptor descriptor = layerOperatorConfig.createLayersOperatorDescriptor();
- descriptorRegistry.addLayerOperatorDescriptor(descriptor);
- } catch (InstanciationException e) {
- System.err.println("LOG - " + this.getClass().getName() + " - " + e.getMessage());
- e.printStackTrace();
- }
- }
-
- // Load operators
- for( OperatorConfig operatorConfig : model.getAllOperatorConfig()) {
- try {
- PropertyOperator operator = operatorConfig.createOperatorDescriptor();
- descriptorRegistry.addPropertyOperator(operator);
- } catch (InstanciationException e) {
- System.err.println("LOG - " + this.getClass().getName() + " - " + e.getMessage());
- e.printStackTrace();
- }
-
- }
-
- // Populate LayerOperator with operators
- for( OperatorBinding binding : model.getAllOperatorBinding()) {
- try {
- Property property = propertyRegistry.getProperty(binding.getPropertyId().getName());
- String layerDescriptorName = binding.getLayerOperatorConfig().getName();
- String operatorName = binding.getOperator().getName();
- descriptorRegistry.attachOperatorToDescriptor(property, operatorName, layerDescriptorName);
- } catch (NotFoundException e) {
- System.err.println("LOG - " + this.getClass().getName() + " - " + e.getMessage());
- e.printStackTrace();
- }
-
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ * 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
+ ******************************************************************************/
+package org.eclipse.papyrus.layers.stackmodel.layers.loaders;
+
+import org.eclipse.papyrus.layers.configmodel.layersconfig.LayerOperatorConfig;
+import org.eclipse.papyrus.layers.configmodel.layersconfig.OperatorBinding;
+import org.eclipse.papyrus.layers.configmodel.layersconfig.OperatorConfig;
+import org.eclipse.papyrus.layers.stackmodel.InstanciationException;
+import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptor;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry;
+import org.eclipse.papyrus.layers.stackmodel.layers.Property;
+import org.eclipse.papyrus.layers.stackmodel.layers.PropertyOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
+
+
+/**
+ * A loader used to load various Registries from a unique {@link LayersConfigModel}.
+ * @author cedric dumoulin
+ *
+ */
+public class RegistriesLoader implements ILayerOperatorDescriptorRegistryLoader {
+
+ /**
+ * The model used to load the registries.
+ *
+ */
+ protected LayersConfigModel model;
+
+ /**
+ * Constructor.
+ *
+ * @param model
+ */
+ public RegistriesLoader(LayersConfigModel model) {
+ this.model = model;
+ }
+
+ /**
+ * Load the {@link LayerOperatorDescriptorRegistry} from the {@link LayersConfigModel}.
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.loaders.ILayerOperatorDescriptorRegistryLoader#loadLayerOperatorDescriptorRegistry(org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry, org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry)
+ *
+ * @param descriptorRegistry
+ * @param propertyRegistry
+ */
+ @Override
+ public void loadLayerOperatorDescriptorRegistry(LayerOperatorDescriptorRegistry descriptorRegistry, PropertyRegistry propertyRegistry) {
+
+ // Load LayerOperators
+ for( LayerOperatorConfig layerOperatorConfig : model.getAllLayerOperatorConfig() ) {
+ try {
+ LayerOperatorDescriptor descriptor = layerOperatorConfig.createLayersOperatorDescriptor();
+ descriptorRegistry.addLayerOperatorDescriptor(descriptor);
+ } catch (InstanciationException e) {
+ System.err.println("LOG - " + this.getClass().getName() + " - " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ // Load operators
+ for( OperatorConfig operatorConfig : model.getAllOperatorConfig()) {
+ try {
+ PropertyOperator operator = operatorConfig.createOperatorDescriptor();
+ descriptorRegistry.addPropertyOperator(operator);
+ } catch (InstanciationException e) {
+ System.err.println("LOG - " + this.getClass().getName() + " - " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+
+ // Populate LayerOperator with operators
+ for( OperatorBinding binding : model.getAllOperatorBinding()) {
+ try {
+ Property property = propertyRegistry.getProperty(binding.getPropertyId().getName());
+ String layerDescriptorName = binding.getLayerOperatorConfig().getName();
+ String operatorName = binding.getOperator().getName();
+ descriptorRegistry.attachOperatorToDescriptor(property, operatorName, layerDescriptorName);
+ } catch (NotFoundException e) {
+ System.err.println("LOG - " + this.getClass().getName() + " - " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+
+ }
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoaderTest.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoaderTest.java
index 55fd528b96f..1664b204a01 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoaderTest.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/loaders/LayerOperatorDescriptorRegistryLoaderTest.java
@@ -1,98 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2013 CEA LIST.
- * 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
- ******************************************************************************/
-package org.eclipse.papyrus.layers.stackmodel.layers.loaders;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-
-import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
-import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry;
-import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
-import org.eclipse.papyrus.layers.stackmodel.layers.Property;
-import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * @author cedric dumoulin
- *
- */
-public class LayerOperatorDescriptorRegistryLoaderTest {
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for constructor.
- */
- @Test
- public void testLayerOperatorDescriptorRegistryLoader() {
-
- LayerOperatorDescriptorRegistryLoader loader = new LayerOperatorDescriptorRegistryLoader();
-
- assertNotNull("object created", loader);
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.loaders.LayerOperatorDescriptorRegistryLoader#loadLayerOperatorDescriptorRegistry(org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry, org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry)}.
- * Check if the loader correctly initialize the LayerOperator and the Operators.
- * @throws NotFoundException
- */
- @Test
- public void testLoadRegistry() throws NotFoundException {
-
- // Create a PropertyRegistry
- PropertyRegistry propertyRegistry = LayersFactory.eINSTANCE.createPropertyRegistry();
-
- // Create a registry
- int propertiesCollectionSize = propertyRegistry.getPropertiesCount();
- LayerOperatorDescriptorRegistry registry = LayersFactory.eINSTANCE.createLayerOperatorDescriptorRegistry();
- registry.setPropertyCollectionSize(propertiesCollectionSize);
- // Create the loader
- LayerOperatorDescriptorRegistryLoader loader = new LayerOperatorDescriptorRegistryLoader();
-
-
- // Load the registry with the loader
- loader.loadLayerOperatorDescriptorRegistry(registry, propertyRegistry);
-
- // check registry content
- assertNotNull("layerOperator AndLayerOperator loaded", registry.getLayerOperatorDescriptor("OrStackedLayerOperator") );
- assertNotNull("layerOperator OrLayerOperator loaded", registry.getLayerOperatorDescriptor("AndStackedLayerOperator") );
-
-
- assertNotNull("Operator BooleanAnd loaded", registry.getPropertyOperator("booleanOr"));
- assertNotNull("Operator BooleanAnd loaded", registry.getPropertyOperator("booleanAnd"));
-
- // Check attachment
- Property isVisibleProp = propertyRegistry.getProperty("isVisible");
- assertNotNull("property set", isVisibleProp);
- assertNotNull("Operator attached to AndLayerOperator ", registry.getLayerOperatorDescriptor("OrStackedLayerOperator").getPropertyOperator(isVisibleProp) );
- assertNotNull("Operator attached to OrLayerOperator ", registry.getLayerOperatorDescriptor("AndStackedLayerOperator").getPropertyOperator(isVisibleProp) );
- // check if the right operator is attached to the right layerOperator
- assertSame("Operator attached to AndLayerOperator ", registry.getPropertyOperator("booleanOr"), registry.getLayerOperatorDescriptor("OrStackedLayerOperator").getPropertyOperator(isVisibleProp) );
- assertSame("Operator attached to OrLayerOperator ", registry.getPropertyOperator("booleanAnd"), registry.getLayerOperatorDescriptor("AndStackedLayerOperator").getPropertyOperator(isVisibleProp) );
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ * 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
+ ******************************************************************************/
+package org.eclipse.papyrus.layers.stackmodel.layers.loaders;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+
+import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
+import org.eclipse.papyrus.layers.stackmodel.layers.Property;
+import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+/**
+ * @author cedric dumoulin
+ *
+ */
+public class LayerOperatorDescriptorRegistryLoaderTest {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for constructor.
+ */
+ @Test
+ public void testLayerOperatorDescriptorRegistryLoader() {
+
+ LayerOperatorDescriptorRegistryLoader loader = new LayerOperatorDescriptorRegistryLoader();
+
+ assertNotNull("object created", loader);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.loaders.LayerOperatorDescriptorRegistryLoader#loadLayerOperatorDescriptorRegistry(org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptorRegistry, org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry)}.
+ * Check if the loader correctly initialize the LayerOperator and the Operators.
+ * Registry loading do not use this loader (LayerOperatorDescriptorRegistryLoader) anymore.
+ * The new loader {@link RegistriesLoader} is now used.
+ *
+ * @throws NotFoundException
+ */
+ @Test
+ @Ignore
+ public void testLoadRegistry() throws NotFoundException {
+
+ // Create a PropertyRegistry
+ PropertyRegistry propertyRegistry = LayersFactory.eINSTANCE.createPropertyRegistry();
+
+ // Create a registry
+ int propertiesCollectionSize = propertyRegistry.getPropertiesCount();
+ LayerOperatorDescriptorRegistry registry = LayersFactory.eINSTANCE.createLayerOperatorDescriptorRegistry();
+ registry.setPropertyCollectionSize(propertiesCollectionSize);
+ // Create the loader
+ LayerOperatorDescriptorRegistryLoader loader = new LayerOperatorDescriptorRegistryLoader();
+
+
+ // Load the registry with the loader
+ loader.loadLayerOperatorDescriptorRegistry(registry, propertyRegistry);
+
+ // check registry content
+ assertNotNull("layerOperator AndLayerOperator loaded", registry.getLayerOperatorDescriptor("OrStackedLayerOperator") );
+ assertNotNull("layerOperator OrLayerOperator loaded", registry.getLayerOperatorDescriptor("AndStackedLayerOperator") );
+
+
+ assertNotNull("Operator BooleanAnd loaded", registry.getPropertyOperator("booleanOr"));
+ assertNotNull("Operator BooleanAnd loaded", registry.getPropertyOperator("booleanAnd"));
+
+ // Check attachment
+ Property isVisibleProp = propertyRegistry.getProperty("isVisible");
+ assertNotNull("property set", isVisibleProp);
+ assertNotNull("Operator attached to AndLayerOperator ", registry.getLayerOperatorDescriptor("OrStackedLayerOperator").getPropertyOperator(isVisibleProp) );
+ assertNotNull("Operator attached to OrLayerOperator ", registry.getLayerOperatorDescriptor("AndStackedLayerOperator").getPropertyOperator(isVisibleProp) );
+ // check if the right operator is attached to the right layerOperator
+ assertSame("Operator attached to AndLayerOperator ", registry.getPropertyOperator("booleanOr"), registry.getLayerOperatorDescriptor("OrStackedLayerOperator").getPropertyOperator(isVisibleProp) );
+ assertSame("Operator attached to OrLayerOperator ", registry.getPropertyOperator("booleanAnd"), registry.getLayerOperatorDescriptor("AndStackedLayerOperator").getPropertyOperator(isVisibleProp) );
+
+ }
+
+}

Back to the top