├── .gitignore ├── .project ├── README.md ├── screenshot-diagram+text.png ├── screenshot-diagram.png └── xtext-support-parent ├── .project ├── examples ├── org.eclipse.sirius.example.fowlerdsl.design │ ├── .classpath │ ├── .project │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.acceleo │ ├── build.properties │ ├── description │ │ └── fowlerdsl.odesign │ ├── icons │ │ ├── .directory │ │ ├── Association.gif │ │ ├── CallOperationAction.gif │ │ ├── Operation.gif │ │ ├── SignalEvent.gif │ │ ├── State.gif │ │ └── StateMachine.gif │ ├── plugin.xml │ └── src │ │ └── org │ │ └── eclipse │ │ └── sirius │ │ └── example │ │ └── fowlerdsl │ │ └── design │ │ ├── Activator.java │ │ ├── OpenEmbeddedEditor.java │ │ └── service │ │ └── StatemachineServices.java ├── org.eclipse.sirius.example.fowlerdsl.xtextwidget │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── plugin.xml │ └── src │ │ └── org │ │ └── eclipse │ │ └── sirius │ │ └── example │ │ └── fowlerdsl │ │ └── xtextwidget │ │ ├── XtextPartialViewerController.java │ │ ├── XtextPartialViewerLifecycleManager.java │ │ ├── XtextPartialViewerLifecycleManagerProvider.java │ │ └── XtextPartialViewerWidget.java ├── org.eclipse.xtext.example.fowlerdsl.edit │ ├── .classpath │ ├── .project │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── icons │ │ └── full │ │ │ └── obj16 │ │ │ ├── .directory │ │ │ ├── Command.gif │ │ │ ├── Event.gif │ │ │ ├── State.gif │ │ │ ├── StateMachine.gif │ │ │ ├── Statemachine.gif │ │ │ └── Transition.gif │ ├── plugin.properties │ ├── plugin.xml │ └── src-gen │ │ └── org │ │ └── eclipse │ │ └── xtext │ │ └── example │ │ └── fowlerdsl │ │ └── statemachine │ │ └── provider │ │ ├── CommandItemProvider.java │ │ ├── EventItemProvider.java │ │ ├── StateItemProvider.java │ │ ├── StatemachineEditPlugin.java │ │ ├── StatemachineItemProvider.java │ │ ├── StatemachineItemProviderAdapterFactory.java │ │ └── TransitionItemProvider.java ├── org.eclipse.xtext.example.fowlerdsl.ui │ ├── .classpath │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.core.runtime.prefs │ │ └── org.eclipse.jdt.core.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── plugin.xml │ ├── plugin.xml_gen │ ├── src-gen │ │ └── org │ │ │ └── eclipse │ │ │ └── xtext │ │ │ └── example │ │ │ └── fowlerdsl │ │ │ └── ui │ │ │ ├── AbstractStatemachineUiModule.java │ │ │ ├── StatemachineExecutableExtensionFactory.java │ │ │ ├── contentassist │ │ │ ├── AbstractStatemachineProposalProvider.java │ │ │ └── antlr │ │ │ │ ├── PartialStatemachineContentAssistParser.java │ │ │ │ ├── StatemachineParser.java │ │ │ │ └── internal │ │ │ │ ├── InternalStatemachine.g │ │ │ │ ├── InternalStatemachine.tokens │ │ │ │ ├── InternalStatemachineLexer.java │ │ │ │ └── InternalStatemachineParser.java │ │ │ └── internal │ │ │ └── StatemachineActivator.java │ ├── src │ │ └── org │ │ │ └── eclipse │ │ │ └── xtext │ │ │ └── example │ │ │ └── fowlerdsl │ │ │ └── ui │ │ │ ├── StatemachineUiModule.java │ │ │ ├── contentassist │ │ │ └── StatemachineProposalProvider.xtend │ │ │ ├── findrefs │ │ │ └── StatemachineReferenceFinder.xtend │ │ │ ├── labeling │ │ │ ├── StatemachineDescriptionLabelProvider.xtend │ │ │ └── StatemachineLabelProvider.xtend │ │ │ ├── outline │ │ │ └── StatemachineOutlineTreeProvider.xtend │ │ │ ├── quickfix │ │ │ └── StatemachineQuickfixProvider.xtend │ │ │ └── rename │ │ │ ├── StatemachineDependentElementsCalculator.xtend │ │ │ └── StatemachineReferenceUpdaterDispatcher.xtend │ └── xtend-gen │ │ └── org │ │ └── eclipse │ │ └── xtext │ │ └── example │ │ └── fowlerdsl │ │ └── ui │ │ ├── contentassist │ │ └── .gitignore │ │ ├── findrefs │ │ ├── .StatemachineReferenceFinder.java._trace │ │ ├── .StatemachineReferenceFinder.xtendbin │ │ └── StatemachineReferenceFinder.java │ │ ├── labeling │ │ └── .gitignore │ │ ├── outline │ │ └── .gitignore │ │ ├── quickfix │ │ └── .gitignore │ │ └── rename │ │ ├── .StatemachineDependentElementsCalculator.java._trace │ │ ├── .StatemachineDependentElementsCalculator.xtendbin │ │ ├── .StatemachineReferenceUpdaterDispatcher.java._trace │ │ ├── .StatemachineReferenceUpdaterDispatcher.xtendbin │ │ ├── StatemachineDependentElementsCalculator.java │ │ └── StatemachineReferenceUpdaterDispatcher.java └── org.eclipse.xtext.example.fowlerdsl │ ├── .antlr-generator-3.2.0-patch.jar │ ├── .classpath │ ├── .project │ ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.core.runtime.prefs │ └── org.eclipse.jdt.core.prefs │ ├── GenerateStatemachine.mwe2.launch │ ├── META-INF │ └── MANIFEST.MF │ ├── README.TXT │ ├── build.properties │ ├── model │ └── generated │ │ ├── Statemachine.ecore │ │ └── Statemachine.genmodel │ ├── plugin.xml │ ├── plugin.xml_gen │ ├── src-gen │ └── org │ │ └── eclipse │ │ └── xtext │ │ └── example │ │ └── fowlerdsl │ │ ├── AbstractStatemachineRuntimeModule.java │ │ ├── Statemachine.xtextbin │ │ ├── StatemachineStandaloneSetupGenerated.java │ │ ├── parser │ │ └── antlr │ │ │ ├── StatemachineAntlrTokenFileProvider.java │ │ │ ├── StatemachineParser.java │ │ │ └── internal │ │ │ ├── InternalStatemachine.g │ │ │ ├── InternalStatemachine.tokens │ │ │ ├── InternalStatemachineLexer.java │ │ │ └── InternalStatemachineParser.java │ │ ├── serializer │ │ ├── StatemachineSemanticSequencer.java │ │ └── StatemachineSyntacticSequencer.java │ │ ├── services │ │ └── StatemachineGrammarAccess.java │ │ ├── statemachine │ │ ├── Command.java │ │ ├── Event.java │ │ ├── State.java │ │ ├── Statemachine.java │ │ ├── StatemachineFactory.java │ │ ├── StatemachinePackage.java │ │ ├── Transition.java │ │ ├── impl │ │ │ ├── CommandImpl.java │ │ │ ├── EventImpl.java │ │ │ ├── StateImpl.java │ │ │ ├── StatemachineFactoryImpl.java │ │ │ ├── StatemachineImpl.java │ │ │ ├── StatemachinePackageImpl.java │ │ │ └── TransitionImpl.java │ │ └── util │ │ │ ├── StatemachineAdapterFactory.java │ │ │ └── StatemachineSwitch.java │ │ └── validation │ │ └── AbstractStatemachineValidator.java │ ├── src │ └── org │ │ └── eclipse │ │ └── xtext │ │ └── example │ │ └── fowlerdsl │ │ ├── GenerateStatemachine.mwe2 │ │ ├── Statemachine.xtext │ │ ├── StatemachineRuntimeModule.java │ │ ├── StatemachineStandaloneSetup.java │ │ ├── formatting2 │ │ └── StatemachineFormatter.xtend │ │ ├── generator │ │ └── StatemachineGenerator.xtend │ │ ├── resource │ │ ├── PathURIFragmentProvider.xtend │ │ ├── StatemachineFragmentProvider.java │ │ └── StatemachineResourceDescriptionStrategy.xtend │ │ ├── scoping │ │ └── StatemachineScopeProvider.xtend │ │ └── validation │ │ └── StatemachineValidator.xtend │ └── xtend-gen │ └── org │ └── eclipse │ └── xtext │ └── example │ └── fowlerdsl │ ├── formatting │ └── .gitignore │ ├── formatting2 │ ├── .StatemachineFormatter.java._trace │ ├── .StatemachineFormatter.xtendbin │ └── StatemachineFormatter.java │ ├── generator │ └── .gitignore │ ├── resource │ ├── .PathURIFragmentProvider.java._trace │ ├── .PathURIFragmentProvider.xtendbin │ ├── .StatemachineResourceDescriptionStrategy.java._trace │ ├── .StatemachineResourceDescriptionStrategy.xtendbin │ ├── PathURIFragmentProvider.java │ └── StatemachineResourceDescriptionStrategy.java │ ├── scoping │ └── .gitignore │ └── validation │ └── .gitignore ├── features ├── org.obeonetwork.dsl.viewpoint.feature.xtext.support │ ├── .project │ ├── build.properties │ ├── feature.xml │ └── pom.xml └── org.obeonetwork.dsl.viewpoint.xtext.support.update │ ├── .project │ ├── category.xml │ └── pom.xml ├── plugins ├── io.typefox.xtext.sirius.aird │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── plugin.xml │ └── src │ │ └── io │ │ └── typefox │ │ └── xtext │ │ └── sirius │ │ └── aird │ │ ├── AirdRuntimeModule.java │ │ └── ui │ │ ├── Activator.java │ │ ├── AirdUiModule.java │ │ ├── EcoreEditorOpener.java │ │ └── ExecutableExtensionFactory.java └── org.obeonetwork.dsl.viewpoint.xtext.support │ ├── .classpath │ ├── .project │ ├── META-INF │ └── MANIFEST.MF │ ├── build.properties │ ├── pom.xml │ └── src │ └── org │ └── obeonetwork │ └── dsl │ └── viewpoint │ └── xtext │ └── support │ ├── Activator.java │ ├── StringUtil.java │ ├── XtextAttributeEmbeddedEditor.java │ ├── XtextEmbeddedEditor.java │ └── action │ └── OpenXtextEmbeddedEditor.java └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | target 3 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | xtext-viewpoint-integration 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Xtext Sirius Embedded Editor Example 2 | ------------------------------------ 3 | 4 | This plug-in contains a basic framework easing the embedding of an Xtext editor inside a diagram representation created with Sirius. 5 | This is not needed at all to load Xtext models and create diagrams on top of those, this functionnaliy is provided by the Sirius project itself in its update-site. 6 | 7 | 8 | ### Features 9 | 10 | ![Screenshot of diagram without embedded text editor](screenshot-diagram+text.png "Screenshot without the text editor") 11 | 12 | 13 | ![Screenshot of diagram with embedded text editor](screenshot-diagram.png "Screenshot with the text editor") 14 | 15 | 16 | 17 | ### Requires 18 | 19 | - Eclipse Sirius 1.x 20 | - Xtext 2.x 21 | 22 | ### How to 23 | 24 | - Create a tool in your modeler, and in the model operation, add an _External Java Action Call_ and set _OpenEmbeddedEditor_ as id. 25 | - Extends _OpenXtextEmbeddedEditor_ to bind your Xtext model. 26 | 27 | ```java 28 | import org.eclipse.xtext.example.domainmodel.ui.internal.DomainmodelActivator; 29 | import com.google.inject.Injector; 30 | import org.obeonetwork.dsl.viewpoint.xtext.support.action.OpenXtextEmbeddedEditor; 31 | 32 | public class OpenEmbeddedEditor extends OpenXtextEmbeddedEditor { 33 | @Override 34 | protected Injector getInjector() { 35 | return DomainmodelActivator.getInstance().getInjector("org.eclipse.xtext.example.domainmodel.Domainmodel"); 36 | } 37 | } 38 | ``` 39 | 40 | - register your java action 41 | 42 | ```xml 43 | 44 | 47 | 48 | 49 | ``` 50 | 51 | 52 | ### Known limitation 53 | -------------------------------------------------------------------------------- /screenshot-diagram+text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/screenshot-diagram+text.png -------------------------------------------------------------------------------- /screenshot-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/screenshot-diagram.png -------------------------------------------------------------------------------- /xtext-support-parent/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | xtext-support-parent 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.sirius.example.fowlerdsl.design 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.acceleo.ide.ui.acceleoBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.acceleo.ide.ui.acceleoNature 31 | org.eclipse.jdt.core.javanature 32 | org.eclipse.pde.PluginNature 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: org.eclipse.sirius.example.fowlerdsl.design 4 | Bundle-SymbolicName: org.eclipse.sirius.example.fowlerdsl.design;singleton:=true 5 | Bundle-Version: 1.0.0 6 | Bundle-Activator: org.eclipse.sirius.example.fowlerdsl.design.Activator 7 | Require-Bundle: org.eclipse.ui, 8 | org.eclipse.core.runtime, 9 | org.eclipse.sirius, 10 | org.obeonetwork.dsl.viewpoint.xtext.support;bundle-version="1.0.0", 11 | org.eclipse.xtext.example.fowlerdsl;bundle-version="2.5.4", 12 | org.eclipse.xtext.example.fowlerdsl.ui;bundle-version="1.0.0", 13 | org.eclipse.core.resources;bundle-version="3.9.0", 14 | org.eclipse.jface.text;bundle-version="3.9.1", 15 | org.eclipse.ui.ide;bundle-version="3.10.1", 16 | org.eclipse.ui.workbench.texteditor;bundle-version="3.9.0", 17 | org.eclipse.sirius.common.acceleo.aql;bundle-version="4.1.3" 18 | Bundle-ActivationPolicy: lazy 19 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 20 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/build.acceleo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/build.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Tue Apr 22 11:51:07 CEST 2014 3 | bin.includes=META-INF/,.,description/,plugin.xml 4 | output..=bin/ 5 | source..=src/ 6 | customBuildCallbacks=build.acceleo 7 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | PreviewsShown=true 3 | Timestamp=2014,4,22,14,34,32 4 | Version=3 5 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/Association.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/Association.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/CallOperationAction.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/CallOperationAction.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/Operation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/Operation.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/SignalEvent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/SignalEvent.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/State.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/State.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/StateMachine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/icons/StateMachine.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 12 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/src/org/eclipse/sirius/example/fowlerdsl/design/Activator.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.sirius.example.fowlerdsl.design; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; 7 | import org.eclipse.sirius.viewpoint.description.Viewpoint; 8 | import org.eclipse.ui.plugin.AbstractUIPlugin; 9 | import org.osgi.framework.BundleContext; 10 | 11 | /** 12 | * The activator class controls the plug-in life cycle 13 | */ 14 | public class Activator extends AbstractUIPlugin { 15 | // The plug-in ID 16 | public static final String PLUGIN_ID = "org.eclipse.sirius.example.fowlerdsl.design"; 17 | 18 | // The shared instance 19 | private static Activator plugin; 20 | 21 | private static Set viewpoints; 22 | 23 | /** 24 | * The constructor 25 | */ 26 | public Activator() { 27 | } 28 | 29 | /* 30 | * (non-Javadoc) 31 | * 32 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) 33 | */ 34 | public void start(BundleContext context) throws Exception { 35 | super.start(context); 36 | plugin = this; 37 | viewpoints = new HashSet(); 38 | viewpoints.addAll(ViewpointRegistry.getInstance().registerFromPlugin(PLUGIN_ID + "/description/fowlerdsl.odesign")); 39 | } 40 | 41 | /* 42 | * (non-Javadoc) 43 | * 44 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) 45 | */ 46 | public void stop(BundleContext context) throws Exception { 47 | plugin = null; 48 | if (viewpoints != null) { 49 | for (final Viewpoint viewpoint: viewpoints) { 50 | ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint); 51 | } 52 | viewpoints.clear(); 53 | viewpoints = null; 54 | } 55 | super.stop(context); 56 | } 57 | 58 | /** 59 | * Returns the shared instance 60 | * 61 | * @return the shared instance 62 | */ 63 | public static Activator getDefault() { 64 | return plugin; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/src/org/eclipse/sirius/example/fowlerdsl/design/OpenEmbeddedEditor.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.sirius.example.fowlerdsl.design; 2 | 3 | import org.eclipse.xtext.example.fowlerdsl.ui.internal.StatemachineActivator; 4 | import org.obeonetwork.dsl.viewpoint.xtext.support.action.OpenXtextEmbeddedEditor; 5 | 6 | import com.google.inject.Injector; 7 | 8 | public class OpenEmbeddedEditor extends OpenXtextEmbeddedEditor { 9 | 10 | @Override 11 | protected Injector getInjector() { 12 | return StatemachineActivator.getInstance().getInjector("org.eclipse.xtext.example.fowlerdsl.Statemachine"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.design/src/org/eclipse/sirius/example/fowlerdsl/design/service/StatemachineServices.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.sirius.example.fowlerdsl.design.service; 2 | 3 | import org.eclipse.core.resources.IFile; 4 | import org.eclipse.core.resources.ResourcesPlugin; 5 | import org.eclipse.core.runtime.Path; 6 | import org.eclipse.emf.ecore.EObject; 7 | import org.eclipse.ui.IEditorPart; 8 | import org.eclipse.ui.IWorkbenchPage; 9 | import org.eclipse.ui.PartInitException; 10 | import org.eclipse.ui.PlatformUI; 11 | import org.eclipse.ui.ide.IDE; 12 | import org.eclipse.ui.texteditor.AbstractTextEditor; 13 | import org.eclipse.xtext.nodemodel.ICompositeNode; 14 | import org.eclipse.xtext.nodemodel.util.NodeModelUtils; 15 | import org.eclipse.xtext.resource.XtextResource; 16 | 17 | public class StatemachineServices { 18 | 19 | public EObject openTextEditor(EObject any) { 20 | if (any != null && any.eResource() instanceof XtextResource 21 | && any.eResource().getURI() != null) { 22 | 23 | String fileURI = any.eResource().getURI().toPlatformString(true); 24 | IFile workspaceFile = ResourcesPlugin.getWorkspace().getRoot() 25 | .getFile(new Path(fileURI)); 26 | if (workspaceFile != null) { 27 | IWorkbenchPage page = PlatformUI.getWorkbench() 28 | .getActiveWorkbenchWindow().getActivePage(); 29 | try { 30 | IEditorPart openEditor = IDE.openEditor(page, 31 | workspaceFile, 32 | "org.eclipse.xtext.example.fowlerdsl.Statemachine", 33 | true); 34 | if (openEditor instanceof AbstractTextEditor) { 35 | ICompositeNode node = NodeModelUtils 36 | .findActualNodeFor(any); 37 | if (node != null) { 38 | int offset = node.getOffset(); 39 | int length = node.getTotalEndOffset() - offset; 40 | ((AbstractTextEditor) openEditor).selectAndReveal( 41 | offset, length); 42 | System.out 43 | .println("StatemachineServices.openTextEditor()"); 44 | } 45 | } 46 | // editorInput. 47 | } catch (PartInitException e) { 48 | // Put your exception handler here if you wish to. 49 | } 50 | } 51 | } 52 | System.out.println(any); 53 | return any; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.sirius.example.fowlerdsl.xtextwidget 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.pde.PluginNature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Xtext Widget for Sirius Properties Views 4 | Bundle-SymbolicName: org.eclipse.sirius.example.fowlerdsl.xtextwidget;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Vendor: Obeo 7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 8 | Require-Bundle: org.eclipse.eef.core, 9 | org.eclipse.eef, 10 | org.eclipse.sirius.common.interpreter, 11 | org.eclipse.equinox.registry, 12 | org.eclipse.eef.ide.ui, 13 | org.eclipse.swt, 14 | org.eclipse.emf.mwe.core, 15 | org.eclipse.eef.common.ui, 16 | com.google.inject, 17 | org.eclipse.xtext.example.fowlerdsl.ui, 18 | org.eclipse.xtext.ui, 19 | org.eclipse.eef.common;bundle-version="1.9.0", 20 | org.eclipse.ui.forms;bundle-version="3.7.0" 21 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | plugin.xml 6 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/src/org/eclipse/sirius/example/fowlerdsl/xtextwidget/XtextPartialViewerController.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.sirius.example.fowlerdsl.xtextwidget; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import org.eclipse.eef.EEFCustomWidgetDescription; 6 | import org.eclipse.eef.core.api.EditingContextAdapter; 7 | import org.eclipse.eef.core.api.controllers.AbstractEEFCustomWidgetController; 8 | import org.eclipse.sirius.common.interpreter.api.IInterpreter; 9 | import org.eclipse.sirius.common.interpreter.api.IVariableManager; 10 | 11 | public class XtextPartialViewerController extends AbstractEEFCustomWidgetController { 12 | 13 | private Consumer newValueConsumer; 14 | 15 | public XtextPartialViewerController(EEFCustomWidgetDescription description, IVariableManager variableManager, IInterpreter interpreter, 16 | EditingContextAdapter contextAdapter) { 17 | super(description, variableManager, interpreter, contextAdapter); 18 | } 19 | 20 | @Override 21 | protected EEFCustomWidgetDescription getDescription() { 22 | return this.description; 23 | } 24 | 25 | @Override 26 | public void refresh() { 27 | super.refresh(); 28 | this.newEval().call("var:self", this.newValueConsumer); 29 | } 30 | 31 | public void onNewValue(Consumer consumer) { 32 | this.newValueConsumer = consumer; 33 | } 34 | 35 | public void removeValueConsumer() { 36 | this.newValueConsumer = null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/src/org/eclipse/sirius/example/fowlerdsl/xtextwidget/XtextPartialViewerLifecycleManager.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.sirius.example.fowlerdsl.xtextwidget; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import org.eclipse.eef.EEFCustomWidgetDescription; 6 | import org.eclipse.eef.EEFWidgetDescription; 7 | import org.eclipse.eef.common.ui.api.IEEFFormContainer; 8 | import org.eclipse.eef.core.api.EditingContextAdapter; 9 | import org.eclipse.eef.core.api.controllers.IEEFWidgetController; 10 | import org.eclipse.eef.ide.ui.api.widgets.AbstractEEFWidgetLifecycleManager; 11 | import org.eclipse.emf.ecore.EObject; 12 | import org.eclipse.sirius.common.interpreter.api.IInterpreter; 13 | import org.eclipse.sirius.common.interpreter.api.IVariableManager; 14 | import org.eclipse.swt.SWT; 15 | import org.eclipse.swt.layout.GridData; 16 | import org.eclipse.swt.widgets.Composite; 17 | import org.eclipse.swt.widgets.Control; 18 | import org.eclipse.xtext.example.fowlerdsl.ui.internal.StatemachineActivator; 19 | 20 | import com.google.inject.Injector; 21 | 22 | public class XtextPartialViewerLifecycleManager extends AbstractEEFWidgetLifecycleManager { 23 | 24 | private EEFCustomWidgetDescription description; 25 | 26 | private XtextPartialViewerWidget xtextPartialEditorWidget; 27 | 28 | private XtextPartialViewerController controller; 29 | 30 | private Consumer newValueConsumer; 31 | 32 | 33 | public XtextPartialViewerLifecycleManager( 34 | EEFCustomWidgetDescription controlDescription, 35 | IVariableManager variableManager, 36 | IInterpreter interpreter, 37 | EditingContextAdapter contextAdapter) { 38 | super(variableManager, interpreter, contextAdapter); 39 | this.description = controlDescription; 40 | } 41 | 42 | @Override 43 | protected void createMainControl(Composite parent, IEEFFormContainer formContainer) { 44 | Injector injector = StatemachineActivator.getInstance().getInjector(StatemachineActivator.ORG_ECLIPSE_XTEXT_EXAMPLE_FOWLERDSL_STATEMACHINE); 45 | xtextPartialEditorWidget = new XtextPartialViewerWidget(parent, injector, SWT.BORDER | SWT.H_SCROLL); 46 | Control control = xtextPartialEditorWidget.getControl(); 47 | GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); 48 | gridData.heightHint = 14 * 12; 49 | gridData.widthHint = 300; 50 | gridData.horizontalIndent = VALIDATION_MARKER_OFFSET; 51 | control.setLayoutData(gridData); 52 | 53 | this.controller = new XtextPartialViewerController(description, variableManager, interpreter, editingContextAdapter); 54 | } 55 | 56 | @Override 57 | public void aboutToBeShown() { 58 | super.aboutToBeShown(); 59 | 60 | this.newValueConsumer = (newValue) -> this.xtextPartialEditorWidget.update((EObject)newValue); 61 | this.controller.onNewValue(this.newValueConsumer); 62 | } 63 | 64 | @Override 65 | public void refresh() { 66 | super.refresh(); 67 | this.controller.refresh(); 68 | } 69 | 70 | @Override 71 | public void aboutToBeHidden() { 72 | super.aboutToBeHidden(); 73 | this.controller.removeValueConsumer(); 74 | this.newValueConsumer = null; 75 | } 76 | 77 | @Override 78 | protected IEEFWidgetController getController() { 79 | return this.controller; 80 | } 81 | 82 | @Override 83 | protected EEFWidgetDescription getWidgetDescription() { 84 | return this.description; 85 | } 86 | 87 | @Override 88 | protected Control getValidationControl() { 89 | return this.xtextPartialEditorWidget.getControl(); 90 | } 91 | 92 | @Override 93 | public void dispose() { 94 | super.dispose(); 95 | } 96 | 97 | @Override 98 | protected void setEnabled(boolean enabled) { 99 | // Not handled. 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/src/org/eclipse/sirius/example/fowlerdsl/xtextwidget/XtextPartialViewerLifecycleManagerProvider.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.sirius.example.fowlerdsl.xtextwidget; 2 | 3 | import org.eclipse.eef.EEFControlDescription; 4 | import org.eclipse.eef.EEFCustomWidgetDescription; 5 | import org.eclipse.eef.EEFGroupDescription; 6 | import org.eclipse.eef.core.api.EditingContextAdapter; 7 | import org.eclipse.eef.ide.ui.api.widgets.IEEFLifecycleManager; 8 | import org.eclipse.eef.ide.ui.api.widgets.IEEFLifecycleManagerProvider; 9 | import org.eclipse.sirius.common.interpreter.api.IInterpreter; 10 | import org.eclipse.sirius.common.interpreter.api.IVariableManager; 11 | 12 | public class XtextPartialViewerLifecycleManagerProvider implements IEEFLifecycleManagerProvider { 13 | 14 | private static final String SUPPORTED_ID = "XtextGroup"; 15 | 16 | @Override 17 | public boolean canHandle(EEFControlDescription controlDescription) { 18 | /* 19 | * it seems there is a bug in EEF right now which prevents me from relying on 20 | * the identifier directly. 21 | */ 22 | return controlDescription.eContainer() instanceof EEFGroupDescription 23 | && SUPPORTED_ID.equals(((EEFGroupDescription) controlDescription.eContainer()).getIdentifier()) 24 | && controlDescription instanceof EEFCustomWidgetDescription; 25 | } 26 | 27 | @Override 28 | public IEEFLifecycleManager getLifecycleManager(EEFControlDescription controlDescription, 29 | IVariableManager variableManager, IInterpreter interpreter, EditingContextAdapter contextAdapter) { 30 | if (controlDescription instanceof EEFCustomWidgetDescription) { 31 | return new XtextPartialViewerLifecycleManager((EEFCustomWidgetDescription) controlDescription, 32 | variableManager, interpreter, contextAdapter); 33 | } 34 | throw new IllegalArgumentException(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.sirius.example.fowlerdsl.xtextwidget/src/org/eclipse/sirius/example/fowlerdsl/xtextwidget/XtextPartialViewerWidget.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.sirius.example.fowlerdsl.xtextwidget; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.IOException; 5 | import java.util.Collections; 6 | 7 | import org.eclipse.emf.common.util.URI; 8 | import org.eclipse.emf.ecore.EObject; 9 | import org.eclipse.emf.ecore.util.EcoreUtil; 10 | import org.eclipse.emf.ecore.xmi.XMLResource.ResourceHandler; 11 | import org.eclipse.jface.text.IDocument; 12 | import org.eclipse.jface.text.IDocumentPartitioner; 13 | import org.eclipse.jface.text.contentassist.IContentAssistant; 14 | import org.eclipse.swt.SWT; 15 | import org.eclipse.swt.events.KeyAdapter; 16 | import org.eclipse.swt.events.KeyEvent; 17 | import org.eclipse.swt.widgets.Composite; 18 | import org.eclipse.swt.widgets.Control; 19 | import org.eclipse.xtext.Constants; 20 | import org.eclipse.xtext.nodemodel.ICompositeNode; 21 | import org.eclipse.xtext.nodemodel.util.NodeModelUtils; 22 | import org.eclipse.xtext.resource.IResourceFactory; 23 | import org.eclipse.xtext.resource.XtextResource; 24 | import org.eclipse.xtext.resource.XtextResourceSet; 25 | import org.eclipse.xtext.ui.editor.XtextSourceViewer; 26 | import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration; 27 | import org.eclipse.xtext.ui.editor.model.XtextDocument; 28 | 29 | import com.google.inject.Inject; 30 | import com.google.inject.Injector; 31 | import com.google.inject.Provider; 32 | import com.google.inject.name.Named; 33 | 34 | public class XtextPartialViewerWidget { 35 | 36 | private int style; 37 | 38 | private XtextSourceViewer sourceViewer; 39 | 40 | private XtextDocument document; 41 | 42 | @Inject 43 | @Named(Constants.FILE_EXTENSIONS) 44 | private String fileExtension; 45 | 46 | @Inject 47 | private XtextSourceViewer.Factory sourceViewerFactory; 48 | 49 | @Inject 50 | private Provider sourceViewerConfigurationProvider; 51 | 52 | @Inject 53 | private Provider documentProvider; 54 | 55 | @Inject 56 | private Provider documentPartitioner; 57 | 58 | @Inject 59 | private IResourceFactory resourceFactory; 60 | 61 | @Inject 62 | private XtextResourceSet resourceSet; 63 | 64 | private KeyAdapter ctrlKeyList = new KeyAdapter() { 65 | }; 66 | 67 | private XtextResource virtualResource; 68 | 69 | public XtextPartialViewerWidget(Composite parentComposite, Injector xtextInjector, int style) { 70 | this.style = style; 71 | 72 | xtextInjector.injectMembers(this); 73 | 74 | createEditor(parentComposite); 75 | } 76 | 77 | public XtextPartialViewerWidget(Composite control, Injector injector) { 78 | this(control, injector, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); 79 | } 80 | 81 | private void createEditor(Composite parent) { 82 | sourceViewer = sourceViewerFactory.createSourceViewer(parent, null, null, true, style); 83 | sourceViewer.setEditable(false); 84 | 85 | XtextSourceViewerConfiguration viewerConfiguration = sourceViewerConfigurationProvider.get(); 86 | 87 | sourceViewer.configure(viewerConfiguration); 88 | 89 | document = documentProvider.get(); 90 | IDocumentPartitioner partitioner = documentPartitioner.get(); 91 | partitioner.connect(document); 92 | document.setDocumentPartitioner(partitioner); 93 | 94 | sourceViewer.setDocument(document); 95 | 96 | final IContentAssistant contentAssistant = viewerConfiguration.getContentAssistant(sourceViewer); 97 | contentAssistant.install(sourceViewer); 98 | 99 | ctrlKeyList = new KeyAdapter() { 100 | public void keyPressed(KeyEvent e) { 101 | // CTRL + SPACE to complement 102 | if (viewerConfiguration != null && e.keyCode == SWT.SPACE && e.stateMask == SWT.CTRL) { 103 | contentAssistant.showPossibleCompletions(); 104 | } 105 | } 106 | }; 107 | sourceViewer.getTextWidget().addKeyListener(ctrlKeyList); 108 | try { 109 | virtualResource = createVirtualXtextResource(URI.createURI("_synthetic.statemachine")); 110 | } catch (IOException e1) { 111 | // TODO Auto-generated catch block 112 | e1.printStackTrace(); 113 | } 114 | 115 | } 116 | 117 | private XtextResource createVirtualXtextResource(URI uri) throws IOException { 118 | resourceSet.setClasspathURIContext(getClass()); 119 | // Create virtual resource 120 | XtextResource xtextVirtualResource = (XtextResource) resourceFactory 121 | .createResource(URI.createURI(uri.toString())); 122 | resourceSet.getResources().add(xtextVirtualResource); 123 | 124 | // // Populate virtual resource with the given semantic element to edit 125 | // xtextVirtualResource.getContents().add(semanticElement); 126 | // 127 | // // Save and reparse in order to initialize virtual Xtext resource 128 | // ByteArrayOutputStream out = new ByteArrayOutputStream(); 129 | // xtextVirtualResource.save(out, Collections.emptyMap()); 130 | // xtextVirtualResource.reparse(new String(out.toByteArray())); 131 | 132 | return xtextVirtualResource; 133 | } 134 | 135 | public Control getControl() { 136 | return sourceViewer.getControl(); 137 | } 138 | 139 | public void update(EObject semanticElement) { 140 | 141 | if (semanticElement != null) { 142 | if (semanticElement.eResource() instanceof XtextResource) { 143 | virtualResource.getContents().clear(); 144 | virtualResource.getContents() 145 | .add(EcoreUtil.copy(semanticElement.eResource().getContents().iterator().next())); 146 | // Save and reparse in order to initialize virtual Xtext 147 | // resource 148 | try { 149 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 150 | virtualResource.save(out, Collections.emptyMap()); 151 | virtualResource.reparse(new String(out.toByteArray())); 152 | } catch (IOException e) { 153 | // TODO Auto-generated catch block 154 | e.printStackTrace(); 155 | } 156 | 157 | document.setInput(virtualResource); 158 | ICompositeNode elementNode = NodeModelUtils.findActualNodeFor(semanticElement); 159 | if (elementNode != null && elementNode.getText() != null) { 160 | update(elementNode.getText().trim()); 161 | } 162 | } 163 | } 164 | 165 | } 166 | 167 | public void update(String text) { 168 | IDocument document = sourceViewer.getDocument(); 169 | sourceViewer.setRedraw(false); 170 | document.set(text); 171 | sourceViewer.setVisibleRegion(0, text.length()); 172 | sourceViewer.setSelectedRange(0, 0); 173 | sourceViewer.setRedraw(true); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.xtext.example.fowlerdsl.edit 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | org.eclipse.pde.PluginNature 27 | 28 | 29 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %pluginName 4 | Bundle-SymbolicName: org.eclipse.xtext.example.fowlerdsl.edit;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-ClassPath: . 7 | Bundle-Activator: org.eclipse.xtext.example.fowlerdsl.statemachine.provider.StatemachineEditPlugin$Implementation 8 | Bundle-Vendor: %providerName 9 | Bundle-Localization: plugin 10 | Bundle-RequiredExecutionEnvironment: J2SE-1.5 11 | Export-Package: org.eclipse.xtext.example.fowlerdsl.statemachine.provider 12 | Require-Bundle: org.eclipse.core.runtime, 13 | org.eclipse.xtext.example.fowlerdsl;visibility:=reexport, 14 | org.eclipse.emf.edit;visibility:=reexport 15 | Bundle-ActivationPolicy: lazy 16 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/build.properties: -------------------------------------------------------------------------------- 1 | # 2 | 3 | bin.includes = .,\ 4 | icons/,\ 5 | META-INF/,\ 6 | plugin.xml,\ 7 | plugin.properties 8 | jars.compile.order = . 9 | source.. = src-gen/ 10 | output.. = bin/ 11 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | PreviewsShown=true 3 | Timestamp=2014,10,27,10,53,51 4 | Version=3 5 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Command.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Command.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Event.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Event.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/State.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/State.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/StateMachine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/StateMachine.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Statemachine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Statemachine.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Transition.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/icons/full/obj16/Transition.gif -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/plugin.properties: -------------------------------------------------------------------------------- 1 | # 2 | 3 | pluginName = Statemachine Edit Support 4 | providerName = www.example.org 5 | 6 | _UI_CreateChild_text = {0} 7 | _UI_CreateChild_text2 = {1} {0} 8 | _UI_CreateChild_text3 = {1} 9 | _UI_CreateChild_tooltip = Create New {0} Under {1} Feature 10 | _UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. 11 | _UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. 12 | 13 | _UI_PropertyDescriptor_description = The {0} of the {1} 14 | 15 | _UI_Statemachine_type = Statemachine 16 | _UI_Event_type = Event 17 | _UI_Command_type = Command 18 | _UI_State_type = State 19 | _UI_Transition_type = Transition 20 | _UI_Unknown_type = Object 21 | 22 | _UI_Unknown_datatype= Value 23 | 24 | _UI_Statemachine_events_feature = Events 25 | _UI_Statemachine_resetEvents_feature = Reset Events 26 | _UI_Statemachine_commands_feature = Commands 27 | _UI_Statemachine_states_feature = States 28 | _UI_Event_name_feature = Name 29 | _UI_Event_code_feature = Code 30 | _UI_Command_name_feature = Name 31 | _UI_Command_code_feature = Code 32 | _UI_State_name_feature = Name 33 | _UI_State_actions_feature = Actions 34 | _UI_State_transitions_feature = Transitions 35 | _UI_Transition_event_feature = Event 36 | _UI_Transition_state_feature = State 37 | _UI_Unknown_feature = Unspecified 38 | 39 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/provider/EventItemProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine.provider; 4 | 5 | 6 | import java.util.Collection; 7 | import java.util.List; 8 | 9 | import org.eclipse.emf.common.notify.AdapterFactory; 10 | import org.eclipse.emf.common.notify.Notification; 11 | 12 | import org.eclipse.emf.common.util.ResourceLocator; 13 | 14 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 15 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 16 | import org.eclipse.emf.edit.provider.IItemLabelProvider; 17 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; 18 | import org.eclipse.emf.edit.provider.IItemPropertySource; 19 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 20 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 21 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; 22 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; 23 | import org.eclipse.emf.edit.provider.ViewerNotification; 24 | 25 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Event; 26 | import org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage; 27 | 28 | /** 29 | * This is the item provider adapter for a {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Event} object. 30 | * 31 | * 32 | * @generated 33 | */ 34 | public class EventItemProvider 35 | extends ItemProviderAdapter 36 | implements 37 | IEditingDomainItemProvider, 38 | IStructuredItemContentProvider, 39 | ITreeItemContentProvider, 40 | IItemLabelProvider, 41 | IItemPropertySource { 42 | /** 43 | * This constructs an instance from a factory and a notifier. 44 | * 45 | * 46 | * @generated 47 | */ 48 | public EventItemProvider(AdapterFactory adapterFactory) { 49 | super(adapterFactory); 50 | } 51 | 52 | /** 53 | * This returns the property descriptors for the adapted class. 54 | * 55 | * 56 | * @generated 57 | */ 58 | @Override 59 | public List getPropertyDescriptors(Object object) { 60 | if (itemPropertyDescriptors == null) { 61 | super.getPropertyDescriptors(object); 62 | 63 | addNamePropertyDescriptor(object); 64 | addCodePropertyDescriptor(object); 65 | } 66 | return itemPropertyDescriptors; 67 | } 68 | 69 | /** 70 | * This adds a property descriptor for the Name feature. 71 | * 72 | * 73 | * @generated 74 | */ 75 | protected void addNamePropertyDescriptor(Object object) { 76 | itemPropertyDescriptors.add 77 | (createItemPropertyDescriptor 78 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 79 | getResourceLocator(), 80 | getString("_UI_Event_name_feature"), 81 | getString("_UI_PropertyDescriptor_description", "_UI_Event_name_feature", "_UI_Event_type"), 82 | StatemachinePackage.Literals.EVENT__NAME, 83 | true, 84 | false, 85 | false, 86 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, 87 | null, 88 | null)); 89 | } 90 | 91 | /** 92 | * This adds a property descriptor for the Code feature. 93 | * 94 | * 95 | * @generated 96 | */ 97 | protected void addCodePropertyDescriptor(Object object) { 98 | itemPropertyDescriptors.add 99 | (createItemPropertyDescriptor 100 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 101 | getResourceLocator(), 102 | getString("_UI_Event_code_feature"), 103 | getString("_UI_PropertyDescriptor_description", "_UI_Event_code_feature", "_UI_Event_type"), 104 | StatemachinePackage.Literals.EVENT__CODE, 105 | true, 106 | false, 107 | false, 108 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, 109 | null, 110 | null)); 111 | } 112 | 113 | /** 114 | * This returns Event.gif. 115 | * 116 | * 117 | * @generated 118 | */ 119 | @Override 120 | public Object getImage(Object object) { 121 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Event")); 122 | } 123 | 124 | /** 125 | * 126 | * 127 | * @generated 128 | */ 129 | @Override 130 | protected boolean shouldComposeCreationImage() { 131 | return true; 132 | } 133 | 134 | /** 135 | * This returns the label text for the adapted class. 136 | * 137 | * 138 | * @generated 139 | */ 140 | @Override 141 | public String getText(Object object) { 142 | String label = ((Event)object).getName(); 143 | return label == null || label.length() == 0 ? 144 | getString("_UI_Event_type") : 145 | getString("_UI_Event_type") + " " + label; 146 | } 147 | 148 | 149 | /** 150 | * This handles model notifications by calling {@link #updateChildren} to update any cached 151 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. 152 | * 153 | * 154 | * @generated 155 | */ 156 | @Override 157 | public void notifyChanged(Notification notification) { 158 | updateChildren(notification); 159 | 160 | switch (notification.getFeatureID(Event.class)) { 161 | case StatemachinePackage.EVENT__NAME: 162 | case StatemachinePackage.EVENT__CODE: 163 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 164 | return; 165 | } 166 | super.notifyChanged(notification); 167 | } 168 | 169 | /** 170 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children 171 | * that can be created under this object. 172 | * 173 | * 174 | * @generated 175 | */ 176 | @Override 177 | protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 178 | super.collectNewChildDescriptors(newChildDescriptors, object); 179 | } 180 | 181 | /** 182 | * Return the resource locator for this item provider's resources. 183 | * 184 | * 185 | * @generated 186 | */ 187 | @Override 188 | public ResourceLocator getResourceLocator() { 189 | return StatemachineEditPlugin.INSTANCE; 190 | } 191 | 192 | } 193 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/provider/StatemachineEditPlugin.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine.provider; 4 | 5 | import org.eclipse.emf.common.EMFPlugin; 6 | 7 | import org.eclipse.emf.common.util.ResourceLocator; 8 | 9 | /** 10 | * This is the central singleton for the Statemachine edit plugin. 11 | * 12 | * 13 | * @generated 14 | */ 15 | public final class StatemachineEditPlugin extends EMFPlugin { 16 | /** 17 | * Keep track of the singleton. 18 | * 19 | * 20 | * @generated 21 | */ 22 | public static final StatemachineEditPlugin INSTANCE = new StatemachineEditPlugin(); 23 | 24 | /** 25 | * Keep track of the singleton. 26 | * 27 | * 28 | * @generated 29 | */ 30 | private static Implementation plugin; 31 | 32 | /** 33 | * Create the instance. 34 | * 35 | * 36 | * @generated 37 | */ 38 | public StatemachineEditPlugin() { 39 | super 40 | (new ResourceLocator [] { 41 | }); 42 | } 43 | 44 | /** 45 | * Returns the singleton instance of the Eclipse plugin. 46 | * 47 | * 48 | * @return the singleton instance. 49 | * @generated 50 | */ 51 | @Override 52 | public ResourceLocator getPluginResourceLocator() { 53 | return plugin; 54 | } 55 | 56 | /** 57 | * Returns the singleton instance of the Eclipse plugin. 58 | * 59 | * 60 | * @return the singleton instance. 61 | * @generated 62 | */ 63 | public static Implementation getPlugin() { 64 | return plugin; 65 | } 66 | 67 | /** 68 | * The actual implementation of the Eclipse Plugin. 69 | * 70 | * 71 | * @generated 72 | */ 73 | public static class Implementation extends EclipsePlugin { 74 | /** 75 | * Creates an instance. 76 | * 77 | * 78 | * @generated 79 | */ 80 | public Implementation() { 81 | super(); 82 | 83 | // Remember the static instance. 84 | // 85 | plugin = this; 86 | } 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.edit/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/provider/TransitionItemProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine.provider; 4 | 5 | 6 | import java.util.Collection; 7 | import java.util.List; 8 | 9 | import org.eclipse.emf.common.notify.AdapterFactory; 10 | import org.eclipse.emf.common.notify.Notification; 11 | 12 | import org.eclipse.emf.common.util.ResourceLocator; 13 | 14 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 15 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 16 | import org.eclipse.emf.edit.provider.IItemLabelProvider; 17 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; 18 | import org.eclipse.emf.edit.provider.IItemPropertySource; 19 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 20 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 21 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; 22 | 23 | import org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage; 24 | 25 | /** 26 | * This is the item provider adapter for a {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Transition} object. 27 | * 28 | * 29 | * @generated 30 | */ 31 | public class TransitionItemProvider 32 | extends ItemProviderAdapter 33 | implements 34 | IEditingDomainItemProvider, 35 | IStructuredItemContentProvider, 36 | ITreeItemContentProvider, 37 | IItemLabelProvider, 38 | IItemPropertySource { 39 | /** 40 | * This constructs an instance from a factory and a notifier. 41 | * 42 | * 43 | * @generated 44 | */ 45 | public TransitionItemProvider(AdapterFactory adapterFactory) { 46 | super(adapterFactory); 47 | } 48 | 49 | /** 50 | * This returns the property descriptors for the adapted class. 51 | * 52 | * 53 | * @generated 54 | */ 55 | @Override 56 | public List getPropertyDescriptors(Object object) { 57 | if (itemPropertyDescriptors == null) { 58 | super.getPropertyDescriptors(object); 59 | 60 | addEventPropertyDescriptor(object); 61 | addStatePropertyDescriptor(object); 62 | } 63 | return itemPropertyDescriptors; 64 | } 65 | 66 | /** 67 | * This adds a property descriptor for the Event feature. 68 | * 69 | * 70 | * @generated 71 | */ 72 | protected void addEventPropertyDescriptor(Object object) { 73 | itemPropertyDescriptors.add 74 | (createItemPropertyDescriptor 75 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 76 | getResourceLocator(), 77 | getString("_UI_Transition_event_feature"), 78 | getString("_UI_PropertyDescriptor_description", "_UI_Transition_event_feature", "_UI_Transition_type"), 79 | StatemachinePackage.Literals.TRANSITION__EVENT, 80 | true, 81 | false, 82 | true, 83 | null, 84 | null, 85 | null)); 86 | } 87 | 88 | /** 89 | * This adds a property descriptor for the State feature. 90 | * 91 | * 92 | * @generated 93 | */ 94 | protected void addStatePropertyDescriptor(Object object) { 95 | itemPropertyDescriptors.add 96 | (createItemPropertyDescriptor 97 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 98 | getResourceLocator(), 99 | getString("_UI_Transition_state_feature"), 100 | getString("_UI_PropertyDescriptor_description", "_UI_Transition_state_feature", "_UI_Transition_type"), 101 | StatemachinePackage.Literals.TRANSITION__STATE, 102 | true, 103 | false, 104 | true, 105 | null, 106 | null, 107 | null)); 108 | } 109 | 110 | /** 111 | * This returns Transition.gif. 112 | * 113 | * 114 | * @generated 115 | */ 116 | @Override 117 | public Object getImage(Object object) { 118 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Transition")); 119 | } 120 | 121 | /** 122 | * 123 | * 124 | * @generated 125 | */ 126 | @Override 127 | protected boolean shouldComposeCreationImage() { 128 | return true; 129 | } 130 | 131 | /** 132 | * This returns the label text for the adapted class. 133 | * 134 | * 135 | * @generated 136 | */ 137 | @Override 138 | public String getText(Object object) { 139 | return getString("_UI_Transition_type"); 140 | } 141 | 142 | 143 | /** 144 | * This handles model notifications by calling {@link #updateChildren} to update any cached 145 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. 146 | * 147 | * 148 | * @generated 149 | */ 150 | @Override 151 | public void notifyChanged(Notification notification) { 152 | updateChildren(notification); 153 | super.notifyChanged(notification); 154 | } 155 | 156 | /** 157 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children 158 | * that can be created under this object. 159 | * 160 | * 161 | * @generated 162 | */ 163 | @Override 164 | protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 165 | super.collectNewChildDescriptors(newChildDescriptors, object); 166 | } 167 | 168 | /** 169 | * Return the resource locator for this item provider's resources. 170 | * 171 | * 172 | * @generated 173 | */ 174 | @Override 175 | public ResourceLocator getResourceLocator() { 176 | return StatemachineEditPlugin.INSTANCE; 177 | } 178 | 179 | } 180 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.xtext.example.fowlerdsl.ui 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.xtext.ui.shared.xtextBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.ManifestBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.pde.SchemaBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jdt.core.javanature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.xtext.ui.shared.xtextNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Xtext Fowler DSL Example - UI 4 | Bundle-Vendor: Eclipse Xtext 5 | Bundle-Version: 2.11.0.qualifier 6 | Bundle-SymbolicName: org.eclipse.xtext.example.fowlerdsl.ui; singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: org.eclipse.xtext.example.fowlerdsl;visibility:=reexport, 9 | org.eclipse.xtext.ui, 10 | org.eclipse.ui.editors;bundle-version="3.6.0", 11 | org.eclipse.ui.ide;bundle-version="3.6.0", 12 | org.eclipse.xtext.ui.shared, 13 | org.eclipse.ui;bundle-version="3.6.0", 14 | org.eclipse.xtext.builder, 15 | org.antlr.runtime, 16 | org.eclipse.xtext.common.types.ui, 17 | org.eclipse.xtext.ui.codetemplates.ui, 18 | org.eclipse.compare;bundle-version="2.1.0", 19 | org.eclipse.xtext.xbase.lib 20 | Import-Package: org.apache.log4j 21 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 22 | Export-Package: org.eclipse.xtext.example.fowlerdsl.ui.quickfix, 23 | org.eclipse.xtext.example.fowlerdsl.ui.contentassist, 24 | org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr, 25 | org.eclipse.xtext.example.fowlerdsl.ui.internal, 26 | org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr.internal 27 | Bundle-Activator: org.eclipse.xtext.example.fowlerdsl.ui.internal.StatemachineActivator 28 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = META-INF/,\ 5 | .,\ 6 | plugin.xml -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/fowlerdsl/ui/StatemachineExecutableExtensionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui; 5 | 6 | import org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory; 7 | import org.osgi.framework.Bundle; 8 | 9 | import com.google.inject.Injector; 10 | 11 | import org.eclipse.xtext.example.fowlerdsl.ui.internal.StatemachineActivator; 12 | 13 | /** 14 | * This class was generated. Customizations should only happen in a newly 15 | * introduced subclass. 16 | */ 17 | public class StatemachineExecutableExtensionFactory extends AbstractGuiceAwareExecutableExtensionFactory { 18 | 19 | @Override 20 | protected Bundle getBundle() { 21 | return StatemachineActivator.getInstance().getBundle(); 22 | } 23 | 24 | @Override 25 | protected Injector getInjector() { 26 | return StatemachineActivator.getInstance().getInjector(StatemachineActivator.ORG_ECLIPSE_XTEXT_EXAMPLE_FOWLERDSL_STATEMACHINE); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/fowlerdsl/ui/contentassist/AbstractStatemachineProposalProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.contentassist; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | import org.eclipse.xtext.*; 8 | import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor; 9 | import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext; 10 | 11 | /** 12 | * Represents a generated, default implementation of superclass {@link org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider}. 13 | * Methods are dynamically dispatched on the first parameter, i.e., you can override them 14 | * with a more concrete subtype. 15 | */ 16 | @SuppressWarnings("all") 17 | public class AbstractStatemachineProposalProvider extends org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider { 18 | 19 | public void completeStatemachine_Events(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 20 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 21 | } 22 | public void completeStatemachine_ResetEvents(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 23 | lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); 24 | } 25 | public void completeStatemachine_Commands(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 26 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 27 | } 28 | public void completeStatemachine_States(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 29 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 30 | } 31 | public void completeEvent_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 32 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 33 | } 34 | public void completeEvent_Code(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 35 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 36 | } 37 | public void completeCommand_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 38 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 39 | } 40 | public void completeCommand_Code(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 41 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 42 | } 43 | public void completeState_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 44 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 45 | } 46 | public void completeState_Actions(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 47 | lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); 48 | } 49 | public void completeState_Transitions(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 50 | completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); 51 | } 52 | public void completeTransition_Event(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 53 | lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); 54 | } 55 | public void completeTransition_State(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 56 | lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); 57 | } 58 | 59 | public void complete_Statemachine(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 60 | // subclasses may override 61 | } 62 | public void complete_Event(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 63 | // subclasses may override 64 | } 65 | public void complete_Command(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 66 | // subclasses may override 67 | } 68 | public void complete_State(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 69 | // subclasses may override 70 | } 71 | public void complete_Transition(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { 72 | // subclasses may override 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/fowlerdsl/ui/contentassist/antlr/PartialStatemachineContentAssistParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr; 5 | 6 | import java.util.Collection; 7 | import java.util.Collections; 8 | 9 | import org.eclipse.xtext.AbstractRule; 10 | import org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialContentAssistParser; 11 | import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement; 12 | import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; 13 | import org.eclipse.xtext.util.PolymorphicDispatcher; 14 | 15 | /* 16 | * Template CodetemplatesGeneratorFragment.xpt 17 | */ 18 | public class PartialStatemachineContentAssistParser extends StatemachineParser implements IPartialContentAssistParser { 19 | 20 | private AbstractRule rule; 21 | 22 | @Override 23 | public void initializeFor(AbstractRule rule) { 24 | this.rule = rule; 25 | } 26 | 27 | @Override 28 | protected Collection getFollowElements(AbstractInternalContentAssistParser parser) { 29 | if (rule == null || rule.eIsProxy()) 30 | return Collections.emptyList(); 31 | String methodName = "entryRule" + rule.getName(); 32 | PolymorphicDispatcher> dispatcher = 33 | new PolymorphicDispatcher>(methodName, 0, 0, Collections.singletonList(parser)); 34 | dispatcher.invoke(); 35 | return parser.getFollowElements(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/fowlerdsl/ui/contentassist/antlr/StatemachineParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr; 5 | 6 | import java.util.Collection; 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | 10 | import org.antlr.runtime.RecognitionException; 11 | import org.eclipse.xtext.AbstractElement; 12 | import org.eclipse.xtext.ui.editor.contentassist.antlr.AbstractPartialContentAssistParser; 13 | import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement; 14 | import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; 15 | 16 | import com.google.inject.Inject; 17 | 18 | import org.eclipse.xtext.example.fowlerdsl.services.StatemachineGrammarAccess; 19 | 20 | public class StatemachineParser extends AbstractPartialContentAssistParser { 21 | 22 | @Inject 23 | private StatemachineGrammarAccess grammarAccess; 24 | 25 | private Map nameMappings; 26 | 27 | @Override 28 | protected org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr.internal.InternalStatemachineParser createParser() { 29 | org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr.internal.InternalStatemachineParser result = new org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr.internal.InternalStatemachineParser(null); 30 | result.setGrammarAccess(grammarAccess); 31 | return result; 32 | } 33 | 34 | @Override 35 | protected String getRuleName(AbstractElement element) { 36 | if (nameMappings == null) { 37 | nameMappings = new HashMap() { 38 | private static final long serialVersionUID = 1L; 39 | { 40 | put(grammarAccess.getStatemachineAccess().getGroup(), "rule__Statemachine__Group__0"); 41 | put(grammarAccess.getStatemachineAccess().getGroup_1(), "rule__Statemachine__Group_1__0"); 42 | put(grammarAccess.getStatemachineAccess().getGroup_2(), "rule__Statemachine__Group_2__0"); 43 | put(grammarAccess.getStatemachineAccess().getGroup_3(), "rule__Statemachine__Group_3__0"); 44 | put(grammarAccess.getEventAccess().getGroup(), "rule__Event__Group__0"); 45 | put(grammarAccess.getCommandAccess().getGroup(), "rule__Command__Group__0"); 46 | put(grammarAccess.getStateAccess().getGroup(), "rule__State__Group__0"); 47 | put(grammarAccess.getStateAccess().getGroup_2(), "rule__State__Group_2__0"); 48 | put(grammarAccess.getTransitionAccess().getGroup(), "rule__Transition__Group__0"); 49 | put(grammarAccess.getStatemachineAccess().getEventsAssignment_1_1(), "rule__Statemachine__EventsAssignment_1_1"); 50 | put(grammarAccess.getStatemachineAccess().getResetEventsAssignment_2_1(), "rule__Statemachine__ResetEventsAssignment_2_1"); 51 | put(grammarAccess.getStatemachineAccess().getCommandsAssignment_3_1(), "rule__Statemachine__CommandsAssignment_3_1"); 52 | put(grammarAccess.getStatemachineAccess().getStatesAssignment_4(), "rule__Statemachine__StatesAssignment_4"); 53 | put(grammarAccess.getEventAccess().getNameAssignment_0(), "rule__Event__NameAssignment_0"); 54 | put(grammarAccess.getEventAccess().getCodeAssignment_1(), "rule__Event__CodeAssignment_1"); 55 | put(grammarAccess.getCommandAccess().getNameAssignment_0(), "rule__Command__NameAssignment_0"); 56 | put(grammarAccess.getCommandAccess().getCodeAssignment_1(), "rule__Command__CodeAssignment_1"); 57 | put(grammarAccess.getStateAccess().getNameAssignment_1(), "rule__State__NameAssignment_1"); 58 | put(grammarAccess.getStateAccess().getActionsAssignment_2_2(), "rule__State__ActionsAssignment_2_2"); 59 | put(grammarAccess.getStateAccess().getTransitionsAssignment_3(), "rule__State__TransitionsAssignment_3"); 60 | put(grammarAccess.getTransitionAccess().getEventAssignment_0(), "rule__Transition__EventAssignment_0"); 61 | put(grammarAccess.getTransitionAccess().getStateAssignment_2(), "rule__Transition__StateAssignment_2"); 62 | } 63 | }; 64 | } 65 | return nameMappings.get(element); 66 | } 67 | 68 | @Override 69 | protected Collection getFollowElements(AbstractInternalContentAssistParser parser) { 70 | try { 71 | org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr.internal.InternalStatemachineParser typedParser = (org.eclipse.xtext.example.fowlerdsl.ui.contentassist.antlr.internal.InternalStatemachineParser) parser; 72 | typedParser.entryRuleStatemachine(); 73 | return typedParser.getFollowElements(); 74 | } catch(RecognitionException ex) { 75 | throw new RuntimeException(ex); 76 | } 77 | } 78 | 79 | @Override 80 | protected String[] getInitialHiddenTokens() { 81 | return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" }; 82 | } 83 | 84 | public StatemachineGrammarAccess getGrammarAccess() { 85 | return this.grammarAccess; 86 | } 87 | 88 | public void setGrammarAccess(StatemachineGrammarAccess grammarAccess) { 89 | this.grammarAccess = grammarAccess; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/fowlerdsl/ui/contentassist/antlr/internal/InternalStatemachine.tokens: -------------------------------------------------------------------------------- 1 | '=>'=19 2 | 'actions'=16 3 | 'commands'=14 4 | 'end'=12 5 | 'events'=11 6 | 'resetEvents'=13 7 | 'state'=15 8 | '{'=17 9 | '}'=18 10 | RULE_ANY_OTHER=10 11 | RULE_ID=4 12 | RULE_INT=5 13 | RULE_ML_COMMENT=7 14 | RULE_SL_COMMENT=8 15 | RULE_STRING=6 16 | RULE_WS=9 17 | T__11=11 18 | T__12=12 19 | T__13=13 20 | T__14=14 21 | T__15=15 22 | T__16=16 23 | T__17=17 24 | T__18=18 25 | T__19=19 26 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/fowlerdsl/ui/internal/StatemachineActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.internal; 5 | 6 | import java.util.Collections; 7 | import java.util.Map; 8 | 9 | import org.apache.log4j.Logger; 10 | import org.eclipse.ui.plugin.AbstractUIPlugin; 11 | import org.eclipse.xtext.ui.shared.SharedStateModule; 12 | import org.eclipse.xtext.util.Modules2; 13 | import org.osgi.framework.BundleContext; 14 | 15 | import com.google.common.collect.Maps; 16 | import com.google.inject.Guice; 17 | import com.google.inject.Injector; 18 | import com.google.inject.Module; 19 | 20 | /** 21 | * This class was generated. Customizations should only happen in a newly 22 | * introduced subclass. 23 | */ 24 | public class StatemachineActivator extends AbstractUIPlugin { 25 | 26 | public static final String ORG_ECLIPSE_XTEXT_EXAMPLE_FOWLERDSL_STATEMACHINE = "org.eclipse.xtext.example.fowlerdsl.Statemachine"; 27 | 28 | private static final Logger logger = Logger.getLogger(StatemachineActivator.class); 29 | 30 | private static StatemachineActivator INSTANCE; 31 | 32 | private Map injectors = Collections.synchronizedMap(Maps. newHashMapWithExpectedSize(1)); 33 | 34 | @Override 35 | public void start(BundleContext context) throws Exception { 36 | super.start(context); 37 | INSTANCE = this; 38 | } 39 | 40 | @Override 41 | public void stop(BundleContext context) throws Exception { 42 | injectors.clear(); 43 | INSTANCE = null; 44 | super.stop(context); 45 | } 46 | 47 | public static StatemachineActivator getInstance() { 48 | return INSTANCE; 49 | } 50 | 51 | public Injector getInjector(String language) { 52 | synchronized (injectors) { 53 | Injector injector = injectors.get(language); 54 | if (injector == null) { 55 | injectors.put(language, injector = createInjector(language)); 56 | } 57 | return injector; 58 | } 59 | } 60 | 61 | protected Injector createInjector(String language) { 62 | try { 63 | Module runtimeModule = getRuntimeModule(language); 64 | Module sharedStateModule = getSharedStateModule(); 65 | Module uiModule = getUiModule(language); 66 | Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule); 67 | return Guice.createInjector(mergedModule); 68 | } catch (Exception e) { 69 | logger.error("Failed to create injector for " + language); 70 | logger.error(e.getMessage(), e); 71 | throw new RuntimeException("Failed to create injector for " + language, e); 72 | } 73 | } 74 | 75 | protected Module getRuntimeModule(String grammar) { 76 | if (ORG_ECLIPSE_XTEXT_EXAMPLE_FOWLERDSL_STATEMACHINE.equals(grammar)) { 77 | return new org.eclipse.xtext.example.fowlerdsl.StatemachineRuntimeModule(); 78 | } 79 | 80 | throw new IllegalArgumentException(grammar); 81 | } 82 | 83 | protected Module getUiModule(String grammar) { 84 | if (ORG_ECLIPSE_XTEXT_EXAMPLE_FOWLERDSL_STATEMACHINE.equals(grammar)) { 85 | return new org.eclipse.xtext.example.fowlerdsl.ui.StatemachineUiModule(this); 86 | } 87 | 88 | throw new IllegalArgumentException(grammar); 89 | } 90 | 91 | protected Module getSharedStateModule() { 92 | return new SharedStateModule(); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/StatemachineUiModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui; 5 | 6 | import org.eclipse.ui.plugin.AbstractUIPlugin; 7 | import org.eclipse.xtext.example.fowlerdsl.ui.findrefs.StatemachineReferenceFinder; 8 | import org.eclipse.xtext.example.fowlerdsl.ui.rename.StatemachineDependentElementsCalculator; 9 | import org.eclipse.xtext.example.fowlerdsl.ui.rename.StatemachineReferenceUpdaterDispatcher; 10 | import org.eclipse.xtext.ui.editor.findrefs.IReferenceFinder; 11 | import org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator; 12 | import org.eclipse.xtext.ui.refactoring.impl.ReferenceUpdaterDispatcher; 13 | 14 | /** 15 | * Use this class to register components to be used within the IDE. 16 | */ 17 | public class StatemachineUiModule extends org.eclipse.xtext.example.fowlerdsl.ui.AbstractStatemachineUiModule { 18 | public StatemachineUiModule(AbstractUIPlugin plugin) { 19 | super(plugin); 20 | } 21 | 22 | public Class bindReferenceUpdaterDispatcher() { 23 | return StatemachineReferenceUpdaterDispatcher.class; 24 | } 25 | 26 | public Class bindIReferenceFinder() { 27 | return StatemachineReferenceFinder.class; 28 | } 29 | 30 | public Class bindIDependentElementsCalculator() { 31 | return StatemachineDependentElementsCalculator.class; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/contentassist/StatemachineProposalProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.contentassist 5 | 6 | import org.eclipse.xtext.example.fowlerdsl.ui.contentassist.AbstractStatemachineProposalProvider 7 | 8 | /** 9 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist 10 | * on how to customize the content assistant. 11 | */ 12 | class StatemachineProposalProvider extends AbstractStatemachineProposalProvider { 13 | } 14 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/findrefs/StatemachineReferenceFinder.xtend: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package org.eclipse.xtext.example.fowlerdsl.ui.findrefs 9 | 10 | import org.eclipse.emf.common.util.URI 11 | import org.eclipse.emf.ecore.EObject 12 | import org.eclipse.emf.ecore.EReference 13 | import org.eclipse.xtext.resource.IReferenceDescription 14 | import org.eclipse.xtext.resource.IResourceServiceProvider.Registry 15 | import org.eclipse.xtext.ui.editor.findrefs.DelegatingReferenceFinder 16 | import org.eclipse.xtext.ui.editor.findrefs.ReferenceAcceptor 17 | import org.eclipse.xtext.util.IAcceptor 18 | 19 | import static extension org.eclipse.xtext.example.fowlerdsl.resource.PathURIFragmentProvider.* 20 | 21 | class StatemachineReferenceFinder extends DelegatingReferenceFinder { 22 | 23 | override protected toAcceptor(IAcceptor acceptor) { 24 | new StatemachineReferenceAcceptor(acceptor, resourceServiceProviderRegistry) 25 | } 26 | 27 | static class StatemachineReferenceAcceptor extends ReferenceAcceptor { 28 | 29 | protected new(IAcceptor delegate, Registry resourceServiceProviderRegistry) { 30 | super(delegate, resourceServiceProviderRegistry) 31 | } 32 | 33 | override void accept(EObject source, URI sourceURI, EReference eReference, int index, EObject targetOrProxy, URI targetURI) { 34 | super.accept(source, sourceURI, eReference, index, targetOrProxy, targetURI) 35 | this.accept(this.createReferenceDescription(source.pathURI, targetURI, eReference, index, this.findExportedContainer(source))) 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/labeling/StatemachineDescriptionLabelProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.labeling 5 | 6 | //import org.eclipse.xtext.resource.IEObjectDescription 7 | 8 | /** 9 | * Provides labels for a IEObjectDescriptions and IResourceDescriptions. 10 | * 11 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider 12 | */ 13 | class StatemachineDescriptionLabelProvider extends org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider { 14 | 15 | // Labels and icons can be computed like this: 16 | 17 | // override text(IEObjectDescription ele) { 18 | // ele.name.toString 19 | // } 20 | // 21 | // override image(IEObjectDescription ele) { 22 | // ele.EClass.name + '.gif' 23 | // } 24 | } 25 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/labeling/StatemachineLabelProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.labeling 5 | 6 | import com.google.inject.Inject 7 | import org.eclipse.xtext.example.fowlerdsl.statemachine.State 8 | 9 | /** 10 | * Provides labels for a EObjects. 11 | * 12 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider 13 | */ 14 | class StatemachineLabelProvider extends org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider { 15 | 16 | @Inject 17 | new(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider delegate) { 18 | super(delegate); 19 | } 20 | 21 | def text(State state) { 22 | 'state ' + state.name 23 | } 24 | 25 | // def image(State ele) { 26 | // 'State.gif' 27 | // } 28 | } 29 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/outline/StatemachineOutlineTreeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.outline 5 | 6 | /** 7 | * Customization of the default outline structure. 8 | * 9 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#outline 10 | */ 11 | class StatemachineOutlineTreeProvider extends org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/quickfix/StatemachineQuickfixProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.ui.quickfix 5 | 6 | import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider 7 | import org.eclipse.xtext.ui.editor.quickfix.Fix 8 | import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor 9 | import org.eclipse.xtext.validation.Issue 10 | import org.eclipse.xtext.example.fowlerdsl.validation.StatemachineValidator 11 | 12 | /** 13 | * Custom quickfixes. 14 | * 15 | * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#quick-fixes 16 | */ 17 | class StatemachineQuickfixProvider extends DefaultQuickfixProvider { 18 | 19 | @Fix(StatemachineValidator.INVALID_NAME) 20 | def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) { 21 | acceptor.accept(issue, "Change to '"+issue.data.head.toFirstLower+"'.", "Change to '"+issue.data.head.toFirstLower+"'.", 'upcase.png') [ 22 | val firstLetter = xtextDocument.get(issue.offset, 1) 23 | xtextDocument.replace(issue.offset, 1, firstLetter.toLowerCase) 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/rename/StatemachineDependentElementsCalculator.xtend: -------------------------------------------------------------------------------- 1 | package org.eclipse.xtext.example.fowlerdsl.ui.rename 2 | 3 | import org.eclipse.core.runtime.IProgressMonitor 4 | import org.eclipse.emf.ecore.EObject 5 | import org.eclipse.xtext.example.fowlerdsl.statemachine.State 6 | import org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator 7 | 8 | import static extension org.eclipse.emf.ecore.util.EcoreUtil.* 9 | 10 | class StatemachineDependentElementsCalculator extends DefaultDependentElementsCalculator { 11 | 12 | override getDependentElementURIs(EObject baseElement, IProgressMonitor monitor) { 13 | val dependentElementURIs = super.getDependentElementURIs(baseElement, monitor) 14 | if(baseElement instanceof State) 15 | dependentElementURIs += baseElement.transitions.map[URI] 16 | return dependentElementURIs 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/rename/StatemachineReferenceUpdaterDispatcher.xtend: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package org.eclipse.xtext.example.fowlerdsl.ui.rename 9 | 10 | import com.google.inject.Inject 11 | import org.eclipse.emf.common.util.URI 12 | import org.eclipse.emf.ecore.EObject 13 | import org.eclipse.emf.ecore.EReference 14 | import org.eclipse.xtext.resource.IResourceServiceProvider 15 | import org.eclipse.xtext.resource.IResourceServiceProvider.Registry 16 | import org.eclipse.xtext.resource.impl.DefaultReferenceDescription 17 | import org.eclipse.xtext.ui.refactoring.IRefactoringUpdateAcceptor 18 | import org.eclipse.xtext.ui.refactoring.impl.ReferenceUpdaterDispatcher 19 | import org.eclipse.xtext.ui.refactoring.impl.StatusWrapper 20 | 21 | import static extension org.eclipse.xtext.example.fowlerdsl.resource.PathURIFragmentProvider.* 22 | 23 | class StatemachineReferenceUpdaterDispatcher extends ReferenceUpdaterDispatcher { 24 | 25 | @Inject IResourceServiceProvider.Registry resourceServiceProviderRegistry; 26 | 27 | override protected createFindReferenceAcceptor(IRefactoringUpdateAcceptor updateAcceptor) { 28 | new StatemachineReferenceDescriptionAcceptor(resourceServiceProviderRegistry, updateAcceptor.getRefactoringStatus()) 29 | } 30 | 31 | static class StatemachineReferenceDescriptionAcceptor extends ReferenceDescriptionAcceptor { 32 | 33 | new(Registry resourceServiceProviderRegistry, StatusWrapper status) { 34 | super(resourceServiceProviderRegistry, status) 35 | } 36 | 37 | override void accept(EObject source, URI sourceURI, EReference eReference, int index, EObject targetOrProxy, URI targetURI) { 38 | accept(new DefaultReferenceDescription(source.pathURI, targetURI, eReference, index, null)) 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/contentassist/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineProposalProvider.java._trace 2 | /.StatemachineProposalProvider.xtendbin 3 | /StatemachineProposalProvider.java 4 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/findrefs/.StatemachineReferenceFinder.java._trace: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/findrefs/.StatemachineReferenceFinder.java._trace -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/findrefs/.StatemachineReferenceFinder.xtendbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/findrefs/.StatemachineReferenceFinder.xtendbin -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/findrefs/StatemachineReferenceFinder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.eclipse.xtext.example.fowlerdsl.ui.findrefs; 9 | 10 | import org.eclipse.emf.common.util.URI; 11 | import org.eclipse.emf.ecore.EObject; 12 | import org.eclipse.emf.ecore.EReference; 13 | import org.eclipse.xtext.example.fowlerdsl.resource.PathURIFragmentProvider; 14 | import org.eclipse.xtext.findReferences.IReferenceFinder; 15 | import org.eclipse.xtext.resource.IReferenceDescription; 16 | import org.eclipse.xtext.resource.IResourceServiceProvider; 17 | import org.eclipse.xtext.ui.editor.findrefs.DelegatingReferenceFinder; 18 | import org.eclipse.xtext.ui.editor.findrefs.ReferenceAcceptor; 19 | import org.eclipse.xtext.util.IAcceptor; 20 | 21 | @SuppressWarnings("all") 22 | public class StatemachineReferenceFinder extends DelegatingReferenceFinder { 23 | public static class StatemachineReferenceAcceptor extends ReferenceAcceptor { 24 | protected StatemachineReferenceAcceptor(final IAcceptor delegate, final IResourceServiceProvider.Registry resourceServiceProviderRegistry) { 25 | super(delegate, resourceServiceProviderRegistry); 26 | } 27 | 28 | @Override 29 | public void accept(final EObject source, final URI sourceURI, final EReference eReference, final int index, final EObject targetOrProxy, final URI targetURI) { 30 | super.accept(source, sourceURI, eReference, index, targetOrProxy, targetURI); 31 | this.accept(this.createReferenceDescription(PathURIFragmentProvider.getPathURI(source), targetURI, eReference, index, this.findExportedContainer(source))); 32 | } 33 | } 34 | 35 | @Override 36 | protected IReferenceFinder.Acceptor toAcceptor(final IAcceptor acceptor) { 37 | IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry(); 38 | return new StatemachineReferenceFinder.StatemachineReferenceAcceptor(acceptor, _resourceServiceProviderRegistry); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/labeling/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineDescriptionLabelProvider.java._trace 2 | /.StatemachineDescriptionLabelProvider.xtendbin 3 | /.StatemachineLabelProvider.java._trace 4 | /.StatemachineLabelProvider.xtendbin 5 | /StatemachineDescriptionLabelProvider.java 6 | /StatemachineLabelProvider.java 7 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/outline/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineOutlineTreeProvider.java._trace 2 | /.StatemachineOutlineTreeProvider.xtendbin 3 | /StatemachineOutlineTreeProvider.java 4 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/quickfix/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineQuickfixProvider.java._trace 2 | /.StatemachineQuickfixProvider.xtendbin 3 | /StatemachineQuickfixProvider.java 4 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineDependentElementsCalculator.java._trace: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineDependentElementsCalculator.java._trace -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineDependentElementsCalculator.xtendbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineDependentElementsCalculator.xtendbin -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineReferenceUpdaterDispatcher.java._trace: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineReferenceUpdaterDispatcher.java._trace -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineReferenceUpdaterDispatcher.xtendbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/.StatemachineReferenceUpdaterDispatcher.xtendbin -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/StatemachineDependentElementsCalculator.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.xtext.example.fowlerdsl.ui.rename; 2 | 3 | import com.google.common.collect.Iterables; 4 | import java.util.List; 5 | import org.eclipse.core.runtime.IProgressMonitor; 6 | import org.eclipse.emf.common.util.URI; 7 | import org.eclipse.emf.ecore.EObject; 8 | import org.eclipse.emf.ecore.util.EcoreUtil; 9 | import org.eclipse.xtext.example.fowlerdsl.statemachine.State; 10 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Transition; 11 | import org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator; 12 | import org.eclipse.xtext.xbase.lib.Functions.Function1; 13 | import org.eclipse.xtext.xbase.lib.ListExtensions; 14 | 15 | @SuppressWarnings("all") 16 | public class StatemachineDependentElementsCalculator extends DefaultDependentElementsCalculator { 17 | @Override 18 | public List getDependentElementURIs(final EObject baseElement, final IProgressMonitor monitor) { 19 | final List dependentElementURIs = super.getDependentElementURIs(baseElement, monitor); 20 | if ((baseElement instanceof State)) { 21 | final Function1 _function = (Transition it) -> { 22 | return EcoreUtil.getURI(it); 23 | }; 24 | List _map = ListExtensions.map(((State)baseElement).getTransitions(), _function); 25 | Iterables.addAll(dependentElementURIs, _map); 26 | } 27 | return dependentElementURIs; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl.ui/xtend-gen/org/eclipse/xtext/example/fowlerdsl/ui/rename/StatemachineReferenceUpdaterDispatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.eclipse.xtext.example.fowlerdsl.ui.rename; 9 | 10 | import com.google.inject.Inject; 11 | import org.eclipse.emf.common.util.URI; 12 | import org.eclipse.emf.ecore.EObject; 13 | import org.eclipse.emf.ecore.EReference; 14 | import org.eclipse.xtext.example.fowlerdsl.resource.PathURIFragmentProvider; 15 | import org.eclipse.xtext.resource.IResourceServiceProvider; 16 | import org.eclipse.xtext.resource.impl.DefaultReferenceDescription; 17 | import org.eclipse.xtext.ui.refactoring.IRefactoringUpdateAcceptor; 18 | import org.eclipse.xtext.ui.refactoring.impl.ReferenceUpdaterDispatcher; 19 | import org.eclipse.xtext.ui.refactoring.impl.StatusWrapper; 20 | 21 | @SuppressWarnings("all") 22 | public class StatemachineReferenceUpdaterDispatcher extends ReferenceUpdaterDispatcher { 23 | public static class StatemachineReferenceDescriptionAcceptor extends ReferenceUpdaterDispatcher.ReferenceDescriptionAcceptor { 24 | public StatemachineReferenceDescriptionAcceptor(final IResourceServiceProvider.Registry resourceServiceProviderRegistry, final StatusWrapper status) { 25 | super(resourceServiceProviderRegistry, status); 26 | } 27 | 28 | @Override 29 | public void accept(final EObject source, final URI sourceURI, final EReference eReference, final int index, final EObject targetOrProxy, final URI targetURI) { 30 | URI _pathURI = PathURIFragmentProvider.getPathURI(source); 31 | DefaultReferenceDescription _defaultReferenceDescription = new DefaultReferenceDescription(_pathURI, targetURI, eReference, index, null); 32 | this.accept(_defaultReferenceDescription); 33 | } 34 | } 35 | 36 | @Inject 37 | private IResourceServiceProvider.Registry resourceServiceProviderRegistry; 38 | 39 | @Override 40 | protected ReferenceUpdaterDispatcher.ReferenceDescriptionAcceptor createFindReferenceAcceptor(final IRefactoringUpdateAcceptor updateAcceptor) { 41 | StatusWrapper _refactoringStatus = updateAcceptor.getRefactoringStatus(); 42 | return new StatemachineReferenceUpdaterDispatcher.StatemachineReferenceDescriptionAcceptor(this.resourceServiceProviderRegistry, _refactoringStatus); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/.antlr-generator-3.2.0-patch.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/.antlr-generator-3.2.0-patch.jar -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.xtext.example.fowlerdsl 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.xtext.ui.shared.xtextBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jdt.core.javanature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.xtext.ui.shared.xtextNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/GenerateStatemachine.mwe2.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Xtext Fowler DSL Example - Runtime 4 | Bundle-Vendor: Eclipse Xtext 5 | Bundle-Version: 2.11.0.qualifier 6 | Bundle-SymbolicName: org.eclipse.xtext.example.fowlerdsl; singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: org.eclipse.xtext;visibility:=reexport, 9 | org.eclipse.xtext.xbase;resolution:=optional;visibility:=reexport, 10 | org.eclipse.xtext.util, 11 | org.eclipse.emf.ecore;bundle-version="2.10.2", 12 | org.eclipse.emf.common;bundle-version="2.10.1", 13 | org.antlr.runtime, 14 | org.eclipse.xtext.common.types, 15 | org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional, 16 | org.eclipse.xtext.xbase.lib, 17 | org.eclipse.equinox.common 18 | Import-Package: org.apache.log4j 19 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 20 | Export-Package: org.eclipse.xtext.example.fowlerdsl, 21 | org.eclipse.xtext.example.fowlerdsl.formatting, 22 | org.eclipse.xtext.example.fowlerdsl.generator, 23 | org.eclipse.xtext.example.fowlerdsl.parser.antlr, 24 | org.eclipse.xtext.example.fowlerdsl.parser.antlr.internal, 25 | org.eclipse.xtext.example.fowlerdsl.resource, 26 | org.eclipse.xtext.example.fowlerdsl.scoping, 27 | org.eclipse.xtext.example.fowlerdsl.serializer, 28 | org.eclipse.xtext.example.fowlerdsl.services, 29 | org.eclipse.xtext.example.fowlerdsl.statemachine, 30 | org.eclipse.xtext.example.fowlerdsl.statemachine.impl, 31 | org.eclipse.xtext.example.fowlerdsl.statemachine.util, 32 | org.eclipse.xtext.example.fowlerdsl.validation 33 | 34 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/README.TXT: -------------------------------------------------------------------------------- 1 | Start a new Eclipse Application and create an empty Java project. 2 | Add new source folder called "src-gen/" and put the following statemachine into a file in the "src/" folder. 3 | 4 | // MrsGrantsSecretCompartments.statemachine 5 | 6 | events 7 | doorClosed D1CL 8 | drawOpened D2OP 9 | lightOn L1ON 10 | doorOpened D1OP 11 | panelClosed PNCL 12 | end 13 | 14 | resetEvents 15 | doorClosed 16 | end 17 | 18 | commands 19 | unlockPanel PNUL 20 | lockPanel PNLK 21 | lockDoor D1LK 22 | unlockDoor D1UL 23 | end 24 | 25 | state idle 26 | actions {unlockDoor lockPanel} 27 | doorClosed => active 28 | end 29 | 30 | state active 31 | drawOpened => waitingForLight 32 | lightOn => waitingForDraw 33 | end 34 | 35 | state waitingForLight 36 | lightOn => unlockedPanel 37 | end 38 | 39 | state waitingForDraw 40 | drawOpened => unlockedPanel 41 | end 42 | 43 | state unlockedPanel 44 | actions {unlockPanel lockDoor} 45 | panelClosed => idle 46 | end -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = model/,\ 5 | META-INF/,\ 6 | .,\ 7 | plugin.xml 8 | additional.bundles = org.eclipse.emf.mwe2.launch,\ 9 | org.apache.commons.logging,\ 10 | org.eclipse.xtext.generator 11 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/model/generated/Statemachine.ecore: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/model/generated/Statemachine.genmodel: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/plugin.xml_gen: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/Statemachine.xtextbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/Statemachine.xtextbin -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/StatemachineStandaloneSetupGenerated.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl; 5 | 6 | import org.eclipse.emf.ecore.EPackage; 7 | import org.eclipse.emf.ecore.resource.Resource; 8 | import org.eclipse.xtext.ISetup; 9 | 10 | import com.google.inject.Guice; 11 | import com.google.inject.Injector; 12 | 13 | /** 14 | * Generated from StandaloneSetup.xpt! 15 | */ 16 | @SuppressWarnings("all") 17 | public class StatemachineStandaloneSetupGenerated implements ISetup { 18 | 19 | @Override 20 | public Injector createInjectorAndDoEMFRegistration() { 21 | org.eclipse.xtext.common.TerminalsStandaloneSetup.doSetup(); 22 | 23 | Injector injector = createInjector(); 24 | register(injector); 25 | return injector; 26 | } 27 | 28 | public Injector createInjector() { 29 | return Guice.createInjector(new org.eclipse.xtext.example.fowlerdsl.StatemachineRuntimeModule()); 30 | } 31 | 32 | public void register(Injector injector) { 33 | if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/xtext/example/fowlerdsl/Statemachine")) { 34 | EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xtext/example/fowlerdsl/Statemachine", org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage.eINSTANCE); 35 | } 36 | 37 | org.eclipse.xtext.resource.IResourceFactory resourceFactory = injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class); 38 | org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider = injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class); 39 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("statemachine", resourceFactory); 40 | org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("statemachine", serviceProvider); 41 | 42 | 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/parser/antlr/StatemachineAntlrTokenFileProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.parser.antlr; 5 | 6 | import java.io.InputStream; 7 | import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; 8 | 9 | public class StatemachineAntlrTokenFileProvider implements IAntlrTokenFileProvider { 10 | 11 | @Override 12 | public InputStream getAntlrTokenFile() { 13 | ClassLoader classLoader = getClass().getClassLoader(); 14 | return classLoader.getResourceAsStream("org/eclipse/xtext/example/fowlerdsl/parser/antlr/internal/InternalStatemachine.tokens"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/parser/antlr/StatemachineParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.parser.antlr; 5 | 6 | import com.google.inject.Inject; 7 | 8 | import org.eclipse.xtext.parser.antlr.XtextTokenStream; 9 | import org.eclipse.xtext.example.fowlerdsl.services.StatemachineGrammarAccess; 10 | 11 | public class StatemachineParser extends org.eclipse.xtext.parser.antlr.AbstractAntlrParser { 12 | 13 | @Inject 14 | private StatemachineGrammarAccess grammarAccess; 15 | 16 | @Override 17 | protected void setInitialHiddenTokens(XtextTokenStream tokenStream) { 18 | tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT"); 19 | } 20 | 21 | @Override 22 | protected org.eclipse.xtext.example.fowlerdsl.parser.antlr.internal.InternalStatemachineParser createParser(XtextTokenStream stream) { 23 | return new org.eclipse.xtext.example.fowlerdsl.parser.antlr.internal.InternalStatemachineParser(stream, getGrammarAccess()); 24 | } 25 | 26 | @Override 27 | protected String getDefaultRuleName() { 28 | return "Statemachine"; 29 | } 30 | 31 | public StatemachineGrammarAccess getGrammarAccess() { 32 | return this.grammarAccess; 33 | } 34 | 35 | public void setGrammarAccess(StatemachineGrammarAccess grammarAccess) { 36 | this.grammarAccess = grammarAccess; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/parser/antlr/internal/InternalStatemachine.tokens: -------------------------------------------------------------------------------- 1 | '=>'=19 2 | 'actions'=16 3 | 'commands'=14 4 | 'end'=12 5 | 'events'=11 6 | 'resetEvents'=13 7 | 'state'=15 8 | '{'=17 9 | '}'=18 10 | RULE_ANY_OTHER=10 11 | RULE_ID=4 12 | RULE_INT=5 13 | RULE_ML_COMMENT=7 14 | RULE_SL_COMMENT=8 15 | RULE_STRING=6 16 | RULE_WS=9 17 | T__11=11 18 | T__12=12 19 | T__13=13 20 | T__14=14 21 | T__15=15 22 | T__16=16 23 | T__17=17 24 | T__18=18 25 | T__19=19 26 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/serializer/StatemachineSyntacticSequencer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.serializer; 5 | 6 | import com.google.inject.Inject; 7 | import java.util.List; 8 | import org.eclipse.emf.ecore.EObject; 9 | import org.eclipse.xtext.IGrammarAccess; 10 | import org.eclipse.xtext.RuleCall; 11 | import org.eclipse.xtext.example.fowlerdsl.services.StatemachineGrammarAccess; 12 | import org.eclipse.xtext.nodemodel.INode; 13 | import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias; 14 | import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition; 15 | import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer; 16 | 17 | @SuppressWarnings("all") 18 | public class StatemachineSyntacticSequencer extends AbstractSyntacticSequencer { 19 | 20 | protected StatemachineGrammarAccess grammarAccess; 21 | 22 | @Inject 23 | protected void init(IGrammarAccess access) { 24 | grammarAccess = (StatemachineGrammarAccess) access; 25 | } 26 | 27 | @Override 28 | protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { 29 | return ""; 30 | } 31 | 32 | 33 | @Override 34 | protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { 35 | if (transition.getAmbiguousSyntaxes().isEmpty()) return; 36 | List transitionNodes = collectNodes(fromNode, toNode); 37 | for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { 38 | List syntaxNodes = getNodesFor(transitionNodes, syntax); 39 | acceptNodes(getLastNavigableState(), syntaxNodes); 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/Command.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine; 4 | 5 | import org.eclipse.emf.ecore.EObject; 6 | 7 | /** 8 | * 9 | * A representation of the model object 'Command'. 10 | * 11 | * 12 | *

13 | * The following features are supported: 14 | *

15 | *
    16 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Command#getName Name}
  • 17 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Command#getCode Code}
  • 18 | *
19 | * 20 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getCommand() 21 | * @model 22 | * @generated 23 | */ 24 | public interface Command extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'Name' attribute. 28 | * 29 | *

30 | * If the meaning of the 'Name' attribute isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'Name' attribute. 35 | * @see #setName(String) 36 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getCommand_Name() 37 | * @model 38 | * @generated 39 | */ 40 | String getName(); 41 | 42 | /** 43 | * Sets the value of the '{@link org.eclipse.xtext.example.fowlerdsl.statemachine.Command#getName Name}' attribute. 44 | * 45 | * 46 | * @param value the new value of the 'Name' attribute. 47 | * @see #getName() 48 | * @generated 49 | */ 50 | void setName(String value); 51 | 52 | /** 53 | * Returns the value of the 'Code' attribute. 54 | * 55 | *

56 | * If the meaning of the 'Code' attribute isn't clear, 57 | * there really should be more of a description here... 58 | *

59 | * 60 | * @return the value of the 'Code' attribute. 61 | * @see #setCode(String) 62 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getCommand_Code() 63 | * @model 64 | * @generated 65 | */ 66 | String getCode(); 67 | 68 | /** 69 | * Sets the value of the '{@link org.eclipse.xtext.example.fowlerdsl.statemachine.Command#getCode Code}' attribute. 70 | * 71 | * 72 | * @param value the new value of the 'Code' attribute. 73 | * @see #getCode() 74 | * @generated 75 | */ 76 | void setCode(String value); 77 | 78 | } // Command 79 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/Event.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine; 4 | 5 | import org.eclipse.emf.ecore.EObject; 6 | 7 | /** 8 | * 9 | * A representation of the model object 'Event'. 10 | * 11 | * 12 | *

13 | * The following features are supported: 14 | *

15 | *
    16 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Event#getName Name}
  • 17 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Event#getCode Code}
  • 18 | *
19 | * 20 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getEvent() 21 | * @model 22 | * @generated 23 | */ 24 | public interface Event extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'Name' attribute. 28 | * 29 | *

30 | * If the meaning of the 'Name' attribute isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'Name' attribute. 35 | * @see #setName(String) 36 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getEvent_Name() 37 | * @model 38 | * @generated 39 | */ 40 | String getName(); 41 | 42 | /** 43 | * Sets the value of the '{@link org.eclipse.xtext.example.fowlerdsl.statemachine.Event#getName Name}' attribute. 44 | * 45 | * 46 | * @param value the new value of the 'Name' attribute. 47 | * @see #getName() 48 | * @generated 49 | */ 50 | void setName(String value); 51 | 52 | /** 53 | * Returns the value of the 'Code' attribute. 54 | * 55 | *

56 | * If the meaning of the 'Code' attribute isn't clear, 57 | * there really should be more of a description here... 58 | *

59 | * 60 | * @return the value of the 'Code' attribute. 61 | * @see #setCode(String) 62 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getEvent_Code() 63 | * @model 64 | * @generated 65 | */ 66 | String getCode(); 67 | 68 | /** 69 | * Sets the value of the '{@link org.eclipse.xtext.example.fowlerdsl.statemachine.Event#getCode Code}' attribute. 70 | * 71 | * 72 | * @param value the new value of the 'Code' attribute. 73 | * @see #getCode() 74 | * @generated 75 | */ 76 | void setCode(String value); 77 | 78 | } // Event 79 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/State.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine; 4 | 5 | import org.eclipse.emf.common.util.EList; 6 | 7 | import org.eclipse.emf.ecore.EObject; 8 | 9 | /** 10 | * 11 | * A representation of the model object 'State'. 12 | * 13 | * 14 | *

15 | * The following features are supported: 16 | *

17 | *
    18 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.State#getName Name}
  • 19 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.State#getActions Actions}
  • 20 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.State#getTransitions Transitions}
  • 21 | *
22 | * 23 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getState() 24 | * @model 25 | * @generated 26 | */ 27 | public interface State extends EObject 28 | { 29 | /** 30 | * Returns the value of the 'Name' attribute. 31 | * 32 | *

33 | * If the meaning of the 'Name' attribute isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'Name' attribute. 38 | * @see #setName(String) 39 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getState_Name() 40 | * @model 41 | * @generated 42 | */ 43 | String getName(); 44 | 45 | /** 46 | * Sets the value of the '{@link org.eclipse.xtext.example.fowlerdsl.statemachine.State#getName Name}' attribute. 47 | * 48 | * 49 | * @param value the new value of the 'Name' attribute. 50 | * @see #getName() 51 | * @generated 52 | */ 53 | void setName(String value); 54 | 55 | /** 56 | * Returns the value of the 'Actions' reference list. 57 | * The list contents are of type {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Command}. 58 | * 59 | *

60 | * If the meaning of the 'Actions' reference list isn't clear, 61 | * there really should be more of a description here... 62 | *

63 | * 64 | * @return the value of the 'Actions' reference list. 65 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getState_Actions() 66 | * @model 67 | * @generated 68 | */ 69 | EList getActions(); 70 | 71 | /** 72 | * Returns the value of the 'Transitions' containment reference list. 73 | * The list contents are of type {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Transition}. 74 | * 75 | *

76 | * If the meaning of the 'Transitions' containment reference list isn't clear, 77 | * there really should be more of a description here... 78 | *

79 | * 80 | * @return the value of the 'Transitions' containment reference list. 81 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getState_Transitions() 82 | * @model containment="true" 83 | * @generated 84 | */ 85 | EList getTransitions(); 86 | 87 | } // State 88 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/Statemachine.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine; 4 | 5 | import org.eclipse.emf.common.util.EList; 6 | 7 | import org.eclipse.emf.ecore.EObject; 8 | 9 | /** 10 | * 11 | * A representation of the model object 'Statemachine'. 12 | * 13 | * 14 | *

15 | * The following features are supported: 16 | *

17 | *
    18 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine#getEvents Events}
  • 19 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine#getResetEvents Reset Events}
  • 20 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine#getCommands Commands}
  • 21 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine#getStates States}
  • 22 | *
23 | * 24 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getStatemachine() 25 | * @model 26 | * @generated 27 | */ 28 | public interface Statemachine extends EObject 29 | { 30 | /** 31 | * Returns the value of the 'Events' containment reference list. 32 | * The list contents are of type {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Event}. 33 | * 34 | *

35 | * If the meaning of the 'Events' containment reference list isn't clear, 36 | * there really should be more of a description here... 37 | *

38 | * 39 | * @return the value of the 'Events' containment reference list. 40 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getStatemachine_Events() 41 | * @model containment="true" 42 | * @generated 43 | */ 44 | EList getEvents(); 45 | 46 | /** 47 | * Returns the value of the 'Reset Events' reference list. 48 | * The list contents are of type {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Event}. 49 | * 50 | *

51 | * If the meaning of the 'Reset Events' reference list isn't clear, 52 | * there really should be more of a description here... 53 | *

54 | * 55 | * @return the value of the 'Reset Events' reference list. 56 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getStatemachine_ResetEvents() 57 | * @model 58 | * @generated 59 | */ 60 | EList getResetEvents(); 61 | 62 | /** 63 | * Returns the value of the 'Commands' containment reference list. 64 | * The list contents are of type {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Command}. 65 | * 66 | *

67 | * If the meaning of the 'Commands' containment reference list isn't clear, 68 | * there really should be more of a description here... 69 | *

70 | * 71 | * @return the value of the 'Commands' containment reference list. 72 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getStatemachine_Commands() 73 | * @model containment="true" 74 | * @generated 75 | */ 76 | EList getCommands(); 77 | 78 | /** 79 | * Returns the value of the 'States' containment reference list. 80 | * The list contents are of type {@link org.eclipse.xtext.example.fowlerdsl.statemachine.State}. 81 | * 82 | *

83 | * If the meaning of the 'States' containment reference list isn't clear, 84 | * there really should be more of a description here... 85 | *

86 | * 87 | * @return the value of the 'States' containment reference list. 88 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getStatemachine_States() 89 | * @model containment="true" 90 | * @generated 91 | */ 92 | EList getStates(); 93 | 94 | } // Statemachine 95 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/StatemachineFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine; 4 | 5 | import org.eclipse.emf.ecore.EFactory; 6 | 7 | /** 8 | * 9 | * The Factory for the model. 10 | * It provides a create method for each non-abstract class of the model. 11 | * 12 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage 13 | * @generated 14 | */ 15 | public interface StatemachineFactory extends EFactory 16 | { 17 | /** 18 | * The singleton instance of the factory. 19 | * 20 | * 21 | * @generated 22 | */ 23 | StatemachineFactory eINSTANCE = org.eclipse.xtext.example.fowlerdsl.statemachine.impl.StatemachineFactoryImpl.init(); 24 | 25 | /** 26 | * Returns a new object of class 'Statemachine'. 27 | * 28 | * 29 | * @return a new object of class 'Statemachine'. 30 | * @generated 31 | */ 32 | Statemachine createStatemachine(); 33 | 34 | /** 35 | * Returns a new object of class 'Event'. 36 | * 37 | * 38 | * @return a new object of class 'Event'. 39 | * @generated 40 | */ 41 | Event createEvent(); 42 | 43 | /** 44 | * Returns a new object of class 'Command'. 45 | * 46 | * 47 | * @return a new object of class 'Command'. 48 | * @generated 49 | */ 50 | Command createCommand(); 51 | 52 | /** 53 | * Returns a new object of class 'State'. 54 | * 55 | * 56 | * @return a new object of class 'State'. 57 | * @generated 58 | */ 59 | State createState(); 60 | 61 | /** 62 | * Returns a new object of class 'Transition'. 63 | * 64 | * 65 | * @return a new object of class 'Transition'. 66 | * @generated 67 | */ 68 | Transition createTransition(); 69 | 70 | /** 71 | * Returns the package supported by this factory. 72 | * 73 | * 74 | * @return the package supported by this factory. 75 | * @generated 76 | */ 77 | StatemachinePackage getStatemachinePackage(); 78 | 79 | } //StatemachineFactory 80 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/Transition.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine; 4 | 5 | import org.eclipse.emf.ecore.EObject; 6 | 7 | /** 8 | * 9 | * A representation of the model object 'Transition'. 10 | * 11 | * 12 | *

13 | * The following features are supported: 14 | *

15 | *
    16 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Transition#getEvent Event}
  • 17 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.Transition#getState State}
  • 18 | *
19 | * 20 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getTransition() 21 | * @model 22 | * @generated 23 | */ 24 | public interface Transition extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'Event' reference. 28 | * 29 | *

30 | * If the meaning of the 'Event' reference isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'Event' reference. 35 | * @see #setEvent(Event) 36 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getTransition_Event() 37 | * @model 38 | * @generated 39 | */ 40 | Event getEvent(); 41 | 42 | /** 43 | * Sets the value of the '{@link org.eclipse.xtext.example.fowlerdsl.statemachine.Transition#getEvent Event}' reference. 44 | * 45 | * 46 | * @param value the new value of the 'Event' reference. 47 | * @see #getEvent() 48 | * @generated 49 | */ 50 | void setEvent(Event value); 51 | 52 | /** 53 | * Returns the value of the 'State' reference. 54 | * 55 | *

56 | * If the meaning of the 'State' reference isn't clear, 57 | * there really should be more of a description here... 58 | *

59 | * 60 | * @return the value of the 'State' reference. 61 | * @see #setState(State) 62 | * @see org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage#getTransition_State() 63 | * @model 64 | * @generated 65 | */ 66 | State getState(); 67 | 68 | /** 69 | * Sets the value of the '{@link org.eclipse.xtext.example.fowlerdsl.statemachine.Transition#getState State}' reference. 70 | * 71 | * 72 | * @param value the new value of the 'State' reference. 73 | * @see #getState() 74 | * @generated 75 | */ 76 | void setState(State value); 77 | 78 | } // Transition 79 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/impl/CommandImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine.impl; 4 | 5 | import org.eclipse.emf.common.notify.Notification; 6 | 7 | import org.eclipse.emf.ecore.EClass; 8 | 9 | import org.eclipse.emf.ecore.impl.ENotificationImpl; 10 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 11 | 12 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Command; 13 | import org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage; 14 | 15 | /** 16 | * 17 | * An implementation of the model object 'Command'. 18 | * 19 | *

20 | * The following features are implemented: 21 | *

22 | *
    23 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.impl.CommandImpl#getName Name}
  • 24 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.impl.CommandImpl#getCode Code}
  • 25 | *
26 | * 27 | * @generated 28 | */ 29 | public class CommandImpl extends MinimalEObjectImpl.Container implements Command 30 | { 31 | /** 32 | * The default value of the '{@link #getName() Name}' attribute. 33 | * 34 | * 35 | * @see #getName() 36 | * @generated 37 | * @ordered 38 | */ 39 | protected static final String NAME_EDEFAULT = null; 40 | 41 | /** 42 | * The cached value of the '{@link #getName() Name}' attribute. 43 | * 44 | * 45 | * @see #getName() 46 | * @generated 47 | * @ordered 48 | */ 49 | protected String name = NAME_EDEFAULT; 50 | 51 | /** 52 | * The default value of the '{@link #getCode() Code}' attribute. 53 | * 54 | * 55 | * @see #getCode() 56 | * @generated 57 | * @ordered 58 | */ 59 | protected static final String CODE_EDEFAULT = null; 60 | 61 | /** 62 | * The cached value of the '{@link #getCode() Code}' attribute. 63 | * 64 | * 65 | * @see #getCode() 66 | * @generated 67 | * @ordered 68 | */ 69 | protected String code = CODE_EDEFAULT; 70 | 71 | /** 72 | * 73 | * 74 | * @generated 75 | */ 76 | protected CommandImpl() 77 | { 78 | super(); 79 | } 80 | 81 | /** 82 | * 83 | * 84 | * @generated 85 | */ 86 | @Override 87 | protected EClass eStaticClass() 88 | { 89 | return StatemachinePackage.Literals.COMMAND; 90 | } 91 | 92 | /** 93 | * 94 | * 95 | * @generated 96 | */ 97 | public String getName() 98 | { 99 | return name; 100 | } 101 | 102 | /** 103 | * 104 | * 105 | * @generated 106 | */ 107 | public void setName(String newName) 108 | { 109 | String oldName = name; 110 | name = newName; 111 | if (eNotificationRequired()) 112 | eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.COMMAND__NAME, oldName, name)); 113 | } 114 | 115 | /** 116 | * 117 | * 118 | * @generated 119 | */ 120 | public String getCode() 121 | { 122 | return code; 123 | } 124 | 125 | /** 126 | * 127 | * 128 | * @generated 129 | */ 130 | public void setCode(String newCode) 131 | { 132 | String oldCode = code; 133 | code = newCode; 134 | if (eNotificationRequired()) 135 | eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.COMMAND__CODE, oldCode, code)); 136 | } 137 | 138 | /** 139 | * 140 | * 141 | * @generated 142 | */ 143 | @Override 144 | public Object eGet(int featureID, boolean resolve, boolean coreType) 145 | { 146 | switch (featureID) 147 | { 148 | case StatemachinePackage.COMMAND__NAME: 149 | return getName(); 150 | case StatemachinePackage.COMMAND__CODE: 151 | return getCode(); 152 | } 153 | return super.eGet(featureID, resolve, coreType); 154 | } 155 | 156 | /** 157 | * 158 | * 159 | * @generated 160 | */ 161 | @Override 162 | public void eSet(int featureID, Object newValue) 163 | { 164 | switch (featureID) 165 | { 166 | case StatemachinePackage.COMMAND__NAME: 167 | setName((String)newValue); 168 | return; 169 | case StatemachinePackage.COMMAND__CODE: 170 | setCode((String)newValue); 171 | return; 172 | } 173 | super.eSet(featureID, newValue); 174 | } 175 | 176 | /** 177 | * 178 | * 179 | * @generated 180 | */ 181 | @Override 182 | public void eUnset(int featureID) 183 | { 184 | switch (featureID) 185 | { 186 | case StatemachinePackage.COMMAND__NAME: 187 | setName(NAME_EDEFAULT); 188 | return; 189 | case StatemachinePackage.COMMAND__CODE: 190 | setCode(CODE_EDEFAULT); 191 | return; 192 | } 193 | super.eUnset(featureID); 194 | } 195 | 196 | /** 197 | * 198 | * 199 | * @generated 200 | */ 201 | @Override 202 | public boolean eIsSet(int featureID) 203 | { 204 | switch (featureID) 205 | { 206 | case StatemachinePackage.COMMAND__NAME: 207 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); 208 | case StatemachinePackage.COMMAND__CODE: 209 | return CODE_EDEFAULT == null ? code != null : !CODE_EDEFAULT.equals(code); 210 | } 211 | return super.eIsSet(featureID); 212 | } 213 | 214 | /** 215 | * 216 | * 217 | * @generated 218 | */ 219 | @Override 220 | public String toString() 221 | { 222 | if (eIsProxy()) return super.toString(); 223 | 224 | StringBuffer result = new StringBuffer(super.toString()); 225 | result.append(" (name: "); 226 | result.append(name); 227 | result.append(", code: "); 228 | result.append(code); 229 | result.append(')'); 230 | return result.toString(); 231 | } 232 | 233 | } //CommandImpl 234 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/impl/EventImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine.impl; 4 | 5 | import org.eclipse.emf.common.notify.Notification; 6 | 7 | import org.eclipse.emf.ecore.EClass; 8 | 9 | import org.eclipse.emf.ecore.impl.ENotificationImpl; 10 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 11 | 12 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Event; 13 | import org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage; 14 | 15 | /** 16 | * 17 | * An implementation of the model object 'Event'. 18 | * 19 | *

20 | * The following features are implemented: 21 | *

22 | *
    23 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.impl.EventImpl#getName Name}
  • 24 | *
  • {@link org.eclipse.xtext.example.fowlerdsl.statemachine.impl.EventImpl#getCode Code}
  • 25 | *
26 | * 27 | * @generated 28 | */ 29 | public class EventImpl extends MinimalEObjectImpl.Container implements Event 30 | { 31 | /** 32 | * The default value of the '{@link #getName() Name}' attribute. 33 | * 34 | * 35 | * @see #getName() 36 | * @generated 37 | * @ordered 38 | */ 39 | protected static final String NAME_EDEFAULT = null; 40 | 41 | /** 42 | * The cached value of the '{@link #getName() Name}' attribute. 43 | * 44 | * 45 | * @see #getName() 46 | * @generated 47 | * @ordered 48 | */ 49 | protected String name = NAME_EDEFAULT; 50 | 51 | /** 52 | * The default value of the '{@link #getCode() Code}' attribute. 53 | * 54 | * 55 | * @see #getCode() 56 | * @generated 57 | * @ordered 58 | */ 59 | protected static final String CODE_EDEFAULT = null; 60 | 61 | /** 62 | * The cached value of the '{@link #getCode() Code}' attribute. 63 | * 64 | * 65 | * @see #getCode() 66 | * @generated 67 | * @ordered 68 | */ 69 | protected String code = CODE_EDEFAULT; 70 | 71 | /** 72 | * 73 | * 74 | * @generated 75 | */ 76 | protected EventImpl() 77 | { 78 | super(); 79 | } 80 | 81 | /** 82 | * 83 | * 84 | * @generated 85 | */ 86 | @Override 87 | protected EClass eStaticClass() 88 | { 89 | return StatemachinePackage.Literals.EVENT; 90 | } 91 | 92 | /** 93 | * 94 | * 95 | * @generated 96 | */ 97 | public String getName() 98 | { 99 | return name; 100 | } 101 | 102 | /** 103 | * 104 | * 105 | * @generated 106 | */ 107 | public void setName(String newName) 108 | { 109 | String oldName = name; 110 | name = newName; 111 | if (eNotificationRequired()) 112 | eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.EVENT__NAME, oldName, name)); 113 | } 114 | 115 | /** 116 | * 117 | * 118 | * @generated 119 | */ 120 | public String getCode() 121 | { 122 | return code; 123 | } 124 | 125 | /** 126 | * 127 | * 128 | * @generated 129 | */ 130 | public void setCode(String newCode) 131 | { 132 | String oldCode = code; 133 | code = newCode; 134 | if (eNotificationRequired()) 135 | eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.EVENT__CODE, oldCode, code)); 136 | } 137 | 138 | /** 139 | * 140 | * 141 | * @generated 142 | */ 143 | @Override 144 | public Object eGet(int featureID, boolean resolve, boolean coreType) 145 | { 146 | switch (featureID) 147 | { 148 | case StatemachinePackage.EVENT__NAME: 149 | return getName(); 150 | case StatemachinePackage.EVENT__CODE: 151 | return getCode(); 152 | } 153 | return super.eGet(featureID, resolve, coreType); 154 | } 155 | 156 | /** 157 | * 158 | * 159 | * @generated 160 | */ 161 | @Override 162 | public void eSet(int featureID, Object newValue) 163 | { 164 | switch (featureID) 165 | { 166 | case StatemachinePackage.EVENT__NAME: 167 | setName((String)newValue); 168 | return; 169 | case StatemachinePackage.EVENT__CODE: 170 | setCode((String)newValue); 171 | return; 172 | } 173 | super.eSet(featureID, newValue); 174 | } 175 | 176 | /** 177 | * 178 | * 179 | * @generated 180 | */ 181 | @Override 182 | public void eUnset(int featureID) 183 | { 184 | switch (featureID) 185 | { 186 | case StatemachinePackage.EVENT__NAME: 187 | setName(NAME_EDEFAULT); 188 | return; 189 | case StatemachinePackage.EVENT__CODE: 190 | setCode(CODE_EDEFAULT); 191 | return; 192 | } 193 | super.eUnset(featureID); 194 | } 195 | 196 | /** 197 | * 198 | * 199 | * @generated 200 | */ 201 | @Override 202 | public boolean eIsSet(int featureID) 203 | { 204 | switch (featureID) 205 | { 206 | case StatemachinePackage.EVENT__NAME: 207 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); 208 | case StatemachinePackage.EVENT__CODE: 209 | return CODE_EDEFAULT == null ? code != null : !CODE_EDEFAULT.equals(code); 210 | } 211 | return super.eIsSet(featureID); 212 | } 213 | 214 | /** 215 | * 216 | * 217 | * @generated 218 | */ 219 | @Override 220 | public String toString() 221 | { 222 | if (eIsProxy()) return super.toString(); 223 | 224 | StringBuffer result = new StringBuffer(super.toString()); 225 | result.append(" (name: "); 226 | result.append(name); 227 | result.append(", code: "); 228 | result.append(code); 229 | result.append(')'); 230 | return result.toString(); 231 | } 232 | 233 | } //EventImpl 234 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/statemachine/impl/StatemachineFactoryImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package org.eclipse.xtext.example.fowlerdsl.statemachine.impl; 4 | 5 | import org.eclipse.emf.ecore.EClass; 6 | import org.eclipse.emf.ecore.EObject; 7 | import org.eclipse.emf.ecore.EPackage; 8 | 9 | import org.eclipse.emf.ecore.impl.EFactoryImpl; 10 | 11 | import org.eclipse.emf.ecore.plugin.EcorePlugin; 12 | 13 | import org.eclipse.xtext.example.fowlerdsl.statemachine.*; 14 | 15 | /** 16 | * 17 | * An implementation of the model Factory. 18 | * 19 | * @generated 20 | */ 21 | public class StatemachineFactoryImpl extends EFactoryImpl implements StatemachineFactory 22 | { 23 | /** 24 | * Creates the default factory implementation. 25 | * 26 | * 27 | * @generated 28 | */ 29 | public static StatemachineFactory init() 30 | { 31 | try 32 | { 33 | StatemachineFactory theStatemachineFactory = (StatemachineFactory)EPackage.Registry.INSTANCE.getEFactory(StatemachinePackage.eNS_URI); 34 | if (theStatemachineFactory != null) 35 | { 36 | return theStatemachineFactory; 37 | } 38 | } 39 | catch (Exception exception) 40 | { 41 | EcorePlugin.INSTANCE.log(exception); 42 | } 43 | return new StatemachineFactoryImpl(); 44 | } 45 | 46 | /** 47 | * Creates an instance of the factory. 48 | * 49 | * 50 | * @generated 51 | */ 52 | public StatemachineFactoryImpl() 53 | { 54 | super(); 55 | } 56 | 57 | /** 58 | * 59 | * 60 | * @generated 61 | */ 62 | @Override 63 | public EObject create(EClass eClass) 64 | { 65 | switch (eClass.getClassifierID()) 66 | { 67 | case StatemachinePackage.STATEMACHINE: return createStatemachine(); 68 | case StatemachinePackage.EVENT: return createEvent(); 69 | case StatemachinePackage.COMMAND: return createCommand(); 70 | case StatemachinePackage.STATE: return createState(); 71 | case StatemachinePackage.TRANSITION: return createTransition(); 72 | default: 73 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); 74 | } 75 | } 76 | 77 | /** 78 | * 79 | * 80 | * @generated 81 | */ 82 | public Statemachine createStatemachine() 83 | { 84 | StatemachineImpl statemachine = new StatemachineImpl(); 85 | return statemachine; 86 | } 87 | 88 | /** 89 | * 90 | * 91 | * @generated 92 | */ 93 | public Event createEvent() 94 | { 95 | EventImpl event = new EventImpl(); 96 | return event; 97 | } 98 | 99 | /** 100 | * 101 | * 102 | * @generated 103 | */ 104 | public Command createCommand() 105 | { 106 | CommandImpl command = new CommandImpl(); 107 | return command; 108 | } 109 | 110 | /** 111 | * 112 | * 113 | * @generated 114 | */ 115 | public State createState() 116 | { 117 | StateImpl state = new StateImpl(); 118 | return state; 119 | } 120 | 121 | /** 122 | * 123 | * 124 | * @generated 125 | */ 126 | public Transition createTransition() 127 | { 128 | TransitionImpl transition = new TransitionImpl(); 129 | return transition; 130 | } 131 | 132 | /** 133 | * 134 | * 135 | * @generated 136 | */ 137 | public StatemachinePackage getStatemachinePackage() 138 | { 139 | return (StatemachinePackage)getEPackage(); 140 | } 141 | 142 | /** 143 | * 144 | * 145 | * @deprecated 146 | * @generated 147 | */ 148 | @Deprecated 149 | public static StatemachinePackage getPackage() 150 | { 151 | return StatemachinePackage.eINSTANCE; 152 | } 153 | 154 | } //StatemachineFactoryImpl 155 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/fowlerdsl/validation/AbstractStatemachineValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.validation; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import org.eclipse.emf.ecore.EPackage; 9 | 10 | public class AbstractStatemachineValidator extends org.eclipse.xtext.validation.AbstractDeclarativeValidator { 11 | 12 | @Override 13 | protected List getEPackages() { 14 | List result = new ArrayList(); 15 | result.add(org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage.eINSTANCE); 16 | return result; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/GenerateStatemachine.mwe2: -------------------------------------------------------------------------------- 1 | module org.eclipse.xtext.example.fowlerdsl.GenerateStatemachine 2 | 3 | import org.eclipse.emf.mwe.utils.* 4 | import org.eclipse.xtext.generator.* 5 | import org.eclipse.xtext.ui.generator.* 6 | 7 | var grammarURI = "classpath:/org/eclipse/xtext/example/fowlerdsl/Statemachine.xtext" 8 | var fileExtensions = "statemachine" 9 | var projectName = "org.eclipse.xtext.example.fowlerdsl" 10 | var runtimeProject = "../${projectName}" 11 | var generateXtendStub = true 12 | var encoding = "UTF-8" 13 | var lineDelimiter = '\n' 14 | 15 | Workflow { 16 | bean = StandaloneSetup { 17 | scanClassPath = true 18 | platformUri = "${runtimeProject}/.." 19 | // The following two lines can be removed, if Xbase is not used. 20 | registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage" 21 | registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel" 22 | } 23 | 24 | component = DirectoryCleaner { 25 | directory = "${runtimeProject}/src-gen" 26 | } 27 | 28 | component = DirectoryCleaner { 29 | directory = "${runtimeProject}/model" 30 | } 31 | 32 | component = DirectoryCleaner { 33 | directory = "${runtimeProject}.ui/src-gen" 34 | } 35 | 36 | // component = DirectoryCleaner { 37 | // directory = "${runtimeProject}.tests/src-gen" 38 | // } 39 | 40 | component = Generator auto-inject { 41 | pathRtProject = runtimeProject 42 | pathUiProject = "${runtimeProject}.ui" 43 | // pathTestProject = "${runtimeProject}.tests" 44 | projectNameRt = projectName 45 | projectNameUi = "${projectName}.ui" 46 | encoding = encoding 47 | language = auto-inject { 48 | uri = grammarURI 49 | 50 | // Java API to access grammar elements (required by several other fragments) 51 | fragment = grammarAccess.GrammarAccessFragment auto-inject {} 52 | 53 | // generates Java API for the generated EPackages 54 | fragment = ecore.EMFGeneratorFragment auto-inject {} 55 | 56 | // the old serialization component 57 | // fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {} 58 | 59 | // serializer 2.0 60 | fragment = serializer.SerializerFragment auto-inject { 61 | generateStub = false 62 | } 63 | 64 | // a custom ResourceFactory for use with EMF 65 | fragment = resourceFactory.ResourceFactoryFragment auto-inject {} 66 | 67 | // The antlr parser generator fragment. 68 | fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject { 69 | // options = { 70 | // backtrack = true 71 | // } 72 | } 73 | 74 | // Xtend-based API for validation 75 | fragment = validation.ValidatorFragment auto-inject { 76 | // composedCheck = "org.eclipse.xtext.validation.ImportUriValidator" 77 | // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" 78 | } 79 | 80 | // old scoping and exporting API 81 | // fragment = scoping.ImportURIScopingFragment auto-inject {} 82 | // fragment = exporting.SimpleNamesFragment auto-inject {} 83 | 84 | // scoping and exporting API 85 | fragment = scoping.ImportNamespacesScopingFragment auto-inject {} 86 | fragment = exporting.QualifiedNamesFragment auto-inject {} 87 | fragment = builder.BuilderIntegrationFragment auto-inject {} 88 | 89 | // generator API 90 | fragment = generator.GeneratorFragment auto-inject {} 91 | 92 | // formatter API 93 | fragment = formatting2.Formatter2Fragment auto-inject {} 94 | 95 | // labeling API 96 | fragment = labeling.LabelProviderFragment auto-inject {} 97 | 98 | // outline API 99 | fragment = outline.OutlineTreeProviderFragment auto-inject {} 100 | fragment = outline.QuickOutlineFragment auto-inject {} 101 | 102 | // quickfix API 103 | fragment = quickfix.QuickfixProviderFragment auto-inject {} 104 | 105 | // content assist API 106 | fragment = contentAssist.ContentAssistFragment auto-inject {} 107 | 108 | // generates a more lightweight Antlr parser and lexer tailored for content assist 109 | fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject { 110 | partialParsing = true 111 | } 112 | 113 | // generates junit test support classes into Generator#pathTestProject 114 | // fragment = junit.Junit4Fragment auto-inject {} 115 | 116 | // rename refactoring 117 | fragment = refactoring.RefactorElementNameFragment auto-inject {} 118 | 119 | // provides the necessary bindings for java types integration 120 | fragment = types.TypesGeneratorFragment auto-inject {} 121 | 122 | // generates the required bindings only if the grammar inherits from Xbase 123 | fragment = xbase.XbaseGeneratorFragment auto-inject {} 124 | 125 | // provides a preference page for template proposals 126 | fragment = templates.CodetemplatesGeneratorFragment auto-inject {} 127 | 128 | // provides a compare view 129 | fragment = compare.CompareFragment auto-inject {} 130 | } 131 | } 132 | } 133 | 134 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/Statemachine.xtext: -------------------------------------------------------------------------------- 1 | grammar org.eclipse.xtext.example.fowlerdsl.Statemachine with org.eclipse.xtext.common.Terminals 2 | 3 | generate statemachine "http://www.eclipse.org/xtext/example/fowlerdsl/Statemachine" 4 | 5 | Statemachine : 6 | {Statemachine} 7 | ('events' 8 | events+=Event+ 9 | 'end')? 10 | ('resetEvents' 11 | resetEvents+=[Event]+ 12 | 'end')? 13 | ('commands' 14 | commands+=Command+ 15 | 'end')? 16 | states+=State* 17 | ; 18 | 19 | Event: 20 | name=ID code=ID 21 | ; 22 | 23 | Command: 24 | name=ID code=ID 25 | ; 26 | 27 | State: 28 | 'state' name=ID 29 | ('actions' '{' actions+=[Command]+ '}')? 30 | transitions+=Transition* 31 | 'end' 32 | ; 33 | 34 | Transition: 35 | event=[Event] '=>' state=[State] 36 | ; 37 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/StatemachineRuntimeModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl; 5 | 6 | import org.eclipse.xtext.example.fowlerdsl.resource.StatemachineFragmentProvider; 7 | import org.eclipse.xtext.example.fowlerdsl.resource.StatemachineResourceDescriptionStrategy; 8 | import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy; 9 | import org.eclipse.xtext.resource.IFragmentProvider; 10 | 11 | /** 12 | * Use this class to register components to be used at runtime / without the Equinox extension registry. 13 | */ 14 | public class StatemachineRuntimeModule extends org.eclipse.xtext.example.fowlerdsl.AbstractStatemachineRuntimeModule { 15 | 16 | 17 | public Class bindIFragmentProvider() { 18 | return StatemachineFragmentProvider.class; 19 | } 20 | 21 | public Class bindIDefaultResourceDescriptionStrategy(){ 22 | return StatemachineResourceDescriptionStrategy.class; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/StatemachineStandaloneSetup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl; 5 | 6 | /** 7 | * Initialization support for running Xtext languages 8 | * without equinox extension registry 9 | */ 10 | public class StatemachineStandaloneSetup extends StatemachineStandaloneSetupGenerated{ 11 | 12 | public static void doSetup() { 13 | new StatemachineStandaloneSetup().createInjectorAndDoEMFRegistration(); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/formatting2/StatemachineFormatter.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.formatting2; 5 | 6 | import com.google.inject.Inject 7 | import org.eclipse.xtext.example.fowlerdsl.services.StatemachineGrammarAccess 8 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Command 9 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Event 10 | import org.eclipse.xtext.example.fowlerdsl.statemachine.State 11 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine 12 | import org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage 13 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Transition 14 | import org.eclipse.xtext.formatting2.AbstractFormatter2 15 | import org.eclipse.xtext.formatting2.IFormattableDocument 16 | 17 | class StatemachineFormatter extends AbstractFormatter2 { 18 | 19 | @Inject extension StatemachineGrammarAccess 20 | 21 | def dispatch void format(Statemachine statemachine, extension IFormattableDocument document) { 22 | // TODO: format HiddenRegions around keywords, attributes, cross references, etc. 23 | for (Event events : statemachine.getEvents()) { 24 | format(events, document); 25 | } 26 | for (Command commands : statemachine.getCommands()) { 27 | format(commands, document); 28 | } 29 | for (State states : statemachine.getStates()) { 30 | format(states, document); 31 | } 32 | } 33 | 34 | 35 | def dispatch void format(State state, extension IFormattableDocument document) { 36 | interior( 37 | state.regionFor.keyword('state').append[oneSpace], 38 | state.regionFor.keyword('end'), 39 | [indent] 40 | ) 41 | if (state.name !== null) { 42 | state.regionFor.feature(StatemachinePackage.Literals.STATE__NAME).prepend[oneSpace] 43 | } 44 | state.regionFor.keyword('actions').prepend[newLine].append[oneSpace] 45 | interior( 46 | state.regionFor.keyword('{').append[newLine], 47 | state.regionFor.keyword('}').append[newLine], 48 | [indent] 49 | ) 50 | state.append[setNewLines(1, 1, 2)] 51 | for (command : state.actions) { 52 | command.format 53 | } 54 | for (Transition transitions : state.getTransitions()) { 55 | format(transitions, document); 56 | } 57 | } 58 | 59 | def dispatch void format(Transition transition, extension IFormattableDocument document) { 60 | transition.regionFor.keywords('=>', '(', ')').forEach [ 61 | surround[oneSpace] 62 | ] 63 | transition.append[setNewLines(1, 1, 2)] 64 | transition.event.format 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/generator/StatemachineGenerator.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.generator 5 | 6 | import org.eclipse.emf.ecore.resource.Resource 7 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Command 8 | import org.eclipse.xtext.example.fowlerdsl.statemachine.State 9 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine 10 | import org.eclipse.xtext.generator.IFileSystemAccess 11 | import org.eclipse.xtext.generator.IGenerator 12 | 13 | /** 14 | * Generates code from your model files on save. 15 | * 16 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation 17 | */ 18 | class StatemachineGenerator implements IGenerator { 19 | 20 | override void doGenerate(Resource resource, IFileSystemAccess fsa) { 21 | fsa.generateFile(resource.className+".java", toJavaCode(resource.contents.head as Statemachine)) 22 | } 23 | 24 | def className(Resource res) { 25 | var name = res.URI.lastSegment 26 | return name.substring(0, name.indexOf('.')) 27 | } 28 | 29 | def toJavaCode(Statemachine sm) ''' 30 | import java.io.BufferedReader; 31 | import java.io.IOException; 32 | import java.io.InputStreamReader; 33 | 34 | public class «sm.eResource.className» { 35 | 36 | public static void main(String[] args) { 37 | new «sm.eResource.className»().run(); 38 | } 39 | 40 | «FOR c : sm.commands» 41 | «c.declareCommand» 42 | «ENDFOR» 43 | 44 | protected void run() { 45 | boolean executeActions = true; 46 | String currentState = "«sm.states.head?.name»"; 47 | String lastEvent = null; 48 | while (true) { 49 | «FOR state : sm.states» 50 | «state.generateCode» 51 | «ENDFOR» 52 | «FOR resetEvent : sm.resetEvents» 53 | if ("«resetEvent.name»".equals(lastEvent)) { 54 | System.out.println("Resetting state machine."); 55 | currentState = "«sm.states.head?.name»"; 56 | executeActions = true; 57 | } 58 | «ENDFOR» 59 | 60 | } 61 | } 62 | 63 | private String receiveEvent() { 64 | System.out.flush(); 65 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 66 | try { 67 | return br.readLine(); 68 | } catch (IOException ioe) { 69 | System.out.println("Problem reading input"); 70 | return ""; 71 | } 72 | } 73 | } 74 | ''' 75 | 76 | def declareCommand(Command command) ''' 77 | protected void do«command.name.toFirstUpper»() { 78 | System.out.println("Executing command «command.name» («command.code»)"); 79 | } 80 | ''' 81 | 82 | def generateCode(State state) ''' 83 | if (currentState.equals("«state.name»")) { 84 | if (executeActions) { 85 | «FOR c : state.actions» 86 | do«c.name.toFirstUpper»(); 87 | «ENDFOR» 88 | executeActions = false; 89 | } 90 | System.out.println("Your are now in state '«state.name»'. Possible events are [« 91 | state.transitions.map(t | t.event.name).join(', ')»]."); 92 | lastEvent = receiveEvent(); 93 | «FOR t : state.transitions» 94 | if ("«t.event.name»".equals(lastEvent)) { 95 | currentState = "«t.state.name»"; 96 | executeActions = true; 97 | } 98 | «ENDFOR» 99 | } 100 | ''' 101 | 102 | } -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/resource/PathURIFragmentProvider.xtend: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package org.eclipse.xtext.example.fowlerdsl.resource 9 | 10 | import org.eclipse.emf.common.util.SegmentSequence 11 | import org.eclipse.emf.common.util.URI 12 | import org.eclipse.emf.ecore.EObject 13 | import org.eclipse.emf.ecore.InternalEObject 14 | import org.eclipse.emf.ecore.resource.impl.ResourceImpl 15 | import org.eclipse.xtext.EcoreUtil2 16 | 17 | /** 18 | * Calculates the standard EMF path URI fragment. 19 | * Temporary workaround for https://github.com/eclipse/xtext-eclipse/issues/284 20 | * 21 | * @author koehnlein 22 | */ 23 | class PathURIFragmentProvider { 24 | 25 | /** 26 | * inspired by {@link ResourceImpl#getURIFragment()} 27 | */ 28 | static def String getPathURIFragment(EObject element) { 29 | val builder = SegmentSequence.newBuilder("/") 30 | var internalEObject = element as InternalEObject 31 | var isContained = internalEObject.eDirectResource !== null 32 | for (var container = internalEObject.eInternalContainer(); 33 | container !== null && !isContained; 34 | container = internalEObject.eInternalContainer()) { 35 | builder.append(container.eURIFragmentSegment(internalEObject.eContainingFeature(), internalEObject)) 36 | internalEObject = container 37 | if (container.eDirectResource() !== null) { 38 | isContained = true 39 | } 40 | } 41 | if (!isContained) { 42 | return "/-1" 43 | } 44 | builder.append(getURIFragmentRootSegment(internalEObject)) 45 | builder.append("") 46 | builder.reverse() 47 | return builder.toSegmentSequence().toString() 48 | } 49 | 50 | static def URI getPathURI(EObject object) { 51 | val resource = object.eResource 52 | if(resource !== null) { 53 | val fragment = object.pathURIFragment 54 | val resourceURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(resource) 55 | return resourceURI.appendFragment(fragment) 56 | } else { 57 | return EcoreUtil2.getPlatformResourceOrNormalizedURI(object) 58 | } 59 | } 60 | 61 | protected static def String getURIFragmentRootSegment(EObject eObject) { 62 | var contents = eObject.eResource.contents 63 | if (contents.size > 1) 64 | return Integer.toString(contents.indexOf(eObject)) 65 | else 66 | return '' 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/resource/StatemachineFragmentProvider.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.xtext.example.fowlerdsl.resource; 2 | 3 | import java.util.Iterator; 4 | 5 | import org.eclipse.emf.ecore.EObject; 6 | import org.eclipse.emf.ecore.InternalEObject; 7 | import org.eclipse.emf.ecore.resource.Resource; 8 | import org.eclipse.emf.ecore.util.EcoreUtil; 9 | import org.eclipse.xtext.example.fowlerdsl.statemachine.State; 10 | import org.eclipse.xtext.example.fowlerdsl.statemachine.Transition; 11 | import org.eclipse.xtext.naming.IQualifiedNameProvider; 12 | import org.eclipse.xtext.naming.QualifiedName; 13 | import org.eclipse.xtext.naming.SimpleNameProvider; 14 | import org.eclipse.xtext.resource.IFragmentProvider; 15 | 16 | import com.google.inject.Inject; 17 | 18 | public class StatemachineFragmentProvider implements IFragmentProvider { 19 | 20 | @Inject 21 | private IQualifiedNameProvider qualifiedNameProvider = new SimpleNameProvider(); 22 | 23 | public String getFragment(EObject obj, Fallback fallback) { 24 | QualifiedName qName = qualifiedNameProvider.getFullyQualifiedName(obj); 25 | if (obj instanceof Transition && obj.eContainer() instanceof State) { 26 | String r = ((State) obj.eContainer()).getName(); 27 | if (r == null) { 28 | r = ""; 29 | } 30 | r += "-|"; 31 | if (((Transition) obj).getEvent() != null && ((Transition) obj).getEvent().getCode() != null) { 32 | r += ((Transition) obj).getEvent().getCode(); 33 | } 34 | r += "|"; 35 | return r; 36 | 37 | } else { 38 | 39 | return qName != null ? qName.toString() : fallback.getFragment(obj); 40 | } 41 | } 42 | 43 | public EObject getEObject(Resource resource, String fragment, Fallback fallback) { 44 | if (fragment != null) { 45 | Iterator i = EcoreUtil.getAllContents(resource, false); 46 | while (i.hasNext()) { 47 | EObject eObject = i.next(); 48 | String candidateFragment = (eObject.eIsProxy()) ? ((InternalEObject) eObject).eProxyURI().fragment() 49 | : getFragment(eObject, fallback); 50 | if (fragment.equals(candidateFragment)) 51 | return eObject; 52 | } 53 | } 54 | return fallback.getEObject(fragment); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/resource/StatemachineResourceDescriptionStrategy.xtend: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package org.eclipse.xtext.example.fowlerdsl.resource 9 | 10 | import org.eclipse.emf.common.util.URI 11 | import org.eclipse.emf.ecore.EObject 12 | import org.eclipse.emf.ecore.EReference 13 | import org.eclipse.xtext.resource.impl.DefaultReferenceDescription 14 | import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy 15 | 16 | import static extension org.eclipse.xtext.example.fowlerdsl.resource.PathURIFragmentProvider.* 17 | 18 | class StatemachineResourceDescriptionStrategy extends DefaultResourceDescriptionStrategy { 19 | 20 | override protected createReferenceDescription(EObject owner, URI exportedContainerURI, EReference eReference, int indexInList, EObject target) { 21 | val ownerURI = owner.pathURI 22 | val targetURI = target.pathURI 23 | return new DefaultReferenceDescription(ownerURI, targetURI, eReference, indexInList, exportedContainerURI) 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/scoping/StatemachineScopeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.scoping 5 | 6 | /** 7 | * This class contains custom scoping description. 8 | * 9 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping 10 | * on how and when to use it. 11 | * 12 | */ 13 | class StatemachineScopeProvider extends org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/validation/StatemachineValidator.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package org.eclipse.xtext.example.fowlerdsl.validation 5 | 6 | import org.eclipse.xtext.example.fowlerdsl.statemachine.StatemachinePackage 7 | import org.eclipse.xtext.validation.Check 8 | 9 | /** 10 | * Custom validation rules. 11 | * 12 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation 13 | */ 14 | class StatemachineValidator extends AbstractStatemachineValidator { 15 | 16 | public static val INVALID_NAME = 'invalidName' 17 | 18 | @Check 19 | def checkStateNameStartsWithLowerCase(org.eclipse.xtext.example.fowlerdsl.statemachine.State state) { 20 | if (Character.isUpperCase(state.name.charAt(0))) { 21 | warning('Name should start with a lower case letter', 22 | StatemachinePackage.Literals.STATE__NAME, 23 | INVALID_NAME, state.name) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/formatting/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineFormatter.java._trace 2 | /.StatemachineFormatter.xtendbin 3 | /StatemachineFormatter.java 4 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/formatting2/.StatemachineFormatter.java._trace: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/formatting2/.StatemachineFormatter.java._trace -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/formatting2/.StatemachineFormatter.xtendbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/formatting2/.StatemachineFormatter.xtendbin -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/generator/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineGenerator.java._trace 2 | /.StatemachineGenerator.xtendbin 3 | /StatemachineGenerator.java 4 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.PathURIFragmentProvider.java._trace: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.PathURIFragmentProvider.java._trace -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.PathURIFragmentProvider.xtendbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.PathURIFragmentProvider.xtendbin -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.StatemachineResourceDescriptionStrategy.java._trace: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.StatemachineResourceDescriptionStrategy.java._trace -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.StatemachineResourceDescriptionStrategy.xtendbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ObeoNetwork/Xtext-Sirius-integration/098f5c4777ff5b443785d69fef8387d14c61e131/xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/.StatemachineResourceDescriptionStrategy.xtendbin -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/PathURIFragmentProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.eclipse.xtext.example.fowlerdsl.resource; 9 | 10 | import org.eclipse.emf.common.util.EList; 11 | import org.eclipse.emf.common.util.SegmentSequence; 12 | import org.eclipse.emf.common.util.URI; 13 | import org.eclipse.emf.ecore.EObject; 14 | import org.eclipse.emf.ecore.InternalEObject; 15 | import org.eclipse.emf.ecore.resource.Resource; 16 | import org.eclipse.emf.ecore.resource.impl.ResourceImpl; 17 | import org.eclipse.xtext.EcoreUtil2; 18 | 19 | /** 20 | * Calculates the standard EMF path URI fragment. 21 | * Temporary workaround for https://github.com/eclipse/xtext-eclipse/issues/284 22 | * 23 | * @author koehnlein 24 | */ 25 | @SuppressWarnings("all") 26 | public class PathURIFragmentProvider { 27 | /** 28 | * inspired by {@link ResourceImpl#getURIFragment()} 29 | */ 30 | public static String getPathURIFragment(final EObject element) { 31 | final SegmentSequence.Builder builder = SegmentSequence.newBuilder("/"); 32 | InternalEObject internalEObject = ((InternalEObject) element); 33 | Resource.Internal _eDirectResource = internalEObject.eDirectResource(); 34 | boolean isContained = (_eDirectResource != null); 35 | for (InternalEObject container = internalEObject.eInternalContainer(); ((container != null) && (!isContained)); container = internalEObject.eInternalContainer()) { 36 | { 37 | builder.append(container.eURIFragmentSegment(internalEObject.eContainingFeature(), internalEObject)); 38 | internalEObject = container; 39 | Resource.Internal _eDirectResource_1 = container.eDirectResource(); 40 | boolean _tripleNotEquals = (_eDirectResource_1 != null); 41 | if (_tripleNotEquals) { 42 | isContained = true; 43 | } 44 | } 45 | } 46 | if ((!isContained)) { 47 | return "/-1"; 48 | } 49 | builder.append(PathURIFragmentProvider.getURIFragmentRootSegment(internalEObject)); 50 | builder.append(""); 51 | builder.reverse(); 52 | return builder.toSegmentSequence().toString(); 53 | } 54 | 55 | public static URI getPathURI(final EObject object) { 56 | final Resource resource = object.eResource(); 57 | if ((resource != null)) { 58 | final String fragment = PathURIFragmentProvider.getPathURIFragment(object); 59 | final URI resourceURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(resource); 60 | return resourceURI.appendFragment(fragment); 61 | } else { 62 | return EcoreUtil2.getPlatformResourceOrNormalizedURI(object); 63 | } 64 | } 65 | 66 | protected static String getURIFragmentRootSegment(final EObject eObject) { 67 | EList contents = eObject.eResource().getContents(); 68 | int _size = contents.size(); 69 | boolean _greaterThan = (_size > 1); 70 | if (_greaterThan) { 71 | return Integer.toString(contents.indexOf(eObject)); 72 | } else { 73 | return ""; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/resource/StatemachineResourceDescriptionStrategy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.eclipse.xtext.example.fowlerdsl.resource; 9 | 10 | import org.eclipse.emf.common.util.URI; 11 | import org.eclipse.emf.ecore.EObject; 12 | import org.eclipse.emf.ecore.EReference; 13 | import org.eclipse.xtext.example.fowlerdsl.resource.PathURIFragmentProvider; 14 | import org.eclipse.xtext.resource.IReferenceDescription; 15 | import org.eclipse.xtext.resource.impl.DefaultReferenceDescription; 16 | import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy; 17 | 18 | @SuppressWarnings("all") 19 | public class StatemachineResourceDescriptionStrategy extends DefaultResourceDescriptionStrategy { 20 | @Override 21 | protected IReferenceDescription createReferenceDescription(final EObject owner, final URI exportedContainerURI, final EReference eReference, final int indexInList, final EObject target) { 22 | final URI ownerURI = PathURIFragmentProvider.getPathURI(owner); 23 | final URI targetURI = PathURIFragmentProvider.getPathURI(target); 24 | return new DefaultReferenceDescription(ownerURI, targetURI, eReference, indexInList, exportedContainerURI); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/scoping/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineScopeProvider.java._trace 2 | /.StatemachineScopeProvider.xtendbin 3 | /StatemachineScopeProvider.java 4 | -------------------------------------------------------------------------------- /xtext-support-parent/examples/org.eclipse.xtext.example.fowlerdsl/xtend-gen/org/eclipse/xtext/example/fowlerdsl/validation/.gitignore: -------------------------------------------------------------------------------- 1 | /.StatemachineValidator.java._trace 2 | /.StatemachineValidator.xtendbin 3 | /StatemachineValidator.java 4 | -------------------------------------------------------------------------------- /xtext-support-parent/features/org.obeonetwork.dsl.viewpoint.feature.xtext.support/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.obeonetwork.dsl.viewpoint.feature.xtext.support 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.pde.FeatureNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /xtext-support-parent/features/org.obeonetwork.dsl.viewpoint.feature.xtext.support/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes = feature.xml 2 | -------------------------------------------------------------------------------- /xtext-support-parent/features/org.obeonetwork.dsl.viewpoint.feature.xtext.support/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | [Enter Feature Description here.] 9 | 10 | 11 | 12 | [Enter Copyright Description here.] 13 | 14 | 15 | 16 | [Enter License Description here.] 17 | 18 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /xtext-support-parent/features/org.obeonetwork.dsl.viewpoint.feature.xtext.support/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | ../.. 7 | org.obeonetwork.dsl.viewpoint.xtext.support 8 | xtext-support-parent 9 | 1.0.0-SNAPSHOT 10 | 11 | 12 | org.obeonetwork.dsl.viewpoint.feature.xtext.support 13 | eclipse-feature 14 | 15 | -------------------------------------------------------------------------------- /xtext-support-parent/features/org.obeonetwork.dsl.viewpoint.xtext.support.update/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.obeonetwork.dsl.viewpoint.xtext.support.update 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.UpdateSiteBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.UpdateSiteNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /xtext-support-parent/features/org.obeonetwork.dsl.viewpoint.xtext.support.update/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Viewpoint 5 | 6 | 7 | 8 | 9 | 10 | 11 | The Obeo Network. 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /xtext-support-parent/features/org.obeonetwork.dsl.viewpoint.xtext.support.update/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | ../.. 7 | org.obeonetwork.dsl.viewpoint.xtext.support 8 | xtext-support-parent 9 | 1.0.0-SNAPSHOT 10 | 11 | 12 | org.obeonetwork.dsl.viewpoint.xtext.support.update 13 | eclipse-repository 14 | 15 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.typefox.xtext.sirius.aird 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.pde.PluginNature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Xtext integration for Sirius aird files 4 | Bundle-SymbolicName: io.typefox.xtext.sirius.aird;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Vendor: TypeFox 7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 8 | Require-Bundle: org.eclipse.xtext, 9 | org.eclipse.core.runtime, 10 | org.eclipse.xtext.ui, 11 | org.eclipse.emf.ecore.editor, 12 | org.eclipse.xtext.ui.shared 13 | Import-Package: org.apache.log4j 14 | Bundle-ActivationPolicy: lazy 15 | Bundle-Activator: io.typefox.xtext.sirius.aird.ui.Activator 16 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | plugin.xml 6 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/src/io/typefox/xtext/sirius/aird/AirdRuntimeModule.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package io.typefox.xtext.sirius.aird; 9 | 10 | import org.eclipse.xtext.resource.generic.AbstractGenericResourceRuntimeModule; 11 | import org.eclipse.xtext.validation.IResourceValidator; 12 | 13 | /** 14 | * The DI module to configure the Xtext language services for aird models. 15 | * 16 | * @author koehnlein 17 | */ 18 | public class AirdRuntimeModule extends AbstractGenericResourceRuntimeModule { 19 | 20 | @Override 21 | protected String getLanguageName() { 22 | return "io.typefox.xtext.sirius.aird"; 23 | } 24 | 25 | @Override 26 | protected String getFileExtensions() { 27 | return "aird"; 28 | } 29 | 30 | public IResourceValidator bindIResourceValidator() { 31 | return IResourceValidator.NULL; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/src/io/typefox/xtext/sirius/aird/ui/Activator.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package io.typefox.xtext.sirius.aird.ui; 9 | 10 | import org.apache.log4j.Logger; 11 | import org.eclipse.ui.plugin.AbstractUIPlugin; 12 | import org.eclipse.xtext.ui.shared.SharedStateModule; 13 | import org.osgi.framework.BundleContext; 14 | 15 | import com.google.inject.Guice; 16 | import com.google.inject.Injector; 17 | import com.google.inject.util.Modules; 18 | 19 | import io.typefox.xtext.sirius.aird.AirdRuntimeModule; 20 | 21 | public class Activator extends AbstractUIPlugin { 22 | 23 | private static final Logger logger = Logger.getLogger(Activator.class); 24 | 25 | // The plug-in ID 26 | public static final String PLUGIN_ID = "io.typefox.xtext.sirius.aird"; //$NON-NLS-1$ 27 | 28 | // The shared instance 29 | private static Activator plugin; 30 | 31 | private Injector injector; 32 | 33 | /** 34 | * The constructor 35 | */ 36 | public Activator() { 37 | } 38 | 39 | public Injector getInjector() { 40 | return injector; 41 | } 42 | 43 | private void initializeEcoreInjector() { 44 | injector = Guice.createInjector( 45 | Modules.override(Modules.override(new AirdRuntimeModule()) 46 | .with(new AirdUiModule(plugin))) 47 | .with(new SharedStateModule())); 48 | } 49 | 50 | @Override 51 | public void start(BundleContext context) throws Exception { 52 | super.start(context); 53 | plugin = this; 54 | try { 55 | initializeEcoreInjector(); 56 | } catch(Exception e) { 57 | logger.error(e.getMessage(), e); 58 | throw e; 59 | } 60 | } 61 | 62 | @Override 63 | public void stop(BundleContext context) throws Exception { 64 | plugin = null; 65 | injector = null; 66 | super.stop(context); 67 | } 68 | 69 | /** 70 | * Returns the shared instance 71 | * 72 | * @return the shared instance 73 | */ 74 | public static Activator getDefault() { 75 | return plugin; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/src/io/typefox/xtext/sirius/aird/ui/AirdUiModule.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package io.typefox.xtext.sirius.aird.ui; 9 | 10 | import org.eclipse.ui.plugin.AbstractUIPlugin; 11 | import org.eclipse.xtext.ui.LanguageSpecific; 12 | import org.eclipse.xtext.ui.editor.IURIEditorOpener; 13 | import org.eclipse.xtext.ui.resource.generic.EmfUiModule; 14 | 15 | /** 16 | * The DI module to configure the Xtext UI language services for aird models. 17 | * 18 | * @author koehnlein 19 | */ 20 | public class AirdUiModule extends EmfUiModule { 21 | 22 | public AirdUiModule(AbstractUIPlugin plugin) { 23 | super(plugin); 24 | } 25 | 26 | @Override 27 | public void configureLanguageSpecificURIEditorOpener(com.google.inject.Binder binder) { 28 | binder.bind(IURIEditorOpener.class).annotatedWith(LanguageSpecific.class).to(EcoreEditorOpener.class); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/src/io/typefox/xtext/sirius/aird/ui/EcoreEditorOpener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package io.typefox.xtext.sirius.aird.ui; 9 | 10 | import java.util.Collections; 11 | 12 | import org.eclipse.emf.common.util.URI; 13 | import org.eclipse.emf.ecore.EObject; 14 | import org.eclipse.emf.ecore.EReference; 15 | import org.eclipse.emf.ecore.presentation.EcoreEditor; 16 | import org.eclipse.ui.IEditorPart; 17 | import org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener; 18 | 19 | /** 20 | * @author koehnlein 21 | */ 22 | public class EcoreEditorOpener extends LanguageSpecificURIEditorOpener { 23 | 24 | @Override 25 | protected void selectAndReveal(IEditorPart openEditor, URI uri, 26 | EReference crossReference, int indexInList, boolean select) { 27 | if (uri.fragment() != null) { 28 | EcoreEditor ecoreEditor = (EcoreEditor) openEditor.getAdapter(EcoreEditor.class); 29 | if (ecoreEditor != null) { 30 | EObject eObject = ecoreEditor.getEditingDomain().getResourceSet().getEObject(uri, true); 31 | ecoreEditor.setSelectionToViewer(Collections.singletonList(eObject)); 32 | } 33 | } 34 | } 35 | 36 | @Override 37 | protected String getEditorId() { 38 | return "fr.obeo.dsl.designer.sample.flow.presentation.FlowEditorID"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/io.typefox.xtext.sirius.aird/src/io/typefox/xtext/sirius/aird/ui/ExecutableExtensionFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 TypeFox and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package io.typefox.xtext.sirius.aird.ui; 9 | 10 | import org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory; 11 | import org.osgi.framework.Bundle; 12 | 13 | import com.google.inject.Injector; 14 | 15 | /** 16 | * Instantiates classes declared in the plugin.xml using the DI container. 17 | * 18 | * @author koehnlein 19 | */ 20 | public class ExecutableExtensionFactory extends AbstractGuiceAwareExecutableExtensionFactory { 21 | 22 | @Override 23 | protected Bundle getBundle() { 24 | return Activator.getDefault().getBundle(); 25 | } 26 | 27 | @Override 28 | protected Injector getInjector() { 29 | return Activator.getDefault().getInjector(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.obeonetwork.dsl.viewpoint.xtext.support 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.m2e.core.maven2Nature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.jdt.core.javanature 33 | 34 | 35 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: org.obeonetwork.dsl.viewpoint.xtext.support 4 | Bundle-SymbolicName: org.obeonetwork.dsl.viewpoint.xtext.support 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Activator: org.obeonetwork.dsl.viewpoint.xtext.support.Activator 7 | Require-Bundle: org.eclipse.ui, 8 | org.eclipse.core.runtime, 9 | org.eclipse.emf.common;bundle-version="2.5.0", 10 | org.eclipse.xtext;bundle-version="2.0.0", 11 | org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.2.1", 12 | org.eclipse.ui.ide;bundle-version="3.5.0", 13 | org.eclipse.xtext.ui;bundle-version="2.0.0", 14 | org.eclipse.core.expressions;bundle-version="3.4.100", 15 | org.eclipse.xtext.ui.shared;bundle-version="0.8.0", 16 | org.eclipse.emf.compare, 17 | org.eclipse.sirius;bundle-version="1.0.0", 18 | org.eclipse.emf.compare.rcp;bundle-version="2.2.0" 19 | Bundle-ActivationPolicy: lazy 20 | Bundle-RequiredExecutionEnvironment: J2SE-1.5 21 | Export-Package: org.obeonetwork.dsl.viewpoint.xtext.support, 22 | org.obeonetwork.dsl.viewpoint.xtext.support.action 23 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | . 5 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | ../.. 7 | org.obeonetwork.dsl.viewpoint.xtext.support 8 | xtext-support-parent 9 | 1.0.0-SNAPSHOT 10 | 11 | 12 | org.obeonetwork.dsl.viewpoint.xtext.support 13 | eclipse-plugin 14 | 15 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/src/org/obeonetwork/dsl/viewpoint/xtext/support/Activator.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2011 Obeo and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * Obeo - initial API and implementation 10 | ****************************************************************************/ 11 | 12 | package org.obeonetwork.dsl.viewpoint.xtext.support; 13 | 14 | import org.eclipse.core.runtime.IStatus; 15 | import org.eclipse.core.runtime.Status; 16 | import org.eclipse.ui.plugin.AbstractUIPlugin; 17 | import org.osgi.framework.BundleContext; 18 | 19 | /** 20 | * The activator class controls the plug-in life cycle 21 | */ 22 | public class Activator extends AbstractUIPlugin { 23 | 24 | // The plug-in ID 25 | public static final String PLUGIN_ID = "org.obeonetwork.dsl.viewpoint.xtext.support"; 26 | 27 | // The shared instance 28 | private static Activator plugin; 29 | 30 | /** 31 | * The constructor 32 | */ 33 | public Activator() { 34 | } 35 | 36 | /* 37 | * (non-Javadoc) 38 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) 39 | */ 40 | public void start(BundleContext context) throws Exception { 41 | super.start(context); 42 | plugin = this; 43 | } 44 | 45 | /* 46 | * (non-Javadoc) 47 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) 48 | */ 49 | public void stop(BundleContext context) throws Exception { 50 | plugin = null; 51 | super.stop(context); 52 | } 53 | 54 | /** 55 | * Returns the shared instance 56 | * 57 | * @return the shared instance 58 | */ 59 | public static Activator getDefault() { 60 | return plugin; 61 | } 62 | 63 | public static void logError(Throwable t) { 64 | getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, t.getMessage(), t)); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/src/org/obeonetwork/dsl/viewpoint/xtext/support/StringUtil.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | *******************************************************************************/ 8 | package org.obeonetwork.dsl.viewpoint.xtext.support; 9 | 10 | /** 11 | * @author koehnlein 12 | */ 13 | public class StringUtil { 14 | 15 | public static int getNumLines(String s) { 16 | int numLines = 1; 17 | for (char c : s.toCharArray()) { 18 | if (c == '\n') { 19 | ++numLines; 20 | } 21 | } 22 | return numLines; 23 | } 24 | 25 | public static int getMaxColumns(String s) { 26 | int maxColumns = 0; 27 | int currentColumns = 0; 28 | for (char c : s.toCharArray()) { 29 | if (c == '\n') { 30 | maxColumns = Math.max(maxColumns, currentColumns); 31 | currentColumns = 0; 32 | } else { 33 | ++currentColumns; 34 | } 35 | } 36 | return Math.max(currentColumns, maxColumns); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xtext-support-parent/plugins/org.obeonetwork.dsl.viewpoint.xtext.support/src/org/obeonetwork/dsl/viewpoint/xtext/support/action/OpenXtextEmbeddedEditor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2011 Obeo and others. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * Obeo - initial API and implementation 10 | ****************************************************************************/ 11 | 12 | package org.obeonetwork.dsl.viewpoint.xtext.support.action; 13 | 14 | import java.util.Collection; 15 | import java.util.Map; 16 | 17 | import org.eclipse.emf.ecore.EObject; 18 | import org.eclipse.gef.EditPart; 19 | import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; 20 | import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; 21 | import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; 22 | import org.eclipse.sirius.tools.api.ui.IExternalJavaAction; 23 | import org.eclipse.ui.IEditorPart; 24 | import org.eclipse.ui.IWorkbench; 25 | import org.eclipse.ui.IWorkbenchPage; 26 | import org.eclipse.ui.PlatformUI; 27 | import org.obeonetwork.dsl.viewpoint.xtext.support.XtextEmbeddedEditor; 28 | 29 | import com.google.inject.Injector; 30 | 31 | public abstract class OpenXtextEmbeddedEditor implements IExternalJavaAction { 32 | 33 | public boolean canExecute(Collection arg0) { 34 | return true; 35 | } 36 | 37 | public void execute(Collection context, 38 | Map parameters) { 39 | DiagramEditPart diagramEditPart = ((DiagramEditor) getActiveEditor()) 40 | .getDiagramEditPart(); 41 | for (EObject o : context) { 42 | EditPart editPart = diagramEditPart 43 | .findEditPart(diagramEditPart, o); 44 | if (editPart != null && (editPart instanceof IGraphicalEditPart)) { 45 | openEmbeddedEditor((IGraphicalEditPart) editPart); 46 | break; 47 | } 48 | } 49 | 50 | } 51 | 52 | protected void openEmbeddedEditor(IGraphicalEditPart graphicalEditPart) { 53 | XtextEmbeddedEditor embeddedEditor = new XtextEmbeddedEditor(graphicalEditPart, getInjector()); 54 | embeddedEditor.showEditor(); 55 | } 56 | 57 | /** 58 | * Return the injector associated to you domain model plug-in. 59 | * @return 60 | */ 61 | protected abstract Injector getInjector(); 62 | 63 | protected IEditorPart getActiveEditor() { 64 | IWorkbench workbench = PlatformUI.getWorkbench(); 65 | IWorkbenchPage page = workbench.getActiveWorkbenchWindow() 66 | .getActivePage(); 67 | return page.getActiveEditor(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /xtext-support-parent/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.obeonetwork.dsl.viewpoint.xtext.support 6 | xtext-support-parent 7 | 1.0.0-SNAPSHOT 8 | pom 9 | 10 | 11 | plugins/org.obeonetwork.dsl.viewpoint.xtext.support 12 | features/org.obeonetwork.dsl.viewpoint.feature.xtext.support 13 | features/org.obeonetwork.dsl.viewpoint.xtext.support.update 14 | 15 | 16 | 17 | 0.14.1 18 | 19 | 20 | 21 | 22 | juno 23 | p2 24 | http://download.eclipse.org/releases/juno 25 | 26 | 27 | xtext 28 | p2 29 | http://download.itemis.com/updates 30 | 31 | 32 | obeodesigner 33 | p2 34 | http://www.obeo.fr/download/release/designer/6.1/latest/juno3/update 35 | 36 | 37 | acceleo 38 | p2 39 | http://download.eclipse.org/modeling/m2t/acceleo/updates/releases/3.2 40 | 41 | 42 | Indigo Release 43 | http://www.obeo.fr/download/acceleo/maven/releases/indigo 44 | 45 | 46 | Snapshots 47 | http://www.obeo.fr/download/acceleo/maven/snapshots 48 | 49 | 50 | 51 | 52 | 53 | Indigo Release 54 | http://www.obeo.fr/download/acceleo/maven/releases/indigo 55 | 56 | 57 | Snapshots 58 | http://www.obeo.fr/download/acceleo/maven/snapshots 59 | 60 | 61 | 62 | 63 | 64 | 65 | org.eclipse.tycho 66 | tycho-maven-plugin 67 | ${tycho-version} 68 | true 69 | 70 | 71 | 72 | org.eclipse.tycho 73 | tycho-p2-director-plugin 74 | ${tycho-version} 75 | 76 | 77 | materialize-products 78 | 79 | materialize-products 80 | 81 | 82 | 83 | archive-products 84 | 85 | archive-products 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | --------------------------------------------------------------------------------