Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormgolubev2012-05-14 07:35:46 -0400
committermgolubev2012-05-14 07:35:46 -0400
commitec55db83fafcb40bbdb1a55f056be21d595cd1b5 (patch)
treee31ffa652fba670733cd1268accf5af91451511d
parent4bedc9fd5f12ed8266217743f428fada4e81ec0a (diff)
parentf9af6b3815b989f79cf1f6d773b9fc858c7a111d (diff)
downloadorg.eclipse.gmf-tooling-3.0.M7-build.tar.gz
org.eclipse.gmf-tooling-3.0.M7-build.tar.xz
org.eclipse.gmf-tooling-3.0.M7-build.zip
Merge branch '3.0.M7-build' of ssh://git.eclipse.org/gitroot/gmf-tooling/org.eclipse.gmf-tooling into 3.0.M7-build3.0.M7-build
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt8
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java34
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/AbstractDiagramEditorTest.java1
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java3
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/GenProjectSetup.java56
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java18
6 files changed, 80 insertions, 40 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
index 21c9e8d4b..0561b682a 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
@@ -192,7 +192,7 @@ org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().ge
«ENDDEFINE»
«DEFINE _parser(modelFacet : gmfgen::LabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::ExternalParser-»
-«REM»NO-OP«ENDREM-»
+«REM»NO-OP«ENDREM»«-»
«ENDDEFINE»
«DEFINE _parser(modelFacet : gmfgen::FeatureLabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::PredefinedParser»
@@ -238,8 +238,10 @@ org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().ge
«EXPAND _setPatterns(viewMethod, editMethod, parserVar) FOR modelFacet-»
«ENDDEFINE»
-«DEFINE _createPredefinedParser(modelFacet : gmfgen::FeatureLabelModelFacet, parserVar : String) FOR gmfgen::PredefinedEnumParser»
- org.eclipse.emf.ecore.EAttribute editableFeature = «EXPAND MetaModel::MetaFeature FOR modelFacet.editableMetaFeatures->first()»;
+«DEFINE _createPredefinedParser(modelFacet : gmfgen::FeatureLabelModelFacet, parserVar : String) FOR gmfgen::PredefinedEnumParser»
+ «LET if modelFacet.editableMetaFeatures->isEmpty() then modelFacet.metaFeatures->first() else modelFacet.editableMetaFeatures->first() endif AS feature-»
+ org.eclipse.emf.ecore.EAttribute editableFeature = «EXPAND MetaModel::MetaFeature FOR feature»;
+ «ENDLET-»
«getQualifiedClassName()» «parserVar» = new «getQualifiedClassName()»(editableFeature);
«ENDDEFINE»
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java
index 836d29241..e08732525 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java
@@ -86,8 +86,7 @@ public class AllTests {
System.err.println("Generating a target platform");
Utils.setTargetPlatform();
}
-
-
+
TestSuite suite = new TestSuite("Tests for org.eclipse.gmf, tooling side");
final SessionSetup sessionSetup = SessionSetup.newInstance();
final LinksSessionSetup sessionSetup2 = LinksSessionSetup.newInstance();
@@ -97,16 +96,15 @@ public class AllTests {
// subclassing to generate extra code
final SessionSetup setupEditHelpersTest = new EditHelpersTest.EditHelpersSessionSetup();
final SessionSetup setupBundleActivationTest = new BundleActivationTest.CustomSetup();
-
+
SessionSetup.disallowSingleTestCaseUse();
-
JavaCore.initializeAfterLoad(null);
/*
- * Temporary workaround: loading all the projects in the
- * beginning to get rid of the problems with runtime registries
- * reloading. In particular - ViewService.
+ * Temporary workaround: loading all the projects in the beginning to
+ * get rid of the problems with runtime registries reloading. In
+ * particular - ViewService.
*/
// since we force initialization, need to make sure our tests would use same initialized setup instances.
Plugin.getConfig().registerInstance(SessionSetup.class, sessionSetup);
@@ -146,10 +144,10 @@ public class AllTests {
suite.addTestSuite(TestDefaultMergeService.class);
suite.addTestSuite(PluginXMLTextMergerTest.class);
suite.addTestSuite(ManifestMergeTest.class);
- suite.addTestSuite(OrganizeImportsPostprocessorTest.class);
+ suite.addTestSuite(OrganizeImportsPostprocessorTest.class);
suite.addTestSuite(EcoreGenModelMatcherTest.class);
- suite.addTestSuite(ModelLoadHelperTest.class);
+ suite.addTestSuite(ModelLoadHelperTest.class);
suite.addTest(AllMigrationTests.suite());
suite.addTest(AllValidateTests.suite());
@@ -163,14 +161,14 @@ public class AllTests {
suite.addTestSuite(MapModeStrategyTest.class);
suite.addTestSuite(ViewmapProducersTest.class);
suite.addTestSuite(ToolDefHandocodedImplTest.class);
- suite.addTestSuite(AuditHandcodedTest.class);
- suite.addTestSuite(AuditRulesTest.class);
+ suite.addTestSuite(AuditHandcodedTest.class);
+ suite.addTestSuite(AuditRulesTest.class);
suite.addTestSuite(ElementInitializerTest.class);
suite.addTestSuite(CodegenReconcileTest.class);
// though it might be an overkill to check two setups, it should be fast and won't hurt.
suite.addTest(feed(TestAllDerivedFeatures.class, sessionSetup, "-SessionSetup"));
suite.addTest(feed(TestAllDerivedFeatures.class, sessionSetup2, "-LinksSessionSetup"));
-
+
suite.addTestSuite(DiagramNodeTest.class);
suite.addTestSuite(CompartmentPropertiesTest.class);
suite.addTestSuite(NamingStrategyTest.class);
@@ -189,19 +187,19 @@ public class AllTests {
suite.addTestSuite(LinkCreationTest.class);
suite.addTestSuite(LinkCreationConstraintsTest.class);
- suite.addTestSuite(MetricRulesTest.class);
+ suite.addTestSuite(MetricRulesTest.class);
suite.addTestSuite(GenFeatureSeqInitializerTest.class);
suite.addTestSuite(GenModelGraphAnalyzerTest.class);
suite.addTestSuite(EditHelpersTest.class);
- //suite.addTest(feed(ParsersTest.class, new ParsersSetup(false), "-direct"));
- //suite.addTest(feed(ParsersTest.class, new ParsersSetup(true), "-provider"));
+ suite.addTest(feed(ParsersTest.class, new ParsersSetup(false), "-direct"));
+ suite.addTest(feed(ParsersTest.class, new ParsersSetup(true), "-provider"));
// slowest test goes last
suite.addTestSuite(RuntimeCompilationTest.class);
-
//$JUnit-END$
suite.addTest(new CleanupTest("testCleanup") {
+
protected void performCleanup() throws Exception {
sessionSetup.cleanup();
sessionSetup2.cleanup();
@@ -211,7 +209,7 @@ public class AllTests {
setupBundleActivationTest.cleanup();
}
});
-
+
return suite;
}
@@ -231,7 +229,7 @@ public class AllTests {
c.register(GenModelTransformerSimpleTest.class, SessionSetup.class);
c.register(LabelMappingTransformTest.class, SessionSetup.class);
c.register(PaletteTransformationTest.class, SessionSetup.class);
- c.register(AuditHandcodedTest.class, SessionSetup.class);
+ c.register(AuditHandcodedTest.class, SessionSetup.class);
c.register(CodegenReconcileTest.class, SessionSetup.class);
// Default configuration, TestAllDerivedFeatures also runs for LinksSessionSetup
c.register(TestAllDerivedFeatures.class, SessionSetup.class);
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/AbstractDiagramEditorTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/AbstractDiagramEditorTest.java
index 747806a83..b955bd47d 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/AbstractDiagramEditorTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/AbstractDiagramEditorTest.java
@@ -104,6 +104,7 @@ public abstract class AbstractDiagramEditorTest extends AbstractCanvasTest {
protected void tearDown() throws Exception {
if (myEditor != null) {
closeEditor(myEditor);
+ myEditor = null;
}
// keep project alive for potential workspace investigations
// deleteProject();
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java
index 63b8236e2..83efec5d7 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/ParsersTest.java
@@ -525,8 +525,11 @@ public class ParsersTest extends TestCase {
final PredefinedParser printfRegexParser = GMFGenFactory.eINSTANCE.createPredefinedParser();
printfRegexParser.setViewMethod(LabelTextAccessMethod.PRINTF);
printfRegexParser.setEditMethod(LabelTextAccessMethod.REGEXP);
+
final CustomParser customParser = GMFGenFactory.eINSTANCE.createCustomParser();
customParser.setQualifiedName(diagramkin.getEditPartsPackageName() + ".MyCustomParser");
+ customParser.setGenerateBoilerplate(false); // because we will generate this class externally, see ParsersSetup#GenProjectSetup#hookExtraCodeGeneration
+
final ExternalParser externalParser = GMFGenFactory.eINSTANCE.createExternalParser();
externalParser.setHint("\"Description\""); // value of CommonParserHint.DESCIPTION constant,
// not the constant itself to manually (visually) assure (in the generated class) the hint is being used.
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/GenProjectSetup.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/GenProjectSetup.java
index c509c49e9..8b72fee58 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/GenProjectSetup.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/GenProjectSetup.java
@@ -19,6 +19,7 @@ import java.util.StringTokenizer;
import junit.framework.Assert;
+import org.eclipse.core.commands.contexts.Context;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -36,6 +37,8 @@ import org.eclipse.gmf.tests.JobTracker;
import org.eclipse.gmf.tests.Plugin;
import org.eclipse.gmf.tests.Utils;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextService;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -46,7 +49,9 @@ import org.osgi.framework.BundleException;
public class GenProjectSetup extends GenProjectBaseSetup {
private ArrayList<Bundle> myAllInstalledBundes = new ArrayList<Bundle>();
+
private Bundle myBundle;
+
private final boolean myIsFullRuntimeRun;
public GenProjectSetup(GeneratorConfiguration generatorFactory) {
@@ -65,8 +70,9 @@ public class GenProjectSetup extends GenProjectBaseSetup {
* FIXME introduce DiaGenSourceBase with single getDiagram() accessor
*/
public GenProjectSetup init(GenEditorGenerator genEditor) throws BundleException {
- final boolean[] extensionChangeNotification = new boolean[] {true};
+ final boolean[] extensionChangeNotification = new boolean[] { true };
final IRegistryChangeListener listener = new IRegistryChangeListener() {
+
public void registryChanged(IRegistryChangeEvent event) {
extensionChangeNotification[0] = false;
}
@@ -87,6 +93,7 @@ public class GenProjectSetup extends GenProjectBaseSetup {
// System.out.println("Jobs to wait:" + jt.getJobsCount()); 13!
registerExtensions(myBundle);
registerEMFEditExtensions();
+ registerContexts();
// there should be hit, any .diagram plugin is supposed to register extensions we monitor with the listener above.
monitorExtensionLoad(extensionChangeNotification, 60);
monitorExtensionLoad(jt.getNonEmptyCondition(), 10);
@@ -127,7 +134,7 @@ public class GenProjectSetup extends GenProjectBaseSetup {
/**
* Manually registering all extensions from the generated (diagramming) plugin into eclipse registries
- */
+ */
private void registerExtensions(Bundle bundle) {
IConfigurationElement[] configElements = getConfigurationElements(bundle.getSymbolicName(), "org.eclipse.emf.ecore.extension_parser");
for (int i = 0; i < configElements.length; i++) {
@@ -141,10 +148,38 @@ public class GenProjectSetup extends GenProjectBaseSetup {
}
}
+ private void registerContexts() {
+ IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(IContextService.class);
+ if (contextService == null) {
+ return;
+ }
+
+ for (Bundle next : myAllInstalledBundes) {
+ IConfigurationElement[] configElements = getConfigurationElements(next.getSymbolicName(), "org.eclipse.ui.contexts");
+ for (int i = 0; i < configElements.length; i++) {
+ IConfigurationElement element = configElements[i];
+ if (element.getName().equals("context")) {
+ String id = element.getAttribute("id");
+ String description = element.getAttribute("description");
+ String name = element.getAttribute("name");
+ String parentId = element.getAttribute("parentId");
+ if (id == null || description == null || name == null || parentId == null) {
+ continue;
+ }
+ Context context = contextService.getContext(id);
+ if (!context.isDefined()) {
+ context.define(name, description, parentId);
+ }
+ }
+ }
+ }
+
+ }
+
private void registerEMFEditExtensions() {
- for(Bundle next : myAllInstalledBundes) {
+ for (Bundle next : myAllInstalledBundes) {
IConfigurationElement[] configElements = getConfigurationElements(next.getSymbolicName(), "org.eclipse.emf.edit.itemProviderAdapterFactories");
- for(int i = 0; i < configElements.length; i++) {
+ for (int i = 0; i < configElements.length; i++) {
IConfigurationElement element = configElements[i];
if (element.getName().equals("factory")) {
String packageURI = element.getAttribute("uri");
@@ -152,24 +187,23 @@ public class GenProjectSetup extends GenProjectBaseSetup {
String supportedTypes = element.getAttribute("supportedTypes");
if (packageURI == null) {
continue;
- }
- else if (className == null) {
+ } else if (className == null) {
continue;
- }
- else if (supportedTypes == null) {
+ } else if (supportedTypes == null) {
continue;
}
class PluginAdapterFactoryDescriptor extends PluginClassDescriptor implements ComposedAdapterFactory.Descriptor {
+
public PluginAdapterFactoryDescriptor(IConfigurationElement element, String attributeName) {
super(element, attributeName);
}
public AdapterFactory createAdapterFactory() {
- return (AdapterFactory)createInstance();
+ return (AdapterFactory) createInstance();
}
}
- for (StringTokenizer stringTokenizer = new StringTokenizer(supportedTypes); stringTokenizer.hasMoreTokens(); ) {
+ for (StringTokenizer stringTokenizer = new StringTokenizer(supportedTypes); stringTokenizer.hasMoreTokens();) {
String supportedType = stringTokenizer.nextToken();
ArrayList<String> key = new ArrayList<String>(2);
key.add(packageURI);
@@ -189,7 +223,7 @@ public class GenProjectSetup extends GenProjectBaseSetup {
if (bundlID.equals(configs[i].getContributor().getName())) {
ownConfigs.add(configs[i]);
}
- }
+ }
return ownConfigs.toArray(new IConfigurationElement[ownConfigs.size()]);
}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java
index d9ce324b5..a73e74fd6 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeWorkspaceSetup.java
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.gmf.tests.Plugin;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
/**
* Running tests within PDE, we face two major problems:
@@ -79,10 +80,10 @@ public class RuntimeWorkspaceSetup {
List<String> l = Arrays.asList(Platform.getCommandLineArgs());
int i;
if ((i = l.indexOf("-dev")) != -1) {
- isDevBinPresent = i + 1 < l.size() && l.get(i+1).startsWith("bin");
+ isDevBinPresent = i + 1 < l.size() && l.get(i + 1).startsWith("bin");
} else {
String osgiDevProp = Plugin.getBundleContext().getProperty("osgi.dev");
- isDevBinPresent = osgiDevProp!= null && osgiDevProp.contains("bin");
+ isDevBinPresent = osgiDevProp != null && osgiDevProp.contains("bin");
}
}
@@ -145,13 +146,14 @@ public class RuntimeWorkspaceSetup {
/**
* at least 1.4
*/
+ @SuppressWarnings("restriction")
private static void ensureJava14() {
- if (!JavaCore.VERSION_1_4.equals(JavaCore.getOption(JavaCore.COMPILER_SOURCE))) {
+ String actual = JavaCore.getOption(JavaCore.COMPILER_SOURCE);
+ long comparableValue = CompilerOptions.versionToJdkLevel(actual);
+ if (comparableValue < CompilerOptions.versionToJdkLevel(JavaCore.VERSION_1_4)) {
@SuppressWarnings("unchecked")
- Hashtable<String,String> options = JavaCore.getOptions();
- options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
- options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4);
- options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_4);
+ Hashtable<String, String> options = JavaCore.getOptions();
+ JavaCore.setComplianceOptions(JavaCore.VERSION_1_4, options);
JavaCore.setOptions(options);
}
}
@@ -163,7 +165,7 @@ public class RuntimeWorkspaceSetup {
wd.setFileStateLongevity(0);
wd.setMaxFileStates(0);
wd.setMaxFileStateSize(0);
- wd.setSnapshotInterval(60*60*1000);
+ wd.setSnapshotInterval(60 * 60 * 1000);
}
private static void switchAutobuildOff(IWorkspaceDescription wd) {

Back to the top