diff options
| author | Pierre-Charles David | 2016-01-25 15:36:17 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2016-01-25 16:05:15 +0000 |
| commit | 61ec81be66e42c6bf840da9eee065c3dc38cd4e2 (patch) | |
| tree | 0e99a1a01cdbc2d7c45e27369cb6306878dec395 | |
| parent | 86c632bf513629a1261d6e798be86d64d4be333a (diff) | |
| download | org.eclipse.sirius-61ec81be66e42c6bf840da9eee065c3dc38cd4e2.tar.gz org.eclipse.sirius-61ec81be66e42c6bf840da9eee065c3dc38cd4e2.tar.xz org.eclipse.sirius-61ec81be66e42c6bf840da9eee065c3dc38cd4e2.zip | |
[482528] Do not wipe the FILES property when setting up SiriusInterpreter
This is a workaround relying on a specific concrete interpreter
implementation (ODesignGenericInterpreter). A better solution would be
to expose the getProperty() method directly on IInterpreter, but this
would break binary compatibility with the Query Legacy
interpreter (which is unmaintained), so a proper solution will have to
wait until #478878 is finished.
Bug: 482528
Change-Id: I74c36abb9642f0194414d7e6540327723a95c9ac
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
3 files changed, 28 insertions, 4 deletions
diff --git a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/Activator.java b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/Activator.java index a04afccbb4..e50d544066 100644 --- a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/Activator.java +++ b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/Activator.java @@ -22,6 +22,8 @@ import org.osgi.framework.BundleContext; * Bundle activator for <code>org.eclipse.sirius.ui.properties</code>. */ public class Activator implements BundleActivator { + static final String PLUGIN_ID = "org.eclipse.sirius.ui.properties"; + /** * The adapter is stateless, use a single instance that can be easily * unregistered when stopped. diff --git a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusInterpreter.java b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusInterpreter.java index 75f9c921ba..49fb3cefd3 100644 --- a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusInterpreter.java +++ b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusInterpreter.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.sirius.ui.properties.internal; +import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -22,6 +24,7 @@ import org.eclipse.sirius.common.interpreter.api.IEvaluationResult; import org.eclipse.sirius.common.interpreter.api.IInterpreter; import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException; import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterWithDiagnostic; +import org.eclipse.sirius.tools.internal.interpreter.ODesignGenericInterpreter; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; @@ -63,9 +66,17 @@ public class SiriusInterpreter implements IInterpreter { private void setupInterpreter(Map<String, Object> variables) { if (this.interpreter instanceof org.eclipse.sirius.common.tools.api.interpreter.IInterpreter) { org.eclipse.sirius.common.tools.api.interpreter.IInterpreter i = (org.eclipse.sirius.common.tools.api.interpreter.IInterpreter) this.interpreter; - // FIXME This breaks the rest of Sirius by wiping the session - // interpreter's "classpath" for services - i.setProperty(org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.FILES, Lists.newArrayList("org.eclipse.sirius.ui.properties")); + Collection<Object> filesProperty = Lists.newArrayList(); + if (i instanceof ODesignGenericInterpreter) { + Object current = ((ODesignGenericInterpreter) i).getProperty(org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.FILES); + if (current instanceof Collection) { + filesProperty = (Collection<Object>) current; + } + } + if (!filesProperty.contains(Activator.PLUGIN_ID)) { + filesProperty.add(Activator.PLUGIN_ID); + } + i.setProperty(org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.FILES, filesProperty); i.addImport(org.eclipse.sirius.ui.properties.internal.SiriusToolServices.class.getName()); declareLocals(variables, i); } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/tools/internal/interpreter/ODesignGenericInterpreter.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/tools/internal/interpreter/ODesignGenericInterpreter.java index b82f94aeed..7ed8cec324 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/tools/internal/interpreter/ODesignGenericInterpreter.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/tools/internal/interpreter/ODesignGenericInterpreter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES and others. * 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 @@ -234,6 +234,17 @@ public class ODesignGenericInterpreter implements IInterpreter, IProposalProvide } } + /** + * Returns the current value of a specific property. + * + * @param key + * the property's key. + * @return the property's value. + */ + public Object getProperty(Object key) { + return this.properties.get(key); + } + @Override public void clearVariables() { this.variables.clearVariables(); |
