Merge branch 'master' into json
diff --git a/devtools/org.eclipse.emf.parsley.workspace/buckminster.cspex b/devtools/org.eclipse.emf.parsley.workspace/buckminster.cspex
deleted file mode 100644
index 4786a94..0000000
--- a/devtools/org.eclipse.emf.parsley.workspace/buckminster.cspex
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<cspecExtension
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:bc="http://www.eclipse.org/buckminster/Common-1.0"
- xmlns="http://www.eclipse.org/buckminster/CSpec-1.0">
- <dependencies>
- <dependency name="org.eclipse.emf.parsley.targetplatform"
- componentType="buckminster" />
- <dependency name="org.eclipse.emf.parsley.parent"
- componentType="buckminster" />
- <dependency name="org.eclipse.emf.parsley.releng"
- componentType="buckminster" />
- </dependencies>
-</cspecExtension>
diff --git a/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/02-FirstExample.xdoc b/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/02-FirstExample.xdoc
index 326ad01..5973852 100644
--- a/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/02-FirstExample.xdoc
+++ b/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/02-FirstExample.xdoc
@@ -86,9 +86,15 @@
The e[viewpart] corresponds to the standard Eclipse view part extension point; the Parsley
DSL will generate a e[plugin.xml_emfparsley_gen]
-into the root folder of your project. Just copy this file into e["plugin.xml"]. Parsley
-will never override your e[plugin.xml] file; each time you modify the module file, the
-e[plugin.xml_emfparsley_gen] will be generated: it is up to you to keep the generated file
+into the root folder of your project.
+The very first time, and only if it does not exist already, the DSL will also
+generate a e[plugin.xml] file.
+Further generations will NOT overwrite the e[plugin.xml]: they will overwrite
+e[plugin.xml_emfparsley_gen].
+If you make changes to the e[parts] section in the DSL file, you will have
+to manually merge the two files e[plugin.xml] and
+e[plugin.xml_emfparsley_gen].
+It is up to you to keep the generated file
synchronized with your e["plugin.xml"]. The easiest way is to select to the files,
and use the context menu "Compare With" => "Each Other".
diff --git a/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/03bis-SampleImplementations.xdoc b/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/03bis-SampleImplementations.xdoc
index 60e6b0f..45ac5bb 100644
--- a/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/03bis-SampleImplementations.xdoc
+++ b/doc/org.eclipse.emf.parsley.doc/xdoc/documentation/03bis-SampleImplementations.xdoc
@@ -298,30 +298,6 @@
%% ]]
%% ]]
%%]
-section3:OnSelectionListView[On Selection List View]
-
-codeRef[org.eclipse.emf.parsley.views.OnSelectionListView]
-
-%%ul[
-%% item[ref:ViewerInitializer[ViewerInitializer]
-%% ul[
-%% item[ref:EditingDomainResourceLoader[EditingDomainResourceLoader]
-%% ul[
-%% item[ref:ResourceLoader[ResourceLoader]
-%% ul[
-%% item[ref:EmptyResourceInitializer[EmptyResourceInitializer]]
-%% ]]
-%% item[ref:EmptyResourceInitializer[EmptyResourceInitializer]]
-%% item[ref:FeaturesProvider[FeaturesProvider]]
-%% ]]
-%% item[ref:JfaceProviderFactory[JfaceProviderFactory]
-%% ul[
-%% item[ref:ViewerLabelProvider[ViewerLabelProvider]]
-%% item[ref:TableColumnLabelProvider[TableColumnLabelProvider]]
-%% ]]
-%% item[ref:ViewerContextMenuFactory[ViewerContextMenuFactory]]
-%% ]]
-%%]
section3:OnSelectionTreeView[On Selection Tree View]
codeRef[org.eclipse.emf.parsley.views.OnSelectionTreeView]
diff --git a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslAllTests.java b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslAllTests.java
index 0c54bf1..3228893 100644
--- a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslAllTests.java
+++ b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslAllTests.java
@@ -32,7 +32,8 @@
EmfParsleyDslNewProjectFilesTests.class,
EmfParsleyProjectFilesGeneratorUtilTests.class,
EmfParsleyTemplateWizardConfigurationTests.class,
- EmfParsleyTemplateWizardConfigurationFactoryTests.class
+ EmfParsleyTemplateWizardConfigurationFactoryTests.class,
+ EmfParsleyDslFormatterTests.class,
})
public class EmfParsleyDslAllTests {
diff --git a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslFormatterTests.xtend b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslFormatterTests.xtend
new file mode 100644
index 0000000..537a082
--- /dev/null
+++ b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslFormatterTests.xtend
@@ -0,0 +1,921 @@
+/*******************************************************************************
+ * Copyright (c) 2015 RCP Vision (http://www.rcp-vision.com) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lorenzo Bettini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.parsley.dsl.tests
+
+import com.google.inject.Inject
+import org.eclipse.emf.parsley.dsl.EmfParsleyDslInjectorProvider
+import org.eclipse.xtext.junit4.InjectWith
+import org.eclipse.xtext.junit4.XtextRunner
+import org.eclipse.xtext.junit4.formatter.FormatterTester
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(typeof(XtextRunner))
+@InjectWith(typeof(EmfParsleyDslInjectorProvider))
+class EmfParsleyDslFormatterTests extends EmfParsleyDslAbstractTests {
+
+ @Inject extension FormatterTester
+
+ @Test def void testFormatPartSpecification() {
+ assertFormatted[
+ expectation = '''
+ module Foo {
+ parts {
+ viewpart my.view.tree.part {
+ viewname "My Tree View"
+ viewclass AbstractSaveableTreeView
+ viewcategory My.Category
+ }
+ viewpart my.view.tree.part2 {
+ viewname "My Tree View"
+ viewclass AbstractSaveableTreeView
+ }
+ }
+ }
+ '''
+ toBeFormatted = '''
+ module Foo { parts { viewpart
+ my.view.tree.part { viewname "My Tree View" viewclass AbstractSaveableTreeView viewcategory My.Category}
+ viewpart my.view.tree.part2 { viewname "My Tree View" viewclass AbstractSaveableTreeView }
+ }
+ }
+ '''
+ ]
+ }
+
+ @Test def void testFieldSpecifications() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.ecore.resource.Resource
+import com.google.inject.Inject
+
+module my.empty {
+ tableViewerContentProvider {
+ val field = "a field";
+ @Inject
+ val field2 = "a field";
+ var f1 = 0;
+ var extension int f2 = 0;
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.ecore.resource.Resource
+import com.google.inject.Inject
+
+module my.empty {
+ tableViewerContentProvider { val field = "a field"; @Inject
+ val field2 = "a field"; var f1 = 0 ; var extension int f2 = 0 ;
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testExtends() {
+ assertFormatted[
+ expectation = '''
+module my.empty {
+ tableViewerContentProvider extends Foo {
+ }
+}
+ '''
+ toBeFormatted = '''
+module my.empty {
+ tableViewerContentProvider extends Foo {
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testResourceManager() {
+ assertFormatted[
+ expectation = '''
+ import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+
+ module my.empty {
+ resourceManager {
+ val EXTLibraryFactory libraryFactory = EXTLibraryFactory.eINSTANCE;
+
+ initializeResource {
+ getContents() += libraryFactory.createLibrary
+ }
+ saveResource {
+ it.save(null)
+ return true
+ }
+ }
+ }
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+
+ module my.empty {
+ resourceManager {
+ val EXTLibraryFactory libraryFactory = EXTLibraryFactory.eINSTANCE;
+
+ initializeResource { getContents() += libraryFactory.createLibrary
+ }
+ saveResource {
+ it.save(null)
+ return true
+ }
+ }
+ }
+ '''
+ ]
+ }
+
+ @Test def void testResourceManagerWithoutSaveResource() {
+ assertFormatted[
+ expectation = '''
+ import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+
+ module my.empty {
+ resourceManager {
+ val EXTLibraryFactory libraryFactory = EXTLibraryFactory.eINSTANCE;
+
+ initializeResource {
+ getContents() += libraryFactory.createLibrary
+ }
+ }
+ }
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+
+ module my.empty {
+ resourceManager {
+ val EXTLibraryFactory libraryFactory = EXTLibraryFactory.eINSTANCE;
+
+ initializeResource { getContents() += libraryFactory.createLibrary
+ }
+ }
+ }
+ '''
+ ]
+ }
+
+ @Test def void testTableViewerContentProvider() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.ecore.resource.Resource
+
+module my.empty {
+ tableViewerContentProvider {
+ val field = "a field";
+ elements {
+ Resource -> {
+ getContents()
+ }
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.ecore.resource.Resource
+
+module my.empty {
+ tableViewerContentProvider { val field = "a field";
+ elements { Resource -> { getContents()
+ }
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testTableViewerContentProviderWithoutElements() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.ecore.resource.Resource
+
+module my.empty {
+ tableViewerContentProvider {
+ val field = "a field";
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.ecore.resource.Resource
+
+module my.empty {
+ tableViewerContentProvider { val field = "a field";
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testViewerContentProvider() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.emf.ecore.EObject
+
+module my.empty {
+ viewerContentProvider {
+ val field = "a field";
+ elements {
+ Resource -> {
+ getContents()
+ }
+ }
+ children {
+ Resource -> {
+ getContents()
+ }
+ EObject -> {
+ emptyList
+ }
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.emf.ecore.EObject
+
+module my.empty {
+ viewerContentProvider { val field = "a field";
+ elements { Resource -> { getContents()
+ }
+ }
+ children { Resource -> { getContents()
+ } EObject -> { emptyList
+ }
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testConfigurator() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryPackage
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.emf.common.util.URI
+
+module my.empty {
+ configurator {
+ val EXTLibraryPackage libraryPackage = EXTLibraryPackage.eINSTANCE;
+
+ resourceURI {
+ Library lib -> URI.createFileURI("file:/foo")
+ Writer -> null
+ }
+ eClass {
+ Library lib -> libraryPackage.library
+ Writer -> libraryPackage.writer
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryPackage
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.emf.common.util.URI
+
+module my.empty {
+
+ configurator { val EXTLibraryPackage libraryPackage = EXTLibraryPackage.eINSTANCE;
+
+ resourceURI { Library lib -> URI.createFileURI("file:/foo") Writer -> null
+ }
+ eClass { Library lib -> libraryPackage.library Writer -> libraryPackage.writer
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testMenuBuilder() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ menuBuilder {
+ val EXTLibraryFactory libraryFactory = EXTLibraryFactory.eINSTANCE;
+
+ menus {
+ Object -> #[
+ actionRedo,
+ actionUndo,
+ separator,
+ actionCopy,
+ actionPaste
+ ]
+
+ Writer -> {
+ #[
+ actionUndo,
+ separator,
+ submenu("Submenu1", #[
+ actionCopy,
+ submenu("Submenu2", #[
+ actionCut
+ ])
+ ]),
+ actionPaste
+ ]
+ }
+ }
+
+ emfMenus {
+ Library lib -> newArrayList(
+ actionAdd(
+ "New Writer",
+ lib.writers,
+ libraryFactory.createWriter => [
+ name = "This is a new writer"
+ ]
+ )
+ )
+ Writer -> #[
+ actionAdd(
+ "New book",
+ books,
+ libraryFactory.createBook => [
+ title = "New book"
+ ]
+ )
+ ]
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+
+ menuBuilder {
+ val EXTLibraryFactory libraryFactory = EXTLibraryFactory.eINSTANCE;
+
+ menus {
+ Object -> #[
+ actionRedo,
+ actionUndo,
+ separator,
+ actionCopy,
+ actionPaste
+ ]
+
+ Writer -> {
+ #[
+ actionUndo,
+ separator,
+ submenu("Submenu1", #[
+ actionCopy,
+ submenu("Submenu2", #[
+ actionCut
+ ])
+ ]),
+ actionPaste
+ ]
+ }
+ }
+
+ emfMenus {
+ Library lib -> newArrayList(
+ actionAdd("New Writer", lib.writers,
+ libraryFactory.createWriter => [
+ name = "This is a new writer"
+ ]
+ )
+ )
+ Writer -> #[
+ actionAdd("New book", books,
+ libraryFactory.createBook => [
+ title = "New book"
+ ]
+ )
+ ]
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testControlFactory() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.Borrower
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ formControlFactory {
+ control {
+ Library : name -> {
+ }
+ Writer : books -> createLabel(books.map[title].join(", "))
+ Writer : name -> {
+ createLabel(parent, "")
+ } target {
+ observeText
+ }
+ Writer : firstName -> toolkit.createLabel(parent, "") target observeText(SWT::Modify)
+ Borrower : firstName -> {
+ createText(firstName, SWT::MULTI, SWT::BORDER, SWT::WRAP, SWT::V_SCROLL)
+ }
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.Borrower
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ formControlFactory {
+ control {
+ Library : name -> { }
+ Writer : books ->
+ createLabel(
+ books.map[title].join(", "))
+ Writer : name -> { createLabel(parent, "") }
+ target { observeText }
+ Writer : firstName ->
+ toolkit.createLabel(parent, "")
+ target observeText(SWT::Modify)
+ Borrower : firstName -> {
+ createText(firstName, SWT::MULTI, SWT::BORDER,
+ SWT::WRAP, SWT::V_SCROLL)
+ }
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testFeaturesProvider() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ featuresProvider {
+ features {
+ Library -> name
+ Writer -> firstName, lastName, books
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ featuresProvider {
+ features {
+ Library -> name
+ Writer -> firstName , lastName, books
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testFeatureCaptionProvider() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ featureCaptionProvider {
+ text {
+ Library : name -> 'Name'
+ Library : books -> 'Books'
+ Writer : lastName -> name.toFirstUpper
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ featureCaptionProvider {
+ text {
+ Library:name -> 'Name'
+ Library:books -> 'Books'
+ Writer:lastName -> name.toFirstUpper
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testCaptionProviderWithLabel() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryPackage
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.swt.SWT
+import org.eclipse.swt.widgets.Label
+
+module my.empty {
+ formFeatureCaptionProvider {
+ text {
+ Library : name -> 'Name' // constant
+ Library : books -> 'Books' // constant
+ Writer : lastName -> name.toFirstUpper // the implicit param is an EStructuralFeature
+ }
+ label {
+ Library : name -> createLabel(parent, "Name")
+ Library : books -> createLabel(parent, EXTLibraryPackage.eINSTANCE.library,
+ EXTLibraryPackage.eINSTANCE.library_Books)
+ Writer : lastName -> {
+ new Label(parent, SWT.NONE) => [ l |
+ l.^text = name
+ ]
+ // the implicit param is an EStructuralFeature
+ // 'name' comes from EStructuralFeature
+ }
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.EXTLibraryPackage
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.swt.SWT
+import org.eclipse.swt.widgets.Label
+
+module my.empty {
+ formFeatureCaptionProvider {
+ text {
+ Library:name -> 'Name' // constant
+ Library:books -> 'Books' // constant
+ Writer:lastName -> name.toFirstUpper // the implicit param is an EStructuralFeature
+ }
+ label {
+ Library:name -> createLabel(parent, "Name")
+ Library:books -> createLabel(parent, EXTLibraryPackage.eINSTANCE.library, EXTLibraryPackage.eINSTANCE.library_Books)
+ Writer:lastName -> {
+ new Label(parent, SWT.NONE) => [
+ l |
+ l.^text = name
+ ]
+ // the implicit param is an EStructuralFeature
+ // 'name' comes from EStructuralFeature
+ }
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testTableLabelProvider() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.Book
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.swt.graphics.ImageData
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+
+module my.empty {
+ tableLabelProvider {
+ text {
+ Library : name -> 'Name' // constant
+ Library : books -> 'Books' // constant
+ Writer : lastName -> name.toFirstUpper // the implicit param is an EStructuralFeature
+ }
+
+ image {
+ Book : author -> if (author.name.nullOrEmpty)
+ "noname.gif"
+ else
+ new ImageData("writer.jpeg")
+ }
+
+ font {
+ Library : name -> JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)
+ }
+
+ foreground {
+ Library : books -> Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)
+ }
+
+ background {
+ Library : address -> Display.getCurrent().getSystemColor(SWT.COLOR_GREEN)
+ }
+
+ rowFont {
+ Library -> JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)
+ }
+
+ rowForeground {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)
+ }
+
+ rowBackground {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_GREEN)
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.Book
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.swt.graphics.ImageData
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+
+module my.empty {
+ tableLabelProvider {
+ text {
+ Library:name -> 'Name' // constant
+ Library:books -> 'Books' // constant
+ Writer:lastName -> name.toFirstUpper // the implicit param is an EStructuralFeature
+ }
+
+ image {
+ Book: author ->
+ if (author.name.nullOrEmpty)
+ "noname.gif"
+ else
+ new ImageData("writer.jpeg")
+ }
+
+ font {
+ Library : name -> JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)
+ }
+
+ foreground {
+ Library : books -> Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)
+ }
+
+ background {
+ Library : address -> Display.getCurrent().getSystemColor(SWT.COLOR_GREEN)
+ }
+
+ rowFont {
+ Library -> JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)
+ }
+
+ rowForeground {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)
+ }
+
+ rowBackground {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_GREEN)
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testLabelProvider() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.Book
+import org.eclipse.emf.parsley.examples.library.BookOnTape
+import org.eclipse.emf.parsley.examples.library.Borrower
+import org.eclipse.emf.parsley.examples.library.Lendable
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.swt.graphics.ImageData
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+
+module my.empty {
+ labelProvider {
+ text {
+ Library -> 'foo' // constant
+ Writer writer -> writer.getName() // explicit param
+ Book -> title // implit 'it' param
+ Lendable -> 'copies: ' + copies
+ Borrower -> { // complex block
+ val buffer = 'borrowed: ' + borrowed.map [ b |
+ b.copies
+ ]
+ buffer.toUpperCase
+ }
+ BookOnTape -> getTitle
+ }
+
+ image {
+ Library -> 'library.jpeg' // constant
+ Writer writer -> if (writer.name.nullOrEmpty)
+ "noname.gif"
+ else
+ new ImageData("writer.jpeg")
+ }
+
+ font {
+ Library -> JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)
+ }
+
+ foreground {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)
+ }
+
+ background {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_GREEN)
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.Book
+import org.eclipse.emf.parsley.examples.library.BookOnTape
+import org.eclipse.emf.parsley.examples.library.Borrower
+import org.eclipse.emf.parsley.examples.library.Lendable
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+import org.eclipse.swt.graphics.ImageData
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+
+module my.empty {
+ labelProvider {
+ text {
+ Library -> 'foo' // constant
+ Writer writer -> writer.getName() // explicit param
+ Book -> title // implit 'it' param
+ Lendable -> 'copies: ' + copies
+ Borrower -> { // complex block
+ val buffer = 'borrowed: ' + borrowed.map [
+ b | b.copies
+ ]
+ buffer.toUpperCase
+ }
+ BookOnTape -> getTitle
+ }
+
+ image {
+ Library -> 'library.jpeg' // constant
+ Writer writer ->
+ if (writer.name.nullOrEmpty)
+ "noname.gif"
+ else
+ new ImageData("writer.jpeg")
+ }
+
+ font {
+ Library -> JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)
+ }
+
+ foreground {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)
+ }
+
+background {
+ Library -> Display.getCurrent().getSystemColor(SWT.COLOR_GREEN)
+ }
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testBindings() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.jface.viewers.ILabelProvider
+import org.eclipse.jface.viewers.IBaseLabelProvider
+import org.eclipse.emf.parsley.ui.provider.ViewerLabelProvider
+
+module my.empty {
+ bindings {
+ type ILabelProvider -> ViewerLabelProvider
+ type IBaseLabelProvider -> ViewerLabelProvider
+ provide IBaseLabelProvider -> ViewerLabelProvider
+ value IBaseLabelProvider a -> ViewerLabelProvider
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.jface.viewers.ILabelProvider
+import org.eclipse.jface.viewers.IBaseLabelProvider
+import org.eclipse.emf.parsley.ui.provider.ViewerLabelProvider
+
+module my.empty {
+ bindings {
+ type ILabelProvider -> ViewerLabelProvider
+ type IBaseLabelProvider -> ViewerLabelProvider
+ provide IBaseLabelProvider -> ViewerLabelProvider
+ value IBaseLabelProvider a -> ViewerLabelProvider
+ }
+}
+ '''
+ ]
+ }
+
+ @Test def void testProposals() {
+ assertFormatted[
+ expectation = '''
+import org.eclipse.emf.parsley.examples.library.Book
+import org.eclipse.emf.parsley.examples.library.Borrower
+import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ proposals {
+ Library : name -> {
+ newArrayList('foo', 'bar')
+ }
+ Writer : books -> {
+ books
+ } // it.books
+ Book : author -> {
+ newArrayList(
+ EXTLibraryFactory::eINSTANCE.createWriter => [
+ name = "Foo"
+ ],
+ EXTLibraryFactory::eINSTANCE.createWriter => [
+ name = "Bar"
+ ]
+ )
+ }
+ Borrower : borrowed -> {
+ val p = defaultProposals(feature) => [
+ add(EXTLibraryFactory::eINSTANCE.createBook => [
+ title = "Fake Book"
+ ])
+ ]
+ return p
+ }
+ }
+}
+ '''
+ toBeFormatted = '''
+import org.eclipse.emf.parsley.examples.library.Book
+import org.eclipse.emf.parsley.examples.library.Borrower
+import org.eclipse.emf.parsley.examples.library.EXTLibraryFactory
+import org.eclipse.emf.parsley.examples.library.Library
+import org.eclipse.emf.parsley.examples.library.Writer
+
+module my.empty {
+ proposals {
+ Library : name -> { newArrayList('foo', 'bar') }
+ Writer : books ->
+ { books } // it.books
+ Book : author -> {
+ newArrayList(
+ EXTLibraryFactory::eINSTANCE.createWriter => [
+ name = "Foo"
+ ],
+ EXTLibraryFactory::eINSTANCE.createWriter => [
+ name = "Bar"
+ ]
+ )
+ }
+ Borrower : borrowed -> {
+ val p = defaultProposals(feature) => [
+ add(EXTLibraryFactory::eINSTANCE.createBook => [
+ title = "Fake Book"
+ ])
+ ]
+ return p
+ }
+ }
+}
+ '''
+ ]
+ }
+
+}
\ No newline at end of file
diff --git a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslScopingTests.xtend b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslScopingTests.xtend
index 447eede..88b912f 100644
--- a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslScopingTests.xtend
+++ b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslScopingTests.xtend
@@ -32,7 +32,7 @@
@Test
def void testFeaturesForLabelSpecifications() {
inputs.tableLabelProvider.parseModel.
- module.tableLabelProvider.labelSpecifications.head.
+ module.tableLabelProvider.featureTexts.specifications.head.
assertScope
(ModelPackage::eINSTANCE.featureAssociatedExpression_Feature,
"name, books, borrowers, writers, employees, stock, branches, parentBranch, people, address, class"
@@ -43,7 +43,7 @@
@Test
def void testFeaturesForPropertyDescriptionSpecifications() {
inputs.featureCaptionProvider.parseModel.
- module.featureCaptionProvider.specifications.head.
+ module.featureCaptionProvider.featureTexts.specifications.head.
assertScope
(ModelPackage::eINSTANCE.featureAssociatedExpression_Feature,
"name, books, borrowers, writers, employees, stock, branches, parentBranch, people, address, class"
diff --git a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslValidatorTests.xtend b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslValidatorTests.xtend
index d65bddd..ff3ff30 100644
--- a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslValidatorTests.xtend
+++ b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslValidatorTests.xtend
@@ -556,11 +556,11 @@
input.parse => [
4.assertEquals(validate.size)
assertDuplicateElement(
- ModelPackage.eINSTANCE.labelSpecification,
+ ModelPackage.eINSTANCE.polymorphicSpecification,
input.indexOf("EClass ->"), 'EClass -> ""'.length
)
assertDuplicateElement(
- ModelPackage.eINSTANCE.labelSpecification,
+ ModelPackage.eINSTANCE.polymorphicSpecification,
input.indexOf("EClass c"), 'EClass c -> ""'.length
)
assertDuplicateElement(
diff --git a/dsl/org.eclipse.emf.parsley.dsl/META-INF/MANIFEST.MF b/dsl/org.eclipse.emf.parsley.dsl/META-INF/MANIFEST.MF
index 7a605d7..8184c58 100644
--- a/dsl/org.eclipse.emf.parsley.dsl/META-INF/MANIFEST.MF
+++ b/dsl/org.eclipse.emf.parsley.dsl/META-INF/MANIFEST.MF
@@ -25,7 +25,6 @@
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.emf.parsley.dsl,
- org.eclipse.emf.parsley.dsl.formatting,
org.eclipse.emf.parsley.dsl.generator,
org.eclipse.emf.parsley.dsl.jvmmodel,
org.eclipse.emf.parsley.dsl.model,
diff --git a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/EmfParsleyDsl.xtext b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/EmfParsleyDsl.xtext
index c18d7d5..a471d76 100644
--- a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/EmfParsleyDsl.xtext
+++ b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/EmfParsleyDsl.xtext
@@ -71,35 +71,15 @@
fields += FieldSpecification*
(
- (
- 'text' '{'
- labelSpecifications+=LabelSpecification*
- '}'
- )?
+ (texts=Texts)?
&
- (
- 'image' '{'
- imageSpecifications+=LabelSpecification*
- '}'
- )?
+ (images=Images)?
&
- (
- 'font' '{'
- fontSpecifications+=LabelSpecification*
- '}'
- )?
+ (fonts=Fonts)?
&
- (
- 'foreground' '{'
- foregroundSpecifications+=LabelSpecification*
- '}'
- )?
+ (foregrounds=Foregrounds)?
&
- (
- 'background' '{'
- backgroundSpecifications+=LabelSpecification*
- '}'
- )?
+ (backgrounds=Backgrounds)?
)
'}'
;
@@ -115,66 +95,60 @@
name=ValidID ('=' right=XExpression)? ';'?
;
+Texts:
+ {Texts} 'text' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+Images:
+ {Images} 'image' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+Fonts:
+ {Fonts} 'font' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+Foregrounds:
+ {Foregrounds} 'foreground' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+Backgrounds:
+ {Backgrounds} 'background' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
TableLabelProvider:
{TableLabelProvider} 'tableLabelProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- // Note: the assignments text='text' are useless for the AST, but they help to avoid
- // to get too many ambiguities in the grammar, and avoid a too big serializer
- // (The code of method init(IGrammarAccess) is exceeding the 65535 bytes limit in EmfParsleyDslSyntacticSequencer.java)
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=458705#c5
(
- (
- text='text' '{'
- labelSpecifications+=FeatureAssociatedExpression*
- '}'
- )?
+ (featureTexts=FeatureTexts)?
&
- (
- image='image' '{'
- imageSpecifications+=FeatureAssociatedExpression*
- '}'
- )?
+ (featureImages=FeatureImages)?
&
- (
- font='font' '{'
- fontSpecifications+=FeatureAssociatedExpression*
- '}'
- )?
+ (featureFonts=FeatureFonts)?
&
- (
- foreground='foreground' '{'
- foregroundSpecifications+=FeatureAssociatedExpression*
- '}'
- )?
+ (featureForegrounds=FeatureForegrounds)?
&
- (
- background='background' '{'
- backgroundSpecifications+=FeatureAssociatedExpression*
- '}'
- )?
+ (featureBackgrounds=FeatureBackgrounds)?
&
- (
- rowFont='rowFont' '{'
- rowFontSpecifications+=LabelSpecification*
- '}'
- )?
+ (rowFonts=RowFonts)?
&
- (
- rowForeground='rowForeground' '{'
- rowForegroundSpecifications+=LabelSpecification*
- '}'
- )?
+ (rowForegrounds=RowForegrounds)?
&
- (
- rowBackground='rowBackground' '{'
- rowBackgroundSpecifications+=LabelSpecification*
- '}'
- )?
+ (rowBackgrounds=RowBackgrounds)?
)
'}'
;
-LabelSpecification:
+PolymorphicSpecification:
parameterType=JvmTypeReference (name=ValidID)?
'->'
expression = XExpression
@@ -185,11 +159,7 @@
{FeatureCaptionProvider} 'featureCaptionProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- ((
- 'text' '{'
- specifications+=FeatureAssociatedExpression*
- '}'
- )?)
+ (featureTexts=FeatureTexts)?
'}'
;
@@ -197,17 +167,11 @@
{FormFeatureCaptionProvider} 'formFeatureCaptionProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- ((
- 'text' '{'
- specifications+=FeatureAssociatedExpression*
- '}'
- )?
- &
(
- 'label' '{'
- labelSpecifications+=FeatureAssociatedExpression*
- '}'
- )?)
+ (featureTexts=FeatureTexts)?
+ &
+ (featureLabels=FeatureLabels)?
+ )
'}'
;
@@ -215,20 +179,79 @@
{DialogFeatureCaptionProvider} 'dialogFeatureCaptionProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- ((
- 'text' '{'
- specifications+=FeatureAssociatedExpression*
- '}'
- )?
- &
(
- 'label' '{'
- labelSpecifications+=FeatureAssociatedExpression*
- '}'
- )?)
+ (featureTexts=FeatureTexts)?
+ &
+ (featureLabels=FeatureLabels)?
+ )
'}'
;
+FeatureTexts:
+ {FeatureTexts} 'text' '{'
+ specifications+=FeatureAssociatedExpression*
+ '}'
+;
+
+FeatureImages:
+ {FeatureImages} 'image' '{'
+ specifications+=FeatureAssociatedExpression*
+ '}'
+;
+
+FeatureFonts:
+ {FeatureFonts} 'font' '{'
+ specifications+=FeatureAssociatedExpression*
+ '}'
+;
+
+FeatureForegrounds:
+ {FeatureForegrounds} 'foreground' '{'
+ specifications+=FeatureAssociatedExpression*
+ '}'
+;
+
+FeatureBackgrounds:
+ {FeatureBackgrounds} 'background' '{'
+ specifications+=FeatureAssociatedExpression*
+ '}'
+;
+
+FeatureLabels:
+ {FeatureLabels} 'label' '{'
+ specifications+=FeatureAssociatedExpression*
+ '}'
+;
+
+WithFeatureAssociatedExpressions:
+ FeatureTexts | FeatureImages | FeatureFonts | FeatureForegrounds | FeatureBackgrounds | FeatureLabels
+;
+
+RowFonts:
+ {RowFonts} 'rowFont' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+RowForegrounds:
+ {RowForegrounds} 'rowForeground' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+RowBackgrounds:
+ {RowBackgrounds} 'rowBackground' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+WithExpressions:
+ RowFonts | RowForegrounds | RowBackgrounds | Menus | EmfMenus |
+ ConfiguratorResourceURI | ConfiguratorEClass |
+ ContentProviderElements | ContentProviderChildren |
+ Texts | Images | Fonts | Foregrounds | Backgrounds
+;
+
/**
* Specify an XExpression associated to an EStructuralFeature
* (actually we associated to the Java get method in the generated code, which
@@ -244,11 +267,7 @@
{FeaturesProvider} 'featuresProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- ((
- 'features' '{'
- featureSpecifications+=FeatureSpecification*
- '}'
- )?)
+ (features=FeatureSpecifications)?
'}'
;
@@ -257,11 +276,13 @@
{TableFeaturesProvider} 'tableFeaturesProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- ((
- 'features' '{'
- featureSpecifications+=FeatureSpecification*
- '}'
- )?)
+ (features=FeatureSpecifications)?
+ '}'
+;
+
+FeatureSpecifications:
+ {FeatureSpecifications} 'features' '{'
+ featureSpecifications+=FeatureSpecification*
'}'
;
@@ -275,11 +296,7 @@
{FormControlFactory} 'formControlFactory' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- (
- 'control' '{'
- controlSpecifications+=ControlFactorySpecification*
- '}'
- )?
+ (controls=ControlFactorySpecifications)?
'}'
;
@@ -287,11 +304,13 @@
{DialogControlFactory} 'dialogControlFactory' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- (
- 'control' '{'
- controlSpecifications+=ControlFactorySpecification*
- '}'
- )?
+ (controls=ControlFactorySpecifications)?
+ '}'
+;
+
+ControlFactorySpecifications:
+ {ControlFactorySpecifications} 'control' '{'
+ specifications+=ControlFactorySpecification*
'}'
;
@@ -314,17 +333,23 @@
{MenuBuilder} 'menuBuilder' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- ((
- 'menus' '{'
- menuSpecifications+=LabelSpecification*
- '}'
- )?
- &
(
- 'emfMenus' '{'
- emfMenuSpecifications+=LabelSpecification*
- '}'
- )?)
+ (menus=Menus)?
+ &
+ (emfMenus=EmfMenus)?
+ )
+ '}'
+;
+
+Menus:
+ {Menus} 'menus' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+EmfMenus:
+ {EmfMenus} 'emfMenus' '{'
+ specifications+=PolymorphicSpecification*
'}'
;
@@ -333,36 +358,34 @@
fields += FieldSpecification*
(
- (
- 'resourceURI' '{'
- resourceURISpecifications+=LabelSpecification*
- '}'
- )?
- &
- (
- 'eClass' '{'
- eClassSpecifications+=LabelSpecification*
- '}'
- )?
+ (resourceURI=ConfiguratorResourceURI)?
+ &
+ (eClassSpec=ConfiguratorEClass)?
)
'}'
;
+ConfiguratorResourceURI:
+ {ConfiguratorResourceURI} 'resourceURI' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+ConfiguratorEClass:
+ {ConfiguratorEClass} 'eClass' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
ViewerContentProvider:
{ViewerContentProvider} 'viewerContentProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- ((
- 'elements' '{'
- elementsSpecifications+=LabelSpecification*
- '}'
- )?
- &
(
- 'children' '{'
- childrenSpecifications+=LabelSpecification*
- '}'
- )?)
+ (elements=ContentProviderElements)?
+ &
+ (children=ContentProviderChildren)?
+ )
'}'
;
@@ -370,11 +393,19 @@
{TableViewerContentProvider} 'tableViewerContentProvider' (extendsClause=ExtendsClause)? '{'
fields += FieldSpecification*
- (
- 'elements' '{'
- elementsSpecifications+=LabelSpecification*
- '}'
- )?
+ (elements=ContentProviderElements)?
+ '}'
+;
+
+ContentProviderChildren:
+ {ContentProviderChildren} 'children' '{'
+ specifications+=PolymorphicSpecification*
+ '}'
+;
+
+ContentProviderElements:
+ {ContentProviderElements} 'elements' '{'
+ specifications+=PolymorphicSpecification*
'}'
;
diff --git a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/GenerateEmfParsleyDsl.mwe2 b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/GenerateEmfParsleyDsl.mwe2
index f66a9c4..cfc5881 100644
--- a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/GenerateEmfParsleyDsl.mwe2
+++ b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/GenerateEmfParsleyDsl.mwe2
@@ -98,7 +98,7 @@
}
// formatter API
- fragment = formatting.FormatterFragment auto-inject {}
+ fragment = formatting2.Formatter2Fragment auto-inject {}
// labeling API
fragment = labeling.LabelProviderFragment auto-inject {}
diff --git a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/formatting/EmfParsleyDslFormatter.xtend b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/formatting/EmfParsleyDslFormatter.xtend
deleted file mode 100644
index 43d9e63..0000000
--- a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/formatting/EmfParsleyDslFormatter.xtend
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Lorenzo Bettini - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.parsley.dsl.formatting
-
-import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter
-import org.eclipse.xtext.formatting.impl.FormattingConfig
-// import com.google.inject.Inject;
-// import org.eclipse.emf.parsley.dsl.services.EmfParsleyDslGrammarAccess
-
-/**
- * This class contains custom formatting description.
- *
- * see : http://www.eclipse.org/Xtext/documentation.html#formatting
- * on how and when to use it
- *
- * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
- */
-class EmfParsleyDslFormatter extends AbstractDeclarativeFormatter {
-
-// @Inject extension EmfParsleyDslGrammarAccess
-
- override protected void configureFormatting(FormattingConfig c) {
-// It's usually a good idea to activate the following three statements.
-// They will add and preserve newlines around comments
-// c.setLinewrap(0, 1, 2).before(SL_COMMENTRule)
-// c.setLinewrap(0, 1, 2).before(ML_COMMENTRule)
-// c.setLinewrap(0, 1, 1).after(ML_COMMENTRule)
- }
-}
diff --git a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/formatting2/EmfParsleyDslFormatter.xtend b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/formatting2/EmfParsleyDslFormatter.xtend
new file mode 100644
index 0000000..b02e6a8
--- /dev/null
+++ b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/formatting2/EmfParsleyDslFormatter.xtend
@@ -0,0 +1,457 @@
+/*******************************************************************************
+ * Copyright (c) 2015 RCP Vision (http://www.rcp-vision.com) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lorenzo Bettini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.parsley.dsl.formatting2;
+
+import com.google.inject.Provider
+import java.util.List
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.emf.parsley.dsl.model.AbstractControlFactory
+import org.eclipse.emf.parsley.dsl.model.AbstractFeatureCaptionProviderWithLabel
+import org.eclipse.emf.parsley.dsl.model.AbstractFeatureProvider
+import org.eclipse.emf.parsley.dsl.model.Binding
+import org.eclipse.emf.parsley.dsl.model.BindingsSpecification
+import org.eclipse.emf.parsley.dsl.model.Configurator
+import org.eclipse.emf.parsley.dsl.model.ControlFactorySpecification
+import org.eclipse.emf.parsley.dsl.model.ExtendsClause
+import org.eclipse.emf.parsley.dsl.model.FeatureAssociatedExpression
+import org.eclipse.emf.parsley.dsl.model.FeatureCaptionProvider
+import org.eclipse.emf.parsley.dsl.model.FeatureSpecification
+import org.eclipse.emf.parsley.dsl.model.FieldSpecification
+import org.eclipse.emf.parsley.dsl.model.LabelProvider
+import org.eclipse.emf.parsley.dsl.model.MenuBuilder
+import org.eclipse.emf.parsley.dsl.model.Model
+import org.eclipse.emf.parsley.dsl.model.Module
+import org.eclipse.emf.parsley.dsl.model.PartsSpecifications
+import org.eclipse.emf.parsley.dsl.model.PolymorphicSpecification
+import org.eclipse.emf.parsley.dsl.model.ProposalCreator
+import org.eclipse.emf.parsley.dsl.model.ProviderBinding
+import org.eclipse.emf.parsley.dsl.model.ResourceManager
+import org.eclipse.emf.parsley.dsl.model.SimpleMethodSpecification
+import org.eclipse.emf.parsley.dsl.model.TableLabelProvider
+import org.eclipse.emf.parsley.dsl.model.TableViewerContentProvider
+import org.eclipse.emf.parsley.dsl.model.TypeBinding
+import org.eclipse.emf.parsley.dsl.model.ValueBinding
+import org.eclipse.emf.parsley.dsl.model.ViewSpecification
+import org.eclipse.emf.parsley.dsl.model.ViewerContentProvider
+import org.eclipse.emf.parsley.dsl.model.WithExpressions
+import org.eclipse.emf.parsley.dsl.model.WithExtendsClause
+import org.eclipse.emf.parsley.dsl.model.WithFeatureAssociatedExpressions
+import org.eclipse.emf.parsley.dsl.model.WithFields
+import org.eclipse.xtext.formatting2.IFormattableDocument
+import org.eclipse.xtext.xbase.annotations.formatting2.XbaseWithAnnotationsFormatter
+import org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation
+
+import static org.eclipse.emf.parsley.dsl.model.ModelPackage.Literals.*
+
+/**
+ * @author Lorenzo Bettini
+ *
+ */
+class EmfParsleyDslFormatter extends XbaseWithAnnotationsFormatter {
+
+ override void format(Object o, IFormattableDocument document) {
+ // we could use dispatch methods, but that will generate many other
+ // if cases for inherited dispatch methods that will never be executed during the
+ // tests and I prefer to have full control on code coverage.
+ if (o instanceof AbstractControlFactory) {
+ _format(o, document);
+ return;
+ } else if (o instanceof AbstractFeatureCaptionProviderWithLabel) {
+ _format(o, document);
+ return;
+ } else if (o instanceof AbstractFeatureProvider) {
+ _format(o, document);
+ return;
+ } else if (o instanceof Configurator) {
+ _format(o, document);
+ return;
+ } else if (o instanceof FeatureCaptionProvider) {
+ _format(o, document);
+ return;
+ } else if (o instanceof LabelProvider) {
+ _format(o, document);
+ return;
+ } else if (o instanceof MenuBuilder) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ProposalCreator) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ResourceManager) {
+ _format(o, document);
+ return;
+ } else if (o instanceof TableLabelProvider) {
+ _format(o, document);
+ return;
+ } else if (o instanceof TableViewerContentProvider) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ViewerContentProvider) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ControlFactorySpecification) {
+ _format(o, document);
+ return;
+ } else if (o instanceof FeatureAssociatedExpression) {
+ _format(o, document);
+ return;
+ } else if (o instanceof FeatureSpecification) {
+ _format(o, document);
+ return;
+ } else if (o instanceof Module) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ProviderBinding) {
+ _format(o, document);
+ return;
+ } else if (o instanceof TypeBinding) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ValueBinding) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ViewSpecification) {
+ _format(o, document);
+ return;
+ } else if (o instanceof BindingsSpecification) {
+ _format(o, document);
+ return;
+ } else if (o instanceof ExtendsClause) {
+ _format(o, document);
+ return;
+ } else if (o instanceof FieldSpecification) {
+ _format(o, document);
+ return;
+ } else if (o instanceof PolymorphicSpecification) {
+ _format(o, document);
+ return;
+ } else if (o instanceof Model) {
+ _format(o, document);
+ return;
+ } else if (o instanceof PartsSpecifications) {
+ _format(o, document);
+ return;
+ } else if (o instanceof SimpleMethodSpecification) {
+ _format(o, document);
+ return;
+ } else {
+ super.format(o, document)
+ }
+ }
+
+ def void _format(Model model, extension IFormattableDocument document) {
+ format(model.getImportSection(), document);
+ format(model.getModule(), document);
+ }
+
+ def void _format(Module module, extension IFormattableDocument document) {
+ indentBlock(module, document) [
+ format(module.getExtendsClause(), document);
+ format(module.getBindingsSpecification(), document);
+ format(module.getLabelProvider(), document);
+ format(module.getTableLabelProvider(), document);
+ format(module.getFeatureCaptionProvider(), document);
+ format(module.getFormFeatureCaptionProvider(), document);
+ format(module.getDialogFeatureCaptionProvider(), document);
+ format(module.getFeaturesProvider(), document);
+ format(module.getTableFeaturesProvider(), document);
+ format(module.getFormControlFactory(), document);
+ format(module.getDialogControlFactory(), document);
+ format(module.getProposalCreator(), document);
+ format(module.getMenuBuilder(), document);
+ format(module.getConfigurator(), document);
+ format(module.getViewerContentProvider(), document);
+ format(module.getTableViewerContentProvider(), document);
+ format(module.getPartsSpecifications(), document);
+ format(module.getResourceManager(), document);
+ ]
+ }
+
+ def void _format(ExtendsClause extendsclause, extension IFormattableDocument document) {
+ format(extendsclause.getSuperType(), document);
+ extendsclause.regionForKeyword("extends").surround[oneSpace]
+ }
+
+ def void _format(BindingsSpecification bindingsspecification, extension IFormattableDocument document) {
+ indentBlock(bindingsspecification, document) [
+ formatAndSeparateElementsWithNewlines(bindingsspecification.bindings, document)
+ ]
+ }
+
+ def void _format(TypeBinding typebinding, extension IFormattableDocument document) {
+ oneSpaceAfterKeyword(typebinding, "type", document)
+ format(typebinding.getTypeToBind(), document);
+ formatBinding(typebinding, document)
+ }
+
+ def void _format(ProviderBinding providerbinding, extension IFormattableDocument document) {
+ oneSpaceAfterKeyword(providerbinding, "provide", document)
+ format(providerbinding.getType(), document);
+ formatBinding(providerbinding, document)
+ }
+
+ def void _format(ValueBinding valuebinding, extension IFormattableDocument document) {
+ oneSpaceAfterKeyword(valuebinding, "value", document)
+ format(valuebinding.getTypeDecl(), document);
+ valuebinding.regionForFeature(VALUE_BINDING__ID).surround[oneSpace]
+ formatBinding(valuebinding, document)
+ }
+
+ def private void formatBinding(Binding binding, extension IFormattableDocument document) {
+ binding.regionForKeyword("->").surround[oneSpace]
+ format(binding.getTo(), document);
+ }
+
+ def void _format(LabelProvider labelprovider, extension IFormattableDocument document) {
+ formatWithFields(labelprovider, document) [
+ formatSpecifications(labelprovider.texts, document)
+ formatSpecifications(labelprovider.images, document)
+ formatSpecifications(labelprovider.fonts, document)
+ formatSpecifications(labelprovider.foregrounds, document)
+ formatSpecifications(labelprovider.backgrounds, document)
+ ]
+ }
+
+ def void _format(FieldSpecification expr, extension IFormattableDocument document) {
+ for (XAnnotation annotations : expr.getAnnotations()) {
+ format(annotations, document);
+ }
+ expr.regionForKeyword("val").append[oneSpace]
+ expr.regionForKeyword("var").append[oneSpace]
+ expr.regionForKeyword("extension").append[oneSpace]
+ expr.type.append[oneSpace]
+ expr.regionForKeyword("=").surround[oneSpace]
+ expr.type.format(document)
+ expr.right.format(document)
+ expr.regionForKeyword(";").prepend[noSpace]
+ }
+
+ def void _format(TableLabelProvider tablelabelprovider, extension IFormattableDocument document) {
+ formatWithFields(tablelabelprovider, document) [
+ formatFeatureSpecifications(tablelabelprovider.featureTexts, document)
+ formatFeatureSpecifications(tablelabelprovider.featureImages, document)
+ formatFeatureSpecifications(tablelabelprovider.featureFonts, document)
+ formatFeatureSpecifications(tablelabelprovider.featureForegrounds, document)
+ formatFeatureSpecifications(tablelabelprovider.featureBackgrounds, document)
+ formatSpecifications(tablelabelprovider.rowFonts, document)
+ formatSpecifications(tablelabelprovider.rowForegrounds, document)
+ formatSpecifications(tablelabelprovider.rowBackgrounds, document)
+ ]
+ }
+
+ def void _format(PolymorphicSpecification specification, extension IFormattableDocument document) {
+ format(specification.getParameterType(), document);
+ specification.regionForKeyword("->").surround[oneSpace]
+ format(specification.getExpression(), document);
+ }
+
+ def void _format(FeatureCaptionProvider featurecaptionprovider, extension IFormattableDocument document) {
+ formatWithFields(featurecaptionprovider, document) [
+ indentBlockAndFormatAndSeparateElementsWithNewlines(featurecaptionprovider.featureTexts, document) [
+ featurecaptionprovider.featureTexts.specifications
+ ]
+ ]
+ }
+
+ def void _format(AbstractFeatureCaptionProviderWithLabel featurecaptionprovider,
+ extension IFormattableDocument document) {
+ formatWithFields(featurecaptionprovider, document) [
+ formatFeatureSpecifications(featurecaptionprovider.featureTexts, document)
+ formatFeatureSpecifications(featurecaptionprovider.featureLabels, document)
+ ]
+ }
+
+ def void _format(FeatureAssociatedExpression featureassociatedexpression,
+ extension IFormattableDocument document) {
+ format(featureassociatedexpression.getParameterType(), document);
+ featureassociatedexpression.regionForKeyword(":").surround[oneSpace]
+ featureassociatedexpression.regionForKeyword("->").surround[oneSpace]
+ format(featureassociatedexpression.getExpression(), document);
+ }
+
+ def void _format(AbstractFeatureProvider featuresprovider, extension IFormattableDocument document) {
+ formatWithFields(featuresprovider, document) [
+ indentBlockAndFormatAndSeparateElementsWithNewlines(featuresprovider.features, document) [
+ featuresprovider.features.featureSpecifications
+ ]
+ ]
+ }
+
+ def void _format(FeatureSpecification featurespecification, extension IFormattableDocument document) {
+ format(featurespecification.getParameterType(), document);
+ featurespecification.regionForKeyword("->").surround[oneSpace]
+ for (comma : featurespecification.regionsForKeywords(",")) {
+ comma.prepend[noSpace].append[oneSpace]
+ }
+ }
+
+ def void _format(AbstractControlFactory controlfactory, extension IFormattableDocument document) {
+ formatWithFields(controlfactory, document) [
+ indentBlockAndFormatAndSeparateElementsWithNewlines(controlfactory.controls, document) [
+ controlfactory.controls.specifications
+ ]
+ ]
+ }
+
+ def void _format(ControlFactorySpecification controlfactoryspecification,
+ extension IFormattableDocument document) {
+ format(controlfactoryspecification.getParameterType(), document);
+ controlfactoryspecification.regionForKeyword(":").surround[oneSpace]
+ controlfactoryspecification.regionForKeyword("->").surround[oneSpace]
+ format(controlfactoryspecification.getExpression(), document);
+ controlfactoryspecification.regionForKeyword("target").surround[oneSpace]
+ format(controlfactoryspecification.getTarget(), document);
+ }
+
+ def void _format(ProposalCreator proposalcreator, extension IFormattableDocument document) {
+ formatWithFields(proposalcreator, document) [
+ formatAndSeparateElementsWithNewlines(proposalcreator.proposalsSpecifications, document)
+ ]
+ }
+
+ def void _format(MenuBuilder menubuilder, extension IFormattableDocument document) {
+ formatWithFields(menubuilder, document) [
+ formatSpecifications(menubuilder.menus, document)
+ formatSpecifications(menubuilder.emfMenus, document)
+ ]
+ }
+
+ def void _format(Configurator configurator, extension IFormattableDocument document) {
+ formatWithFields(configurator, document) [
+ formatSpecifications(configurator.resourceURI, document)
+ formatSpecifications(configurator.EClassSpec, document)
+ ]
+ }
+
+ def void _format(ViewerContentProvider viewercontentprovider, extension IFormattableDocument document) {
+ formatWithFields(viewercontentprovider, document) [
+ formatSpecifications(viewercontentprovider.elements, document)
+ formatSpecifications(viewercontentprovider.children, document)
+ ]
+ }
+
+ def void _format(TableViewerContentProvider tableviewercontentprovider,
+ extension IFormattableDocument document) {
+ formatWithFields(tableviewercontentprovider, document) [
+ formatSpecifications(tableviewercontentprovider.elements, document)
+ ]
+ }
+
+ def void _format(ResourceManager resourcemanager, extension IFormattableDocument document) {
+ formatWithFields(resourcemanager, document) [
+ format(resourcemanager.getInitializeBody(), document);
+ format(resourcemanager.getSaveBody(), document);
+ ]
+ }
+
+ def void _format(SimpleMethodSpecification simplemethodspecification, extension IFormattableDocument document) {
+ formatAndSeparateWithNewlines(simplemethodspecification.body, document)
+ }
+
+ def void _format(PartsSpecifications partsspecifications, extension IFormattableDocument document) {
+ indentBlock(partsspecifications, document) [
+ formatAndSeparateElementsWithNewlines(partsspecifications.parts, document)
+ ]
+ }
+
+ def void _format(ViewSpecification viewspecification, extension IFormattableDocument document) {
+ indentBlock(viewspecification, document) [
+ viewspecification.regionForKeyword("viewpart").append[oneSpace]
+
+ viewspecification.regionForKeyword("viewname").append[oneSpace]
+ viewspecification.regionForFeature(VIEW_SPECIFICATION__VIEW_NAME).append[setNewLines(1, 1, 2)]
+
+ viewspecification.regionForKeyword("viewclass").append[oneSpace]
+ format(viewspecification.type, document);
+ viewspecification.type.append[setNewLines(1, 1, 2)]
+
+ if (viewspecification.category != null) {
+ viewspecification.regionForKeyword("viewcategory").append[oneSpace]
+ viewspecification.regionForFeature(VIEW_SPECIFICATION__CATEGORY).append[setNewLines(1, 1, 2)]
+ }
+ ]
+ }
+
+ def private formatWithFields(WithFields e, extension IFormattableDocument document,
+ (WithFields)=>void elementsFormatter) {
+ formatWithExtendsClause(e, document) [
+ formatFields(e, document)
+ elementsFormatter.apply(e)
+ ]
+ }
+
+ def private formatWithExtendsClause(WithExtendsClause e, extension IFormattableDocument document,
+ (WithExtendsClause)=>void elementsFormatter) {
+ format(e.getExtendsClause(), document);
+ indentBlock(e, document) [
+ elementsFormatter.apply(e)
+ ]
+ e.separateElementsWithNewlines(document)
+ }
+
+ def private formatFields(WithFields withFields, extension IFormattableDocument document) {
+ formatAndSeparateElementsWithNewlines(withFields.fields, document)
+ }
+
+
+ def private <T extends EObject> formatSpecifications(WithExpressions e, extension IFormattableDocument document) {
+ indentBlockAndFormatAndSeparateElementsWithNewlines(e, document) [
+ e.specifications
+ ]
+ }
+
+ def private <T extends EObject> formatFeatureSpecifications(WithFeatureAssociatedExpressions e, extension IFormattableDocument document) {
+ indentBlockAndFormatAndSeparateElementsWithNewlines(e, document) [
+ e.specifications
+ ]
+ }
+
+ /**
+ * The elementsProvider is invoked only if the passed parent is not null
+ */
+ def private <T extends EObject> indentBlockAndFormatAndSeparateElementsWithNewlines(EObject parent,
+ extension IFormattableDocument document, Provider<List<? extends T>> elementsProvider) {
+ if (parent != null) {
+ val list = elementsProvider.get
+ indentBlock(parent, document) [
+ formatAndSeparateElementsWithNewlines(list, document)
+ ]
+ separateElementsWithNewlines(parent, document)
+ }
+ }
+
+ def private <T extends EObject> formatAndSeparateElementsWithNewlines(List<? extends T> elements, extension IFormattableDocument document) {
+ for (e : elements) {
+ formatAndSeparateWithNewlines(e, document)
+ }
+ }
+
+ private def <T extends EObject> formatAndSeparateWithNewlines(T e, IFormattableDocument document) {
+ format(e, document)
+ separateElementsWithNewlines(e, document)
+ }
+
+ def private <T extends EObject> oneSpaceAfterKeyword(T element, String k, extension IFormattableDocument document) {
+ element.regionForKeyword(k).append[oneSpace]
+ }
+
+ def private <T extends EObject> separateElementsWithNewlines(T element, extension IFormattableDocument document) {
+ element.append[setNewLines(1, 1, 2)]
+ }
+
+ def private <T extends EObject> indentBlock(T element, extension IFormattableDocument document,
+ (T)=>void elementsFormatter) {
+ element.regionForKeyword("{").append[newLine; increaseIndentation]
+ elementsFormatter.apply(element)
+ element.regionForKeyword("}").prepend[decreaseIndentation]
+ }
+}
+
diff --git a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/jvmmodel/EmfParsleyDslJvmModelInferrer.xtend b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/jvmmodel/EmfParsleyDslJvmModelInferrer.xtend
index ad6a267..2b0d87f 100644
--- a/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/jvmmodel/EmfParsleyDslJvmModelInferrer.xtend
+++ b/dsl/org.eclipse.emf.parsley.dsl/src/org/eclipse/emf/parsley/dsl/jvmmodel/EmfParsleyDslJvmModelInferrer.xtend
@@ -32,15 +32,21 @@
import org.eclipse.emf.parsley.dsl.model.AbstractFeatureCaptionProviderWithLabel
import org.eclipse.emf.parsley.dsl.model.AbstractFeatureProvider
import org.eclipse.emf.parsley.dsl.model.BindingsSpecification
+import org.eclipse.emf.parsley.dsl.model.ContentProviderChildren
+import org.eclipse.emf.parsley.dsl.model.ContentProviderElements
import org.eclipse.emf.parsley.dsl.model.ControlFactorySpecification
import org.eclipse.emf.parsley.dsl.model.FeatureAssociatedExpression
-import org.eclipse.emf.parsley.dsl.model.LabelSpecification
+import org.eclipse.emf.parsley.dsl.model.FeatureLabels
+import org.eclipse.emf.parsley.dsl.model.FeatureTexts
import org.eclipse.emf.parsley.dsl.model.Module
+import org.eclipse.emf.parsley.dsl.model.PolymorphicSpecification
import org.eclipse.emf.parsley.dsl.model.ProviderBinding
import org.eclipse.emf.parsley.dsl.model.SimpleMethodSpecification
import org.eclipse.emf.parsley.dsl.model.TypeBinding
import org.eclipse.emf.parsley.dsl.model.ValueBinding
+import org.eclipse.emf.parsley.dsl.model.WithExpressions
import org.eclipse.emf.parsley.dsl.model.WithExtendsClause
+import org.eclipse.emf.parsley.dsl.model.WithFeatureAssociatedExpressions
import org.eclipse.emf.parsley.dsl.model.WithFields
import org.eclipse.emf.parsley.dsl.typing.EmfParsleyDslTypeSystem
import org.eclipse.emf.parsley.edit.action.EditingMenuBuilder
@@ -58,6 +64,8 @@
import org.eclipse.emf.parsley.ui.provider.ViewerLabelProvider
import org.eclipse.jface.viewers.IContentProvider
import org.eclipse.jface.viewers.ILabelProvider
+import org.eclipse.swt.graphics.Color
+import org.eclipse.swt.graphics.Font
import org.eclipse.swt.widgets.Composite
import org.eclipse.swt.widgets.Control
import org.eclipse.swt.widgets.Label
@@ -77,8 +85,6 @@
import org.eclipse.xtext.xbase.jvmmodel.AbstractModelInferrer
import org.eclipse.xtext.xbase.jvmmodel.IJvmDeclaredTypeAcceptor
import org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder
-import org.eclipse.swt.graphics.Font
-import org.eclipse.swt.graphics.Color
/**
* <p>Infers a JVM model from the source model.</p>
@@ -88,17 +94,17 @@
*/
class EmfParsleyDslJvmModelInferrer extends AbstractModelInferrer {
- /**
- * convenience API to build and initialize JVM types and their members.
- */
+ /**
+ * convenience API to build and initialize JVM types and their members.
+ */
@Inject extension JvmTypesBuilder
-
+
@Inject extension IQualifiedNameProvider
-
+
@Inject extension TypeReferences
-
+
@Inject extension TypesFactory
-
+
@Inject extension EmfParsleyDslGeneratorUtils
@Inject extension EmfParsleyDslTypeSystem
@@ -126,12 +132,12 @@
* rely on linking using the index if isPreIndexingPhase is
* <code>true</code>.
*/
- def dispatch void infer(Module element, IJvmDeclaredTypeAcceptor acceptor, boolean isPreIndexingPhase) {
- if (element.name.empty)
- return
-
+ def dispatch void infer(Module element, IJvmDeclaredTypeAcceptor acceptor, boolean isPreIndexingPhase) {
+ if (element.name.empty)
+ return
+
val moduleClass = element.toClass(element.moduleQN)
-
+
val labelProviderClass = element.inferLabelProvider(acceptor)
val tableLabelProviderClass = element.inferTableLabelProvider(acceptor)
val featureCaptionProviderClass = element.inferFeatureCaptionProvider(acceptor)
@@ -204,8 +210,8 @@
members += element.resourceManager.genBindMethod(resourceManagerClass, typeof(ResourceManager))
]
- }
-
+ }
+
def private setSuperClassType(JvmGenericType e, WithExtendsClause dslElement, Class<?> defaultSuperClass) {
if (dslElement.extendsClause != null)
e.superTypes += dslElement.extendsClause.superType.cloneWithProxies
@@ -235,7 +241,6 @@
members += field
-
members += f.toGetter(name, type)
if (f.writeable) {
members += f.toSetter(name, type)
@@ -246,19 +251,19 @@
def private void translateAnnotations(JvmAnnotationTarget target, List<XAnnotation> annotations) {
target.addAnnotations(annotations.filterNull.filter[annotationType != null])
}
-
- def private moduleQN(Module element) {
- element.fullyQualifiedName + ".EmfParsleyGuiceModuleGen"
- }
+
+ def private moduleQN(Module element) {
+ element.fullyQualifiedName + ".EmfParsleyGuiceModuleGen"
+ }
def private labelProviderQN(Module element) {
element.fullyQualifiedName + ".ui.provider.LabelProviderGen"
}
-
+
def private tableLabelProviderQN(Module element) {
element.fullyQualifiedName + ".ui.provider.TableLabelProviderGen"
}
-
+
def private featureCaptionProviderQN(Module element) {
element.fullyQualifiedName + ".ui.provider.FeatureCaptionProviderGen"
}
@@ -322,32 +327,18 @@
members += labelProvider.toConstructor() [
parameters += labelProvider.
- toParameter("delegate",
+ toParameter("delegate",
typeRef(AdapterFactoryLabelProvider)
)
body = [it.append("super(delegate);")]
annotations += annotationRef(Inject)
]
- for (labelSpecification : labelProvider.labelSpecifications) {
- members += labelSpecification.specificationToMethod("text", typeRef(String))
- }
-
- for (imageSpecification : labelProvider.imageSpecifications) {
- members += imageSpecification.specificationToMethod("image", typeRef(Object))
- }
-
- for (fontSpecification : labelProvider.fontSpecifications) {
- members += fontSpecification.specificationToMethod("font", typeRef(Font))
- }
-
- for (foregroundSpecification : labelProvider.foregroundSpecifications) {
- members += foregroundSpecification.specificationToMethod("foreground", typeRef(Color))
- }
-
- for (backgroundSpecification : labelProvider.backgroundSpecifications) {
- members += backgroundSpecification.specificationToMethod("background", typeRef(Color))
- }
+ specificationsToMethods(labelProvider.texts, "text", typeRef(String))
+ specificationsToMethods(labelProvider.images, "image", typeRef(Object))
+ specificationsToMethods(labelProvider.fonts, "font", typeRef(Font))
+ specificationsToMethods(labelProvider.foregrounds, "foreground", typeRef(Color))
+ specificationsToMethods(labelProvider.backgrounds, "background", typeRef(Color))
]
labelProviderClass
}
@@ -362,27 +353,15 @@
acceptor.accept(tableLabelProviderClass) [
setSuperClassTypeAndFields(tableLabelProvider, typeof(TableColumnLabelProvider))
- inferMethodsForFeatureAssociatedExpression(tableLabelProvider.labelSpecifications, "text_", typeRef(String), parameterCreatorForFeatureAssociatedExpression)
+ inferMethodsForFeatureAssociatedExpression(tableLabelProvider.featureTexts, "text_", typeRef(String), parameterCreatorForFeatureAssociatedExpression)
+ inferMethodsForFeatureAssociatedExpression(tableLabelProvider.featureImages, "image_", typeRef(Object), parameterCreatorForFeatureAssociatedExpression)
+ inferMethodsForFeatureAssociatedExpression(tableLabelProvider.featureFonts, "font_", typeRef(Font), parameterCreatorForFeatureAssociatedExpression)
+ inferMethodsForFeatureAssociatedExpression(tableLabelProvider.featureForegrounds, "foreground_", typeRef(Color), parameterCreatorForFeatureAssociatedExpression)
+ inferMethodsForFeatureAssociatedExpression(tableLabelProvider.featureBackgrounds, "background_", typeRef(Color), parameterCreatorForFeatureAssociatedExpression)
- inferMethodsForFeatureAssociatedExpression(tableLabelProvider.imageSpecifications, "image_", typeRef(Object), parameterCreatorForFeatureAssociatedExpression)
-
- inferMethodsForFeatureAssociatedExpression(tableLabelProvider.fontSpecifications, "font_", typeRef(Font), parameterCreatorForFeatureAssociatedExpression)
-
- inferMethodsForFeatureAssociatedExpression(tableLabelProvider.foregroundSpecifications, "foreground_", typeRef(Color), parameterCreatorForFeatureAssociatedExpression)
-
- inferMethodsForFeatureAssociatedExpression(tableLabelProvider.backgroundSpecifications, "background_", typeRef(Color), parameterCreatorForFeatureAssociatedExpression)
-
- for (fontSpecification : tableLabelProvider.rowFontSpecifications) {
- members += fontSpecification.specificationToMethod("rowFont", typeRef(Font))
- }
-
- for (foregroundSpecification : tableLabelProvider.rowForegroundSpecifications) {
- members += foregroundSpecification.specificationToMethod("rowForeground", typeRef(Color))
- }
-
- for (backgroundSpecification : tableLabelProvider.rowBackgroundSpecifications) {
- members += backgroundSpecification.specificationToMethod("rowBackground", typeRef(Color))
- }
+ specificationsToMethods(tableLabelProvider.rowFonts, "rowFont", typeRef(Font))
+ specificationsToMethods(tableLabelProvider.rowForegrounds, "rowForeground", typeRef(Color))
+ specificationsToMethods(tableLabelProvider.rowBackgrounds, "rowBackground", typeRef(Color))
]
tableLabelProviderClass
}
@@ -397,7 +376,7 @@
acceptor.accept(propertyDescriptionProviderClass) [
setSuperClassTypeAndFields(featureCaptionProvider, typeof(FeatureCaptionProvider))
- inferMethodsForTextCaptionSpecifications(element, it, featureCaptionProvider.specifications)
+ inferMethodsForTextCaptionSpecifications(featureCaptionProvider.featureTexts)
]
propertyDescriptionProviderClass
}
@@ -421,9 +400,9 @@
acceptor.accept(descriptionProviderClass) [
setSuperClassTypeAndFields(element, superClass)
- inferMethodsForTextCaptionSpecifications(element, it, element.specifications)
+ inferMethodsForTextCaptionSpecifications(element.featureTexts)
- inferMethodsForLabelCaptionSpecifications(element, it, element.labelSpecifications)
+ inferMethodsForLabelCaptionSpecifications(element.featureLabels)
]
descriptionProviderClass
}
@@ -438,9 +417,9 @@
]
}
- def private inferMethodsForTextCaptionSpecifications(EObject element, JvmGenericType it, Iterable<FeatureAssociatedExpression> specifications) {
+ def private inferMethodsForTextCaptionSpecifications(JvmGenericType it, FeatureTexts texts) {
inferMethodsForFeatureAssociatedExpression(
- it, specifications, "text_", typeRef(String)
+ it, texts, "text_", typeRef(String)
) [
it, spec |
parameters += spec.toParameter(
@@ -449,9 +428,9 @@
]
}
- def private inferMethodsForLabelCaptionSpecifications(EObject element, JvmGenericType it, Iterable<FeatureAssociatedExpression> specifications) {
+ def private inferMethodsForLabelCaptionSpecifications(JvmGenericType it, FeatureLabels labels) {
inferMethodsForFeatureAssociatedExpression(
- it, specifications, "label_", typeRef(Label)
+ it, labels, "label_", typeRef(Label)
) [
it, spec |
parameters += spec.toParameter(
@@ -463,21 +442,23 @@
]
}
- def private inferMethodsForFeatureAssociatedExpression(JvmGenericType it, Iterable<FeatureAssociatedExpression> specifications,
+ def private inferMethodsForFeatureAssociatedExpression(JvmGenericType it, WithFeatureAssociatedExpressions withFeatureAssociatedExpressions,
String prefix, JvmTypeReference returnType, (JvmOperation, FeatureAssociatedExpression) => void parameterCreator
) {
- for (spec : specifications) {
- featureAssociatedExpressionToMethod(spec, prefix, returnType, parameterCreator)
- }
+ nullSafeAccess(withFeatureAssociatedExpressions) [
+ for (spec : withFeatureAssociatedExpressions.specifications) {
+ featureAssociatedExpressionToMethod(spec, prefix, returnType, parameterCreator)
+ }
+ ]
}
- def private featureAssociatedExpressionToMethod(JvmGenericType it, FeatureAssociatedExpression spec,
+ def private featureAssociatedExpressionToMethod(JvmGenericType it, FeatureAssociatedExpression spec,
String prefix, JvmTypeReference returnType, (JvmOperation, FeatureAssociatedExpression) => void parameterCreator) {
if (spec.feature?.simpleName != null) {
members += spec.toMethod
(prefix +
spec.parameterType.simpleName + "_" +
- spec.feature.simpleName.propertyNameForGetterSetterMethod,
+ spec.feature.simpleName.propertyNameForGetterSetterMethod,
returnType
) [
parameterCreator.apply(it, spec)
@@ -505,26 +486,29 @@
setSuperClassTypeAndFields(element, superClass)
documentation = element.documentation
- members += element.
- toMethod("buildStringMap", Void::TYPE.getTypeForName(element)) [
- addOverrideAnnotation
- parameters += element.toParameter("stringMap",
+ members += element.toMethod("buildStringMap", Void::TYPE.getTypeForName(element)) [
+ m |
+ m.addOverrideAnnotation
+ m.parameters += element.toParameter("stringMap",
typeRef(EClassToEStructuralFeatureAsStringsMap)
)
- body = [
- append("super.buildStringMap(stringMap);").newLine
- for (featureSpecification : element.featureSpecifications) {
- newLine.
- append('''stringMap.mapTo("«featureSpecification.parameterType.identifier»",''').
- increaseIndentation.newLine
- val fs = featureSpecification.features.map [
- feature |
- '"' + feature.simpleName.propertyNameForGetterSetterMethod
- + '"'
- ]
- append(fs.join(", "))
- append(");").decreaseIndentation
- }
+ m.body = [
+ a |
+ a.append("super.buildStringMap(stringMap);").newLine
+ nullSafeAccess(element.features) [
+ for (featureSpecification : element.features.featureSpecifications) {
+ a.newLine.
+ append('''stringMap.mapTo("«featureSpecification.parameterType.identifier»",''').
+ increaseIndentation.newLine
+ val fs = featureSpecification.features.map [
+ feature |
+ '"' + feature.simpleName.propertyNameForGetterSetterMethod
+ + '"'
+ ]
+ a.append(fs.join(", "))
+ a.append(");").decreaseIndentation
+ }
+ ]
]
]
]
@@ -550,7 +534,9 @@
documentation = e.documentation
- inferMethodsForControlFactory(e, it, e.controlSpecifications)
+ nullSafeAccess(e.controls) [
+ inferMethodsForControlFactory(e, it, e.controls.specifications)
+ ]
]
controlFactoryClass
}
@@ -623,13 +609,9 @@
members += toConstructorWithInjectedAdapterFactory(viewerContentProvider)
- for (specification : viewerContentProvider.elementsSpecifications) {
- members += specification.specificationToMethod("elements", typeRef(Object))
- }
+ inferContentProviderElements(viewerContentProvider.elements)
- for (specification : viewerContentProvider.childrenSpecifications) {
- members += specification.specificationToMethod("children", typeRef(Object))
- }
+ inferContentProviderChildren(viewerContentProvider.children)
]
viewerContentProviderClass
}
@@ -646,18 +628,30 @@
members += toConstructorWithInjectedAdapterFactory(viewerContentProvider)
- for (specification : viewerContentProvider.elementsSpecifications) {
- members += specification.specificationToMethod("elements", typeRef(Object))
- }
+ inferContentProviderElements(viewerContentProvider.elements)
]
viewerContentProviderClass
}
}
+ def private inferContentProviderElements(JvmGenericType it, ContentProviderElements elements) {
+ specificationsToMethods(elements, "elements", typeRef(Object))
+ }
+
+ def private inferContentProviderChildren(JvmGenericType it, ContentProviderChildren children) {
+ specificationsToMethods(children, "children", typeRef(Object))
+ }
+
+ def private <T> nullSafeAccess(JvmGenericType it, T parent, (JvmGenericType)=>void acceptor) {
+ if (parent != null) {
+ acceptor.apply(it)
+ }
+ }
+
private def toConstructorWithInjectedAdapterFactory(EObject e) {
e.toConstructor() [
parameters += e.
- toParameter("adapterFactory",
+ toParameter("adapterFactory",
typeRef(AdapterFactory)
)
body = [it.append("super(adapterFactory);")]
@@ -701,13 +695,8 @@
val returnType = typeRef(List, typeRef(IMenuContributionSpecification))
- for (specification : menuBuilder.menuSpecifications) {
- members += specification.specificationToMethod("menuContributions", returnType)
- }
-
- for (specification : menuBuilder.emfMenuSpecifications) {
- members += specification.specificationToMethod("emfMenuContributions", returnType)
- }
+ specificationsToMethods(menuBuilder.menus, "menuContributions", returnType)
+ specificationsToMethods(menuBuilder.emfMenus, "emfMenuContributions", returnType)
]
menuBuilderClass
}
@@ -722,13 +711,8 @@
acceptor.accept(configuratorClass) [
setSuperClassTypeAndFields(configurator, Configurator)
- for (specification : configurator.resourceURISpecifications) {
- members += specification.specificationToMethod("resourceURI", typeRef(URI))
- }
-
- for (specification : configurator.EClassSpecifications) {
- members += specification.specificationToMethod("eClass", typeRef(EClass))
- }
+ specificationsToMethods(configurator.resourceURI, "resourceURI", typeRef(URI))
+ specificationsToMethods(configurator.EClassSpec, "eClass", typeRef(EClass))
]
configuratorClass
}
@@ -769,14 +753,22 @@
}
}
- def private specificationToMethod(LabelSpecification specification, String methodName, JvmTypeReference returnType) {
+ def private specificationsToMethods(JvmGenericType it, WithExpressions e, String methodName, JvmTypeReference returnType) {
+ nullSafeAccess(e) [
+ for (specification : e.specifications) {
+ members += specificationToMethod(specification, methodName, returnType)
+ }
+ ]
+ }
+
+ def private specificationToMethod(PolymorphicSpecification specification, String methodName, JvmTypeReference returnType) {
specification.toMethod(methodName, returnType) [
parameters += specification.specificationParameter
body = specification.expression
]
}
- def private specificationParameter(LabelSpecification specification) {
+ def private specificationParameter(PolymorphicSpecification specification) {
specification.toParameter(
if (specification.name != null)
specification.name
@@ -790,7 +782,7 @@
ControlFactorySpecification spec, (JvmOperation)=>void init
) {
spec.toMethod
- (spec.methodNameForFormFeatureSpecification("control_"),
+ (spec.methodNameForFormFeatureSpecification("control_"),
typeRef(Control)
, init)
}
diff --git a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/composite/AbstractMasterDetailComposite.java b/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/composite/AbstractMasterDetailComposite.java
index c954cd3..16253fc 100644
--- a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/composite/AbstractMasterDetailComposite.java
+++ b/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/composite/AbstractMasterDetailComposite.java
@@ -52,8 +52,6 @@
private final StructuredViewer viewer;
- private final Composite masterComposite;
-
private final Composite detailComposite;
private FormDetailComposite detailForm;
@@ -69,7 +67,7 @@
setLayout( new FillLayout());
sashForm = new SashForm(this, sashStyle);
- masterComposite = new Composite(sashForm, SWT.NONE);
+ Composite masterComposite = new Composite(sashForm, SWT.NONE);
masterComposite.setLayout( new FillLayout());
detailComposite = new Composite(sashForm, SWT.NONE);
diff --git a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/edit/EditingDomainFinder.java b/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/edit/EditingDomainFinder.java
index 850ec84..3413745 100644
--- a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/edit/EditingDomainFinder.java
+++ b/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/edit/EditingDomainFinder.java
@@ -11,20 +11,31 @@
package org.eclipse.emf.parsley.edit;
-import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
/**
- * Retrieves the EditingDomain for an EObject. The default implementation simply
- * uses {@link AdapterFactoryEditingDomain#getEditingDomainFor(EObject)}.
+ * Retrieves the EditingDomain for an Object. The default implementation simply
+ * uses {@link AdapterFactoryEditingDomain#getEditingDomainFor(Object)} and also
+ * considers the case for {@link Resource}.
*
* @author Lorenzo Bettini
*
*/
public class EditingDomainFinder {
- public EditingDomain getEditingDomainFor(EObject object) {
- return AdapterFactoryEditingDomain.getEditingDomainFor(object);
+ public EditingDomain getEditingDomainFor(Object object) {
+ final EditingDomain editingDomainFor = AdapterFactoryEditingDomain.getEditingDomainFor(object);
+ if (editingDomainFor == null && object instanceof Resource) {
+ final Resource resource = (Resource) object;
+ ResourceSet resourceSet = resource.getResourceSet();
+ if (resourceSet instanceof IEditingDomainProvider) {
+ return ((IEditingDomainProvider) resourceSet).getEditingDomain();
+ }
+ }
+ return editingDomainFor;
}
}
diff --git a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/listeners/NoOpMouseAdapter.java b/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/listeners/NoOpMouseAdapter.java
deleted file mode 100644
index f6fc29d..0000000
--- a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/listeners/NoOpMouseAdapter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Lorenzo Bettini - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.parsley.listeners;
-
-import org.eclipse.swt.events.MouseEvent;
-
-/**
- * This implementation does nothing upon mouse events.
- *
- * @author Lorenzo Bettini - Initial contribution and API
- *
- */
-public class NoOpMouseAdapter implements IEditorMouseListener {
- @Override
- public void mouseDoubleClick(MouseEvent event) {
- // the default implementation does nothing
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- // the default implementation does nothing
- }
-
- @Override
- public void mouseUp(MouseEvent e) {
- // the default implementation does nothing
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/util/EmfParsleyUtil.java b/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/util/EmfParsleyUtil.java
index 7df35c5..100b5d0 100644
--- a/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/util/EmfParsleyUtil.java
+++ b/plugins/org.eclipse.emf.parsley.common/src/org/eclipse/emf/parsley/util/EmfParsleyUtil.java
@@ -23,11 +23,11 @@
*
*/
public class EmfParsleyUtil {
-
+
protected EmfParsleyUtil() {
}
-
+
/**
* Given the passed object it ensures that it is a {@link Collection}; if it
* is not, it returns a singleton {@link Collection}; if it is null it
@@ -36,11 +36,15 @@
* @param contents
* @return
*/
- @SuppressWarnings("unchecked")
public static Collection<Object> ensureCollection(Object contents) {
if (contents == null) {
return Collections.emptyList();
}
+ return ensureCollectionInternal(contents);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Collection<Object> ensureCollectionInternal(Object contents) {
if (contents instanceof Collection<?>) {
return (Collection<Object>) contents;
} else if (contents instanceof Iterable<?>) {
@@ -49,13 +53,13 @@
return Lists.newArrayList((Iterator<?>) contents);
} else if (contents.getClass().isArray()) {
return Arrays.asList((Object[]) contents);
- } else {
- return Collections.singleton(contents);
}
+ return Collections.singleton(contents);
}
/**
* Given a List of Integer it returns an array of int
+ *
* @param intList
* @return
*/
diff --git a/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/editors/EmfAbstractEditor.java b/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/editors/EmfAbstractEditor.java
index ef63b06..c0c87f7 100644
--- a/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/editors/EmfAbstractEditor.java
+++ b/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/editors/EmfAbstractEditor.java
@@ -35,7 +35,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.CommonPlugin;
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.notify.AdapterFactory;
@@ -54,7 +53,6 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.impl.GenericXMLResourceFactoryImpl;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
@@ -67,6 +65,8 @@
import org.eclipse.emf.parsley.edit.ui.dnd.ViewerDragAndDropHelper;
import org.eclipse.emf.parsley.editors.listeners.ResourceDeltaVisitor;
import org.eclipse.emf.parsley.handlers.OutlineSelectionHandler;
+import org.eclipse.emf.parsley.internal.editors.listeners.PartListenerAdapter;
+import org.eclipse.emf.parsley.internal.editors.util.ProblemIndicationEContentAdapter;
import org.eclipse.emf.parsley.listeners.AsyncCommandStackListenerClient;
import org.eclipse.emf.parsley.listeners.AsyncCommandStackListenerHelper;
import org.eclipse.emf.parsley.listeners.IEditorMouseListener;
@@ -119,26 +119,6 @@
public abstract class EmfAbstractEditor extends MultiPageEditorPart implements
IEditingDomainProvider, ISelectionProvider, IMenuListener,
IViewerProvider, IGotoMarker, AsyncCommandStackListenerClient {
- public abstract static class XML extends EmfAbstractEditor {
- public XML() {
- try {
- editingDomain.getResourceSet().getResourceFactoryRegistry()
- .getExtensionToFactoryMap()
- .put("*", new GenericXMLResourceFactoryImpl());
-
- Class<?> theItemProviderClass = CommonPlugin
- .loadClass("org.eclipse.xsd.edit",
- "org.eclipse.xsd.provider.XSDItemProviderAdapterFactory");
- AdapterFactory xsdItemProviderAdapterFactory = (AdapterFactory) theItemProviderClass
- .newInstance();
- adapterFactory
- .insertAdapterFactory(xsdItemProviderAdapterFactory);
- } catch (Exception exception) {
- EcoreEditorPlugin.INSTANCE.log(exception);
- }
- }
-
- }
/**
* This is the one adapter factory used for providing views of the model.
@@ -215,46 +195,24 @@
* This listens for when the outline becomes active <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
- protected IPartListener partListener = new IPartListener() {
+ protected IPartListener partListener = new PartListenerAdapter() {
@Override
public void partActivated(IWorkbenchPart p) {
if (p instanceof ContentOutline) {
if (((ContentOutline) p).getCurrentPage() == contentOutlinePage) {
- getActionBarContributor().setActiveEditor(
- EmfAbstractEditor.this);
+ getActionBarContributor().setActiveEditor(EmfAbstractEditor.this);
}
} else if (p instanceof PropertySheet) {
if (((PropertySheet) p).getCurrentPage() == propertySheetPage) {
- getActionBarContributor().setActiveEditor(
- EmfAbstractEditor.this);
+ getActionBarContributor().setActiveEditor(EmfAbstractEditor.this);
handleActivate();
}
} else if (p == EmfAbstractEditor.this) {
handleActivate();
}
}
-
- @Override
- public void partBroughtToTop(IWorkbenchPart p) {
- // Ignore.
- }
-
- @Override
- public void partClosed(IWorkbenchPart p) {
- // Ignore.
- }
-
- @Override
- public void partDeactivated(IWorkbenchPart p) {
- // Ignore.
- }
-
- @Override
- public void partOpened(IWorkbenchPart p) {
- // Ignore.
- }
};
/**
@@ -301,9 +259,9 @@
* Adapter used to update the problem indication when resources are demanded
* loaded. <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
- protected EContentAdapter problemIndicationAdapter = new EContentAdapter() {
+ protected EContentAdapter problemIndicationAdapter = new ProblemIndicationEContentAdapter() {
@Override
public void notifyChanged(Notification notification) {
if (notification.getNotifier() instanceof Resource) {
@@ -312,39 +270,13 @@
case Resource.RESOURCE__ERRORS:
case Resource.RESOURCE__WARNINGS:
Resource resource = (Resource) notification.getNotifier();
- Diagnostic diagnostic = analyzeResourceProblems(resource,
- null);
- if (diagnostic.getSeverity() != Diagnostic.OK) {
- resourceToDiagnosticMap.put(resource, diagnostic);
- } else {
- resourceToDiagnosticMap.remove(resource);
- }
-
- if (updateProblemIndication) {
- getSite().getShell().getDisplay()
- .asyncExec(new Runnable() {
- @Override
- public void run() {
- updateProblemIndication();
- }
- });
- }
+ handleResourceDiagnostic(resource);
break;
}
} else {
super.notifyChanged(notification);
}
}
-
- @Override
- protected void setTarget(Resource target) {
- basicSetTarget(target);
- }
-
- @Override
- protected void unsetTarget(Resource target) {
- basicUnsetTarget(target);
- }
};
/**
@@ -356,41 +288,7 @@
protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener() {
@Override
public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta = event.getDelta();
- try {
- final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
- visitor.init(editingDomain.getResourceSet(), savedResources);
- delta.accept(visitor);
-
- if (!visitor.getRemovedResources().isEmpty()) {
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- removedResources.addAll(visitor
- .getRemovedResources());
- if (!isDirty()) {
- getSite().getPage().closeEditor(
- EmfAbstractEditor.this, false);
- }
- }
- });
- }
-
- if (!visitor.getChangedResources().isEmpty()) {
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- changedResources.addAll(visitor
- .getChangedResources());
- if (getSite().getPage().getActiveEditor() == EmfAbstractEditor.this) {
- handleActivate();
- }
- }
- });
- }
- } catch (CoreException exception) {
- EcoreEditorPlugin.INSTANCE.log(exception);
- }
+ handleIResourceChangeEvent(event);
}
};
@@ -482,21 +380,7 @@
editingDomain.getCommandStack().flush();
updateProblemIndication = false;
- for (Resource resource : changedResources) {
- if (resource.isLoaded()) {
- resource.unload();
- try {
- resource.load(Collections.emptyMap());
- } catch (IOException exception) {
- if (!resourceToDiagnosticMap.containsKey(resource)) {
- resourceToDiagnosticMap
- .put(resource,
- analyzeResourceProblems(resource,
- exception));
- }
- }
- }
- }
+ reloadChangedResources();
if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
setSelection(StructuredSelection.EMPTY);
@@ -507,6 +391,24 @@
}
}
+ protected void reloadChangedResources() {
+ for (Resource resource : changedResources) {
+ if (resource.isLoaded()) {
+ resource.unload();
+ try {
+ resource.load(Collections.emptyMap());
+ } catch (IOException exception) {
+ if (!resourceToDiagnosticMap.containsKey(resource)) {
+ resourceToDiagnosticMap
+ .put(resource,
+ analyzeResourceProblems(resource,
+ exception));
+ }
+ }
+ }
+ }
+ }
+
/**
* Updates the problems indication with the information described in the
* specified diagnostic. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -515,14 +417,7 @@
*/
protected void updateProblemIndication() {
if (updateProblemIndication) {
- BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK,
- "org.eclipse.emf.ecore.editor", 0, null,
- new Object[] { editingDomain.getResourceSet() });
- for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
- if (childDiagnostic.getSeverity() != Diagnostic.OK) {
- diagnostic.add(childDiagnostic);
- }
- }
+ BasicDiagnostic diagnostic = createDiagnostic();
int lastEditorPage = getPageCount() - 1;
if (lastEditorPage >= 0
@@ -547,14 +442,30 @@
}
}
- if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
- markerHelper.deleteMarkers(editingDomain.getResourceSet());
- if (diagnostic.getSeverity() != Diagnostic.OK) {
- try {
- markerHelper.createMarkers(diagnostic);
- } catch (CoreException exception) {
- EcoreEditorPlugin.INSTANCE.log(exception);
- }
+ updateMarkers(diagnostic);
+ }
+ }
+
+ protected BasicDiagnostic createDiagnostic() {
+ BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK,
+ "org.eclipse.emf.ecore.editor", 0, null,
+ new Object[] { editingDomain.getResourceSet() });
+ for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
+ if (childDiagnostic.getSeverity() != Diagnostic.OK) {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+ return diagnostic;
+ }
+
+ protected void updateMarkers(BasicDiagnostic diagnostic) {
+ if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
+ markerHelper.deleteMarkers(editingDomain.getResourceSet());
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ try {
+ markerHelper.createMarkers(diagnostic);
+ } catch (CoreException exception) {
+ EcoreEditorPlugin.INSTANCE.log(exception);
}
}
}
@@ -646,69 +557,6 @@
return editingDomain;
}
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public static class ReverseAdapterFactoryContentProvider extends
- AdapterFactoryContentProvider {
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public ReverseAdapterFactoryContentProvider(
- AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object[] getElements(Object object) {
- Object parent = super.getParent(object);
- return (parent == null ? Collections.emptySet() : Collections
- .singleton(parent)).toArray();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object[] getChildren(Object object) {
- Object parent = super.getParent(object);
- return (parent == null ? Collections.emptySet() : Collections
- .singleton(parent)).toArray();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public boolean hasChildren(Object object) {
- Object parent = super.getParent(object);
- return parent != null;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object getParent(Object object) {
- return null;
- }
- }
-
protected ISelectionChangedListener createSelectionChangedListener() {
return new ISelectionChangedListener() {
// This just notifies those things that are affected by the section.
@@ -912,59 +760,26 @@
@Override
public void doSave(IProgressMonitor progressMonitor) {
// Save only resources that have actually changed.
- //
final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
- saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED,
- Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
-
- // Do the work within an operation because this is a long running
- // activity that modifies the workbench.
- //
- IRunnableWithProgress operation = new IRunnableWithProgress() {
- // This is the method that gets invoked when the operation runs.
- //
- @Override
- public void run(IProgressMonitor monitor) {
- // Save the resources to the file system.
- //
- boolean first = true;
- for (Resource resource : editingDomain.getResourceSet()
- .getResources()) {
- if ((first || !resource.getContents().isEmpty() || isPersisted(resource))
- && !editingDomain.isReadOnly(resource)) {
- try {
- long timeStamp = resource.getTimeStamp();
- resource.save(saveOptions);
- if (resource.getTimeStamp() != timeStamp) {
- savedResources.add(resource);
- }
- } catch (Exception exception) {
- resourceToDiagnosticMap
- .put(resource,
- analyzeResourceProblems(resource,
- exception));
- }
- first = false;
- }
- }
- }
- };
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
updateProblemIndication = false;
saving = true;
try {
- // This runs the options, and shows progress.
- //
- new ProgressMonitorDialog(getSite().getShell()).run(true, false,
- operation);
+ // Do the work within an operation because this is a long running
+ // activity that modifies the workbench.
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) {
+ performSave(saveOptions);
+ }
+ });
// Refresh the necessary state.
- //
((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
firePropertyChange(IEditorPart.PROP_DIRTY);
} catch (Exception exception) {
// Something went wrong that shouldn't.
- //
EcoreEditorPlugin.INSTANCE.log(exception);
}
saving = false;
@@ -1307,4 +1122,85 @@
return selectionViewer;
}
+ protected void handleResourceDiagnostic(Resource resource) {
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, diagnostic);
+ } else {
+ resourceToDiagnosticMap.remove(resource);
+ }
+
+ if (updateProblemIndication) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+ }
+
+ protected void handleIResourceChangeEvent(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+ visitor.init(editingDomain.getResourceSet(), savedResources);
+ delta.accept(visitor);
+
+ if (!visitor.getRemovedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ removedResources.addAll(visitor
+ .getRemovedResources());
+ if (!isDirty()) {
+ getSite().getPage().closeEditor(
+ EmfAbstractEditor.this, false);
+ }
+ }
+ });
+ }
+
+ if (!visitor.getChangedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ changedResources.addAll(visitor
+ .getChangedResources());
+ if (getSite().getPage().getActiveEditor() == EmfAbstractEditor.this) {
+ handleActivate();
+ }
+ }
+ });
+ }
+ } catch (CoreException exception) {
+ EcoreEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ protected void performSave(final Map<Object, Object> saveOptions) {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ for (Resource resource : editingDomain.getResourceSet()
+ .getResources()) {
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource))
+ && !editingDomain.isReadOnly(resource)) {
+ try {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ savedResources.add(resource);
+ }
+ } catch (Exception exception) {
+ resourceToDiagnosticMap
+ .put(resource,
+ analyzeResourceProblems(resource,
+ exception));
+ }
+ first = false;
+ }
+ }
+ }
+
}
diff --git a/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/internal/editors/listeners/PartListenerAdapter.java b/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/internal/editors/listeners/PartListenerAdapter.java
new file mode 100644
index 0000000..592b4ba
--- /dev/null
+++ b/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/internal/editors/listeners/PartListenerAdapter.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2015 RCP Vision (http://www.rcp-vision.com) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lorenzo Bettini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.parsley.internal.editors.listeners;
+
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Base class implementing all the methods as empty but from the one we'll
+ * implement in the editor.
+ *
+ * @author Lorenzo Bettini - initial API and implementation
+ *
+ */
+public abstract class PartListenerAdapter implements IPartListener {
+
+ @Override
+ public void partBroughtToTop(IWorkbenchPart p) {
+ // Ignore.
+ }
+
+ @Override
+ public void partClosed(IWorkbenchPart p) {
+ // Ignore.
+ }
+
+ @Override
+ public void partDeactivated(IWorkbenchPart p) {
+ // Ignore.
+ }
+
+ @Override
+ public void partOpened(IWorkbenchPart p) {
+ // Ignore.
+ }
+}
diff --git a/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/internal/editors/util/ProblemIndicationEContentAdapter.java b/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/internal/editors/util/ProblemIndicationEContentAdapter.java
new file mode 100644
index 0000000..b83a084
--- /dev/null
+++ b/plugins/org.eclipse.emf.parsley.editors.common/src/org/eclipse/emf/parsley/internal/editors/util/ProblemIndicationEContentAdapter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2015 RCP Vision (http://www.rcp-vision.com) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lorenzo Bettini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.parsley.internal.editors.util;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+
+/**
+ * Redefines a few methods.
+ *
+ * @author Lorenzo Bettini - initial API and implementation
+ *
+ */
+public class ProblemIndicationEContentAdapter extends EContentAdapter {
+
+ @Override
+ protected void setTarget(Resource target) {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(Resource target) {
+ basicUnsetTarget(target);
+ }
+}
diff --git a/plugins/org.eclipse.emf.parsley.generator.common/src/org/eclipse/emf/parsley/generator/common/EmfParsleyProjectFilesGenerator.xtend b/plugins/org.eclipse.emf.parsley.generator.common/src/org/eclipse/emf/parsley/generator/common/EmfParsleyProjectFilesGenerator.xtend
index d8ed13a..c39cf36 100644
--- a/plugins/org.eclipse.emf.parsley.generator.common/src/org/eclipse/emf/parsley/generator/common/EmfParsleyProjectFilesGenerator.xtend
+++ b/plugins/org.eclipse.emf.parsley.generator.common/src/org/eclipse/emf/parsley/generator/common/EmfParsleyProjectFilesGenerator.xtend
@@ -26,31 +26,6 @@
def extFactoryName(String projectName)
'''«projectName.buildClassNameFromProject»ExecutableExtensionFactory'''
- def generateManifest(String projectName)
-'''
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: «projectName»
-Bundle-SymbolicName: «projectName»;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: «projectName».«projectName.activatorName»
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.parsley,
- org.eclipse.emf.parsley.views
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-'''
-
- def generateBuildProperties(boolean hasPluginXml)
-'''
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .«IF hasPluginXml»,\
- plugin.xml«ENDIF»
-'''
-
def generateActivator(String projectName)
'''
package «projectName»;
diff --git a/plugins/org.eclipse.emf.parsley.generator.common/src/org/eclipse/emf/parsley/generator/common/EmfParsleyViewFilesGenerator.xtend b/plugins/org.eclipse.emf.parsley.generator.common/src/org/eclipse/emf/parsley/generator/common/EmfParsleyViewFilesGenerator.xtend
deleted file mode 100644
index 6d39169..0000000
--- a/plugins/org.eclipse.emf.parsley.generator.common/src/org/eclipse/emf/parsley/generator/common/EmfParsleyViewFilesGenerator.xtend
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Lorenzo Bettini - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.parsley.generator.common
-
-class EmfParsleyViewFilesGenerator {
-
- def generateConcreteForResourceTreeView(String projectName, String className, String extendsClass)
-'''
-package «projectName»;
-
-import org.eclipse.emf.parsley.views.«extendsClass»;
-
-import org.eclipse.emf.common.util.URI;
-
-public class «className» extends «extendsClass» {
-
- @Override
- protected URI createResourceURI() {
- // TODO Insert here the resource URI
- return null;
- }
-
-}
-'''
-
- def generateConcreteForOnSelectionTableView(String projectName, String simpleName)
-'''
-package «projectName»;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.parsley.views.AbstractOnSelectionTableView;
-
-public class «simpleName» extends AbstractOnSelectionTableView {
-
- @Override
- protected EClass getEClass() {
- // TODO the type of objects to show
- return null;
- }
-
-}
-'''
-
-
- def generateConcreteForOnSelectionTableFormView(String projectName, String simpleName)
-'''
-package «projectName»;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.parsley.views.AbstractOnSelectionTableFormView;
-
-public class «simpleName» extends AbstractOnSelectionTableFormView {
-
- @Override
- protected EClass getEClass() {
- // TODO the type of objects to show
- return null;
- }
-
-}
-'''
-
-
-
- def generateTreeFormView(String projectName, String simpleName)
-'''
-package «projectName»;
-
-import org.eclipse.emf.parsley.views.AbstractSaveableTreeFormView;
-
-import org.eclipse.emf.common.util.URI;
-
-public class «simpleName»TreeFormView extends AbstractSaveableTreeFormView {
-
- @Override
- protected URI createResourceURI() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
-'''
-
- def generateTableView(String projectName, String simpleName)
-'''
-package «projectName»;
-
-import org.eclipse.emf.parsley.views.AbstractSaveableTableView;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class «simpleName»TableView extends AbstractSaveableTableView {
-
- @Override
- protected EClass getEClass() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected URI createResourceURI() {
- // TODO Auto-generated method stub
- return null;
- }
-}
-'''
-
- def generatePluginXml(String factoryClass, String qualifiedNameView)
-'''
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.ui.views">
- <view
- class="«factoryClass»:«qualifiedNameView»"
- id="«qualifiedNameView»"
- name="Form View"
- restorable="true"/>
- </extension>
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="*">
- <view
- id="«qualifiedNameView»"
- minimized="false"
- ratio="100"
- relationship="stack"
- relative="org.eclipse.ui.editorss"
- visible="true">
- </view>
- </perspectiveExtension>
- </extension>
-</plugin>
-'''
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.emf.parsley.views.common/src/org/eclipse/emf/parsley/views/OnSelectionListView.java b/plugins/org.eclipse.emf.parsley.views.common/temporary/OnSelectionListView.java
similarity index 100%
rename from plugins/org.eclipse.emf.parsley.views.common/src/org/eclipse/emf/parsley/views/OnSelectionListView.java
rename to plugins/org.eclipse.emf.parsley.views.common/temporary/OnSelectionListView.java
diff --git a/plugins/org.eclipse.emf.parsley.wizards/build.properties b/plugins/org.eclipse.emf.parsley.wizards/build.properties
index 73840a0..5ee508b 100644
--- a/plugins/org.eclipse.emf.parsley.wizards/build.properties
+++ b/plugins/org.eclipse.emf.parsley.wizards/build.properties
@@ -11,7 +11,6 @@
.,\
plugin.xml,\
icons/,\
- templates_3.4/,\
about.html
src.includes = icons/,\
about.html
diff --git a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/EmfParsleyChoiceTemplate.java b/plugins/org.eclipse.emf.parsley.wizards/old/EmfParsleyChoiceTemplate.java
similarity index 100%
rename from plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/EmfParsleyChoiceTemplate.java
rename to plugins/org.eclipse.emf.parsley.wizards/old/EmfParsleyChoiceTemplate.java
diff --git a/plugins/org.eclipse.emf.parsley.wizards/old/NewEmfParsleyProjectSupport.java b/plugins/org.eclipse.emf.parsley.wizards/old/NewEmfParsleyProjectSupport.java
new file mode 100644
index 0000000..7581694
--- /dev/null
+++ b/plugins/org.eclipse.emf.parsley.wizards/old/NewEmfParsleyProjectSupport.java
@@ -0,0 +1,334 @@
+/*******************************************************************************
+ * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lorenzo Bettini - Initial contribution and API
+ *******************************************************************************/
+package org.eclipse.emf.parsley.wizards;
+
+import java.io.ByteArrayInputStream;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.emf.common.util.UniqueEList;
+import org.eclipse.emf.parsley.generator.common.EmfParsleyProjectFilesGenerator;
+import org.eclipse.emf.parsley.generator.common.EmfParsleyViewFilesGenerator;
+import org.eclipse.emf.parsley.wizards.EmfParsleyChoiceTemplate.Choice;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+
+/**
+ * @author Lorenzo Bettini
+ */
+public class NewEmfParsleyProjectSupport {
+
+ private static final String JAVA_EXTENSION = ".java";
+
+ static EmfParsleyProjectFilesGenerator filesGenerator = new EmfParsleyProjectFilesGenerator();
+
+ static EmfParsleyViewFilesGenerator viewGenerator = new EmfParsleyViewFilesGenerator();
+
+ private static final Logger LOGGER = Logger.getLogger(NewEmfParsleyProjectSupport.class);
+
+ protected NewEmfParsleyProjectSupport() {
+ // hide the implicit one
+ }
+
+ /**
+ * We need to: - create the default Eclipse project - add the java and
+ * plugin natures - create the folder structure
+ *
+ * @param projectName
+ * @param location
+ * @param progressMonitor
+ * @param natureId
+ * @return
+ */
+ public static IProject createProject(String projectName, URI location,
+ Choice viewType, IProgressMonitor progressMonitor) {
+ Assert.isNotNull(projectName);
+ Assert.isTrue(projectName.trim().length() > 0);
+
+ progressMonitor.beginTask("Creating project " + projectName, 10);
+
+ String srcFolder = "src";
+ String metaInfPath = "META-INF";
+ String projectPackagePath = srcFolder + "/"
+ + projectName.replaceAll("\\.", "/");
+
+ IProject project = createBaseProject(projectName, location,
+ createSubProgressMonitor(progressMonitor));
+ try {
+ String[] paths = { srcFolder, projectPackagePath, metaInfPath };
+ addToProjectStructure(project, paths, progressMonitor);
+
+ createActivator(project, projectName, projectPackagePath,
+ progressMonitor);
+ createExecutableExtensionFactory(project, projectName,
+ projectPackagePath, progressMonitor);
+ createModule(project, projectName, projectPackagePath,
+ "EmfParsleyGuiceModule", progressMonitor);
+
+ createProjectFile(project, metaInfPath + "/MANIFEST.MF",
+ filesGenerator.generateManifest(projectName).toString(),
+ createSubProgressMonitor(progressMonitor));
+ createProjectFile(project, "/build.properties", filesGenerator
+ .generateBuildProperties(shouldGeneratePluginXml(viewType))
+ .toString(), createSubProgressMonitor(progressMonitor));
+
+ String simpleClassName = getSimpleNameProject(projectPackagePath);
+ String qualifiedNameView = null;
+ CharSequence contents = "";
+ switch (viewType) {
+ case TREEFORM:
+ qualifiedNameView = simpleClassName + "TreeFormView";
+ contents = viewGenerator.generateTreeFormView(projectName, simpleClassName);
+ break;
+ case TABLEFORM:
+ qualifiedNameView = simpleClassName + "TableView";
+ contents = viewGenerator.generateTableView(projectName, simpleClassName);
+ break;
+ default:
+ // OK, no additional views to create
+ }
+
+ if (qualifiedNameView != null) {
+ createProjectFile(project, projectPackagePath + "/"
+ + qualifiedNameView.concat(JAVA_EXTENSION),
+ contents.toString(),
+ createSubProgressMonitor(progressMonitor));
+
+ createProjectFile(
+ project,
+ "/plugin.xml",
+ viewGenerator.generatePluginXml(
+ projectName
+ .concat(".").
+ concat(filesGenerator.extFactoryName(projectName).toString()),
+ projectName.concat(".").concat(
+ qualifiedNameView)).toString(),
+ createSubProgressMonitor(progressMonitor));
+ }
+
+ addNatures(project, createSubProgressMonitor(progressMonitor));
+ } catch (CoreException e) {
+ LOGGER.error("in createProject", e);
+ project = null;
+ }
+
+ progressMonitor.done();
+
+ return project;
+ }
+
+ public static void createActivator(IProject project, String projectName,
+ String projectPackagePath, IProgressMonitor progressMonitor)
+ throws CoreException {
+ createProjectFile(project, projectPackagePath + "/"
+ + filesGenerator.activatorName(projectName) + JAVA_EXTENSION,
+ filesGenerator.generateActivator(projectName).toString(),
+ createSubProgressMonitor(progressMonitor));
+ }
+
+ public static void createExecutableExtensionFactory(IProject project,
+ String projectName, String projectPackagePath,
+ IProgressMonitor progressMonitor) throws CoreException {
+ createProjectFile(project, projectPackagePath
+ + "/"
+ + filesGenerator.extFactoryName(projectName)
+ + JAVA_EXTENSION, filesGenerator
+ .generateExecutableExtensionFactory(projectName).toString(),
+ createSubProgressMonitor(progressMonitor));
+ }
+
+ public static void createModule(IProject project, String projectName,
+ String projectPackagePath, String superClass,
+ IProgressMonitor progressMonitor) throws CoreException {
+ createProjectFile(project, projectPackagePath
+ + "/"
+ + filesGenerator.moduleName(projectName)
+ + JAVA_EXTENSION, filesGenerator
+ .generateModule(projectName, superClass).toString(),
+ createSubProgressMonitor(progressMonitor));
+ }
+
+ private static boolean shouldGeneratePluginXml(Choice viewType) {
+ return viewType != Choice.NONE;
+ }
+
+ private static String getSimpleNameProject(String projectName) {
+ String simpleNameProject = null;
+ if (projectName.contains(".")) {
+ simpleNameProject = projectName.substring(projectName
+ .lastIndexOf('.') + 1);
+ } else {
+ simpleNameProject = projectName.substring(projectName
+ .lastIndexOf('/') + 1);
+ }
+ simpleNameProject = simpleNameProject.substring(0, 1).toUpperCase()
+ .concat(simpleNameProject.substring(1));
+ return simpleNameProject;
+ }
+
+ /**
+ * @param progressMonitor
+ * @return
+ */
+ public static IProgressMonitor createSubProgressMonitor(
+ IProgressMonitor progressMonitor) {
+ return new SubProgressMonitor(progressMonitor, 1);
+ }
+
+ /**
+ * Just do the basics: create a basic project.
+ *
+ * @param location
+ * @param projectName
+ * @param progressMonitor
+ */
+ private static IProject createBaseProject(String projectName, URI location,
+ IProgressMonitor progressMonitor) {
+ progressMonitor.subTask("Creating project resource");
+
+ // it is acceptable to use the ResourcesPlugin class
+ IProject newProject = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(projectName);
+
+ if (!newProject.exists()) {
+ URI projectLocation = location;
+ IProjectDescription desc = newProject.getWorkspace()
+ .newProjectDescription(newProject.getName());
+ if (location != null
+ && location.equals(ResourcesPlugin.getWorkspace().getRoot()
+ .getLocationURI())) {
+ projectLocation = null;
+ }
+
+ desc.setLocationURI(projectLocation);
+ try {
+ newProject.create(desc,
+ createSubProgressMonitor(progressMonitor));
+ if (!newProject.isOpen()) {
+ newProject.open(createSubProgressMonitor(progressMonitor));
+ }
+ } catch (CoreException e) {
+ LOGGER.error("in createBaseProject", e);
+ }
+ }
+
+ progressMonitor.done();
+
+ return newProject;
+ }
+
+ /**
+ * Create a folder structure with a parent root, overlay, and a few child
+ * folders.
+ *
+ * @param newProject
+ * @param paths
+ * @param progressMonitor
+ * @throws CoreException
+ */
+ public static void addToProjectStructure(IProject newProject,
+ String[] paths, IProgressMonitor monitor) throws CoreException {
+ IProgressMonitor progressMonitor = createSubProgressMonitor(monitor);
+ progressMonitor.subTask("Creating project folders");
+ for (String path : paths) {
+ IFolder etcFolders = newProject.getFolder(path);
+ createFolder(etcFolders);
+ }
+ progressMonitor.done();
+ }
+
+ private static void createFolder(IFolder folder) throws CoreException {
+ IContainer parent = folder.getParent();
+ if (parent instanceof IFolder) {
+ createFolder((IFolder) parent);
+ }
+ if (!folder.exists()) {
+ folder.create(false, true, null);
+ }
+ }
+
+ /**
+ * @param project
+ * @param fileName
+ * @param contents
+ * @param progressMonitor
+ * @throws CoreException
+ */
+ public static void createProjectFile(IProject project, String fileName,
+ String contents, IProgressMonitor progressMonitor)
+ throws CoreException {
+ progressMonitor.subTask("Creating file " + fileName);
+ IFile iFile = project.getFile(fileName);
+ iFile.create(
+ new ByteArrayInputStream(contents.getBytes(Charset
+ .forName(iFile.getCharset()))), true, null);
+ progressMonitor.done();
+ }
+
+ private static void addNatures(IProject project,
+ IProgressMonitor progressMonitor) throws CoreException {
+ progressMonitor.subTask("Adding natures");
+ List<IClasspathEntry> classpathEntries = new UniqueEList<IClasspathEntry>();
+
+ IJavaProject javaProject = JavaCore.create(project);
+ IProjectDescription projectDescription = project.getDescription();
+
+ projectDescription.setNatureIds(new String[] { JavaCore.NATURE_ID,
+ IBundleProjectDescription.PLUGIN_NATURE });
+
+ IProgressMonitor monitor = null;
+ project.setDescription(projectDescription, monitor);
+
+ IPath projectPath = project.getFullPath();
+ IPath javaSource = projectPath.append("src");
+
+ IClasspathEntry sourceClasspathEntry = JavaCore
+ .newSourceEntry(javaSource);
+ for (Iterator<IClasspathEntry> i = classpathEntries.iterator(); i
+ .hasNext();) {
+ IClasspathEntry classpathEntry = i.next();
+ if (classpathEntry.getPath().isPrefixOf(javaSource)) {
+ i.remove();
+ }
+ }
+ classpathEntries.add(0, sourceClasspathEntry);
+
+ classpathEntries.add(JavaRuntime.getDefaultJREContainerEntry());
+
+ classpathEntries.add(JavaCore.newContainerEntry(new Path(
+ "org.eclipse.pde.core.requiredPlugins")));
+
+ javaProject.setRawClasspath(classpathEntries
+ .toArray(new IClasspathEntry[classpathEntries.size()]),
+ createSubProgressMonitor(progressMonitor));
+
+ progressMonitor.done();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/NewEmfParsleyProjectWizard.java b/plugins/org.eclipse.emf.parsley.wizards/old/NewEmfParsleyProjectWizard.java
similarity index 100%
rename from plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/NewEmfParsleyProjectWizard.java
rename to plugins/org.eclipse.emf.parsley.wizards/old/NewEmfParsleyProjectWizard.java
diff --git a/plugins/org.eclipse.emf.parsley.wizards/plugin.xml b/plugins/org.eclipse.emf.parsley.wizards/plugin.xml
index 57a6a48..5deec28 100644
--- a/plugins/org.eclipse.emf.parsley.wizards/plugin.xml
+++ b/plugins/org.eclipse.emf.parsley.wizards/plugin.xml
@@ -8,38 +8,4 @@
name="Emf Parsley">
</category>
</extension>
- <extension
- point="org.eclipse.ui.newWizards">
- <wizard
- category="org.eclipse.emf.parsley.wizards"
- class="org.eclipse.emf.parsley.wizards.NewEmfParsleyProjectWizard"
- icon="icons/sample.gif"
- id="org.eclipse.emf.parsley.wizards.NewEmfParsleyProject"
- name="Emf Parsley Project"
- project="true">
- </wizard>
- </extension>
- <extension
- point="org.eclipse.pde.ui.pluginContent">
- <wizard
- class="org.eclipse.emf.parsley.wizards.TablePluginContentWizard"
- icon="icons/component.jpg"
- id="org.eclipse.emf.parsley.masterdetail.tablewizard"
- java="true"
- name="Table Master Detail Wizard"
- pureOSGi="false"
- rcp="false"
- requiresActivator="false"
- ui-content="true">
- </wizard>
- </extension>
- <extension
- point="org.eclipse.pde.ui.templates">
- <template
- class="org.eclipse.emf.parsley.wizards.TableViewTemplateSection"
- contributingId="org.eclipse.ui.views"
- icon="icons/component.jpg"
- id="org.eclipse.emf.parsley.masterdetail.tabletemplate"
- name="Table Master Detail View"/>
- </extension>
</plugin>
diff --git a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/NewEmfParsleyProjectSupport.java b/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/NewEmfParsleyProjectSupport.java
index 7581694..fc4d1b1 100644
--- a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/NewEmfParsleyProjectSupport.java
+++ b/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/NewEmfParsleyProjectSupport.java
@@ -11,33 +11,16 @@
package org.eclipse.emf.parsley.wizards;
import java.io.ByteArrayInputStream;
-import java.net.URI;
import java.nio.charset.Charset;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.log4j.Logger;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.parsley.generator.common.EmfParsleyProjectFilesGenerator;
-import org.eclipse.emf.parsley.generator.common.EmfParsleyViewFilesGenerator;
-import org.eclipse.emf.parsley.wizards.EmfParsleyChoiceTemplate.Choice;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.pde.core.project.IBundleProjectDescription;
/**
* @author Lorenzo Bettini
@@ -48,101 +31,10 @@
static EmfParsleyProjectFilesGenerator filesGenerator = new EmfParsleyProjectFilesGenerator();
- static EmfParsleyViewFilesGenerator viewGenerator = new EmfParsleyViewFilesGenerator();
-
- private static final Logger LOGGER = Logger.getLogger(NewEmfParsleyProjectSupport.class);
-
protected NewEmfParsleyProjectSupport() {
// hide the implicit one
}
- /**
- * We need to: - create the default Eclipse project - add the java and
- * plugin natures - create the folder structure
- *
- * @param projectName
- * @param location
- * @param progressMonitor
- * @param natureId
- * @return
- */
- public static IProject createProject(String projectName, URI location,
- Choice viewType, IProgressMonitor progressMonitor) {
- Assert.isNotNull(projectName);
- Assert.isTrue(projectName.trim().length() > 0);
-
- progressMonitor.beginTask("Creating project " + projectName, 10);
-
- String srcFolder = "src";
- String metaInfPath = "META-INF";
- String projectPackagePath = srcFolder + "/"
- + projectName.replaceAll("\\.", "/");
-
- IProject project = createBaseProject(projectName, location,
- createSubProgressMonitor(progressMonitor));
- try {
- String[] paths = { srcFolder, projectPackagePath, metaInfPath };
- addToProjectStructure(project, paths, progressMonitor);
-
- createActivator(project, projectName, projectPackagePath,
- progressMonitor);
- createExecutableExtensionFactory(project, projectName,
- projectPackagePath, progressMonitor);
- createModule(project, projectName, projectPackagePath,
- "EmfParsleyGuiceModule", progressMonitor);
-
- createProjectFile(project, metaInfPath + "/MANIFEST.MF",
- filesGenerator.generateManifest(projectName).toString(),
- createSubProgressMonitor(progressMonitor));
- createProjectFile(project, "/build.properties", filesGenerator
- .generateBuildProperties(shouldGeneratePluginXml(viewType))
- .toString(), createSubProgressMonitor(progressMonitor));
-
- String simpleClassName = getSimpleNameProject(projectPackagePath);
- String qualifiedNameView = null;
- CharSequence contents = "";
- switch (viewType) {
- case TREEFORM:
- qualifiedNameView = simpleClassName + "TreeFormView";
- contents = viewGenerator.generateTreeFormView(projectName, simpleClassName);
- break;
- case TABLEFORM:
- qualifiedNameView = simpleClassName + "TableView";
- contents = viewGenerator.generateTableView(projectName, simpleClassName);
- break;
- default:
- // OK, no additional views to create
- }
-
- if (qualifiedNameView != null) {
- createProjectFile(project, projectPackagePath + "/"
- + qualifiedNameView.concat(JAVA_EXTENSION),
- contents.toString(),
- createSubProgressMonitor(progressMonitor));
-
- createProjectFile(
- project,
- "/plugin.xml",
- viewGenerator.generatePluginXml(
- projectName
- .concat(".").
- concat(filesGenerator.extFactoryName(projectName).toString()),
- projectName.concat(".").concat(
- qualifiedNameView)).toString(),
- createSubProgressMonitor(progressMonitor));
- }
-
- addNatures(project, createSubProgressMonitor(progressMonitor));
- } catch (CoreException e) {
- LOGGER.error("in createProject", e);
- project = null;
- }
-
- progressMonitor.done();
-
- return project;
- }
-
public static void createActivator(IProject project, String projectName,
String projectPackagePath, IProgressMonitor progressMonitor)
throws CoreException {
@@ -174,24 +66,6 @@
createSubProgressMonitor(progressMonitor));
}
- private static boolean shouldGeneratePluginXml(Choice viewType) {
- return viewType != Choice.NONE;
- }
-
- private static String getSimpleNameProject(String projectName) {
- String simpleNameProject = null;
- if (projectName.contains(".")) {
- simpleNameProject = projectName.substring(projectName
- .lastIndexOf('.') + 1);
- } else {
- simpleNameProject = projectName.substring(projectName
- .lastIndexOf('/') + 1);
- }
- simpleNameProject = simpleNameProject.substring(0, 1).toUpperCase()
- .concat(simpleNameProject.substring(1));
- return simpleNameProject;
- }
-
/**
* @param progressMonitor
* @return
@@ -202,48 +76,6 @@
}
/**
- * Just do the basics: create a basic project.
- *
- * @param location
- * @param projectName
- * @param progressMonitor
- */
- private static IProject createBaseProject(String projectName, URI location,
- IProgressMonitor progressMonitor) {
- progressMonitor.subTask("Creating project resource");
-
- // it is acceptable to use the ResourcesPlugin class
- IProject newProject = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
-
- if (!newProject.exists()) {
- URI projectLocation = location;
- IProjectDescription desc = newProject.getWorkspace()
- .newProjectDescription(newProject.getName());
- if (location != null
- && location.equals(ResourcesPlugin.getWorkspace().getRoot()
- .getLocationURI())) {
- projectLocation = null;
- }
-
- desc.setLocationURI(projectLocation);
- try {
- newProject.create(desc,
- createSubProgressMonitor(progressMonitor));
- if (!newProject.isOpen()) {
- newProject.open(createSubProgressMonitor(progressMonitor));
- }
- } catch (CoreException e) {
- LOGGER.error("in createBaseProject", e);
- }
- }
-
- progressMonitor.done();
-
- return newProject;
- }
-
- /**
* Create a folder structure with a parent root, overlay, and a few child
* folders.
*
@@ -291,44 +123,4 @@
progressMonitor.done();
}
- private static void addNatures(IProject project,
- IProgressMonitor progressMonitor) throws CoreException {
- progressMonitor.subTask("Adding natures");
- List<IClasspathEntry> classpathEntries = new UniqueEList<IClasspathEntry>();
-
- IJavaProject javaProject = JavaCore.create(project);
- IProjectDescription projectDescription = project.getDescription();
-
- projectDescription.setNatureIds(new String[] { JavaCore.NATURE_ID,
- IBundleProjectDescription.PLUGIN_NATURE });
-
- IProgressMonitor monitor = null;
- project.setDescription(projectDescription, monitor);
-
- IPath projectPath = project.getFullPath();
- IPath javaSource = projectPath.append("src");
-
- IClasspathEntry sourceClasspathEntry = JavaCore
- .newSourceEntry(javaSource);
- for (Iterator<IClasspathEntry> i = classpathEntries.iterator(); i
- .hasNext();) {
- IClasspathEntry classpathEntry = i.next();
- if (classpathEntry.getPath().isPrefixOf(javaSource)) {
- i.remove();
- }
- }
- classpathEntries.add(0, sourceClasspathEntry);
-
- classpathEntries.add(JavaRuntime.getDefaultJREContainerEntry());
-
- classpathEntries.add(JavaCore.newContainerEntry(new Path(
- "org.eclipse.pde.core.requiredPlugins")));
-
- javaProject.setRawClasspath(classpathEntries
- .toArray(new IClasspathEntry[classpathEntries.size()]),
- createSubProgressMonitor(progressMonitor));
-
- progressMonitor.done();
- }
-
}
diff --git a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/TablePluginContentWizard.java b/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/TablePluginContentWizard.java
deleted file mode 100644
index 5b8182a..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/TablePluginContentWizard.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Lorenzo Bettini - Initial contribution and API
- *******************************************************************************/
-package org.eclipse.emf.parsley.wizards;
-
-
-import org.eclipse.pde.ui.IFieldData;
-import org.eclipse.pde.ui.templates.ITemplateSection;
-import org.eclipse.pde.ui.templates.NewPluginTemplateWizard;
-
-public class TablePluginContentWizard extends NewPluginTemplateWizard {
-
- protected IFieldData fData;
-
- @Override
- public void init(IFieldData data) {
- super.init(data);
- fData = data;
- // not available in Indigo: setWindowTitle
- }
-
- @Override
- public ITemplateSection[] createTemplateSections() {
- return new ITemplateSection[] {new TableViewTemplateSection()};
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/TableViewTemplateSection.java b/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/TableViewTemplateSection.java
deleted file mode 100644
index 5be7e25..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/src/org/eclipse/emf/parsley/wizards/TableViewTemplateSection.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Lorenzo Bettini - Initial contribution and API
- *******************************************************************************/
-package org.eclipse.emf.parsley.wizards;
-
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.pde.core.plugin.IPluginBase;
-import org.eclipse.pde.core.plugin.IPluginElement;
-import org.eclipse.pde.core.plugin.IPluginExtension;
-import org.eclipse.pde.core.plugin.IPluginModelFactory;
-import org.eclipse.pde.core.plugin.IPluginReference;
-import org.eclipse.pde.internal.ui.IHelpContextIds;
-import org.eclipse.pde.ui.templates.OptionTemplateSection;
-import org.eclipse.pde.ui.templates.PluginReference;
-
-@SuppressWarnings("restriction")
-public class TableViewTemplateSection extends OptionTemplateSection {
-
- private static final String KEY_PROJECT_NAME = "packageName";
- private static final String KEY_PREFIX_CLASSESNAME = "prefixClassesname";
- private static final String KEY_EDITABLE = "editableView";
-
- private static final String MASTERDETAIL_VIEWNAME = "org.eclipse.emf.parsley.view.masterdetail.TableMasterDetailView";
-
- public TableViewTemplateSection() {
- setPageCount(1);
- createOptions();
- }
-
- @Override
- public String getUsedExtensionPoint() {
- return null;
- }
-
- @Override
- public String[] getNewFiles() {
- return new String[] { "icons/" };
- }
-
- @Override
- public String getSectionId() {
- return "viewtemplate";
- }
-
- @Override
- protected URL getInstallURL() {
- return EmfParsleyWizardsActivator.getDefault().getBundle().getEntry("/");
- }
-
- @Override
- protected ResourceBundle getPluginResourceBundle() {
- return Platform.getResourceBundle(EmfParsleyWizardsActivator.getDefault().getBundle());
- }
-
- @Override
- public void addPages(Wizard wizard) {
- WizardPage page = createPage(0, IHelpContextIds.TEMPLATE_INTRO);
- page.setTitle("Table Master Detail Template");
- page.setDescription("Creates a Table Master Detail view");
- wizard.addPage(page);
- markPagesAdded();
- }
-
- private void createOptions() {
- addOption(KEY_PREFIX_CLASSESNAME, "Prefix classes name", "", 0);
- addOption(KEY_EDITABLE, "Is editable", true, 0);
- }
-
- @Override
- protected void updateModel(IProgressMonitor monitor) throws CoreException {
- String projectId = project.getDescription().getName();
- addOption(KEY_PROJECT_NAME, "Project Name", projectId, 0);
-
- IPluginModelFactory factory = model.getPluginFactory();
- IPluginExtension extensionView = createExtensionView(factory);
- IPluginExtension extensionMenu = createExtensionMenu(factory);
-
- IPluginBase plugin = model.getPluginBase();
- plugin.add(extensionView);
- plugin.add(extensionMenu);
- }
-
- private IPluginExtension createExtensionMenu(IPluginModelFactory factory)
- throws CoreException {
- IPluginExtension extensionMenu = createExtension("org.eclipse.ui.menus", true);
-
- IPluginElement elementMenu = factory.createElement(extensionMenu);
- elementMenu.setName("menuContribution");
- elementMenu.setAttribute("locationURI", "menu:org.eclipse.ui.main.menu");
- elementMenu.setAttribute("allPopups", "false");
-
- IPluginElement elementSubMenu = factory.createElement(elementMenu);
- elementSubMenu.setName("command");
- elementSubMenu.setAttribute("commandId", "org.eclipse.ui.views.showView");
- elementSubMenu.setAttribute("label", getStringOption(KEY_PREFIX_CLASSESNAME));
- elementSubMenu.setAttribute("tooltip", "Open the Master Detail");
- elementSubMenu.setAttribute("style", "push");
-
- IPluginElement elementSubMenuParameter = factory.createElement(elementSubMenu);
- elementSubMenuParameter.setName("parameter");
- elementSubMenuParameter.setAttribute("name", "org.eclipse.ui.views.showView.viewId");
- elementSubMenuParameter.setAttribute("value", getViewId());
-
- extensionMenu.add(elementMenu);
- elementMenu.add(elementSubMenu);
- elementSubMenu.add(elementSubMenuParameter);
-
- return extensionMenu;
- }
-
- private IPluginExtension createExtensionView(IPluginModelFactory factory)
- throws CoreException {
- IPluginExtension extensionView = createExtension("org.eclipse.ui.views", true);
-
- IPluginElement elementView = factory.createElement(extensionView);
- elementView.setName("view");
- elementView.setAttribute("id", getViewId());
- elementView.setAttribute("name", getStringOption(KEY_PREFIX_CLASSESNAME));
-
- String fullClassName = getAbstractDispatcherPath() + MASTERDETAIL_VIEWNAME;
- elementView.setAttribute("class", fullClassName);
- elementView.setAttribute("icon", "icons/table.jpg");
-
- extensionView.add(elementView);
-
- return extensionView;
- }
-
- private String getAbstractDispatcherPath() {
- return getStringOption(KEY_PROJECT_NAME) + ".internal.guice." + getStringOption(KEY_PREFIX_CLASSESNAME) + "ExecutableExtensionFactory:";
- }
-
- private String getViewId() {
- return getStringOption(KEY_PROJECT_NAME) + "." + getStringOption(KEY_PREFIX_CLASSESNAME);
- }
-
- @Override
- public IPluginReference[] getDependencies(String schemaVersion) {
- List<IPluginReference> result = new ArrayList<IPluginReference>();
- result.addAll(Arrays.asList(super.getDependencies(schemaVersion)));
- result.add(new PluginReference("org.eclipse.core.runtime", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.emf.cdo", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.emf.cdo.net4j", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.net4j.tcp", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.xtext", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.ui.forms", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.core.databinding.property", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.emf.parsley", null, 0)); //$NON-NLS-1$
- result.add(new PluginReference("org.eclipse.emf.parsley.cdo", null, 0)); //$NON-NLS-1$
- return result.toArray(new IPluginReference[result.size()]);
- }
-
-}
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/.gitignore b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/.gitignore
deleted file mode 100644
index 08eb0a0..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-!bin/
\ No newline at end of file
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/bin/a.java b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/bin/a.java
deleted file mode 100644
index 6f5745d..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/bin/a.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package it.rcpvision.cdo04.editor.labeling;
-
-import org.eclipse.emf.parsley.composite.ControlObservablePair;
-import org.eclipse.emf.parsley.composite.FormControlFactory;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jface.databinding.swt.SWTObservables;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.DateTime;
-
-public class DemoBindingFactory extends EmfSwtBindingFactory {
-
- public ControlObservablePair control_Order_date(EStructuralFeature feature) {
- DateTime dateTime= new DateTime(getParent(), SWT.DROP_DOWN);
- getToolkit().adapt(dateTime);
- return new ControlObservablePair(dateTime, SWTObservables.observeSelection(dateTime));
- }
-}
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/$prefixClassesname$CDOSessionManager.java b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/$prefixClassesname$CDOSessionManager.java
deleted file mode 100644
index f5b6b87..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/$prefixClassesname$CDOSessionManager.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package $packageName$;
-
-import org.eclipse.emf.parsley.cdo.CDOSessionManager;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-
-public class $prefixClassesname$CDOSessionManager extends CDOSessionManager {
-
- @Override
- public CDOSession getSession(EObject obj) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public CDOResource getTransactionalResourceFor(EClass eReferenceType) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/$prefixClassesname$ViewConfigurator.java b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/$prefixClassesname$ViewConfigurator.java
deleted file mode 100644
index d17dd0e..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/$prefixClassesname$ViewConfigurator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package $packageName$;
-
-import org.eclipse.emf.parsley.view.masterdetail.ViewConfigurator;
-
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-
-public class $prefixClassesname$ViewConfigurator extends ViewConfigurator {
-
- @Override
- public EObject getContainer() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public EReference getListFeature() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Boolean isEditable(){
-%if editableView
- return true;
-%else
- return false;
-%endif
- }
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$BindingFactory.java b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$BindingFactory.java
deleted file mode 100644
index a6b1fb3..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$BindingFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package $packageName$.internal.guice;
-
-import org.eclipse.emf.parsley.composite.ControlObservablePair;
-import org.eclipse.emf.parsley.composite.FormControlFactory;
-
-//import org.eclipse.emf.ecore.EStructuralFeature;
-//import org.eclipse.jface.databinding.swt.SWTObservables;
-//import org.eclipse.swt.SWT;
-//import org.eclipse.swt.widgets.DateTime;
-
-public class $prefixClassesname$BindingFactory extends EmfSwtBindingFactory {
-
- /*
- * Example: manage "date" fields with a date picker.
- *
- public ControlObservablePair control_$prefixClassesname$_date(EStructuralFeature feature) {
- DateTime dateTime= new DateTime(getParent(), SWT.DROP_DOWN);
- getToolkit().adapt(dateTime);
- return new ControlObservablePair(dateTime, SWTObservables.observeSelection(dateTime));
- }
- */
-}
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$ExecutableExtensionFactory.java b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$ExecutableExtensionFactory.java
deleted file mode 100644
index d65b9ca..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$ExecutableExtensionFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package $packageName$.internal.guice;
-
-import $packageName$.Activator;
-import org.eclipse.emf.parsley.EmfParsleyExtensionFactory;
-import org.eclipse.emf.parsley.EmfParsleyGuiceModule;
-
-import org.osgi.framework.Bundle;
-
-public class $prefixClassesname$ExecutableExtensionFactory extends
- EmfParsleyExtensionFactory {
-
- @Override
- protected Bundle getBundle() {
- return Activator.getDefault().getBundle();
- }
-
- @Override
- protected EmfParsleyGuiceModule getModule() {
- return new $prefixClassesname$Module(Activator.getDefault());
- }
-
-}
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$FeatureLabelProvider.java b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$FeatureLabelProvider.java
deleted file mode 100644
index f3ac4d5..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$FeatureLabelProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package $packageName$.internal.guice;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-import org.eclipse.emf.parsley.ui.provider.FormPropertyDescriptionProvider;
-
-public class $prefixClassesname$FeatureLabelProvider extends FeatureLabelProvider{
-
- /**
- *
- * @param feature
- * @return
- */
- public String text_$prefixClassesname$_code(EStructuralFeature feature) {
- // TODO Auto-generated method stub
- return "Code: ";
- }
-
- /**
- *
- * @param parent
- * @param feature
- * @return
- */
- public Label label_$prefixClassesname$_description(Composite parent, EStructuralFeature feature) {
- // TODO Auto-generated method stub
- return new Label(parent, SWT.NONE);
- }
-
-
-}
diff --git a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$Module.java b/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$Module.java
deleted file mode 100644
index a4f7a56..0000000
--- a/plugins/org.eclipse.emf.parsley.wizards/templates_3.4/viewtemplate/java/internal/guice/$prefixClassesname$Module.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package $packageName$.internal.guice;
-
-
-import $packageName$.$prefixClassesname$ViewConfigurator;
-import $packageName$.$prefixClassesname$CDOSessionManager;
-import org.eclipse.emf.parsley.cdo.CDOEmfParsleyModule;
-import org.eclipse.emf.parsley.cdo.CDOSessionManager;
-import org.eclipse.emf.parsley.view.masterdetail.ViewConfigurator;
-import org.eclipse.emf.parsley.composite.FormControlFactory;
-import org.eclipse.emf.parsley.ui.provider.FormPropertyDescriptionProvider;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-public class $prefixClassesname$Module extends CDOEmfParsleyModule {
-
- public $prefixClassesname$Module(AbstractUIPlugin plugin) {
- super(plugin);
- }
-
- public Class<? extends ViewConfigurator> bindViewConfigurator(){
- return $prefixClassesname$ViewConfigurator.class;
- }
-
- public Class<? extends CDOSessionManager> bindCDOSessionManager(){
- return $prefixClassesname$CDOSessionManager.class;
- }
-
- @Override
- public Class<? extends FeatureLabelProvider> bindFormFeatureLabelProvider() {
- return $prefixClassesname$FeatureLabelProvider.class;
- }
-
- @Override
- public Class<? extends EmfSwtBindingFactory> bindEmfSwtBindingFactory() {
- return $prefixClassesname$BindingFactory.class;
- }
-
-}
diff --git a/releng/org.eclipse.emf.parsley.parent/pom.xml b/releng/org.eclipse.emf.parsley.parent/pom.xml
index 85ea055..244a8a2 100644
--- a/releng/org.eclipse.emf.parsley.parent/pom.xml
+++ b/releng/org.eclipse.emf.parsley.parent/pom.xml
@@ -99,7 +99,7 @@
<!-- **/EmfParsleyViewFilesGenerator.java,**/EmfParsleyProjectFilesGenerator.java report massive code
duplication, but they're generated by Xtend and they are basically template generators;
runtime classes are currently not analyzed. -->
- <sonar.exclusions>file:**/src-gen/**,file:**/runtime/**,file:**/test/**,file:**/tests/**,file:**/example/**,file:**/examples/**,**/*GuiceModule.java,**/*Dsl*Module.java,**/*ParsleyModule.java,**/*Parsley*Activator.java,**/EmfParsleyViewFilesGenerator.java,**/EmfParsleyProjectFilesGenerator.java</sonar.exclusions>
+ <sonar.exclusions>file:**/src-gen/**,file:**/runtime/**,file:**/test/**,file:**/tests/**,file:**/example/**,file:**/examples/**,**/*GuiceModule.java,**/*Dsl*Module.java,**/*ParsleyModule.java,**/*Parsley*Activator.java,**/EmfParsleyViewFilesGenerator.java,**/EmfParsleyProjectFilesGenerator.java,**/EmfParsleyDslNewProjectFiles.java,**/*StandaloneSetup*.java,**/*ExtensionFactory*.java</sonar.exclusions>
<!-- see http://sonarqube.15.x6.nabble.com/sonar-issue-ignore-multicriteria-td5021722.html
and http://stackoverflow.com/questions/21825469/configure-sonar-sonar-issue-ignore-multicriteria-through-maven
diff --git a/tests/org.eclipse.emf.parsley.tests.swtbot/launches/EmfParsleyWizardsTests.launch b/tests/org.eclipse.emf.parsley.tests.swtbot/launches/EmfParsleyWizardsTests.launch
deleted file mode 100644
index 70181e8..0000000
--- a/tests/org.eclipse.emf.parsley.tests.swtbot/launches/EmfParsleyWizardsTests.launch
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
-<setAttribute key="additional_plugins">
-<setEntry value="org.eclipse.emf.parsley.tests.swtbot:0.1.0.qualifier:default:false"/>
-</setAttribute>
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="askclear" value="false"/>
-<booleanAttribute key="automaticAdd" value="true"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
-<booleanAttribute key="clearwslog" value="false"/>
-<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
-<booleanAttribute key="default" value="true"/>
-<stringAttribute key="deselected_workspace_plugins" value="ProvaView,ProvaWizard,it.rcpvision.cdo04.editor,it.rcpvision.cdo04.model,org.eclipse.emf.parsley.cdo,org.eclipse.emf.parsley.cdo.tests,org.eclipse.emf.parsley.cdoexample.masterdetail.table,org.eclipse.emf.parsley.cdoexample.masterdetail.tree,org.eclipse.emf.parsley.cdoexample.model,org.eclipse.emf.parsley.cdoexample.model.business,org.eclipse.emf.parsley.cdoexample.rcp,org.eclipse.emf.parsley.cdoexample.rcp.tests,org.eclipse.emf.parsley.tests.cdo.app,org.eclipse.emf.parsley.tests.cdo.model,org.eclipse.emf.parsley.tests.cdo.product,it.rcpvision.rcptutorial03.model.cdo"/>
-<stringAttribute key="featureDefaultLocation" value="workspace"/>
-<stringAttribute key="featurePluginResolution" value="workspace"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyWizardsTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.parsley.tests.EmfParsleyWizardsTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.parsley.tests.swtbot"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx384m -XX:MaxPermSize=256m -Dorg.eclipse.swt.internal.gtk.cairoGraphics=false -Dorg.eclipse.swtbot.search.timeout=100000"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product" value="org.eclipse.platform.ide"/>
-<setAttribute key="selected_features">
-<setEntry value="org.eclipse.emf.parsley.tests.swtbot.feature:default"/>
-</setAttribute>
-<stringAttribute key="selected_target_plugins" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.google.collect@default:default,com.google.guava@default:default,com.google.inject@default:default,com.ibm.icu@default:default,com.jcraft.jsch@default:default,com.sun.jna@default:default,com.sun.syndication@default:default,com.thoughtworks.xstream@default:default,de.itemis.xtext.antlr@default:default,java_cup.runtime@default:default,javax.activation@default:default,javax.inject@default:default,javax.mail@default:default,javax.persistence@default:default,javax.servlet.jsp@default:default,javax.servlet@default:default,javax.wsdl@default:default,javax.xml.bind@default:default,javax.xml.rpc@default:default,javax.xml.soap@default:default,javax.xml.stream@default:default,javax.xml@default:default,lpg.runtime.java@default:default,net.sourceforge.texlipse@default:default,org.antlr.generator@default:default,org.antlr.runtime@default:default,org.apache.ant@default:default,org.apache.axis@default:default,org.apache.batik.bridge@default:default,org.apache.batik.css@default:default,org.apache.batik.dom.svg@default:default,org.apache.batik.dom@default:default,org.apache.batik.ext.awt@default:default,org.apache.batik.parser@default:default,org.apache.batik.pdf@default:default,org.apache.batik.svggen@default:default,org.apache.batik.transcoder@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.batik.xml@default:default,org.apache.bcel@default:default,org.apache.commons.cli@default:default,org.apache.commons.codec@default:default,org.apache.commons.discovery@default:default,org.apache.commons.el@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.io@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging*1.0.4.v201101211617@default:default,org.apache.commons.logging*1.1.1.v201005080502@default:default,org.apache.commons.logging*1.1.1.v201101211721@default:default,org.apache.derby@default:default,org.apache.jasper@default:default,org.apache.log4j@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.apache.lucene.highlighter@default:default,org.apache.lucene.memory@default:default,org.apache.lucene.misc@default:default,org.apache.lucene.queries@default:default,org.apache.lucene.snowball@default:default,org.apache.lucene.spellchecker@default:default,org.apache.lucene@default:default,org.apache.ws.commons.util@default:default,org.apache.xalan@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.apache.xmlrpc@default:default,org.easymock@default:default,org.eclipse.acceleo.common@default:default,org.eclipse.acceleo.engine@default:default,org.eclipse.acceleo.model@default:default,org.eclipse.acceleo.profiler@default:default,org.eclipse.amalgam.discovery.core@default:default,org.eclipse.amalgam.discovery.modeling@default:default,org.eclipse.amalgam.discovery.ui@default:default,org.eclipse.ant.core@default:default,org.eclipse.ant.launching@default:default,org.eclipse.ant.ui@default:default,org.eclipse.cdt.core@default:default,org.eclipse.cdt.ui@default:default,org.eclipse.compare.core@default:default,org.eclipse.compare@default:default,org.eclipse.core.boot@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.linux.x86@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.linux.x86@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.cvs@default:default,org.eclipse.debug.core@default:default,org.eclipse.debug.ui@default:default,org.eclipse.draw2d.doc.isv@default:default,org.eclipse.draw2d@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.egit.core@default:default,org.eclipse.egit.doc@default:default,org.eclipse.egit.ui@default:default,org.eclipse.egit@default:default,org.eclipse.emf.ant@default:default,org.eclipse.emf.cheatsheets@default:default,org.eclipse.emf.codegen.ecore.ui@default:default,org.eclipse.emf.codegen.ecore@default:default,org.eclipse.emf.codegen.ui@default:default,org.eclipse.emf.codegen@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.compare.diff.edit@default:default,org.eclipse.emf.compare.diff@default:default,org.eclipse.emf.compare.doc@default:default,org.eclipse.emf.compare.epatch@default:default,org.eclipse.emf.compare.match@default:default,org.eclipse.emf.compare.ui.capabilities@default:default,org.eclipse.emf.compare.ui@default:default,org.eclipse.emf.compare@default:default,org.eclipse.emf.converter@default:default,org.eclipse.emf.databinding.edit@default:default,org.eclipse.emf.databinding@default:default,org.eclipse.emf.doc@default:default,org.eclipse.emf.ecore.change.edit@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.emf.ecore.editor@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.ecoretools.diagram.ui.outline@default:default,org.eclipse.emf.ecoretools.diagram@default:default,org.eclipse.emf.ecoretools.doc@default:default,org.eclipse.emf.ecoretools.filters@default:default,org.eclipse.emf.ecoretools.properties@default:default,org.eclipse.emf.ecoretools.tabbedproperties@default:default,org.eclipse.emf.ecoretools@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.emf.edit@default:default,org.eclipse.emf.eef.codegen.ecore@default:default,org.eclipse.emf.eef.codegen@default:default,org.eclipse.emf.eef.components.edit@default:default,org.eclipse.emf.eef.components@default:default,org.eclipse.emf.eef.eefgen@default:default,org.eclipse.emf.eef.mapping.edit@default:default,org.eclipse.emf.eef.mapping@default:default,org.eclipse.emf.eef.runtime@default:default,org.eclipse.emf.eef.views.edit@default:default,org.eclipse.emf.eef.views@default:default,org.eclipse.emf.example.installer@default:default,org.eclipse.emf.exporter@default:default,org.eclipse.emf.generic.editor@default:default,org.eclipse.emf.importer.ecore@default:default,org.eclipse.emf.importer.java@default:default,org.eclipse.emf.importer.rose@default:default,org.eclipse.emf.importer@default:default,org.eclipse.emf.mapping.ecore.editor@default:default,org.eclipse.emf.mapping.ecore2ecore.editor@default:default,org.eclipse.emf.mapping.ecore2ecore@default:default,org.eclipse.emf.mapping.ecore2xml.ui@default:default,org.eclipse.emf.mapping.ecore2xml@default:default,org.eclipse.emf.mapping.ecore@default:default,org.eclipse.emf.mapping.ui@default:default,org.eclipse.emf.mapping.xsd2ecore.editor@default:default,org.eclipse.emf.mapping.xsd2ecore@default:default,org.eclipse.emf.mapping@default:default,org.eclipse.emf.mwe.activities@default:default,org.eclipse.emf.mwe.core@default:default,org.eclipse.emf.mwe.doc@default:default,org.eclipse.emf.mwe.ui.simpleEditor@default:default,org.eclipse.emf.mwe.ui@default:default,org.eclipse.emf.mwe.utils@default:default,org.eclipse.emf.mwe2.language.ui@default:default,org.eclipse.emf.mwe2.language@default:default,org.eclipse.emf.mwe2.launch@default:default,org.eclipse.emf.mwe2.lib@default:default,org.eclipse.emf.mwe2.runtime@default:default,org.eclipse.emf.query.doc@default:default,org.eclipse.emf.query.examples@default:default,org.eclipse.emf.query.ocl@default:default,org.eclipse.emf.query@default:default,org.eclipse.emf.transaction.doc@default:default,org.eclipse.emf.transaction.examples@default:default,org.eclipse.emf.transaction.ui@default:default,org.eclipse.emf.transaction@default:default,org.eclipse.emf.validation.doc@default:default,org.eclipse.emf.validation.examples@default:default,org.eclipse.emf.validation.ocl@default:default,org.eclipse.emf.validation.ui.ide@default:default,org.eclipse.emf.validation.ui@default:default,org.eclipse.emf.validation@default:default,org.eclipse.emf.workspace.doc@default:default,org.eclipse.emf.workspace.ui@default:default,org.eclipse.emf.workspace@default:default,org.eclipse.emf@default:default,org.eclipse.epp.mpc.core@default:default,org.eclipse.epp.mpc.help.ui@default:default,org.eclipse.epp.mpc.ui@default:default,org.eclipse.epp.package.modeling@default:default,org.eclipse.epp.usagedata.gathering@default:default,org.eclipse.epp.usagedata.recording@default:default,org.eclipse.epp.usagedata.ui@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.equinox.launcher.gtk.linux.x86@default:false,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.equinox.p2.discovery.compatibility@default:default,org.eclipse.equinox.p2.discovery@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.equinox.p2.publisher.eclipse@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.transport.ecf@default:default,org.eclipse.equinox.p2.ui.discovery@default:default,org.eclipse.equinox.p2.ui.importexport@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.util@default:default,org.eclipse.gef@default:default,org.eclipse.gmf.runtime.common.core@default:default,org.eclipse.gmf.runtime.common.ui.action.ide@default:default,org.eclipse.gmf.runtime.common.ui.action@default:default,org.eclipse.gmf.runtime.common.ui.printing.win32@default:false,org.eclipse.gmf.runtime.common.ui.printing@default:default,org.eclipse.gmf.runtime.common.ui.services.action@default:default,org.eclipse.gmf.runtime.common.ui.services.properties@default:default,org.eclipse.gmf.runtime.common.ui.services@default:default,org.eclipse.gmf.runtime.common.ui@default:default,org.eclipse.gmf.runtime.diagram.core@default:default,org.eclipse.gmf.runtime.diagram.ui.actions@default:default,org.eclipse.gmf.runtime.diagram.ui.printing.render@default:default,org.eclipse.gmf.runtime.diagram.ui.printing@default:default,org.eclipse.gmf.runtime.diagram.ui.properties@default:default,org.eclipse.gmf.runtime.diagram.ui.providers.ide@default:default,org.eclipse.gmf.runtime.diagram.ui.providers@default:default,org.eclipse.gmf.runtime.diagram.ui.render@default:default,org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide@default:default,org.eclipse.gmf.runtime.diagram.ui.resources.editor@default:default,org.eclipse.gmf.runtime.diagram.ui@default:default,org.eclipse.gmf.runtime.draw2d.ui.render.awt@default:default,org.eclipse.gmf.runtime.draw2d.ui.render@default:default,org.eclipse.gmf.runtime.draw2d.ui@default:default,org.eclipse.gmf.runtime.emf.clipboard.core@default:default,org.eclipse.gmf.runtime.emf.commands.core@default:default,org.eclipse.gmf.runtime.emf.core@default:default,org.eclipse.gmf.runtime.emf.type.core@default:default,org.eclipse.gmf.runtime.emf.ui.properties@default:default,org.eclipse.gmf.runtime.emf.ui@default:default,org.eclipse.gmf.runtime.gef.ui@default:default,org.eclipse.gmf.runtime.notation@default:default,org.eclipse.help.appserver@default:default,org.eclipse.help.base@default:default,org.eclipse.help.ui@default:default,org.eclipse.help.webapp@default:default,org.eclipse.help@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.jdt.core@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.jdt.doc.isv@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.jdt.junit4.runtime@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.jdt@default:default,org.eclipse.jem.proxy@default:default,org.eclipse.jem.util@default:default,org.eclipse.jem.workbench@default:default,org.eclipse.jem@default:default,org.eclipse.jet.core@default:default,org.eclipse.jet.doc@default:default,org.eclipse.jet.source@default:default,org.eclipse.jet.ui@default:default,org.eclipse.jet.uml2@default:false,org.eclipse.jet@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.jgit@default:default,org.eclipse.jsch.core@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.jst.common.annotations.controller@default:default,org.eclipse.jst.common.annotations.core@default:default,org.eclipse.jst.common.frameworks@default:default,org.eclipse.jst.common.project.facet.core@default:default,org.eclipse.jst.j2ee.core@default:default,org.eclipse.jst.j2ee.jca@default:default,org.eclipse.jst.j2ee.web@default:default,org.eclipse.jst.j2ee@default:default,org.eclipse.jst.jee@default:default,org.eclipse.jst.jsf.common.runtime@default:default,org.eclipse.jst.jsf.common.ui@default:default,org.eclipse.jst.jsf.common@default:default,org.eclipse.jst.jsf.core@default:default,org.eclipse.jst.jsf.facesconfig@default:default,org.eclipse.jst.jsp.core@default:default,org.eclipse.jst.jsp.ui@default:default,org.eclipse.jst.pagedesigner.jsf.ui@default:default,org.eclipse.jst.pagedesigner.jsp.core@default:default,org.eclipse.jst.pagedesigner@default:default,org.eclipse.jst.server.core@default:default,org.eclipse.linuxtools.changelog.core@default:default,org.eclipse.linuxtools.changelog.cparser@default:false,org.eclipse.linuxtools.changelog.doc@default:default,org.eclipse.linuxtools.changelog.parsers.java@default:false,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.mylyn.commons.core@default:default,org.eclipse.mylyn.commons.identity@default:default,org.eclipse.mylyn.commons.net@default:default,org.eclipse.mylyn.commons.repositories@default:default,org.eclipse.mylyn.commons.screenshots@default:default,org.eclipse.mylyn.commons.ui@default:default,org.eclipse.mylyn.context.core@default:default,org.eclipse.mylyn.discovery.core@default:default,org.eclipse.mylyn.discovery.ui@default:default,org.eclipse.mylyn.monitor.core@default:default,org.eclipse.mylyn.monitor.ui@default:default,org.eclipse.mylyn.tasks.bugs@default:default,org.eclipse.mylyn.tasks.core@default:default,org.eclipse.mylyn.tasks.ui@default:default,org.eclipse.mylyn.wikitext.core@default:default,org.eclipse.mylyn.wikitext.mediawiki.core@default:default,org.eclipse.net4j.jms.api@default:default,org.eclipse.ocl.doc@default:default,org.eclipse.ocl.ecore.edit@default:default,org.eclipse.ocl.ecore@default:default,org.eclipse.ocl.edit@default:default,org.eclipse.ocl.uml.edit@default:default,org.eclipse.ocl.uml@default:default,org.eclipse.ocl@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.pde.build@default:default,org.eclipse.pde.core@default:default,org.eclipse.pde.doc.user@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.pde.launching@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.pde.ui@default:default,org.eclipse.pde@default:default,org.eclipse.platform.doc.isv@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.platform@default:default,org.eclipse.rcp@default:default,org.eclipse.sdk@default:default,org.eclipse.search@default:default,org.eclipse.swt.gtk.linux.x86@default:false,org.eclipse.swt@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.swtbot.eclipse.core@default:default,org.eclipse.swtbot.eclipse.finder@default:default,org.eclipse.swtbot.eclipse.gef.finder@default:default,org.eclipse.swtbot.eclipse.junit3.headless@default:default,org.eclipse.swtbot.eclipse.junit4.headless@default:default,org.eclipse.swtbot.eclipse.spy@default:default,org.eclipse.swtbot.eclipse.ui@default:default,org.eclipse.swtbot.forms.finder@default:default,org.eclipse.swtbot.go@default:default,org.eclipse.swtbot.junit4_x@default:default,org.eclipse.swtbot.swt.finder@default:default,org.eclipse.team.core@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.team.ui@default:default,org.eclipse.text@default:default,org.eclipse.ui.browser@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.console@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.net@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.eclipse.uml2.codegen.ecore.ui@default:default,org.eclipse.uml2.codegen.ecore@default:default,org.eclipse.uml2.common.edit@default:default,org.eclipse.uml2.common@default:default,org.eclipse.uml2.doc@default:default,org.eclipse.uml2.examples.uml.ui@default:default,org.eclipse.uml2.examples@default:default,org.eclipse.uml2.uml.ecore.exporter@default:default,org.eclipse.uml2.uml.ecore.importer@default:default,org.eclipse.uml2.uml.edit@default:default,org.eclipse.uml2.uml.editor@default:default,org.eclipse.uml2.uml.resources@default:default,org.eclipse.uml2.uml@default:default,org.eclipse.uml2@default:default,org.eclipse.update.configurator@3:true,org.eclipse.update.core.linux@default:false,org.eclipse.update.core@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.update.ui@default:default,org.eclipse.wb.core.databinding.xml@default:default,org.eclipse.wb.core.databinding@default:default,org.eclipse.wb.core.lib@default:default,org.eclipse.wb.core.ui@default:default,org.eclipse.wb.core.xml@default:default,org.eclipse.wb.core@default:default,org.eclipse.wb.discovery.core@default:default,org.eclipse.wb.discovery.ui@default:default,org.eclipse.wb.doc.user@default:default,org.eclipse.wb.jdt.fragment@default:false,org.eclipse.wb.layout.group@default:default,org.eclipse.wb.os.linux@default:default,org.eclipse.wb.os@default:default,org.eclipse.wb.rcp.SWT_AWT@default:default,org.eclipse.wb.rcp.databinding.emf@default:default,org.eclipse.wb.rcp.databinding.xwt@default:default,org.eclipse.wb.rcp.databinding@default:default,org.eclipse.wb.rcp.nebula@default:default,org.eclipse.wb.rcp.swing2swt@default:default,org.eclipse.wb.rcp@default:default,org.eclipse.wb.runtime.lib@default:default,org.eclipse.wb.runtime@default:default,org.eclipse.wb.swing.FormLayout.lib@default:default,org.eclipse.wb.swing.FormLayout@default:default,org.eclipse.wb.swing.MigLayout.lib@default:default,org.eclipse.wb.swing.MigLayout@default:default,org.eclipse.wb.swing.databinding@default:default,org.eclipse.wb.swing.java6@default:default,org.eclipse.wb.swing.jsr296@default:default,org.eclipse.wb.swing@default:default,org.eclipse.wb.swt.widgets.baseline@default:default,org.eclipse.wb.swt@default:default,org.eclipse.wb.xwt@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.wst.common.modulecore.ui@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.wst.css.core@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.wst.dtd.ui.infopop@default:default,org.eclipse.wst.dtd.ui@default:default,org.eclipse.wst.dtdeditor.doc.user@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.wst.server.core@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.wst.validation@default:default,org.eclipse.wst.web@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.wst.xml.xpath2.processor.doc.user@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.wst.xml.xpath2.wtptypes@default:default,org.eclipse.wst.xml.xpath2@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.wst.xsd.core@default:default,org.eclipse.wst.xsd.ui@default:default,org.eclipse.wst.xsdeditor.doc.user@default:default,org.eclipse.wst.xsl.core@default:default,org.eclipse.wst.xsl.debug.ui@default:default,org.eclipse.wst.xsl.doc@default:default,org.eclipse.wst.xsl.exslt.core@default:default,org.eclipse.wst.xsl.exslt.ui@default:default,org.eclipse.wst.xsl.jaxp.debug.ui@default:default,org.eclipse.wst.xsl.jaxp.debug@default:default,org.eclipse.wst.xsl.jaxp.launching@default:default,org.eclipse.wst.xsl.launching@default:default,org.eclipse.wst.xsl.saxon@default:default,org.eclipse.wst.xsl.ui@default:default,org.eclipse.wst.xsl.xalan@default:default,org.eclipse.wst.xsl@default:default,org.eclipse.xpand.activities@default:default,org.eclipse.xpand.doc@default:default,org.eclipse.xpand.examples@default:default,org.eclipse.xpand.incremental@default:default,org.eclipse.xpand.support.cdt@default:default,org.eclipse.xpand.ui@default:default,org.eclipse.xpand@default:default,org.eclipse.xsd.cheatsheets@default:default,org.eclipse.xsd.doc@default:default,org.eclipse.xsd.ecore.converter@default:default,org.eclipse.xsd.ecore.exporter@default:default,org.eclipse.xsd.ecore.importer@default:default,org.eclipse.xsd.edit@default:default,org.eclipse.xsd.editor@default:default,org.eclipse.xsd.example.installer@default:default,org.eclipse.xsd.mapping.editor@default:default,org.eclipse.xsd.mapping@default:default,org.eclipse.xsd@default:default,org.eclipse.xtend.backend.compiler@default:default,org.eclipse.xtend.backend.ui@default:default,org.eclipse.xtend.backend.uml2types@default:default,org.eclipse.xtend.backend.xsdtypes@default:default,org.eclipse.xtend.backend@default:default,org.eclipse.xtend.check.ui@default:default,org.eclipse.xtend.middleend.xpand@default:default,org.eclipse.xtend.middleend.xtend@default:default,org.eclipse.xtend.profiler@default:default,org.eclipse.xtend.shared.ui@default:default,org.eclipse.xtend.typesystem.emf.ui@default:default,org.eclipse.xtend.typesystem.emf@default:default,org.eclipse.xtend.typesystem.uml2.ui@default:default,org.eclipse.xtend.typesystem.uml2@default:default,org.eclipse.xtend.typesystem.xsd.ui@default:default,org.eclipse.xtend.typesystem.xsd@default:default,org.eclipse.xtend.ui@default:default,org.eclipse.xtend.util.stdlib@default:default,org.eclipse.xtend2.lib@default:default,org.eclipse.xtend@default:default,org.eclipse.xtext.activities@default:default,org.eclipse.xtext.builder@default:default,org.eclipse.xtext.common.types.shared@default:default,org.eclipse.xtext.common.types.ui@default:default,org.eclipse.xtext.common.types@default:default,org.eclipse.xtext.doc@default:default,org.eclipse.xtext.ecore@default:default,org.eclipse.xtext.generator@default:default,org.eclipse.xtext.junit4@default:default,org.eclipse.xtext.junit@default:default,org.eclipse.xtext.logging@default:false,org.eclipse.xtext.purexbase.ui@default:default,org.eclipse.xtext.purexbase@default:default,org.eclipse.xtext.ui.codetemplates.ui@default:default,org.eclipse.xtext.ui.codetemplates@default:default,org.eclipse.xtext.ui.ecore@default:default,org.eclipse.xtext.ui.junit@default:default,org.eclipse.xtext.ui.shared@default:default,org.eclipse.xtext.ui@default:default,org.eclipse.xtext.util@default:default,org.eclipse.xtext.xbase.junit@default:default,org.eclipse.xtext.xbase.lib@default:default,org.eclipse.xtext.xbase.ui@default:default,org.eclipse.xtext.xbase@default:default,org.eclipse.xtext.xtend2.lib@default:default,org.eclipse.xtext.xtend2.ui@default:default,org.eclipse.xtext.xtend2@default:default,org.eclipse.xtext.xtext.ui.examples@default:default,org.eclipse.xtext.xtext.ui.graph@default:default,org.eclipse.xtext.xtext.ui@default:default,org.eclipse.xtext@default:default,org.h2@default:default,org.hamcrest.core@default:default,org.hamcrest.integration@default:default,org.hamcrest.library@default:default,org.hamcrest.text@default:default,org.hamcrest@default:default,org.jdom@default:default,org.jdom_jaxen@default:default,org.joda.time@default:default,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.junit4@default:default,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default,org.sat4j.core@default:default,org.sat4j.pb@default:default,org.slf4j.api@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.parsley.tests.swtbot@default:default,org.eclipse.emf.parsley.wizards@default:default,org.eclipse.emf.parsley@default:default,org.eclipse.emf.parsley.examples.library.edit@default:default,org.eclipse.emf.parsley.examples.library.editor@default:default,org.eclipse.emf.parsley.examples.library@default:default,org.eclipse.swtbot.examples@default:default,org.eclipse.swtbot.swt.finder@default:default,org.eclipse.xtext.example.fowlerdsl.ui@default:default,org.eclipse.xtext.example.fowlerdsl@default:default"/>
-<booleanAttribute key="show_selected_only" value="true"/>
-<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useCustomFeatures" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="false"/>
-<booleanAttribute key="useProduct" value="true"/>
-</launchConfiguration>
diff --git a/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyWizardsTests.java b/tests/org.eclipse.emf.parsley.tests.swtbot/old/EmfParsleyWizardsTests.java
similarity index 100%
rename from tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyWizardsTests.java
rename to tests/org.eclipse.emf.parsley.tests.swtbot/old/EmfParsleyWizardsTests.java
diff --git a/tests/org.eclipse.emf.parsley.tests.swtbot/plugin.xml b/tests/org.eclipse.emf.parsley.tests.swtbot/plugin.xml
index cf26fb4..412a053 100644
--- a/tests/org.eclipse.emf.parsley.tests.swtbot/plugin.xml
+++ b/tests/org.eclipse.emf.parsley.tests.swtbot/plugin.xml
@@ -1,20 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="org.eclipse.emf.parsley.tests.factories.NoMouseEventExecutableExtensionFactory:org.eclipse.emf.parsley.editors.EmfTreeEditor"
- contributorClass="org.eclipse.emf.parsley.tests.factories.NoMouseEventExecutableExtensionFactory:org.eclipse.emf.parsley.editors.EmfParsleyEditorActionBarContributor"
- default="false"
- id="org.eclipse.emf.parsley.noMouseEvents"
- name="EMF Tree Editor No Mouse Events">
- <contentTypeBinding
- contentTypeId="org.eclipse.emf.ecore.xmi">
- </contentTypeBinding>
- </editor>
- </extension>
-
<extension
point="org.eclipse.ui.editors">
<editor
diff --git a/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyDslWizardsTests.xtend b/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyDslWizardsTests.xtend
index 37728ed..ef87ea3 100644
--- a/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyDslWizardsTests.xtend
+++ b/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyDslWizardsTests.xtend
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.emf.parsley.tests
+import org.eclipse.emf.parsley.wizards.NewEmfParsleyProjectSupport
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner
import org.junit.Test
import org.junit.runner.RunWith
@@ -27,81 +28,88 @@
val ONSELECTION_TABLE_FORM_TEMPLATE = "On selection Table Form View"
val ONSELECTION_FORM_TEMPLATE = "On selection Form View"
+ new() {
+ // just to avoid code coverage of protected constructor
+ new NewEmfParsleyProjectSupport() {
+
+ };
+ }
+
@Test
def canCreateDslProjectWithWizard() {
createDslProjectWithWizard
}
-
+
@Test
def canCreateDslProjectWithWizardAndTreeFormTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TREE_FORM_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TREE_FORM_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
-
+
@Test
def canCreateDslProjectWithWizardAndTreeTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TREE_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TREE_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
-
+
@Test
def canCreateDslProjectWithWizardAndTableFormTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TABLE_FORM_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TABLE_FORM_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
-
+
@Test
def canCreateDslProjectWithWizardAndTableTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TABLE_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, TABLE_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
-
+
@Test
def canCreateDslProjectWithWizardAndOnselectionTreeTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TREE_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TREE_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
@Test
def canCreateDslProjectWithWizardAndOnselectionTreeFormTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TREE_FORM_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TREE_FORM_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
-
+
@Test
def canCreateDslProjectWithWizardAndOnselectionTableTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TABLE_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TABLE_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
-
+
@Test
def canCreateDslProjectWithWizardAndOnselectionFormTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_FORM_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_FORM_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
@Test
def canCreateDslProjectWithWizardAndOnselectionTableFormTemplate() {
- createProjectWithTemplateInWorkspace(org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
- org.eclipse.emf.parsley.tests.EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TABLE_FORM_TEMPLATE);
+ createProjectWithTemplateInWorkspace(EmfParsleySWTBotAbstractTests.EMF_PARSLEY_CATEGORY,
+ EmfParsleySWTBotAbstractTests.NEW_EMF_PARSLEY_DSL_PROJECT, TEST_PROJ_NAME, ONSELECTION_TABLE_FORM_TEMPLATE);
//bot.sleep(300000);
assertNoErrorsInProjectAfterAutoBuild();
}
-
+
}
diff --git a/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyTestsSuite.java b/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyTestsSuite.java
index fd12b67..dd9c5da 100644
--- a/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyTestsSuite.java
+++ b/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/EmfParsleyTestsSuite.java
@@ -28,7 +28,6 @@
EmfParsleyFormTests.class,
EmfParsleyDialogTests.class,
EmfParsleyEditingStrategyTests.class,
- EmfParsleyWizardsTests.class,
EmfParsleyExamplesWizardsTests.class,
EmfParsleyDslWizardsTests.class,
EmfParsleyDslEditorTests.class
diff --git a/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/factories/NoMouseEventExecutableExtensionFactory.java b/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/factories/NoMouseEventExecutableExtensionFactory.java
deleted file mode 100644
index 7354fed..0000000
--- a/tests/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/factories/NoMouseEventExecutableExtensionFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Lorenzo Bettini - Initial contribution and API
- *******************************************************************************/
-package org.eclipse.emf.parsley.tests.factories;
-
-import org.eclipse.emf.parsley.EmfParsleyGuiceModule;
-import org.eclipse.emf.parsley.listeners.IEditorMouseListener;
-import org.eclipse.emf.parsley.listeners.NoOpMouseAdapter;
-import org.eclipse.emf.parsley.tests.EmfParsleySwtBotTestsActivator;
-
-/**
- * Uses a mouse adapter that does not react to mouse events.
- *
- * @author Lorenzo Bettini
- *
- */
-public class NoMouseEventExecutableExtensionFactory extends
- EmfParsleyTestsExecutableExtensionFactory {
-
- @Override
- protected EmfParsleyGuiceModule getModule() {
- return new EmfParsleyGuiceModule(EmfParsleySwtBotTestsActivator.getDefault()) {
-
- @Override
- public Class<? extends IEditorMouseListener> bindIEditorMouseListener() {
- return NoOpMouseAdapter.class;
- }
-
- };
- }
-
-}
diff --git a/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/EditingDomainFinderTest.xtend b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/EditingDomainFinderTest.xtend
new file mode 100644
index 0000000..d07ccae
--- /dev/null
+++ b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/EditingDomainFinderTest.xtend
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lorenzo Bettini - Initial contribution and API
+ *******************************************************************************/
+package org.eclipse.emf.parsley.tests
+
+import com.google.inject.Inject
+import org.eclipse.emf.common.util.URI
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.emf.edit.domain.EditingDomain
+import org.eclipse.emf.parsley.edit.EditingDomainFinder
+import org.eclipse.emf.parsley.junit4.AbstractEmfParsleyTest
+import org.eclipse.emf.parsley.resource.ResourceLoader
+import org.eclipse.emf.parsley.tests.models.testmodels.ClassWithName
+import org.eclipse.emf.parsley.tests.util.EmfParsleyFixturesAndUtilitiesTestRule
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+
+import static extension org.junit.Assert.*
+import org.eclipse.emf.ecore.resource.impl.ResourceImpl
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
+
+class EditingDomainFinderTest extends AbstractEmfParsleyTest {
+
+ @Rule public extension EmfParsleyFixturesAndUtilitiesTestRule fixtures = new EmfParsleyFixturesAndUtilitiesTestRule()
+
+ @Inject var EditingDomainFinder editingDomainFinder
+
+ @Inject var EditingDomain editingDomain
+
+ @Before
+ def void setupFinder() {
+ getOrCreateInjector.injectMembers(this)
+ }
+
+ @Test def void testNotEObject() {
+ editingDomainFinder.getEditingDomainFor("aString").assertNull
+ }
+
+ @Test def void testEObjectWithoutResource() {
+ editingDomainFinder.getEditingDomainFor(classForControlsInstance).assertNull
+ }
+
+ @Test def void testEObjectInResource() {
+ val resource = loadResourceWithContents()
+ editingDomain.assertSame(editingDomainFinder.getEditingDomainFor(classWithName(resource)))
+ }
+
+ @Test def void testResource() {
+ val resource = loadResourceWithContents()
+ editingDomain.assertSame(editingDomainFinder.getEditingDomainFor(resource))
+ }
+
+ @Test def void testResourceNotInResourceSet() {
+ val resource = new ResourceImpl
+ editingDomainFinder.getEditingDomainFor(resource).assertNull
+ }
+
+ @Test def void testResourceSetNotInEditingDomain() {
+ val resource = new ResourceImpl => [ res |
+ new ResourceSetImpl => [
+ resources += res
+ ]
+ ]
+ resource.resourceSet.assertNotNull
+ editingDomainFinder.getEditingDomainFor(resource).assertNull
+ }
+
+ def private loadResourceWithContents() {
+ val injector = getOrCreateInjector
+ val resourceSet = editingDomain.resourceSet
+
+ resourceSet.setupResouceFactory
+
+ val resource = injector.getInstance(ResourceLoader).getResource(editingDomain,
+ URI.createURI("http:///My.testmodels")).resource
+ resource.assertNotNull
+ resource.contents += createClassWithName("test")
+ resource
+ }
+
+ def private classWithName(Resource resource) {
+ resource.contents.head as ClassWithName
+ }
+
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/EmfParsleyAllTests.java b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/EmfParsleyAllTests.java
index 7f4c197..269b09c 100644
--- a/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/EmfParsleyAllTests.java
+++ b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/EmfParsleyAllTests.java
@@ -25,6 +25,7 @@
ResourceLoaderTest.class,
ResourceSaveStrategyTest.class,
EditingDomainTest.class,
+ EditingDomainFinderTest.class,
AdapterFactoryHelperTest.class,
ViewerContentProviderTest.class,
TableViewerContentProviderTest.class,