diff options
| author | Pierre-Charles David | 2015-12-15 16:13:35 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2016-01-05 10:05:13 +0000 |
| commit | 1477d393c2b609670833a55a1e6eb7f8781de104 (patch) | |
| tree | a2d27fc40b9be1ad19d1e71da29d4bf992f71333 | |
| parent | eea19a2556d682ce50863d04826da8ac19eae25c (diff) | |
| download | org.eclipse.eef-1477d393c2b609670833a55a1e6eb7f8781de104.tar.gz org.eclipse.eef-1477d393c2b609670833a55a1e6eb7f8781de104.tar.xz org.eclipse.eef-1477d393c2b609670833a55a1e6eb7f8781de104.zip | |
[482993] Move IVariableManager and co on the Sirius side
Bug: 482993
Change-Id: I2d16452c94a9b5d29cb0b246117234cfd36ecbb2
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
14 files changed, 14 insertions, 203 deletions
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFGroup.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFGroup.java index 803995fc7..624a8d3c3 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFGroup.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFGroup.java @@ -13,6 +13,7 @@ package org.eclipse.eef.core.api; import org.eclipse.eef.EEFGroupDescription; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * The {@link EEFGroup} is used as the main structure within a page. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFPage.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFPage.java index 416629a3d..641f6ce30 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFPage.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFPage.java @@ -13,6 +13,7 @@ package org.eclipse.eef.core.api; import java.util.List; import org.eclipse.eef.EEFPageDescription; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * The {@link EEFPage} will control the content of a tab. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFVariableManagerFactory.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFVariableManagerFactory.java deleted file mode 100644 index 6736ccc0f..000000000 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFVariableManagerFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Obeo. - * 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: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.eef.core.api; - -import org.eclipse.eef.core.internal.EEFVariableManager; - -/** - * The factory used to create the {@link IVariableManager}. - * - * @author sbegaudeau - */ -public class EEFVariableManagerFactory { - /** - * Returns a new instance of the {@link IVariableManager}. - * - * @return A new instance of the {@link IVariableManager} - */ - public IVariableManager createVariableManager() { - return new EEFVariableManager(); - } -} diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFViewFactory.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFViewFactory.java index 67a771c82..e22cff8e6 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFViewFactory.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EEFViewFactory.java @@ -17,7 +17,8 @@ import org.eclipse.eef.core.internal.EEFCompoundInterpreter; import org.eclipse.eef.core.internal.EEFViewImpl; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.sirius.common.interpreter.api.IInterpreterProvider; +import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * The factory used to create the {@link EEFView}. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/IVariableManager.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/IVariableManager.java deleted file mode 100644 index 4afe40a45..000000000 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/IVariableManager.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Obeo. - * 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: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.eef.core.api; - -import java.util.Map; - -/** - * The variable manager is used to handle the state of the variables. - * - * @author sbegaudeau - */ -public interface IVariableManager { - /** - * Puts the new value of the variable. - * - * @param name - * The name of the variable - * @param value - * The value of the variable - * @return The previous value of the variable or <code>null</code> otherwise - */ - Object put(String name, Object value); - - /** - * Returns the variables. - * - * @return The variables - */ - Map<String, Object> getVariables(); - - /** - * Creates a child {@link IVariableManager}. - * - * @return A child {@link IVariableManager} - */ - IVariableManager createChild(); - - /** - * Clear the variable manager and its children. - */ - void clear(); - -} diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java index f0453850d..040ace40c 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/EEFControllersFactory.java @@ -11,10 +11,10 @@ package org.eclipse.eef.core.api.controllers; import org.eclipse.eef.EEFTextDescription; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.eef.core.internal.controllers.EEFTextControllerImpl; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * This factory will be used to create the controllers. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFGroupImpl.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFGroupImpl.java index 775674413..8aa00eafe 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFGroupImpl.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFGroupImpl.java @@ -13,9 +13,9 @@ package org.eclipse.eef.core.internal; import org.eclipse.eef.EEFGroupDescription; import org.eclipse.eef.core.api.EEFGroup; import org.eclipse.eef.core.api.EEFPage; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * The implementation of the {@link EEFGroup}. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java index efa8e0a8f..70fe6f9d6 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java @@ -19,10 +19,10 @@ import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EEFGroup; import org.eclipse.eef.core.api.EEFPage; import org.eclipse.eef.core.api.EEFView; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.common.interpreter.api.IEvaluationResult; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * The implementation of the {@link EEFPage}. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFVariableManager.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFVariableManager.java deleted file mode 100644 index c9e1f1479..000000000 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFVariableManager.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Obeo. - * 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: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.eef.core.internal; - -import com.google.common.collect.Maps; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.eef.core.api.IVariableManager; - -/** - * The implementation of the {@link IVariableManager}. - * - * @author sbegaudeau - */ -public class EEFVariableManager implements IVariableManager { - - /** - * The parent {@link IVariableManager}. - */ - private IVariableManager parent; - - /** - * The variables. - */ - private Map<String, Object> variables = new HashMap<String, Object>(); - - /** - * The child variable manager. - */ - private List<IVariableManager> children = new ArrayList<IVariableManager>(); - - /** - * The constructor. - */ - public EEFVariableManager() { - // do nothing - } - - /** - * The constructor. - * - * @param parent - * The parent of this {@link IVariableManager}. - */ - public EEFVariableManager(IVariableManager parent) { - this.parent = parent; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.eef.core.api.IVariableManager#put(java.lang.String, java.lang.Object) - */ - @Override - public Object put(String name, Object value) { - Object previous = this.variables.put(name, value); - return previous; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.eef.core.api.IVariableManager#getVariables() - */ - @Override - public Map<String, Object> getVariables() { - if (this.parent != null) { - Map<String, Object> parentVariables = this.parent.getVariables(); - parentVariables.putAll(this.variables); - return parentVariables; - } - return Maps.newHashMap(this.variables); - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.eef.core.api.IVariableManager#createChild() - */ - @Override - public IVariableManager createChild() { - IVariableManager variableManager = new EEFVariableManager(this); - this.children.add(variableManager); - return variableManager; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.eef.core.api.IVariableManager#clear() - */ - @Override - public void clear() { - this.variables.clear(); - - for (IVariableManager variableManager : children) { - variableManager.clear(); - } - } -} diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java index ec91947fb..5b339df03 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java @@ -19,7 +19,6 @@ import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EEFGroup; import org.eclipse.eef.core.api.EEFPage; import org.eclipse.eef.core.api.EEFView; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.util.Diagnostic; @@ -28,6 +27,7 @@ import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.common.interpreter.api.IEvaluationResult; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * The implementation of the {@link EEFView}. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextControllerImpl.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextControllerImpl.java index 98fcc0ca3..45a70f75b 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextControllerImpl.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextControllerImpl.java @@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit; import org.eclipse.eef.EEFTextDescription; import org.eclipse.eef.core.api.EEFExpressionUtils; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.eef.core.api.controllers.EEFTextController; import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.emf.common.command.Command; @@ -28,6 +27,7 @@ import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.common.interpreter.api.IEvaluationResult; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; /** * This class will be used in order to manage the behavior of the text. diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java index cf1f21ee2..59b3ee806 100644 --- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java +++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java @@ -16,9 +16,9 @@ import java.util.List; import org.eclipse.eef.EEFContainerDescription; import org.eclipse.eef.EEFTextDescription; import org.eclipse.eef.EEFWidgetDescription; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java index 02f0698a0..39814ec0e 100644 --- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java +++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java @@ -11,13 +11,13 @@ package org.eclipse.eef.ide.ui.internal.widgets; import org.eclipse.eef.EEFTextDescription; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.eef.core.api.controllers.EEFControllersFactory; import org.eclipse.eef.core.api.controllers.EEFTextController; import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java index 7d9842f1f..addd75cb4 100644 --- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java +++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java @@ -15,8 +15,6 @@ import java.util.Map; import org.eclipse.eef.EEFTextDescription; import org.eclipse.eef.EefFactory; import org.eclipse.eef.core.api.EEFExpressionUtils; -import org.eclipse.eef.core.api.EEFVariableManagerFactory; -import org.eclipse.eef.core.api.IVariableManager; import org.eclipse.eef.core.api.controllers.EEFTextController; import org.eclipse.eef.core.internal.controllers.EEFTextControllerImpl; import org.eclipse.emf.common.command.Command; @@ -33,6 +31,8 @@ import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl; import org.eclipse.sirius.common.interpreter.api.EvaluationResult; import org.eclipse.sirius.common.interpreter.api.IInterpreter; +import org.eclipse.sirius.common.interpreter.api.IVariableManager; +import org.eclipse.sirius.common.interpreter.api.VariableManagerFactory; import org.junit.Before; import org.junit.Test; @@ -73,7 +73,7 @@ public class EEFTextControllerTests { this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl()); this.editingDomain = new TransactionalEditingDomainImpl(adapterFactory, this.resourceSet); - this.variableManager = new EEFVariableManagerFactory().createVariableManager(); + this.variableManager = new VariableManagerFactory().createVariableManager(); this.description = EefFactory.eINSTANCE.createEEFTextDescription(); |
