summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhubner2008-09-11 06:02:42 (EDT)
committerdhubner2008-09-11 06:02:42 (EDT)
commitac5e61426341b1d5974c5980e88a88c7c6c592ac (patch)
tree9db604786b0de702cf54d55f341509728e9d1520
parent6b9fee720058ad82bdc829ca3196a5ed7708da91 (diff)
downloadorg.eclipse.xpand-ac5e61426341b1d5974c5980e88a88c7c6c592ac.zip
org.eclipse.xpand-ac5e61426341b1d5974c5980e88a88c7c6c592ac.tar.gz
org.eclipse.xpand-ac5e61426341b1d5974c5980e88a88c7c6c592ac.tar.bz2
bug fixes, refactoring, tests fixes
-rw-r--r--plugins/org.eclipse.m2t.common.recipe.ui/plugin.xml4
-rw-r--r--plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/RecipePlugin.java2
-rw-r--r--plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/Messages.java2
-rw-r--r--plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeBrowserView.java2
-rw-r--r--plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeViewHelper.java2
-rw-r--r--plugins/org.eclipse.xtend.shared.ui/src/org/eclipse/xtend/shared/ui/core/properties/MetamodelContributorsPropertyAndPreferencePage.java153
-rw-r--r--plugins/org.eclipse.xtend.tests/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java10
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java333
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java54
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java48
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/AllTests.java17
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java (renamed from plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/JavaTest.java)7
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java31
-rw-r--r--plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/templates/files.xpt4
-rw-r--r--plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2Constraints.chk4
-rw-r--r--plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2ecore.ext10
-rw-r--r--tests/org.eclipse.xtend.shared.ui.test/.project6
-rw-r--r--tests/org.eclipse.xtend.typesystem.emf.tests/src/org/eclipse/xtend/typesystem/emf/EmfMetaModelTest.java10
20 files changed, 362 insertions, 350 deletions
diff --git a/plugins/org.eclipse.m2t.common.recipe.ui/plugin.xml b/plugins/org.eclipse.m2t.common.recipe.ui/plugin.xml
index daace32..09dae28 100644
--- a/plugins/org.eclipse.m2t.common.recipe.ui/plugin.xml
+++ b/plugins/org.eclipse.m2t.common.recipe.ui/plugin.xml
@@ -15,7 +15,7 @@
icon="icons/recipeView.gif"
category="recipes"
class="org.eclipse.m2t.common.recipe.ui.recipeBrowser.RecipeBrowserView"
- id="org.openarchitectureware.eclipse.recipeBrowser.RecipeBrowserView">
+ id="org.eclipse.m2t.common.recipe.recipeBrowser.RecipeBrowserView">
</view>
</extension>
@@ -24,7 +24,7 @@
id="org.eclipse.m2t.common.recipe.ui.open"
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.recipes">
- <action id="org.openarchitectureware.recipe.open.action"
+ <action id="org.eclipse.m2t.common.recipe.open.action"
label="Open Recipes"
icon="icons/recipeView.gif"
menubarPath="additions"
diff --git a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/RecipePlugin.java b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/RecipePlugin.java
index 3b1406f..5abb4c5 100644
--- a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/RecipePlugin.java
+++ b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/RecipePlugin.java
@@ -34,7 +34,7 @@ import org.osgi.framework.BundleContext;
public class RecipePlugin extends AbstractUIPlugin implements ITraceLog {
- private static final String PLUGIN_ID = "ID: org.openarchitectureware.recipe";
+ private static final String PLUGIN_ID = "ID: org.eclipse.m2t.common.recipe";
/**
* The shared instance
*/
diff --git a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/Messages.java b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/Messages.java
index 5c5a8f2..7b14773 100644
--- a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/Messages.java
+++ b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/Messages.java
@@ -14,7 +14,7 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
- private static final String BUNDLE_NAME = "org.openarchitectureware.eclipse.recipeBrowser.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.m2t.common.recipe.recipeBrowser.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
diff --git a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeBrowserView.java b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeBrowserView.java
index 9409fa3..ed79104 100644
--- a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeBrowserView.java
+++ b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeBrowserView.java
@@ -64,7 +64,7 @@ import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
public class RecipeBrowserView extends ViewPart implements IResourceChangeListener, ISelectionChangedListener {
- public static final String ID = "org.openarchitectureware.eclipse.recipeBrowser.RecipeBrowserView"; //$NON-NLS-1$
+ public static final String ID = "org.eclipse.m2t.common.recipe.recipeBrowser.RecipeBrowserView"; //$NON-NLS-1$
private Table parameterTable;
diff --git a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeViewHelper.java b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeViewHelper.java
index 023f121..385f46a 100644
--- a/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeViewHelper.java
+++ b/plugins/org.eclipse.m2t.common.recipe.ui/src/org/eclipse/m2t/common/recipe/ui/recipeBrowser/RecipeViewHelper.java
@@ -63,7 +63,7 @@ public class RecipeViewHelper extends EditorPart {
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(pei.getPath());
new OpenRecipesAction(file).run(null);
try {
- getSite().getPage().showView("org.openarchitectureware.eclipse.recipeBrowser.RecipeBrowserView");
+ getSite().getPage().showView("org.eclipse.m2t.common.recipe.recipeBrowser.RecipeBrowserView");
} catch (PartInitException e) {
RecipePlugin.log(e.getStatus());
}
diff --git a/plugins/org.eclipse.xtend.shared.ui/src/org/eclipse/xtend/shared/ui/core/properties/MetamodelContributorsPropertyAndPreferencePage.java b/plugins/org.eclipse.xtend.shared.ui/src/org/eclipse/xtend/shared/ui/core/properties/MetamodelContributorsPropertyAndPreferencePage.java
index d79e9a1..c958545 100644
--- a/plugins/org.eclipse.xtend.shared.ui/src/org/eclipse/xtend/shared/ui/core/properties/MetamodelContributorsPropertyAndPreferencePage.java
+++ b/plugins/org.eclipse.xtend.shared.ui/src/org/eclipse/xtend/shared/ui/core/properties/MetamodelContributorsPropertyAndPreferencePage.java
@@ -12,8 +12,9 @@ package org.eclipse.xtend.shared.ui.core.properties;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IProject;
@@ -58,8 +59,10 @@ import org.eclipse.xtend.shared.ui.internal.XtendLog;
* scope.
*
* @author Peter Friese
+ * @author Dennis Huebner
*/
-public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndPreferencePage {
+public class MetamodelContributorsPropertyAndPreferencePage extends
+ PropertyAndPreferencePage {
private Button downButton;
private Button upButton;
@@ -67,7 +70,8 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
/**
* Renders a human readable representation of the meta model contributors.
*/
- class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
+ class TableLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
public String getColumnText(Object element, int columnIndex) {
if (element instanceof Contributor) {
Contributor contributor = (Contributor) element;
@@ -85,58 +89,39 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
private IPreferenceStore prefStore;
- private LinkedList<Contributor> availableMetamodelContributors;
+ private List<Contributor> availableMetamodelContributors;
private Table table;
- private Collection<Contributor> getEnabledMetamodelContributors() {
+ private List<Contributor> getMetamodelContributors(boolean includeDisabled) {
Map<String, Contributor> availableMetamodelContributors = MetamodelContributorRegistry
.getRegisteredMetamodelContributors();
// retrieve all configured metamodels
prefStore = getPreferenceStore();
fixMetamodelContributorPreferences(prefStore);
- String rawString = prefStore.getString(PreferenceConstants.METAMODELCONTRIBUTORS);
+ String rawString = prefStore
+ .getString(PreferenceConstants.METAMODELCONTRIBUTORS);
- LinkedList<Contributor> result = new LinkedList<Contributor>();
+ List<Contributor> result = new ArrayList<Contributor>();
// first, get all enabled contributors
if (isNotEmpty(rawString)) {
String[] selected = rawString.split(",");
for (String metaModelContributorClassName : selected) {
- Contributor contributor = availableMetamodelContributors.get(metaModelContributorClassName);
- result.add(contributor);
+ Contributor contributor = availableMetamodelContributors
+ .get(metaModelContributorClassName);
+ if (contributor != null)
+ result.add(contributor);
}
}
-
- return result;
- }
-
- private LinkedList<Contributor> getMetamodelContributors() {
- Map<String, Contributor> availableMetamodelContributors = MetamodelContributorRegistry
- .getRegisteredMetamodelContributors();
-
- // retrieve all configured metamodels
- prefStore = getPreferenceStore();
- fixMetamodelContributorPreferences(prefStore);
- String rawString = prefStore.getString(PreferenceConstants.METAMODELCONTRIBUTORS);
-
- LinkedList<Contributor> result = new LinkedList<Contributor>();
-
- // first, get all enabled contributors
- if (isNotEmpty(rawString)) {
- String[] selected = rawString.split(",");
-
- for (String metaModelContributorClassName : selected) {
- Contributor contributor = availableMetamodelContributors.get(metaModelContributorClassName);
- result.add(contributor);
- }
- }
-
- // now, get disabled contributors
- for (Contributor contributor : availableMetamodelContributors.values()) {
- if (!result.contains(contributor)) {
- result.add(contributor);
+ if (includeDisabled) {
+ // now, get disabled contributors
+ for (Contributor contributor : availableMetamodelContributors
+ .values()) {
+ if (!result.contains(contributor)) {
+ result.add(contributor);
+ }
}
}
@@ -144,14 +129,19 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
}
/**
- * fix: package name from UML2MetamodelContributor was wrong. For compatibility
- * reasons we fix this name here on the fly. Later we could offer a migration path.
+ * fix: package name from UML2MetamodelContributor was wrong. For
+ * compatibility reasons we fix this name here on the fly. Later we could
+ * offer a migration path.
*/
- private static void fixMetamodelContributorPreferences(IPreferenceStore prefStore) {
- String metamodelContr = prefStore.getString(PreferenceConstants.METAMODELCONTRIBUTORS);
- if (metamodelContr.indexOf("openarchitecturware")>0) {
- metamodelContr = metamodelContr.replace("openarchitecturware", "openarchitectureware");
- prefStore.setValue(PreferenceConstants.METAMODELCONTRIBUTORS, metamodelContr);
+ private static void fixMetamodelContributorPreferences(
+ IPreferenceStore prefStore) {
+ String metamodelContr = prefStore
+ .getString(PreferenceConstants.METAMODELCONTRIBUTORS);
+ if (metamodelContr.indexOf("openarchitecturware") > 0) {
+ metamodelContr = metamodelContr.replace("openarchitecturware",
+ "openarchitectureware");
+ prefStore.setValue(PreferenceConstants.METAMODELCONTRIBUTORS,
+ metamodelContr);
}
}
@@ -165,25 +155,25 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
if (isProjectPreferencePage()) {
// get java project
IProject project = getProject();
- store = new ScopedPreferenceStore(new ProjectScope(project), Activator.getId());
+ store = new ScopedPreferenceStore(new ProjectScope(project),
+ Activator.getId());
} else {
- store = new ScopedPreferenceStore(new InstanceScope(), Activator.getId());
+ store = new ScopedPreferenceStore(new InstanceScope(), Activator
+ .getId());
}
return store;
}
-
+
private void updateButtonStates() {
int index = table.getSelectionIndex();
if (index == 0) {
upButton.setEnabled(false);
- }
- else {
+ } else {
upButton.setEnabled(true);
}
if (index >= checkboxTableViewer.getTable().getItemCount() - 1) {
downButton.setEnabled(false);
- }
- else {
+ } else {
downButton.setEnabled(true);
}
}
@@ -198,11 +188,14 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
gridLayout.marginWidth = 0;
container.setLayout(gridLayout);
- final Label activatedMetamodelContributorsLabel = new Label(container, SWT.NONE);
- activatedMetamodelContributorsLabel.setText("&Activated metamodel contributors:");
+ final Label activatedMetamodelContributorsLabel = new Label(container,
+ SWT.NONE);
+ activatedMetamodelContributorsLabel
+ .setText("&Activated metamodel contributors:");
new Label(container, SWT.NONE);
- checkboxTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER);
+ checkboxTableViewer = CheckboxTableViewer.newCheckList(container,
+ SWT.BORDER);
checkboxTableViewer.setLabelProvider(new TableLabelProvider());
checkboxTableViewer.setContentProvider(new ArrayContentProvider());
table = checkboxTableViewer.getTable();
@@ -215,7 +208,8 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final Composite composite = new Composite(container, SWT.NONE);
- composite.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
+ composite
+ .setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
final GridLayout gridLayout_1 = new GridLayout();
composite.setLayout(gridLayout_1);
@@ -228,16 +222,19 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
Object firstElement = structuredSelection.getFirstElement();
if (firstElement instanceof Contributor) {
Contributor contributor = (Contributor) firstElement;
- int index = availableMetamodelContributors.indexOf(contributor);
+ int index = availableMetamodelContributors
+ .indexOf(contributor);
availableMetamodelContributors.remove(contributor);
- availableMetamodelContributors.add(index - 1, contributor);
+ availableMetamodelContributors.add(index - 1,
+ contributor);
checkboxTableViewer.refresh();
}
}
updateButtonStates();
}
});
- final GridData gridData_1 = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ final GridData gridData_1 = new GridData(SWT.FILL, SWT.CENTER, false,
+ false);
gridData_1.widthHint = 75;
upButton.setLayoutData(gridData_1);
upButton.setText("&Up");
@@ -251,16 +248,19 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
Object firstElement = structuredSelection.getFirstElement();
if (firstElement instanceof Contributor) {
Contributor contributor = (Contributor) firstElement;
- int index = availableMetamodelContributors.indexOf(contributor);
+ int index = availableMetamodelContributors
+ .indexOf(contributor);
availableMetamodelContributors.remove(contributor);
- availableMetamodelContributors.add(index + 1, contributor);
+ availableMetamodelContributors.add(index + 1,
+ contributor);
checkboxTableViewer.refresh();
}
}
updateButtonStates();
}
});
- final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, false,
+ false);
gridData.widthHint = 75;
downButton.setLayoutData(gridData);
downButton.setText("&Down");
@@ -274,11 +274,12 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
* and visually checks the ones that are enabled.
*/
private void setupData() {
- availableMetamodelContributors = getMetamodelContributors();
+ availableMetamodelContributors = getMetamodelContributors(true);
checkboxTableViewer.setInput(availableMetamodelContributors);
- Collection<Contributor> enabledMetamodelContributors = getEnabledMetamodelContributors();
- checkboxTableViewer.setCheckedElements(enabledMetamodelContributors.toArray());
+ Collection<Contributor> enabledMetamodelContributors = getMetamodelContributors(false);
+ checkboxTableViewer.setCheckedElements(enabledMetamodelContributors
+ .toArray());
}
@Override
@@ -294,15 +295,18 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
@Override
protected boolean hasProjectSpecificOptions(IProject project) {
IPreferenceStore preferenceStore = getPreferenceStore();
- return preferenceStore.getBoolean(PreferenceConstants.PROJECT_SPECIFIC_METAMODEL);
+ return preferenceStore
+ .getBoolean(PreferenceConstants.PROJECT_SPECIFIC_METAMODEL);
}
@Override
public boolean performOk() {
if (isProjectPreferencePage()) {
- prefStore.setValue(PreferenceConstants.PROJECT_SPECIFIC_METAMODEL, useProjectSettings());
+ prefStore.setValue(PreferenceConstants.PROJECT_SPECIFIC_METAMODEL,
+ useProjectSettings());
}
- prefStore.setValue(PreferenceConstants.METAMODELCONTRIBUTORS, createStoreString());
+ prefStore.setValue(PreferenceConstants.METAMODELCONTRIBUTORS,
+ createStoreString());
try {
((ScopedPreferenceStore) prefStore).save();
} catch (IOException e1) {
@@ -317,11 +321,16 @@ public class MetamodelContributorsPropertyAndPreferencePage extends PropertyAndP
try {
new WorkspaceModifyOperation() {
@Override
- protected void execute(IProgressMonitor monitor) throws CoreException,
- java.lang.reflect.InvocationTargetException, InterruptedException {
- IXtendXpandProject p = Activator.getExtXptModelManager().findProject(project);
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException,
+ java.lang.reflect.InvocationTargetException,
+ InterruptedException {
+ IXtendXpandProject p = Activator
+ .getExtXptModelManager().findProject(
+ project);
if (p != null) {
- monitor.beginTask("...", p.getRegisteredResources().length);
+ monitor.beginTask("...", p
+ .getRegisteredResources().length);
p.analyze(monitor);
monitor.done();
}
diff --git a/plugins/org.eclipse.xtend.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.xtend.tests/META-INF/MANIFEST.MF
index 2e266ce..e40a3a1 100644
--- a/plugins/org.eclipse.xtend.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.xtend.tests/META-INF/MANIFEST.MF
@@ -17,7 +17,6 @@ Export-Package: org.eclipse.xtend,
org.eclipse.xtend.typesystem.baseimpl.types,
org.eclipse.xtend.typesystem.impl.javabeans,
org.eclipse.xtend.typesystem.impl.oawclassic,
- org.eclipse.xtend.typesystem.javabeansimpl,
org.eclipse.xtend.typesystem.javabeansimpl.test
Require-Bundle: org.junit,
org.eclipse.emf.mwe.core,
@@ -25,7 +24,5 @@ Require-Bundle: org.junit,
org.antlr.runtime,
org.eclipse.emf.common,
org.apache.log4j,
- org.apache.commons.logging,
- org.eclipse.xtend.backend,
- org.eclipse.xtend.middleend.xtend
+ org.apache.commons.logging
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java
index 5fffe41..50b00a8 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java
@@ -3,9 +3,14 @@ package org.eclipse.xtend;
import junit.framework.Test;
import junit.framework.TestSuite;
-public class AllAllTests extends TestSuite{
+public class AllAllTests extends TestSuite {
+ public static Test suite() {
+ AllAllTests suite = new AllAllTests();
+ return suite;
+ }
public AllAllTests() {
+ super("All Test for org.eclipse.xtend");
addTest(AllTests.suite());
addTest(org.eclipse.xtend.check.AllTests.suite());
addTest(org.eclipse.xtend.codeassist.AllTests.suite());
@@ -18,8 +23,7 @@ public class AllAllTests extends TestSuite{
addTest(org.eclipse.xtend.typesystem.baseimpl.types.AllTests.suite());
addTest(org.eclipse.xtend.typesystem.impl.javabeans.AllTests.suite());
addTest(org.eclipse.xtend.typesystem.impl.oawclassic.AllTests.suite());
- addTest(org.eclipse.xtend.typesystem.javabeansimpl.AllTests.suite());
addTest(org.eclipse.xtend.typesystem.javabeansimpl.test.AllTests.suite());
}
-
+
}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java
index 8f25890..aca3d89 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java
@@ -30,167 +30,186 @@ import org.eclipse.xtend.typesystem.javabeansimpl.test.TypeB;
public class ExtensionEvaluationTest extends TestCase {
- private ExecutionContextImpl ec;
+ private ExecutionContextImpl ec;
+
+ @Override
+ protected void setUp() throws Exception {
+ ec = new ExecutionContextImpl();
+ ec
+ .registerMetaModel(new JavaMetaModel("asdf",
+ new JavaBeansStrategy()));
+ }
+
+ private ExtensionFile parse(final String expression) {
+ return ParseFacade.file(new StringReader(expression), "nofile");
+ }
+
+ public final void testWithEverything() {
+ final ExtensionFile file = parse("String toUpperCase(String str) : JAVA org.eclipse.xtend.Helper.toUpperCase(java.lang.String) ; \n"
+ + "\n"
+ + "String privateHelper(String str) : JAVA org.eclipse.xtend.Helper.privateHelper(java.lang.String) ; \n"
+ + "\n"
+ + "String nonStaticHelper(String str) : JAVA org.eclipse.xtend.Helper.nonStaticHelper(java.lang.String) ; \n"
+ + "\n"
+ + "/* \n"
+ + " * Meine Funktion \n"
+ + " */ \n"
+ + "myExtension(Object val) : {val} ; \n");
+
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ final Object[] params = new Object[] { "test" };
+ Extension ext = ec.getExtension("toUpperCase", params);
+ assertEquals("TEST", ext.evaluate(params, ec));
+
+ ext = ec.getExtension("myExtension", params);
+ assertEquals(Collections.singletonList("test"), ext
+ .evaluate(params, ec));
+ }
+
+ public final void testJavaExtension2() {
+ final ExtensionFile file = parse("Collection union(Collection c1,Collection c2) : JAVA "
+ + "org.eclipse.xtend.Helper.union(java.util.Collection,java.util.Collection) ; \n");
+
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ final Object[] params = new Object[] { Collections.singleton("1"),
+ Collections.singleton("2") };
+ final Extension ext = ec.getExtension("union", params);
+ final Collection result = (Collection) ext.evaluate(params, ec);
+ assertTrue(result.size() == 2);
+ assertTrue(result.contains("1"));
+ assertTrue(result.contains("2"));
+ }
+
+ public final void testPolymorphism() {
+ final ExtensionFile file = parse("ext(Object val) : 'Object' ; \n"
+ + "ext(List[Object] val) : 'List' ; \n"
+ + "ext(Collection[Object] val) : 'Collection' ; \n"
+ + "ext(Integer val) : 'Integer' ; \n");
+
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ Extension ext = ec.getExtension("ext", new Object[] { "test" });
+ assertEquals("Object", ext.evaluate(new Object[] { "test" }, ec));
+
+ ext = ec.getExtension("ext", new Object[] { Collections.EMPTY_SET });
+ assertEquals("Collection", ext.evaluate(
+ new Object[] { Collections.EMPTY_SET }, ec));
+
+ ext = ec.getExtension("ext", new Object[] { Collections.EMPTY_LIST });
+ assertEquals("List", ext.evaluate(
+ new Object[] { Collections.EMPTY_LIST }, ec));
+
+ ext = ec.getExtension("ext", new Object[] { new Integer(2) });
+ assertEquals("Integer", ext.evaluate(new Object[] { new Integer(2) },
+ ec));
+
+ }
+
+ public final void testRecursion() {
+ final ExtensionFile file = parse("List[Integer] recExtension(Integer von,Integer bis) : von>=bis ? {von} : recExtension(von,bis-1).add(bis) ; \n");
+
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+
+ final Extension ext = ec.getExtension("recExtension", new Object[] {
+ new Long(5), new Long(10) });
+ final List<Long> expected = new ArrayList<Long>();
+ for (int i = 5; i <= 10; i++) {
+ expected.add(new Long(i));
+ }
+ final Object evalResult = ext.evaluate(new Object[] { new Long(5),
+ new Long(10) }, ec);
+ assertEquals(expected, evalResult);
+
+ }
+
+ public final void testMemberPosition() {
+ final ExtensionFile file = parse("ext1(String txt) : 'test'+txt ;"
+ + "ext2(String txt) : txt.ext1() ;");
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+
+ final Extension ext = ec.getExtension("ext2", new Object[] { "fall" });
+ final Object evalResult = ext.evaluate(new Object[] { "fall" }, ec);
+ assertEquals("testfall", evalResult);
+
+ }
- @Override
- protected void setUp() throws Exception {
- ec = new ExecutionContextImpl();
- ec.registerMetaModel(new JavaMetaModel("asdf", new JavaBeansStrategy()));
- }
+
+ public final void testCachedExtension() {
+ final ExtensionFile file = parse("cached String ext(String txt) : JAVA org.eclipse.xtend.ExtensionEvaluationTest.testMethod(java.lang.String);");
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+
+ final Extension ext = ec.getExtension("ext", new Object[] { "test" });
+ assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
+ assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
+ assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
+ assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
+ }
+
+ private static int magic = 0;
+
+ public final static String testMethod(final String s) {
+ return s + magic++;
+ }
+
+ public final void testCreateExtension() {
+ final ExtensionFile file = parse("create List l test(String s) : l.add(s) ;");
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ final List l = (List) ((Extension) file.getExtensions().get(0))
+ .evaluate(new String[] { "test" }, ec);
- private ExtensionFile parse(final String expression) {
- return ParseFacade.file(new StringReader(expression),"nofile");
+ assertEquals(Collections.singletonList("test"), l);
}
-
- public final void testWithEverything() {
- final ExtensionFile file = parse("String toUpperCase(String str) : JAVA org.eclipse.xtend.Helper.toUpperCase(java.lang.String) ; \n"
- + "\n"
- + "String privateHelper(String str) : JAVA org.eclipse.xtend.Helper.privateHelper(java.lang.String) ; \n"
- + "\n"
- + "String nonStaticHelper(String str) : JAVA org.eclipse.xtend.Helper.nonStaticHelper(java.lang.String) ; \n"
- + "\n" + "/* \n" + " * Meine Funktion \n" + " */ \n" + "myExtension(Object val) : {val} ; \n");
-
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final Object[] params = new Object[] { "test" };
- Extension ext = ec.getExtension("toUpperCase", params);
- assertEquals("TEST", ext.evaluate(params, ec));
-
- ext = ec.getExtension("myExtension", params);
- assertEquals(Collections.singletonList("test"), ext.evaluate(params, ec));
- }
-
- public final void testJavaExtension2() {
- final ExtensionFile file = parse("Collection union(Collection c1,Collection c2) : JAVA "
- + "org.eclipse.xtend.Helper.union(java.util.Collection,java.util.Collection) ; \n");
-
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final Object[] params = new Object[] { Collections.singleton("1"), Collections.singleton("2") };
- final Extension ext = ec.getExtension("union", params);
- final Collection result = (Collection) ext.evaluate(params, ec);
- assertTrue(result.size() == 2);
- assertTrue(result.contains("1"));
- assertTrue(result.contains("2"));
- }
-
- public final void testPolymorphism() {
- final ExtensionFile file = parse("ext(Object val) : 'Object' ; \n" + "ext(List[Object] val) : 'List' ; \n"
- + "ext(Collection[Object] val) : 'Collection' ; \n" + "ext(Integer val) : 'Integer' ; \n");
-
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- Extension ext = ec.getExtension("ext", new Object[] { "test" });
- assertEquals("Object", ext.evaluate(new Object[] { "test" }, ec));
-
- ext = ec.getExtension("ext", new Object[] { Collections.EMPTY_SET });
- assertEquals("Collection", ext.evaluate(new Object[] { Collections.EMPTY_SET }, ec));
-
- ext = ec.getExtension("ext", new Object[] { Collections.EMPTY_LIST });
- assertEquals("List", ext.evaluate(new Object[] { Collections.EMPTY_LIST }, ec));
-
- ext = ec.getExtension("ext", new Object[] { new Integer(2) });
- assertEquals("Integer", ext.evaluate(new Object[] { new Integer(2) }, ec));
-
- }
-
- public final void testRecursion() {
- final ExtensionFile file = parse("List[Integer] recExtension(Integer von,Integer bis) : von>=bis ? {von} : recExtension(von,bis-1).add(bis) ; \n");
-
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
-
- final Extension ext = ec.getExtension("recExtension", new Object[] { new Long(5), new Long(10) });
- final List<Long> expected = new ArrayList<Long>();
- for (int i = 5; i <= 10; i++) {
- expected.add(new Long(i));
- }
- final Object evalResult = ext.evaluate(new Object[] { new Long(5), new Long(10) }, ec);
- assertEquals(expected, evalResult);
-
- }
-
- public final void testMemberPosition() {
- final ExtensionFile file = parse("ext1(String txt) : 'test'+txt ;" + "ext2(String txt) : txt.ext1() ;");
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
-
- final Extension ext = ec.getExtension("ext2", new Object[] { "fall" });
- final Object evalResult = ext.evaluate(new Object[] { "fall" }, ec);
- assertEquals("testfall", evalResult);
-
- }
-
- public final void testCachedExtension() {
- final ExtensionFile file = parse("cached String ext(String txt) : JAVA org.eclipse.xtend.ExtensionEvaluationTest.testMethod(java.lang.String);");
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
-
- final Extension ext = ec.getExtension("ext", new Object[] { "test" });
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
- }
-
- private static int magic = 0;
-
- public final static String testMethod(final String s) {
- return s + magic++;
- }
-
- public final void testCreateExtension() {
- final ExtensionFile file = parse("create List l test(String s) : l.add(s) ;");
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final List l = (List) ((Extension) file.getExtensions().get(0)).evaluate(new String[] { "test" }, ec);
-
- assertEquals(Collections.singletonList("test"), l);
- }
-
- public final void testCreateExtension1() {
- final ExtensionFile file = parse("create List test(String s) : add(s) ;");
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final List l = (List) ((Extension) file.getExtensions().get(0)).evaluate(new String[] { "test" }, ec);
-
- assertEquals(Collections.singletonList("test"), l);
- }
-
- public final void testAmbigous() {
- final ExtensionFile file = parse("import "+TypeA.class.getPackage().getName().replaceAll("\\.", "::")+";"+
- "doStuff(TypeA this) : true; " +
- "doStuff(TypeC this) : false;");
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- assertNotNull(ec.getExtension("doStuff", new Object[] { new TypeA() }));
- try {
- ec.getExtension("doStuff", new Object[] { new TypeB() });
- fail("Ambigous operation exception expected");
- } catch (final RuntimeException re) {
- //expected
- System.out.println(re.getMessage());
- }
- }
-
- public final void testBug134626 () {
- final ExtensionFile file = parse("String someExt(TestA someA) : JAVA "+getClass().getName()+"(java.lang.String) ; \n");
-
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- }
-
- public static String methodForBug134626 () {
- return "Hello";
- }
-
-
- public void testAdvices() throws Exception {
- final ExtensionFile file = parse(
- "doStuff() : '_THE_'; " +
- "doStuff(String s) : s;");
- ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- ec.registerExtensionAdvices("org::eclipse::xtend::Advices");
-
- assertEquals("AROUND_THE_END",call(ec,"doStuff"));
- assertEquals("AROUNDAROUND_HONK_ENDEND",call(ec,"doStuff","_HONK_"));
-
- }
-
- private Object call(ExecutionContextImpl ctx, String string, Object... params) {
+
+ public final void testCreateExtension1() {
+ final ExtensionFile file = parse("create List test(String s) : add(s) ;");
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ final List l = (List) ((Extension) file.getExtensions().get(0))
+ .evaluate(new String[] { "test" }, ec);
+
+ assertEquals(Collections.singletonList("test"), l);
+ }
+
+ public final void testAmbigous() {
+ final ExtensionFile file = parse("import "
+ + TypeA.class.getPackage().getName().replaceAll("\\.", "::")
+ + ";" + "doStuff(TypeA this) : true; "
+ + "doStuff(TypeC this) : false;");
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ assertNotNull(ec.getExtension("doStuff", new Object[] { new TypeA() }));
+ try {
+ ec.getExtension("doStuff", new Object[] { new TypeB() });
+ fail("Ambigous operation exception expected");
+ } catch (final RuntimeException re) {
+ // expected
+ System.out.println(re.getMessage());
+ }
+ }
+
+ public final void testBug134626() {
+ final ExtensionFile file = parse("String someExt(TestA someA) : JAVA "
+ + getClass().getName() + "(java.lang.String) ; \n");
+
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ }
+
+ public static String methodForBug134626() {
+ return "Hello";
+ }
+
+ public void testAdvices() throws Exception {
+ final ExtensionFile file = parse("doStuff() : '_THE_'; "
+ + "doStuff(String s) : s;");
+ ec = (ExecutionContextImpl) ec.cloneWithResource(file);
+ ec.registerExtensionAdvices("org::eclipse::xtend::Advices");
+
+ assertEquals("AROUND_THE_END", call(ec, "doStuff"));
+ assertEquals("AROUNDAROUND_HONK_ENDEND", call(ec, "doStuff", "_HONK_"));
+
+ }
+
+ private Object call(ExecutionContextImpl ctx, String string,
+ Object... params) {
Extension ext = ctx.getExtension(string, params);
return ext.evaluate(params, ctx);
}
-
-
+
}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java
index afff19b..402fa38 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java
@@ -18,68 +18,72 @@ import java.io.StringWriter;
import junit.framework.TestCase;
public class ResourceManagerDefaultImplTest extends TestCase {
- private final static String CONTENT =
- tag("IMPORT ecore")+"\r\n"
- +tag("AROUND Root FOR EPackage")+"\r\n"
- +tag("ENDAROUND");
-
+ private static final String LINE_WRAP = System
+ .getProperty("line.separator");
+ private final static String CONTENT = tag("IMPORT ecore") + LINE_WRAP
+ + tag("AROUND Root FOR EPackage") + LINE_WRAP + tag("ENDAROUND");
+
class TestResourcManager extends ResourceManagerDefaultImpl {
public Reader _createReader(InputStream in) {
return super.createReader(in);
}
};
+
private TestResourcManager resMgr = new TestResourcManager();
-
- public void testCreateReader_UTF () throws Exception {
+
+ public void testCreateReader_UTF() throws Exception {
checkResourceLoading("UTF8", "templatefile-utf8.xpt");
}
- public void testCreateReader_ISO () throws Exception {
+ public void testCreateReader_ISO() throws Exception {
checkResourceLoading("ISO-8859-1", "templatefile-iso-8859-1.xpt");
}
-
- public void testCreateReader_UTF8_autodetect () throws Exception {
+
+ public void testCreateReader_UTF8_autodetect() throws Exception {
checkResourceLoading(null, "templatefile-utf8.xpt");
}
- public void testCreateReader_ISO_autodetect () throws Exception {
+ public void testCreateReader_ISO_autodetect() throws Exception {
checkResourceLoading(null, "templatefile-iso-8859-1.xpt");
}
- public void testCreateReader_MacRoman_autodetect () throws Exception {
+ public void testCreateReader_MacRoman_autodetect() throws Exception {
checkResourceLoading(null, "templatefile-macroman.xpt");
}
- private void checkResourceLoading (String encoding, String testfile) throws IOException {
+ private void checkResourceLoading(String encoding, String testfile)
+ throws IOException {
resMgr.setFileEncoding(encoding);
InputStream is = getClass().getResourceAsStream(testfile);
- assertNotNull (is);
+ assertNotNull(is);
Reader reader = resMgr._createReader(is);
String read = read(reader);
assertNotNull(read);
assertEquals(CONTENT, read);
-
+
}
-
- private String read (Reader r) throws IOException {
+
+ private String read(Reader r) throws IOException {
StringWriter s = new StringWriter();
char[] buf = new char[1024];
int len;
- len = r.read(buf,0,buf.length);
- while (len!=-1) {
+ len = r.read(buf, 0, buf.length);
+ while (len != -1) {
s.write(buf, 0, len);
- len = r.read(buf,0,buf.length);
+ len = r.read(buf, 0, buf.length);
}
return s.getBuffer().toString();
}
-
+
/**
* Returns a string encapsuled within Xpand guillemot brackets
- * @param s Some string
+ *
+ * @param s
+ * Some string
* @return String with brackets - <code<b>«s»</b></code>
*/
- protected static String tag(final String s) {
- return '\u00ab' + s + '\u00bb';
- }
+ protected static String tag(final String s) {
+ return '\u00ab' + s + '\u00bb';
+ }
}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
index ffd110e..9e534dd 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
@@ -25,13 +25,11 @@ import org.eclipse.internal.xtend.expression.parser.SyntaxConstants;
import org.eclipse.internal.xtend.type.impl.java.JavaMetaModel;
import org.eclipse.internal.xtend.type.impl.java.beans.JavaBeansStrategy;
import org.eclipse.internal.xtend.xtend.parser.ParseFacade;
-import org.eclipse.xtend.backend.types.builtin.StringType;
import org.eclipse.xtend.expression.EvaluationException;
import org.eclipse.xtend.expression.ExecutionContext;
import org.eclipse.xtend.expression.ExecutionContextImpl;
import org.eclipse.xtend.expression.Type1;
import org.eclipse.xtend.expression.Variable;
-import org.eclipse.xtend.middleend.xtend.XtendBackendFacade;
import org.eclipse.xtend.typesystem.Property;
/**
@@ -50,9 +48,9 @@ public class EvaluationTest extends TestCase {
private Object eval (String expression) {
final Object oldResult = evalOld (expression);
- final Object newResult = evalNew (expression);
+ //final Object newResult = evalNew (expression);
- checkEquals (oldResult, newResult);
+ // checkEquals (oldResult, newResult);
setUp (); // re-init ec
@@ -64,17 +62,17 @@ public class EvaluationTest extends TestCase {
return expr.evaluate (ec);
}
- private Object evalNew (String expression) {
- final Map<String, Object> newLocalVars = new HashMap<String, Object> ();
- for (String vn: ec.getVisibleVariables().keySet())
- newLocalVars.put (vn, ec.getVisibleVariables().get(vn).getValue());
-
- final Map<String, Object> newGlobalVars = new HashMap<String, Object> ();
- for (String vn: ec.getGlobalVariables().keySet())
- newGlobalVars.put (vn, ec.getGlobalVariables().get(vn).getValue());
-
- return XtendBackendFacade.evaluateExpression (expression, ec.getMetaModels(), newLocalVars, newGlobalVars);
- }
+// private Object evalNew (String expression) {
+// final Map<String, Object> newLocalVars = new HashMap<String, Object> ();
+// for (String vn: ec.getVisibleVariables().keySet())
+// newLocalVars.put (vn, ec.getVisibleVariables().get(vn).getValue());
+//
+// final Map<String, Object> newGlobalVars = new HashMap<String, Object> ();
+// for (String vn: ec.getGlobalVariables().keySet())
+// newGlobalVars.put (vn, ec.getGlobalVariables().get(vn).getValue());
+//
+// return XtendBackendFacade.evaluateExpression (expression, ec.getMetaModels(), newLocalVars, newGlobalVars);
+// }
// be lenient about type equality - the new backend is more consistent at converting types than the old runtime is...
private void checkEquals (Object o1, Object o2) {
@@ -177,15 +175,15 @@ public class EvaluationTest extends TestCase {
assertNull(eval ("this.unknownMember", "this", null));
}
- public final void testTypeLiteral1() {
- assertEquals (ec.getStringType(), evalOld ("String"));
- assertEquals (StringType.INSTANCE, evalNew ("String"));
-
- assertTrue (evalOld ("String.getProperty('length')") instanceof Property);
- assertTrue (evalNew ("String.getProperty('length')") instanceof org.eclipse.xtend.backend.common.Property);
-
- assertEquals (AType.TEST, eval (getATypeName() + "::TEST"));
- }
+// public final void testTypeLiteral1() {
+// assertEquals (ec.getStringType(), evalOld ("String"));
+// assertEquals (StringType.INSTANCE, evalNew ("String"));
+//
+// assertTrue (evalOld ("String.getProperty('length')") instanceof Property);
+// assertTrue (evalNew ("String.getProperty('length')") instanceof org.eclipse.xtend.backend.common.Property);
+//
+// assertEquals (AType.TEST, eval (getATypeName() + "::TEST"));
+// }
private String getATypeName() {
return AType.class.getName().replaceAll("\\.", SyntaxConstants.NS_DELIM);
@@ -287,7 +285,7 @@ public class EvaluationTest extends TestCase {
checkEquals ("12", evalOld ("x.asString() + x.asString()"));
ec = (ExecutionContextImpl) ec.cloneWithVariable (new Variable ("x", new Cls()));
- checkEquals ("12", evalNew ("x.asString() + x.asString()"));
+ // checkEquals ("12", evalNew ("x.asString() + x.asString()"));
}
public static class Cls {
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/AllTests.java
deleted file mode 100644
index 183e09e..0000000
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/AllTests.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.xtend.typesystem.javabeansimpl;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(
- "Test for org.eclipse.xtend.typesystem.javabeansimpl");
- //$JUnit-BEGIN$
- suite.addTestSuite(JavaTest.class);
- //$JUnit-END$
- return suite;
- }
-
-}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java
index 25c1ef1..09e8c2d 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java
@@ -7,10 +7,10 @@ public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite(
- "Test for org.eclipse.xtend.typesystem.javabeansimpl.test");
- //$JUnit-BEGIN$
-
- //$JUnit-END$
+ "Test for org.eclipse.xtend.typesystem.javabeansimpl");
+ // $JUnit-BEGIN$
+ suite.addTestSuite(JavaTest.class);
+ // $JUnit-END$
return suite;
}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/JavaTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java
index 9e6a9e4..066d552 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/JavaTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java
@@ -9,7 +9,7 @@
* committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
-package org.eclipse.xtend.typesystem.javabeansimpl;
+package org.eclipse.xtend.typesystem.javabeansimpl.test;
import java.util.HashMap;
import java.util.List;
@@ -25,11 +25,6 @@ import org.eclipse.xtend.expression.TypeNameUtil;
import org.eclipse.xtend.typesystem.Operation;
import org.eclipse.xtend.typesystem.StaticProperty;
import org.eclipse.xtend.typesystem.Type;
-import org.eclipse.xtend.typesystem.javabeansimpl.test.Mib;
-import org.eclipse.xtend.typesystem.javabeansimpl.test.OAWTypeD;
-import org.eclipse.xtend.typesystem.javabeansimpl.test.TypeA;
-import org.eclipse.xtend.typesystem.javabeansimpl.test.TypeB;
-import org.eclipse.xtend.typesystem.javabeansimpl.test.TypeC;
/**
* @author Sven Efftinge
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java
index f5cb5f1..b8dc505 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java
@@ -14,7 +14,6 @@ package org.eclipse.xtend.typesystem.emf;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
@@ -48,16 +47,13 @@ public class EmfRegistryMetaModel implements MetaModel {
return eobjectType;
}
- private final Cache cache = new Cache() {
-
-
+ private final Cache<EClassifier, Type> cache = new Cache<EClassifier, Type>() {
@Override
- protected Object createNew(Object arg0) {
- if (arg0 == null) {
+ protected Type createNew(EClassifier ele) {
+ if (ele == null) {
return null;
}
- EClassifier ele = (EClassifier) arg0;
if (ele.getName() == null) {
return null;
}
@@ -98,7 +94,7 @@ public class EmfRegistryMetaModel implements MetaModel {
private final HashSet<EClassifier> realTypes;
private final HashSet<EClassifier> booleanTypes;
-
+
private final HashSet<EClassifier> objectTypes;
public void setUseSingleGlobalResourceSet(boolean b) {
@@ -146,14 +142,14 @@ public class EmfRegistryMetaModel implements MetaModel {
objectTypes.add(EcorePackage.eINSTANCE.getEJavaObject());
}
- private final Cache typeForNameCache = new Cache() {
+ private final Cache<String, Type> typeForNameCache = new Cache<String, Type>() {
@Override
- protected Object createNew(Object typeName) {
+ protected Type createNew(String typeName) {
+
if (typeName.equals(eobjectType.getName())) {
return eobjectType;
}
- Set<ENamedElement> ele = getNamedElementRec(allPackages(),
- (String) typeName);
+ Set<ENamedElement> ele = getNamedElementRec(allPackages(), typeName);
if (ele.size() > 1) {
boolean classifiers = true;
for (ENamedElement element : ele) {
@@ -167,9 +163,9 @@ public class EmfRegistryMetaModel implements MetaModel {
if (ele.isEmpty()) {
return null;
}
- Object type = ele.iterator().next();
+ ENamedElement type = ele.iterator().next();
if (type instanceof EClassifier) {
- return cache.get(type);
+ return cache.get((EClassifier) type);
}
return null;
}
@@ -261,7 +257,8 @@ public class EmfRegistryMetaModel implements MetaModel {
final Set<Type> result = new HashSet<Type>();
result.add(eobjectType);
for (EPackage pack : allPackages()) {
- for (final Iterator iter = pack.eAllContents(); iter.hasNext();) {
+ for (final Iterator<EObject> iter = pack.eAllContents(); iter
+ .hasNext();) {
final Object obj = iter.next();
if (obj instanceof EClassifier) {
try {
@@ -334,8 +331,8 @@ public class EmfRegistryMetaModel implements MetaModel {
String namespace = sb.toString();
namespaces.add(namespace);
- EList subpackages = thePackage.getESubpackages();
- for (EPackage subPackage : (List<EPackage>) subpackages) {
+ EList<EPackage> subpackages = thePackage.getESubpackages();
+ for (EPackage subPackage : subpackages) {
traversePackage(namespace, namespaces, subPackage);
}
}
diff --git a/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/templates/files.xpt b/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/templates/files.xpt
index f842319..6401d6a 100644
--- a/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/templates/files.xpt
+++ b/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/templates/files.xpt
@@ -1,5 +1,5 @@
«IMPORT ecore»
-«EXTENSION org::openarchitectureware::util::uml2ecore::templates::utils»
+«EXTENSION org::eclipse::xtend::util::uml2ecore::templates::utils»
«DEFINE root FOR List»
«EXPAND root FOREACH (Collection[EPackage])this»
@@ -14,7 +14,7 @@
«FILE name+"Constraints.chk"-»
import «nsPrefix»;
-extension org::openarchitectureware::util::stdlib::naming;
+extension org::eclipse::xtend::util::stdlib::naming;
context «eClassifiers.get(0).name» ERROR "dummy - will hopefully be removed sometime :-)": true;
diff --git a/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2Constraints.chk b/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2Constraints.chk
index 284e380..7e7c6ec 100644
--- a/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2Constraints.chk
+++ b/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2Constraints.chk
@@ -5,10 +5,10 @@
import uml;
// load the debug extension in case we need to debug stuff
-extension org::openarchitectureware::util::stdlib::io;
+extension org::eclipse::xtend::util::stdlib::io;
// this is the transformation file; we call one helper function
// from that file (the mapTypeName()), that's why we import it
-extension org::openarchitectureware::util::uml2ecore::uml2ecore;
+extension org::eclipse::xtend::util::uml2ecore::uml2ecore;
// and this verifies that we can map the used primitive types
// to Ecore. This mapping is implemented by the mapTypeName()
diff --git a/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2ecore.ext b/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2ecore.ext
index 07a90cf..419faf2 100644
--- a/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2ecore.ext
+++ b/plugins/org.eclipse.xtend.util.uml2ecore/src/org/eclipse/xtend/util/uml2ecore/uml2ecore.ext
@@ -15,9 +15,9 @@ import uml;
// and we also load the io extensions, for the purpose of
// debugging, in case we need it
-extension org::openarchitectureware::util::stdlib::io;
-extension org::openarchitectureware::util::stdlib::issues;
-extension org::openarchitectureware::util::stdlib::counter;
+extension org::eclipse::xtend::util::stdlib::io;
+extension org::eclipse::xtend::util::stdlib::issues;
+extension org::eclipse::xtend::util::stdlib::counter;
Object top( Model m ):
resourcePerToplevelPackage(m) == "true" ? transformToSeveralFiles(m) : transformToplevelPackage(m);
@@ -209,7 +209,7 @@ private create EStringToStringMapEntry createAnnDetail( Operation o ):
setKey( "body" ) -> setValue( createBody( o.class.name, o.name, o.ownedParameter.select(p|p.direction.toString().toLowerCase()!="return").name ) );
private String createBody( String className, String opName, List params ):
- JAVA org.openarchitectureware.util.uml2ecore.AnnotationBodyCreator.createBody( java.lang.String, java.lang.String, java.util.List );
+ JAVA org.eclipse.xtend.util.uml2ecore.AnnotationBodyCreator.createBody( java.lang.String, java.lang.String, java.util.List );
create EParameter this mapParameter( Parameter p ):
setName( p.name ) ->
@@ -237,7 +237,7 @@ private cached handleType( uml::Type t ):
// actual type mapping to a Java method; take a look at the respective
// method to see how it works
ecore::EClassifier mapTypeName(String t):
- JAVA org.openarchitectureware.util.uml2ecore.TypeMapper.mapType( java.lang.String );
+ JAVA org.eclipse.xtend.util.uml2ecore.TypeMapper.mapType( java.lang.String );
boolean isAnonymous( Class c ):
diff --git a/tests/org.eclipse.xtend.shared.ui.test/.project b/tests/org.eclipse.xtend.shared.ui.test/.project
index a682996..3cbdd24 100644
--- a/tests/org.eclipse.xtend.shared.ui.test/.project
+++ b/tests/org.eclipse.xtend.shared.ui.test/.project
@@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.openarchitectureware.base.oawBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.openarchitectureware.base.oawNature</nature>
</natures>
</projectDescription>
diff --git a/tests/org.eclipse.xtend.typesystem.emf.tests/src/org/eclipse/xtend/typesystem/emf/EmfMetaModelTest.java b/tests/org.eclipse.xtend.typesystem.emf.tests/src/org/eclipse/xtend/typesystem/emf/EmfMetaModelTest.java
index ad28deb..307f6b8 100644
--- a/tests/org.eclipse.xtend.typesystem.emf.tests/src/org/eclipse/xtend/typesystem/emf/EmfMetaModelTest.java
+++ b/tests/org.eclipse.xtend.typesystem.emf.tests/src/org/eclipse/xtend/typesystem/emf/EmfMetaModelTest.java
@@ -35,14 +35,13 @@ import org.eclipse.xtend.typesystem.Operation;
import org.eclipse.xtend.typesystem.ParameterizedType;
import org.eclipse.xtend.typesystem.Property;
import org.eclipse.xtend.typesystem.Type;
-import org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel;
public class EmfMetaModelTest extends TestCase {
@Override
protected void setUp() throws Exception {
new StandaloneSetup().setPlatformUri("..");
}
-
+
public final void testEClassType() {
final ExecutionContextImpl ctx = new ExecutionContextImpl();
final EmfRegistryMetaModel mm = new EmfRegistryMetaModel();
@@ -140,7 +139,7 @@ public class EmfMetaModelTest extends TestCase {
registerEPackagesOfModel("org.eclipse.xtend.typesystem.emf.tests/metamodels/subdir/model.xmi");
EmfRegistryMetaModel mm = new EmfRegistryMetaModel();
ctx.registerMetaModel(mm);
-// assertNotNull(ctx.getTypeForName("base::BaseType"));
+ // assertNotNull(ctx.getTypeForName("base::BaseType"));
assertNotNull(ctx.getTypeForName("referee::SubAndReferring"));
assertNotNull(ctx.getTypeForName("ecore::EClass"));
assertNotNull(ctx.getTypeForName("nested::SubA"));
@@ -149,10 +148,11 @@ public class EmfMetaModelTest extends TestCase {
private void registerEPackagesOfModel(String string) throws IOException {
ResourceSet rs = new ResourceSetImpl();
- Resource r = rs.createResource(URI.createURI("platform:/plugin/"+string));
+ Resource r = rs.createResource(URI
+ .createPlatformPluginURI(string, true));
r.load(Collections.EMPTY_MAP);
EcoreUtil.resolveAll(rs);
EPackage.Registry.INSTANCE.putAll(rs.getPackageRegistry());
}
-
+
}