diff --git a/README.md b/README.md deleted file mode 100644 index a906171..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# graphite -Graphite - a tool for streamlining the development of hybrid graphical-textual model editors diff --git a/.classpath b/graphite/.classpath similarity index 76% rename from .classpath rename to graphite/.classpath index c4b0fff..f1d7ba2 100644 --- a/.classpath +++ b/graphite/.classpath @@ -1,10 +1,6 @@ - - - - - + diff --git a/.project b/graphite/.project similarity index 100% rename from .project rename to graphite/.project diff --git a/graphite/.settings/org.eclipse.core.resources.prefs b/graphite/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/graphite/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/graphite/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from .settings/org.eclipse.jdt.core.prefs rename to graphite/.settings/org.eclipse.jdt.core.prefs diff --git a/META-INF/MANIFEST.MF b/graphite/META-INF/MANIFEST.MF similarity index 100% rename from META-INF/MANIFEST.MF rename to graphite/META-INF/MANIFEST.MF diff --git a/build.properties b/graphite/build.properties similarity index 100% rename from build.properties rename to graphite/build.properties diff --git a/plugin.properties b/graphite/plugin.properties similarity index 58% rename from plugin.properties rename to graphite/plugin.properties index 5b424e7..c7da3f8 100644 --- a/plugin.properties +++ b/graphite/plugin.properties @@ -5,5 +5,5 @@ providerName = Ionut Predoaia xtextWidgetId=graphite.xtextwidgetViewer -editorId=pcs.presentation.PcsEditorID -fileExtensions=pcs \ No newline at end of file +editorId=workload.presentation.WorkloadEditor +fileExtensions=workload \ No newline at end of file diff --git a/plugin.xml b/graphite/plugin.xml similarity index 96% rename from plugin.xml rename to graphite/plugin.xml index 403e76a..d754313 100644 --- a/plugin.xml +++ b/graphite/plugin.xml @@ -14,7 +14,7 @@ point="org.eclipse.xtext.extension_resourceServiceProvider"> + uriExtension="workload"> diff --git a/src/graphite/artefacts/graphite_properties.odesign b/graphite/src/graphite/artefacts/graphite_properties.odesign similarity index 100% rename from src/graphite/artefacts/graphite_properties.odesign rename to graphite/src/graphite/artefacts/graphite_properties.odesign diff --git a/src/graphite/graphical/RefreshConsumer.java b/graphite/src/graphite/graphical/RefreshConsumer.java similarity index 100% rename from src/graphite/graphical/RefreshConsumer.java rename to graphite/src/graphite/graphical/RefreshConsumer.java diff --git a/src/graphite/graphical/SiriusServices.java b/graphite/src/graphite/graphical/SiriusServices.java similarity index 100% rename from src/graphite/graphical/SiriusServices.java rename to graphite/src/graphite/graphical/SiriusServices.java diff --git a/src/graphite/graphical/ViewUtility.java b/graphite/src/graphite/graphical/ViewUtility.java similarity index 100% rename from src/graphite/graphical/ViewUtility.java rename to graphite/src/graphite/graphical/ViewUtility.java diff --git a/src/graphite/modelmanagement/EditorStartup.egl b/graphite/src/graphite/modelmanagement/EditorStartup.egl similarity index 100% rename from src/graphite/modelmanagement/EditorStartup.egl rename to graphite/src/graphite/modelmanagement/EditorStartup.egl diff --git a/src/graphite/modelmanagement/GrammarRuntimeModule.egl b/graphite/src/graphite/modelmanagement/GrammarRuntimeModule.egl similarity index 100% rename from src/graphite/modelmanagement/GrammarRuntimeModule.egl rename to graphite/src/graphite/modelmanagement/GrammarRuntimeModule.egl diff --git a/src/graphite/modelmanagement/PackageFactory.egl b/graphite/src/graphite/modelmanagement/PackageFactory.egl similarity index 100% rename from src/graphite/modelmanagement/PackageFactory.egl rename to graphite/src/graphite/modelmanagement/PackageFactory.egl diff --git a/src/graphite/modelmanagement/PropertiesData.egl b/graphite/src/graphite/modelmanagement/PropertiesData.egl similarity index 100% rename from src/graphite/modelmanagement/PropertiesData.egl rename to graphite/src/graphite/modelmanagement/PropertiesData.egl diff --git a/src/graphite/modelmanagement/XtextEntityImpl.egl b/graphite/src/graphite/modelmanagement/XtextEntityImpl.egl similarity index 100% rename from src/graphite/modelmanagement/XtextEntityImpl.egl rename to graphite/src/graphite/modelmanagement/XtextEntityImpl.egl diff --git a/src/graphite/modelmanagement/XtextPackageFactoryImpl.egl b/graphite/src/graphite/modelmanagement/XtextPackageFactoryImpl.egl similarity index 100% rename from src/graphite/modelmanagement/XtextPackageFactoryImpl.egl rename to graphite/src/graphite/modelmanagement/XtextPackageFactoryImpl.egl diff --git a/src/graphite/modelmanagement/main.egx b/graphite/src/graphite/modelmanagement/main.egx similarity index 100% rename from src/graphite/modelmanagement/main.egx rename to graphite/src/graphite/modelmanagement/main.egx diff --git a/src/graphite/shared/CustomEObjectImpl.java b/graphite/src/graphite/shared/CustomEObjectImpl.java similarity index 100% rename from src/graphite/shared/CustomEObjectImpl.java rename to graphite/src/graphite/shared/CustomEObjectImpl.java diff --git a/src/graphite/shared/CustomValidator.java b/graphite/src/graphite/shared/CustomValidator.java similarity index 100% rename from src/graphite/shared/CustomValidator.java rename to graphite/src/graphite/shared/CustomValidator.java diff --git a/src/graphite/shared/DerivedObjectProperties.java b/graphite/src/graphite/shared/DerivedObjectProperties.java similarity index 100% rename from src/graphite/shared/DerivedObjectProperties.java rename to graphite/src/graphite/shared/DerivedObjectProperties.java diff --git a/src/graphite/shared/DerivedPropertyData.java b/graphite/src/graphite/shared/DerivedPropertyData.java similarity index 100% rename from src/graphite/shared/DerivedPropertyData.java rename to graphite/src/graphite/shared/DerivedPropertyData.java diff --git a/src/graphite/shared/ITransformationService.java b/graphite/src/graphite/shared/ITransformationService.java similarity index 100% rename from src/graphite/shared/ITransformationService.java rename to graphite/src/graphite/shared/ITransformationService.java diff --git a/src/graphite/shared/ModelData.java b/graphite/src/graphite/shared/ModelData.java similarity index 100% rename from src/graphite/shared/ModelData.java rename to graphite/src/graphite/shared/ModelData.java diff --git a/src/graphite/shared/ModelUtility.java b/graphite/src/graphite/shared/ModelUtility.java similarity index 100% rename from src/graphite/shared/ModelUtility.java rename to graphite/src/graphite/shared/ModelUtility.java diff --git a/src/graphite/shared/ReferencesAdapter.java b/graphite/src/graphite/shared/ReferencesAdapter.java similarity index 100% rename from src/graphite/shared/ReferencesAdapter.java rename to graphite/src/graphite/shared/ReferencesAdapter.java diff --git a/src/graphite/shared/ReferencesUtility.java b/graphite/src/graphite/shared/ReferencesUtility.java similarity index 100% rename from src/graphite/shared/ReferencesUtility.java rename to graphite/src/graphite/shared/ReferencesUtility.java diff --git a/src/graphite/shared/Settings.java b/graphite/src/graphite/shared/Settings.java similarity index 100% rename from src/graphite/shared/Settings.java rename to graphite/src/graphite/shared/Settings.java diff --git a/src/graphite/shared/SimpleLock.java b/graphite/src/graphite/shared/SimpleLock.java similarity index 100% rename from src/graphite/shared/SimpleLock.java rename to graphite/src/graphite/shared/SimpleLock.java diff --git a/src/graphite/shared/WorkbenchData.java b/graphite/src/graphite/shared/WorkbenchData.java similarity index 100% rename from src/graphite/shared/WorkbenchData.java rename to graphite/src/graphite/shared/WorkbenchData.java diff --git a/src/graphite/textual/AstFactory.java b/graphite/src/graphite/textual/AstFactory.java similarity index 100% rename from src/graphite/textual/AstFactory.java rename to graphite/src/graphite/textual/AstFactory.java diff --git a/src/graphite/textual/CustomSerializer.java b/graphite/src/graphite/textual/CustomSerializer.java similarity index 100% rename from src/graphite/textual/CustomSerializer.java rename to graphite/src/graphite/textual/CustomSerializer.java diff --git a/src/graphite/textual/CustomXMISaveImpl.java b/graphite/src/graphite/textual/CustomXMISaveImpl.java similarity index 100% rename from src/graphite/textual/CustomXMISaveImpl.java rename to graphite/src/graphite/textual/CustomXMISaveImpl.java diff --git a/src/graphite/textual/CustomXtextResourceImpl.java b/graphite/src/graphite/textual/CustomXtextResourceImpl.java similarity index 100% rename from src/graphite/textual/CustomXtextResourceImpl.java rename to graphite/src/graphite/textual/CustomXtextResourceImpl.java diff --git a/src/graphite/textual/DerivedObjectUtility.java b/graphite/src/graphite/textual/DerivedObjectUtility.java similarity index 100% rename from src/graphite/textual/DerivedObjectUtility.java rename to graphite/src/graphite/textual/DerivedObjectUtility.java diff --git a/src/graphite/textual/GlobalScopeProvider.java b/graphite/src/graphite/textual/GlobalScopeProvider.java similarity index 100% rename from src/graphite/textual/GlobalScopeProvider.java rename to graphite/src/graphite/textual/GlobalScopeProvider.java diff --git a/src/graphite/textual/SerializationAdapter.java b/graphite/src/graphite/textual/SerializationAdapter.java similarity index 100% rename from src/graphite/textual/SerializationAdapter.java rename to graphite/src/graphite/textual/SerializationAdapter.java diff --git a/src/graphite/textual/XtextEObject.java b/graphite/src/graphite/textual/XtextEObject.java similarity index 100% rename from src/graphite/textual/XtextEObject.java rename to graphite/src/graphite/textual/XtextEObject.java diff --git a/src/graphite/textual/XtextParser.java b/graphite/src/graphite/textual/XtextParser.java similarity index 100% rename from src/graphite/textual/XtextParser.java rename to graphite/src/graphite/textual/XtextParser.java diff --git a/src/graphite/textual/XtextXMIResourceFactoryImpl.java b/graphite/src/graphite/textual/XtextXMIResourceFactoryImpl.java similarity index 100% rename from src/graphite/textual/XtextXMIResourceFactoryImpl.java rename to graphite/src/graphite/textual/XtextXMIResourceFactoryImpl.java diff --git a/src/graphite/textual/XtextXMIResourceImpl.java b/graphite/src/graphite/textual/XtextXMIResourceImpl.java similarity index 100% rename from src/graphite/textual/XtextXMIResourceImpl.java rename to graphite/src/graphite/textual/XtextXMIResourceImpl.java diff --git a/src/graphite/xtextwidget/EmbeddedResourceProvider.java b/graphite/src/graphite/xtextwidget/EmbeddedResourceProvider.java similarity index 100% rename from src/graphite/xtextwidget/EmbeddedResourceProvider.java rename to graphite/src/graphite/xtextwidget/EmbeddedResourceProvider.java diff --git a/src/graphite/xtextwidget/XtextPartialViewerController.java b/graphite/src/graphite/xtextwidget/XtextPartialViewerController.java similarity index 100% rename from src/graphite/xtextwidget/XtextPartialViewerController.java rename to graphite/src/graphite/xtextwidget/XtextPartialViewerController.java diff --git a/src/graphite/xtextwidget/XtextPartialViewerLifecycleManager.java b/graphite/src/graphite/xtextwidget/XtextPartialViewerLifecycleManager.java similarity index 100% rename from src/graphite/xtextwidget/XtextPartialViewerLifecycleManager.java rename to graphite/src/graphite/xtextwidget/XtextPartialViewerLifecycleManager.java diff --git a/src/graphite/xtextwidget/XtextPartialViewerLifecycleManagerProvider.java b/graphite/src/graphite/xtextwidget/XtextPartialViewerLifecycleManagerProvider.java similarity index 100% rename from src/graphite/xtextwidget/XtextPartialViewerLifecycleManagerProvider.java rename to graphite/src/graphite/xtextwidget/XtextPartialViewerLifecycleManagerProvider.java diff --git a/src/graphite/xtextxmi/Activator.java b/graphite/src/graphite/xtextxmi/Activator.java similarity index 100% rename from src/graphite/xtextxmi/Activator.java rename to graphite/src/graphite/xtextxmi/Activator.java diff --git a/src/graphite/xtextxmi/ExecutableExtensionFactory.java b/graphite/src/graphite/xtextxmi/ExecutableExtensionFactory.java similarity index 100% rename from src/graphite/xtextxmi/ExecutableExtensionFactory.java rename to graphite/src/graphite/xtextxmi/ExecutableExtensionFactory.java diff --git a/src/graphite/xtextxmi/LanguageProperties.java b/graphite/src/graphite/xtextxmi/LanguageProperties.java similarity index 100% rename from src/graphite/xtextxmi/LanguageProperties.java rename to graphite/src/graphite/xtextxmi/LanguageProperties.java diff --git a/src/graphite/xtextxmi/ResourceSupport.java b/graphite/src/graphite/xtextxmi/ResourceSupport.java similarity index 100% rename from src/graphite/xtextxmi/ResourceSupport.java rename to graphite/src/graphite/xtextxmi/ResourceSupport.java diff --git a/src/graphite/xtextxmi/RuntimeModule.java b/graphite/src/graphite/xtextxmi/RuntimeModule.java similarity index 100% rename from src/graphite/xtextxmi/RuntimeModule.java rename to graphite/src/graphite/xtextxmi/RuntimeModule.java diff --git a/src/graphite/xtextxmi/SiriusEditorOpener.java b/graphite/src/graphite/xtextxmi/SiriusEditorOpener.java similarity index 100% rename from src/graphite/xtextxmi/SiriusEditorOpener.java rename to graphite/src/graphite/xtextxmi/SiriusEditorOpener.java diff --git a/src/graphite/xtextxmi/SupportStandaloneSetup.java b/graphite/src/graphite/xtextxmi/SupportStandaloneSetup.java similarity index 100% rename from src/graphite/xtextxmi/SupportStandaloneSetup.java rename to graphite/src/graphite/xtextxmi/SupportStandaloneSetup.java diff --git a/src/graphite/xtextxmi/UiModule.java b/graphite/src/graphite/xtextxmi/UiModule.java similarity index 100% rename from src/graphite/xtextxmi/UiModule.java rename to graphite/src/graphite/xtextxmi/UiModule.java diff --git a/workload.emf.edit/.classpath b/workload.emf.edit/.classpath new file mode 100644 index 0000000..c3ba59e --- /dev/null +++ b/workload.emf.edit/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workload.emf.edit/.project b/workload.emf.edit/.project new file mode 100644 index 0000000..62df165 --- /dev/null +++ b/workload.emf.edit/.project @@ -0,0 +1,28 @@ + + + workload.emf.edit + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workload.emf.edit/.settings/org.eclipse.core.resources.prefs b/workload.emf.edit/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.emf.edit/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.emf.edit/META-INF/MANIFEST.MF b/workload.emf.edit/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c97f83c --- /dev/null +++ b/workload.emf.edit/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: workload.emf.edit;singleton:=true +Automatic-Module-Name: workload.emf.edit +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: workload.provider.WorkloadEditPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: workload.provider +Require-Bundle: org.eclipse.core.runtime, + workload.emf;visibility:=reexport, + org.eclipse.emf.edit;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/workload.emf.edit/build.properties b/workload.emf.edit/build.properties new file mode 100644 index 0000000..6e3e902 --- /dev/null +++ b/workload.emf.edit/build.properties @@ -0,0 +1,10 @@ +# + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/workload.emf.edit/icons/full/obj16/CostCentre.gif b/workload.emf.edit/icons/full/obj16/CostCentre.gif new file mode 100644 index 0000000..0964ace Binary files /dev/null and b/workload.emf.edit/icons/full/obj16/CostCentre.gif differ diff --git a/workload.emf.edit/icons/full/obj16/Effort.gif b/workload.emf.edit/icons/full/obj16/Effort.gif new file mode 100644 index 0000000..55ce55f Binary files /dev/null and b/workload.emf.edit/icons/full/obj16/Effort.gif differ diff --git a/workload.emf.edit/icons/full/obj16/Person.gif b/workload.emf.edit/icons/full/obj16/Person.gif new file mode 100644 index 0000000..0dec5f8 Binary files /dev/null and b/workload.emf.edit/icons/full/obj16/Person.gif differ diff --git a/workload.emf.edit/icons/full/obj16/Project.gif b/workload.emf.edit/icons/full/obj16/Project.gif new file mode 100644 index 0000000..9e0d6c8 Binary files /dev/null and b/workload.emf.edit/icons/full/obj16/Project.gif differ diff --git a/workload.emf.edit/icons/full/obj16/Task.gif b/workload.emf.edit/icons/full/obj16/Task.gif new file mode 100644 index 0000000..07d80ad Binary files /dev/null and b/workload.emf.edit/icons/full/obj16/Task.gif differ diff --git a/workload.emf.edit/plugin.properties b/workload.emf.edit/plugin.properties new file mode 100644 index 0000000..bde9ee5 --- /dev/null +++ b/workload.emf.edit/plugin.properties @@ -0,0 +1,37 @@ +# + +pluginName = workload.emf Edit Support +providerName = www.example.org + +_UI_CreateChild_text = {0} +_UI_CreateChild_text2 = {1} {0} +_UI_CreateChild_text3 = {1} +_UI_CreateChild_tooltip = Create New {0} Under {1} Feature +_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. +_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. + +_UI_PropertyDescriptor_description = The {0} of the {1} + +_UI_Project_type = Project +_UI_Task_type = Task +_UI_Person_type = Person +_UI_Effort_type = Effort +_UI_CostCentre_type = Cost Centre +_UI_Unknown_type = Object + +_UI_Unknown_datatype= Value + +_UI_Project_tasks_feature = Tasks +_UI_Project_people_feature = People +_UI_Task_name_feature = Name +_UI_Task_effortsExpression_feature = Efforts Expression +_UI_Task_efforts_feature = Efforts +_UI_Task_leader_feature = Leader +_UI_Task_dependencies_feature = Dependencies +_UI_Person_name_feature = Name +_UI_Effort_person_feature = Person +_UI_Effort_months_feature = Months +_UI_CostCentre_name_feature = Name +_UI_CostCentre_efforts_feature = Efforts +_UI_Unknown_feature = Unspecified + diff --git a/workload.emf.edit/plugin.xml b/workload.emf.edit/plugin.xml new file mode 100644 index 0000000..d85526f --- /dev/null +++ b/workload.emf.edit/plugin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/workload.emf.edit/src/workload/provider/CostCentreItemProvider.java b/workload.emf.edit/src/workload/provider/CostCentreItemProvider.java new file mode 100644 index 0000000..41c7605 --- /dev/null +++ b/workload.emf.edit/src/workload/provider/CostCentreItemProvider.java @@ -0,0 +1,169 @@ +/** + */ +package workload.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import workload.CostCentre; +import workload.WorkloadPackage; + +/** + * This is the item provider adapter for a {@link workload.CostCentre} object. + * + * + * @generated + */ +public class CostCentreItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public CostCentreItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + addEffortsPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_CostCentre_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_CostCentre_name_feature", + "_UI_CostCentre_type"), + WorkloadPackage.Literals.COST_CENTRE__NAME, true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Efforts feature. + * + * + * @generated + */ + protected void addEffortsPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_CostCentre_efforts_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_CostCentre_efforts_feature", + "_UI_CostCentre_type"), + WorkloadPackage.Literals.COST_CENTRE__EFFORTS, true, false, true, null, null, null)); + } + + /** + * This returns CostCentre.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/CostCentre")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((CostCentre) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_CostCentre_type") + : getString("_UI_CostCentre_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(CostCentre.class)) { + case WorkloadPackage.COST_CENTRE__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return WorkloadEditPlugin.INSTANCE; + } + +} diff --git a/workload.emf.edit/src/workload/provider/EffortItemProvider.java b/workload.emf.edit/src/workload/provider/EffortItemProvider.java new file mode 100644 index 0000000..b758850 --- /dev/null +++ b/workload.emf.edit/src/workload/provider/EffortItemProvider.java @@ -0,0 +1,166 @@ +/** + */ +package workload.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import workload.Effort; +import workload.WorkloadPackage; + +/** + * This is the item provider adapter for a {@link workload.Effort} object. + * + * + * @generated + */ +public class EffortItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public EffortItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addPersonPropertyDescriptor(object); + addMonthsPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Person feature. + * + * + * @generated + */ + protected void addPersonPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_Effort_person_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Effort_person_feature", "_UI_Effort_type"), + WorkloadPackage.Literals.EFFORT__PERSON, true, false, true, null, null, null)); + } + + /** + * This adds a property descriptor for the Months feature. + * + * + * @generated + */ + protected void addMonthsPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_Effort_months_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Effort_months_feature", "_UI_Effort_type"), + WorkloadPackage.Literals.EFFORT__MONTHS, true, false, false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); + } + + /** + * This returns Effort.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Effort")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + Effort effort = (Effort) object; + return getString("_UI_Effort_type") + " " + effort.getMonths(); + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Effort.class)) { + case WorkloadPackage.EFFORT__MONTHS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return WorkloadEditPlugin.INSTANCE; + } + +} diff --git a/workload.emf.edit/src/workload/provider/PersonItemProvider.java b/workload.emf.edit/src/workload/provider/PersonItemProvider.java new file mode 100644 index 0000000..bd81ce6 --- /dev/null +++ b/workload.emf.edit/src/workload/provider/PersonItemProvider.java @@ -0,0 +1,152 @@ +/** + */ +package workload.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import workload.Person; +import workload.WorkloadPackage; + +/** + * This is the item provider adapter for a {@link workload.Person} object. + * + * + * @generated + */ +public class PersonItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public PersonItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_Person_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Person_name_feature", "_UI_Person_type"), + WorkloadPackage.Literals.PERSON__NAME, true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This returns Person.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Person")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((Person) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_Person_type") + : getString("_UI_Person_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Person.class)) { + case WorkloadPackage.PERSON__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return WorkloadEditPlugin.INSTANCE; + } + +} diff --git a/workload.emf.edit/src/workload/provider/ProjectItemProvider.java b/workload.emf.edit/src/workload/provider/ProjectItemProvider.java new file mode 100644 index 0000000..c006266 --- /dev/null +++ b/workload.emf.edit/src/workload/provider/ProjectItemProvider.java @@ -0,0 +1,173 @@ +/** + */ +package workload.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import workload.Project; +import workload.WorkloadFactory; +import workload.WorkloadPackage; + +/** + * This is the item provider adapter for a {@link workload.Project} object. + * + * + * @generated + */ +public class ProjectItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ProjectItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(WorkloadPackage.Literals.PROJECT__TASKS); + childrenFeatures.add(WorkloadPackage.Literals.PROJECT__PEOPLE); + } + return childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns Project.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Project")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + return getString("_UI_Project_type"); + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Project.class)) { + case WorkloadPackage.PROJECT__TASKS: + case WorkloadPackage.PROJECT__PEOPLE: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add( + createChildParameter(WorkloadPackage.Literals.PROJECT__TASKS, WorkloadFactory.eINSTANCE.createTask())); + + newChildDescriptors.add(createChildParameter(WorkloadPackage.Literals.PROJECT__PEOPLE, + WorkloadFactory.eINSTANCE.createPerson())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return WorkloadEditPlugin.INSTANCE; + } + +} diff --git a/workload.emf.edit/src/workload/provider/TaskItemProvider.java b/workload.emf.edit/src/workload/provider/TaskItemProvider.java new file mode 100644 index 0000000..099dc58 --- /dev/null +++ b/workload.emf.edit/src/workload/provider/TaskItemProvider.java @@ -0,0 +1,240 @@ +/** + */ +package workload.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import workload.Task; +import workload.WorkloadFactory; +import workload.WorkloadPackage; + +/** + * This is the item provider adapter for a {@link workload.Task} object. + * + * + * @generated + */ +public class TaskItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public TaskItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + addEffortsExpressionPropertyDescriptor(object); + addLeaderPropertyDescriptor(object); + addDependenciesPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_Task_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Task_name_feature", "_UI_Task_type"), + WorkloadPackage.Literals.TASK__NAME, true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Efforts Expression feature. + * + * + * @generated + */ + protected void addEffortsExpressionPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_Task_effortsExpression_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Task_effortsExpression_feature", + "_UI_Task_type"), + WorkloadPackage.Literals.TASK__EFFORTS_EXPRESSION, true, true, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Leader feature. + * + * + * @generated + */ + protected void addLeaderPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_Task_leader_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Task_leader_feature", "_UI_Task_type"), + WorkloadPackage.Literals.TASK__LEADER, true, false, true, null, null, null)); + } + + /** + * This adds a property descriptor for the Dependencies feature. + * + * + * @generated + */ + protected void addDependenciesPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_Task_dependencies_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Task_dependencies_feature", + "_UI_Task_type"), + WorkloadPackage.Literals.TASK__DEPENDENCIES, true, false, true, null, null, null)); + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(WorkloadPackage.Literals.TASK__EFFORTS); + } + return childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns Task.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Task")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((Task) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_Task_type") + : getString("_UI_Task_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Task.class)) { + case WorkloadPackage.TASK__NAME: + case WorkloadPackage.TASK__EFFORTS_EXPRESSION: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case WorkloadPackage.TASK__EFFORTS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add( + createChildParameter(WorkloadPackage.Literals.TASK__EFFORTS, WorkloadFactory.eINSTANCE.createEffort())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return WorkloadEditPlugin.INSTANCE; + } + +} diff --git a/workload.emf.edit/src/workload/provider/WorkloadEditPlugin.java b/workload.emf.edit/src/workload/provider/WorkloadEditPlugin.java new file mode 100644 index 0000000..6cf15a4 --- /dev/null +++ b/workload.emf.edit/src/workload/provider/WorkloadEditPlugin.java @@ -0,0 +1,87 @@ +/** + */ +package workload.provider; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Workload edit plugin. + * + * + * @generated + */ +public final class WorkloadEditPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final WorkloadEditPlugin INSTANCE = new WorkloadEditPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public WorkloadEditPlugin() { + super(new ResourceLocator[] {}); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * @generated + */ + public static class Implementation extends EclipsePlugin { + /** + * Creates an instance. + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/workload.emf.edit/src/workload/provider/WorkloadItemProviderAdapterFactory.java b/workload.emf.edit/src/workload/provider/WorkloadItemProviderAdapterFactory.java new file mode 100644 index 0000000..b86ad32 --- /dev/null +++ b/workload.emf.edit/src/workload/provider/WorkloadItemProviderAdapterFactory.java @@ -0,0 +1,301 @@ +/** + */ +package workload.provider; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.edit.provider.ChangeNotifier; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IChangeNotifier; +import org.eclipse.emf.edit.provider.IDisposable; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.INotifyChangedListener; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; + +import workload.util.WorkloadAdapterFactory; + +/** + * This is the factory that is used to provide the interfaces needed to support Viewers. + * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. + * The adapters also support Eclipse property sheets. + * Note that most of the adapters are shared among multiple instances. + * + * + * @generated + */ +public class WorkloadItemProviderAdapterFactory extends WorkloadAdapterFactory + implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * + * + * @generated + */ + protected Collection supportedTypes = new ArrayList(); + + /** + * This constructs an instance. + * + * + * @generated + */ + public WorkloadItemProviderAdapterFactory() { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + } + + /** + * This keeps track of the one adapter used for all {@link workload.Project} instances. + * + * + * @generated + */ + protected ProjectItemProvider projectItemProvider; + + /** + * This creates an adapter for a {@link workload.Project}. + * + * + * @generated + */ + @Override + public Adapter createProjectAdapter() { + if (projectItemProvider == null) { + projectItemProvider = new ProjectItemProvider(this); + } + + return projectItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link workload.Task} instances. + * + * + * @generated + */ + protected TaskItemProvider taskItemProvider; + + /** + * This creates an adapter for a {@link workload.Task}. + * + * + * @generated + */ + @Override + public Adapter createTaskAdapter() { + if (taskItemProvider == null) { + taskItemProvider = new TaskItemProvider(this); + } + + return taskItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link workload.Person} instances. + * + * + * @generated + */ + protected PersonItemProvider personItemProvider; + + /** + * This creates an adapter for a {@link workload.Person}. + * + * + * @generated + */ + @Override + public Adapter createPersonAdapter() { + if (personItemProvider == null) { + personItemProvider = new PersonItemProvider(this); + } + + return personItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link workload.Effort} instances. + * + * + * @generated + */ + protected EffortItemProvider effortItemProvider; + + /** + * This creates an adapter for a {@link workload.Effort}. + * + * + * @generated + */ + @Override + public Adapter createEffortAdapter() { + if (effortItemProvider == null) { + effortItemProvider = new EffortItemProvider(this); + } + + return effortItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link workload.CostCentre} instances. + * + * + * @generated + */ + protected CostCentreItemProvider costCentreItemProvider; + + /** + * This creates an adapter for a {@link workload.CostCentre}. + * + * + * @generated + */ + @Override + public Adapter createCostCentreAdapter() { + if (costCentreItemProvider == null) { + costCentreItemProvider = new CostCentreItemProvider(this); + } + + return costCentreItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * + * + * @generated + */ + public ComposeableAdapterFactory getRootAdapterFactory() { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * + * + * @generated + */ + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * + * + * @generated + */ + @Override + public boolean isFactoryForType(Object type) { + return supportedTypes.contains(type) || super.isFactoryForType(type); + } + + /** + * This implementation substitutes the factory itself as the key for the adapter. + * + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) { + return super.adapt(notifier, this); + } + + /** + * + * + * @generated + */ + @Override + public Object adapt(Object object, Object type) { + if (isFactoryForType(type)) { + Object adapter = super.adapt(object, type); + if (!(type instanceof Class) || (((Class) type).isInstance(adapter))) { + return adapter; + } + } + + return null; + } + + /** + * This adds a listener. + * + * + * @generated + */ + public void addListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * + * + * @generated + */ + public void removeListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * + * + * @generated + */ + public void fireNotifyChanged(Notification notification) { + changeNotifier.fireNotifyChanged(notification); + + if (parentAdapterFactory != null) { + parentAdapterFactory.fireNotifyChanged(notification); + } + } + + /** + * This disposes all of the item providers created by this factory. + * + * + * @generated + */ + public void dispose() { + if (projectItemProvider != null) + projectItemProvider.dispose(); + if (taskItemProvider != null) + taskItemProvider.dispose(); + if (personItemProvider != null) + personItemProvider.dispose(); + if (effortItemProvider != null) + effortItemProvider.dispose(); + if (costCentreItemProvider != null) + costCentreItemProvider.dispose(); + } + +} diff --git a/workload.emf.editor/.classpath b/workload.emf.editor/.classpath new file mode 100644 index 0000000..c3ba59e --- /dev/null +++ b/workload.emf.editor/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workload.emf.editor/.project b/workload.emf.editor/.project new file mode 100644 index 0000000..15d5eba --- /dev/null +++ b/workload.emf.editor/.project @@ -0,0 +1,28 @@ + + + workload.emf.editor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workload.emf.editor/.settings/org.eclipse.core.resources.prefs b/workload.emf.editor/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.emf.editor/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.emf.editor/META-INF/MANIFEST.MF b/workload.emf.editor/META-INF/MANIFEST.MF new file mode 100644 index 0000000..3e76177 --- /dev/null +++ b/workload.emf.editor/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: workload.emf.editor;singleton:=true +Automatic-Module-Name: workload.emf.editor +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: workload.presentation.WorkloadEditorPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: workload.presentation +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources;visibility:=reexport, + workload.emf.edit;visibility:=reexport, + org.eclipse.emf.ecore.xmi;visibility:=reexport, + org.eclipse.emf.edit.ui;visibility:=reexport, + org.eclipse.ui.ide;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/workload.emf.editor/build.properties b/workload.emf.editor/build.properties new file mode 100644 index 0000000..5fb0771 --- /dev/null +++ b/workload.emf.editor/build.properties @@ -0,0 +1,10 @@ +# + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin diff --git a/workload.emf.editor/icons/full/obj16/WorkloadModelFile.gif b/workload.emf.editor/icons/full/obj16/WorkloadModelFile.gif new file mode 100644 index 0000000..e526a91 Binary files /dev/null and b/workload.emf.editor/icons/full/obj16/WorkloadModelFile.gif differ diff --git a/workload.emf.editor/icons/full/wizban/NewWorkload.gif b/workload.emf.editor/icons/full/wizban/NewWorkload.gif new file mode 100644 index 0000000..32e5988 Binary files /dev/null and b/workload.emf.editor/icons/full/wizban/NewWorkload.gif differ diff --git a/workload.emf.editor/plugin.properties b/workload.emf.editor/plugin.properties new file mode 100644 index 0000000..71403f2 --- /dev/null +++ b/workload.emf.editor/plugin.properties @@ -0,0 +1,53 @@ +# + +pluginName = workload.emf Editor +providerName = www.example.org + +_UI_WorkloadEditor_menu = &Workload Editor + +_UI_CreateChild_menu_item = &New Child +_UI_CreateSibling_menu_item = N&ew Sibling + +_UI_ShowPropertiesView_menu_item = Show &Properties View +_UI_RefreshViewer_menu_item = &Refresh + +_UI_SelectionPage_label = Selection +_UI_ParentPage_label = Parent +_UI_ListPage_label = List +_UI_TreePage_label = Tree +_UI_TablePage_label = Table +_UI_TreeWithColumnsPage_label = Tree with Columns +_UI_ObjectColumn_label = Object +_UI_SelfColumn_label = Self + +_UI_NoObjectSelected = Selected Nothing +_UI_SingleObjectSelected = Selected Object: {0} +_UI_MultiObjectSelected = Selected {0} Objects + +_UI_OpenEditorError_label = Open Editor + +_UI_Wizard_category = Example EMF Model Creation Wizards + +_UI_CreateModelError_message = Problems encountered in file "{0}" + +_UI_WorkloadModelWizard_label = Workload Model +_UI_WorkloadModelWizard_description = Create a new Workload model + +_UI_WorkloadEditor_label = Workload Model Editor + +_UI_WorkloadEditorFilenameDefaultBase = My +_UI_WorkloadEditorFilenameExtensions = workload + +_UI_Wizard_label = New + +_WARN_FilenameExtension = The file name must end in ''.{0}'' +_WARN_FilenameExtensions = The file name must have one of the following extensions: {0} + +_UI_ModelObject = &Model Object +_UI_XMLEncoding = &XML Encoding +_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1 +_UI_Wizard_initial_object_description = Select a model object to create + +_UI_FileConflict_label = File Conflict +_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes? + diff --git a/workload.emf.editor/plugin.xml b/workload.emf.editor/plugin.xml new file mode 100644 index 0000000..899ee73 --- /dev/null +++ b/workload.emf.editor/plugin.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + %_UI_WorkloadModelWizard_description + + + + + + + + + + + + + + + diff --git a/workload.emf.editor/src/workload/presentation/WorkloadActionBarContributor.java b/workload.emf.editor/src/workload/presentation/WorkloadActionBarContributor.java new file mode 100644 index 0000000..31d3c1e --- /dev/null +++ b/workload.emf.editor/src/workload/presentation/WorkloadActionBarContributor.java @@ -0,0 +1,422 @@ +/** + */ +package workload.presentation; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; + +import org.eclipse.emf.edit.ui.action.ControlAction; +import org.eclipse.emf.edit.ui.action.CreateChildAction; +import org.eclipse.emf.edit.ui.action.CreateSiblingAction; +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; +import org.eclipse.emf.edit.ui.action.LoadResourceAction; +import org.eclipse.emf.edit.ui.action.ValidateAction; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.action.SubContributionItem; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PartInitException; + +/** + * This is the action bar contributor for the Workload model editor. + * + * + * @generated + */ +public class WorkloadActionBarContributor extends EditingDomainActionBarContributor + implements ISelectionChangedListener { + /** + * This keeps track of the active editor. + * + * + * @generated + */ + protected IEditorPart activeEditorPart; + + /** + * This keeps track of the current selection provider. + * + * + * @generated + */ + protected ISelectionProvider selectionProvider; + + /** + * This action opens the Properties view. + * + * + * @generated + */ + protected IAction showPropertiesViewAction = new Action( + WorkloadEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { + @Override + public void run() { + try { + getPage().showView("org.eclipse.ui.views.PropertySheet"); + } catch (PartInitException exception) { + WorkloadEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * This action refreshes the viewer of the current editor if the editor + * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. + * + * + * @generated + */ + protected IAction refreshViewerAction = new Action( + WorkloadEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { + @Override + public boolean isEnabled() { + return activeEditorPart instanceof IViewerProvider; + } + + @Override + public void run() { + if (activeEditorPart instanceof IViewerProvider) { + Viewer viewer = ((IViewerProvider) activeEditorPart).getViewer(); + if (viewer != null) { + viewer.refresh(); + } + } + } + }; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * + * + * @generated + */ + protected Collection createChildActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateChild actions. + * + * + * @generated + */ + protected IMenuManager createChildMenuManager; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * + * + * @generated + */ + protected Collection createSiblingActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateSibling actions. + * + * + * @generated + */ + protected IMenuManager createSiblingMenuManager; + + /** + * This creates an instance of the contributor. + * + * + * @generated + */ + public WorkloadActionBarContributor() { + super(ADDITIONS_LAST_STYLE); + loadResourceAction = new LoadResourceAction(); + validateAction = new ValidateAction(); + controlAction = new ControlAction(); + } + + /** + * This adds Separators for editor additions to the tool bar. + * + * + * @generated + */ + @Override + public void contributeToToolBar(IToolBarManager toolBarManager) { + super.contributeToToolBar(toolBarManager); + toolBarManager.add(new Separator("workload-settings")); + toolBarManager.add(new Separator("workload-additions")); + } + + /** + * This adds to the menu bar a menu and some separators for editor additions, + * as well as the sub-menus for object creation items. + * + * + * @generated + */ + @Override + public void contributeToMenu(IMenuManager menuManager) { + super.contributeToMenu(menuManager); + + IMenuManager submenuManager = new MenuManager( + WorkloadEditorPlugin.INSTANCE.getString("_UI_WorkloadEditor_menu"), "workloadMenuID"); + menuManager.insertAfter("additions", submenuManager); + submenuManager.add(new Separator("settings")); + submenuManager.add(new Separator("actions")); + submenuManager.add(new Separator("additions")); + submenuManager.add(new Separator("additions-end")); + + // Prepare for CreateChild item addition or removal. + // + createChildMenuManager = new MenuManager(WorkloadEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + submenuManager.insertBefore("additions", createChildMenuManager); + + // Prepare for CreateSibling item addition or removal. + // + createSiblingMenuManager = new MenuManager( + WorkloadEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + submenuManager.insertBefore("additions", createSiblingMenuManager); + + // Force an update because Eclipse hides empty menus now. + // + submenuManager.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager menuManager) { + menuManager.updateAll(true); + } + }); + + addGlobalActions(submenuManager); + } + + /** + * When the active editor changes, this remembers the change and registers with it as a selection provider. + * + * + * @generated + */ + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + activeEditorPart = part; + + // Switch to the new selection provider. + // + if (selectionProvider != null) { + selectionProvider.removeSelectionChangedListener(this); + } + if (part == null) { + selectionProvider = null; + } else { + selectionProvider = part.getSite().getSelectionProvider(); + selectionProvider.addSelectionChangedListener(this); + + // Fake a selection changed event to update the menus. + // + if (selectionProvider.getSelection() != null) { + selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); + } + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, + * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings + * that can be added to the selected object and updating the menus accordingly. + * + * + * @generated + */ + public void selectionChanged(SelectionChangedEvent event) { + // Remove any menu items for old selection. + // + if (createChildMenuManager != null) { + depopulateManager(createChildMenuManager, createChildActions); + } + if (createSiblingMenuManager != null) { + depopulateManager(createSiblingMenuManager, createSiblingActions); + } + + // Query the new selection for appropriate new child/sibling descriptors + // + Collection newChildDescriptors = null; + Collection newSiblingDescriptors = null; + + ISelection selection = event.getSelection(); + if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { + Object object = ((IStructuredSelection) selection).getFirstElement(); + + EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain(); + + newChildDescriptors = domain.getNewChildDescriptors(object, null); + newSiblingDescriptors = domain.getNewChildDescriptors(null, object); + } + + // Generate actions for selection; populate and redraw the menus. + // + createChildActions = generateCreateChildActions(newChildDescriptors, selection); + createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); + + if (createChildMenuManager != null) { + populateManager(createChildMenuManager, createChildActions, null); + createChildMenuManager.update(true); + } + if (createSiblingMenuManager != null) { + populateManager(createSiblingMenuManager, createSiblingActions, null); + createSiblingMenuManager.update(true); + } + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in descriptors, + * and returns the collection of these actions. + * + * + * @generated + */ + protected Collection generateCreateChildActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in descriptors, + * and returns the collection of these actions. + * + * + * @generated + */ + protected Collection generateCreateSiblingActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This populates the specified manager with {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection, + * by inserting them before the specified contribution item contributionID. + * If contributionID is null, they are simply added. + * + * + * @generated + */ + protected void populateManager(IContributionManager manager, Collection actions, + String contributionID) { + if (actions != null) { + for (IAction action : actions) { + if (contributionID != null) { + manager.insertBefore(contributionID, action); + } else { + manager.add(action); + } + } + } + } + + /** + * This removes from the specified manager all {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection. + * + * + * @generated + */ + protected void depopulateManager(IContributionManager manager, Collection actions) { + if (actions != null) { + IContributionItem[] items = manager.getItems(); + for (int i = 0; i < items.length; i++) { + // Look into SubContributionItems + // + IContributionItem contributionItem = items[i]; + while (contributionItem instanceof SubContributionItem) { + contributionItem = ((SubContributionItem) contributionItem).getInnerItem(); + } + + // Delete the ActionContributionItems with matching action. + // + if (contributionItem instanceof ActionContributionItem) { + IAction action = ((ActionContributionItem) contributionItem).getAction(); + if (actions.contains(action)) { + manager.remove(contributionItem); + } + } + } + } + } + + /** + * This populates the pop-up menu before it appears. + * + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + super.menuAboutToShow(menuManager); + MenuManager submenuManager = null; + + submenuManager = new MenuManager(WorkloadEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + populateManager(submenuManager, createChildActions, null); + menuManager.insertBefore("edit", submenuManager); + + submenuManager = new MenuManager(WorkloadEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + populateManager(submenuManager, createSiblingActions, null); + menuManager.insertBefore("edit", submenuManager); + } + + /** + * This inserts global actions before the "additions-end" separator. + * + * + * @generated + */ + @Override + protected void addGlobalActions(IMenuManager menuManager) { + menuManager.insertAfter("additions-end", new Separator("ui-actions")); + menuManager.insertAfter("ui-actions", showPropertiesViewAction); + + refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); + menuManager.insertAfter("ui-actions", refreshViewerAction); + + super.addGlobalActions(menuManager); + } + + /** + * This ensures that a delete action will clean up all references to deleted objects. + * + * + * @generated + */ + @Override + protected boolean removeAllReferencesOnDelete() { + return true; + } + +} diff --git a/workload.emf.editor/src/workload/presentation/WorkloadEditor.java b/workload.emf.editor/src/workload/presentation/WorkloadEditor.java new file mode 100644 index 0000000..ed643fb --- /dev/null +++ b/workload.emf.editor/src/workload/presentation/WorkloadEditor.java @@ -0,0 +1,1775 @@ +/** + */ +package workload.presentation; + +import java.io.IOException; +import java.io.InputStream; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.ResourcesPlugin; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.layout.FillLayout; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.command.CommandStackListener; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.ui.MarkerHelper; +import org.eclipse.emf.common.ui.ViewerPane; + +import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; + +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.util.EContentAdapter; +import org.eclipse.emf.ecore.util.EcoreUtil; + +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; + +import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + +import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + +import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + +import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; +import org.eclipse.emf.edit.ui.util.EditUIUtil; + +import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; + +import workload.provider.WorkloadItemProviderAdapterFactory; + +import org.eclipse.ui.actions.WorkspaceModifyOperation; + +/** + * This is an example of a Workload model editor. + * + * + * @generated + */ +public class WorkloadEditor extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + /** + * This keeps track of the editing domain that is used to track all changes to the model. + * + * + * @generated + */ + protected AdapterFactoryEditingDomain editingDomain; + + /** + * This is the one adapter factory used for providing views of the model. + * + * + * @generated + */ + protected ComposedAdapterFactory adapterFactory; + + /** + * This is the content outline page. + * + * + * @generated + */ + protected IContentOutlinePage contentOutlinePage; + + /** + * This is a kludge... + * + * + * @generated + */ + protected IStatusLineManager contentOutlineStatusLineManager; + + /** + * This is the content outline page's viewer. + * + * + * @generated + */ + protected TreeViewer contentOutlineViewer; + + /** + * This is the property sheet page. + * + * + * @generated + */ + protected List propertySheetPages = new ArrayList(); + + /** + * This is the viewer that shadows the selection in the content outline. + * The parent relation must be correctly defined for this to work. + * + * + * @generated + */ + protected TreeViewer selectionViewer; + + /** + * This inverts the roll of parent and child in the content provider and show parents as a tree. + * + * + * @generated + */ + protected TreeViewer parentViewer; + + /** + * This shows how a tree view works. + * + * + * @generated + */ + protected TreeViewer treeViewer; + + /** + * This shows how a list view works. + * A list viewer doesn't support icons. + * + * + * @generated + */ + protected ListViewer listViewer; + + /** + * This shows how a table view works. + * A table can be used as a list with icons. + * + * + * @generated + */ + protected TableViewer tableViewer; + + /** + * This shows how a tree view with columns works. + * + * + * @generated + */ + protected TreeViewer treeViewerWithColumns; + + /** + * This keeps track of the active viewer pane, in the book. + * + * + * @generated + */ + protected ViewerPane currentViewerPane; + + /** + * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. + * + * + * @generated + */ + protected Viewer currentViewer; + + /** + * This listens to which ever viewer is active. + * + * + * @generated + */ + protected ISelectionChangedListener selectionChangedListener; + + /** + * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. + * + * + * @generated + */ + protected Collection selectionChangedListeners = new ArrayList(); + + /** + * This keeps track of the selection of the editor as a whole. + * + * + * @generated + */ + protected ISelection editorSelection = StructuredSelection.EMPTY; + + /** + * The MarkerHelper is responsible for creating workspace resource markers presented + * in Eclipse's Problems View. + * + * + * @generated + */ + protected MarkerHelper markerHelper = new EditUIMarkerHelper(); + + /** + * This listens for when the outline becomes active + * + * + * @generated + */ + protected IPartListener partListener = new IPartListener() { + public void partActivated(IWorkbenchPart p) { + if (p instanceof ContentOutline) { + if (((ContentOutline) p).getCurrentPage() == contentOutlinePage) { + getActionBarContributor().setActiveEditor(WorkloadEditor.this); + + setCurrentViewer(contentOutlineViewer); + } + } else if (p instanceof PropertySheet) { + if (propertySheetPages.contains(((PropertySheet) p).getCurrentPage())) { + getActionBarContributor().setActiveEditor(WorkloadEditor.this); + handleActivate(); + } + } else if (p == WorkloadEditor.this) { + handleActivate(); + } + } + + public void partBroughtToTop(IWorkbenchPart p) { + // Ignore. + } + + public void partClosed(IWorkbenchPart p) { + // Ignore. + } + + public void partDeactivated(IWorkbenchPart p) { + // Ignore. + } + + public void partOpened(IWorkbenchPart p) { + // Ignore. + } + }; + + /** + * Resources that have been removed since last activation. + * + * + * @generated + */ + protected Collection removedResources = new ArrayList(); + + /** + * Resources that have been changed since last activation. + * + * + * @generated + */ + protected Collection changedResources = new ArrayList(); + + /** + * Resources that have been saved. + * + * + * @generated + */ + protected Collection savedResources = new ArrayList(); + + /** + * Map to store the diagnostic associated with a resource. + * + * + * @generated + */ + protected Map resourceToDiagnosticMap = new LinkedHashMap(); + + /** + * Controls whether the problem indication should be updated. + * + * + * @generated + */ + protected boolean updateProblemIndication = true; + + /** + * Adapter used to update the problem indication when resources are demanded loaded. + * + * + * @generated + */ + protected EContentAdapter problemIndicationAdapter = new EContentAdapter() { + protected boolean dispatching; + + @Override + public void notifyChanged(Notification notification) { + if (notification.getNotifier() instanceof Resource) { + switch (notification.getFeatureID(Resource.class)) { + case Resource.RESOURCE__IS_LOADED: + case Resource.RESOURCE__ERRORS: + case Resource.RESOURCE__WARNINGS: { + Resource resource = (Resource) notification.getNotifier(); + Diagnostic diagnostic = analyzeResourceProblems(resource, null); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, diagnostic); + } else { + resourceToDiagnosticMap.remove(resource); + } + dispatchUpdateProblemIndication(); + break; + } + } + } else { + super.notifyChanged(notification); + } + } + + protected void dispatchUpdateProblemIndication() { + if (updateProblemIndication && !dispatching) { + dispatching = true; + getSite().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + dispatching = false; + updateProblemIndication(); + } + }); + } + } + + @Override + protected void setTarget(Resource target) { + basicSetTarget(target); + } + + @Override + protected void unsetTarget(Resource target) { + basicUnsetTarget(target); + resourceToDiagnosticMap.remove(target); + dispatchUpdateProblemIndication(); + } + }; + + /** + * This listens for workspace changes. + * + * + * @generated + */ + protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { + public void resourceChanged(IResourceChangeEvent event) { + IResourceDelta delta = event.getDelta(); + try { + class ResourceDeltaVisitor implements IResourceDeltaVisitor { + protected ResourceSet resourceSet = editingDomain.getResourceSet(); + protected Collection changedResources = new ArrayList(); + protected Collection removedResources = new ArrayList(); + + public boolean visit(IResourceDelta delta) { + if (delta.getResource().getType() == IResource.FILE) { + if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.CHANGED + && delta.getFlags() != IResourceDelta.MARKERS) { + Resource resource = resourceSet.getResource( + URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); + if (resource != null) { + if (delta.getKind() == IResourceDelta.REMOVED) { + removedResources.add(resource); + } else if (!savedResources.remove(resource)) { + changedResources.add(resource); + } + } + } + return false; + } + + return true; + } + + public Collection getChangedResources() { + return changedResources; + } + + public Collection getRemovedResources() { + return removedResources; + } + } + + final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); + delta.accept(visitor); + + if (!visitor.getRemovedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + removedResources.addAll(visitor.getRemovedResources()); + if (!isDirty()) { + getSite().getPage().closeEditor(WorkloadEditor.this, false); + } + } + }); + } + + if (!visitor.getChangedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + changedResources.addAll(visitor.getChangedResources()); + if (getSite().getPage().getActiveEditor() == WorkloadEditor.this) { + handleActivate(); + } + } + }); + } + } catch (CoreException exception) { + WorkloadEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * Handles activation of the editor or it's associated views. + * + * + * @generated + */ + protected void handleActivate() { + // Recompute the read only state. + // + if (editingDomain.getResourceToReadOnlyMap() != null) { + editingDomain.getResourceToReadOnlyMap().clear(); + + // Refresh any actions that may become enabled or disabled. + // + setSelection(getSelection()); + } + + if (!removedResources.isEmpty()) { + if (handleDirtyConflict()) { + getSite().getPage().closeEditor(WorkloadEditor.this, false); + } else { + removedResources.clear(); + changedResources.clear(); + savedResources.clear(); + } + } else if (!changedResources.isEmpty()) { + changedResources.removeAll(savedResources); + handleChangedResources(); + changedResources.clear(); + savedResources.clear(); + } + } + + /** + * Handles what to do with changed resources on activation. + * + * + * @generated + */ + protected void handleChangedResources() { + if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { + ResourceSet resourceSet = editingDomain.getResourceSet(); + if (isDirty()) { + changedResources.addAll(resourceSet.getResources()); + } + editingDomain.getCommandStack().flush(); + + updateProblemIndication = false; + for (Resource resource : changedResources) { + if (resource.isLoaded()) { + resource.unload(); + try { + resource.load(resourceSet.getLoadOptions()); + } catch (IOException exception) { + if (!resourceToDiagnosticMap.containsKey(resource)) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + } + } + } + + if (AdapterFactoryEditingDomain.isStale(editorSelection)) { + setSelection(StructuredSelection.EMPTY); + } + + updateProblemIndication = true; + updateProblemIndication(); + } + } + + /** + * Updates the problems indication with the information described in the specified diagnostic. + * + * + * @generated + */ + protected void updateProblemIndication() { + if (updateProblemIndication) { + BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "workload.emf.editor", 0, null, + new Object[] { editingDomain.getResourceSet() }); + for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { + if (childDiagnostic.getSeverity() != Diagnostic.OK) { + diagnostic.add(childDiagnostic); + } + } + + int lastEditorPage = getPageCount() - 1; + if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { + ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic); + if (diagnostic.getSeverity() != Diagnostic.OK) { + setActivePage(lastEditorPage); + } + } else if (diagnostic.getSeverity() != Diagnostic.OK) { + ProblemEditorPart problemEditorPart = new ProblemEditorPart(); + problemEditorPart.setDiagnostic(diagnostic); + problemEditorPart.setMarkerHelper(markerHelper); + try { + addPage(++lastEditorPage, problemEditorPart, getEditorInput()); + setPageText(lastEditorPage, problemEditorPart.getPartName()); + setActivePage(lastEditorPage); + showTabs(); + } catch (PartInitException exception) { + WorkloadEditorPlugin.INSTANCE.log(exception); + } + } + + if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { + try { + markerHelper.updateMarkers(diagnostic); + } catch (CoreException exception) { + WorkloadEditorPlugin.INSTANCE.log(exception); + } + } + } + } + + /** + * Shows a dialog that asks if conflicting changes should be discarded. + * + * + * @generated + */ + protected boolean handleDirtyConflict() { + return MessageDialog.openQuestion(getSite().getShell(), getString("_UI_FileConflict_label"), + getString("_WARN_FileConflict")); + } + + /** + * This creates a model editor. + * + * + * @generated + */ + public WorkloadEditor() { + super(); + initializeEditingDomain(); + } + + /** + * This sets up the editing domain for the model editor. + * + * + * @generated + */ + protected void initializeEditingDomain() { + // Create an adapter factory that yields item providers. + // + adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + + adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new WorkloadItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); + + // Create the command stack that will notify this editor as commands are executed. + // + BasicCommandStack commandStack = new BasicCommandStack(); + + // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. + // + commandStack.addCommandStackListener(new CommandStackListener() { + public void commandStackChanged(final EventObject event) { + getContainer().getDisplay().asyncExec(new Runnable() { + public void run() { + firePropertyChange(IEditorPart.PROP_DIRTY); + + // Try to select the affected objects. + // + Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand(); + if (mostRecentCommand != null) { + setSelectionToViewer(mostRecentCommand.getAffectedObjects()); + } + for (Iterator i = propertySheetPages.iterator(); i.hasNext();) { + PropertySheetPage propertySheetPage = i.next(); + if (propertySheetPage.getControl() == null || propertySheetPage.getControl().isDisposed()) { + i.remove(); + } else { + propertySheetPage.refresh(); + } + } + } + }); + } + }); + + // Create the editing domain with a special command stack. + // + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap()); + } + + /** + * This is here for the listener to be able to call it. + * + * + * @generated + */ + @Override + protected void firePropertyChange(int action) { + super.firePropertyChange(action); + } + + /** + * This sets the selection into whichever viewer is active. + * + * + * @generated + */ + public void setSelectionToViewer(Collection collection) { + final Collection theSelection = collection; + // Make sure it's okay. + // + if (theSelection != null && !theSelection.isEmpty()) { + Runnable runnable = new Runnable() { + public void run() { + // Try to select the items in the current content viewer of the editor. + // + if (currentViewer != null) { + currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); + } + } + }; + getSite().getShell().getDisplay().asyncExec(runnable); + } + } + + /** + * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. + * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} + * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. + * + * + * @generated + */ + public EditingDomain getEditingDomain() { + return editingDomain; + } + + /** + * + * + * @generated + */ + public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { + /** + * + * + * @generated + */ + public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * + * + * @generated + */ + @Override + public Object[] getElements(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * @generated + */ + @Override + public Object[] getChildren(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * @generated + */ + @Override + public boolean hasChildren(Object object) { + Object parent = super.getParent(object); + return parent != null; + } + + /** + * + * + * @generated + */ + @Override + public Object getParent(Object object) { + return null; + } + } + + /** + * + * + * @generated + */ + public void setCurrentViewerPane(ViewerPane viewerPane) { + if (currentViewerPane != viewerPane) { + if (currentViewerPane != null) { + currentViewerPane.showFocus(false); + } + currentViewerPane = viewerPane; + } + setCurrentViewer(currentViewerPane.getViewer()); + } + + /** + * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, + * is the current one. + * + * + * @generated + */ + public void setCurrentViewer(Viewer viewer) { + // If it is changing... + // + if (currentViewer != viewer) { + if (selectionChangedListener == null) { + // Create the listener on demand. + // + selectionChangedListener = new ISelectionChangedListener() { + // This just notifies those things that are affected by the section. + // + public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { + setSelection(selectionChangedEvent.getSelection()); + } + }; + } + + // Stop listening to the old one. + // + if (currentViewer != null) { + currentViewer.removeSelectionChangedListener(selectionChangedListener); + } + + // Start listening to the new one. + // + if (viewer != null) { + viewer.addSelectionChangedListener(selectionChangedListener); + } + + // Remember it. + // + currentViewer = viewer; + + // Set the editors selection based on the current viewer's selection. + // + setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); + } + } + + /** + * This returns the viewer as required by the {@link IViewerProvider} interface. + * + * + * @generated + */ + public Viewer getViewer() { + return currentViewer; + } + + /** + * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. + * + * + * @generated + */ + protected void createContextMenuFor(StructuredViewer viewer) { + MenuManager contextMenu = new MenuManager("#PopUp"); + contextMenu.add(new Separator("additions")); + contextMenu.setRemoveAllWhenShown(true); + contextMenu.addMenuListener(this); + Menu menu = contextMenu.createContextMenu(viewer.getControl()); + viewer.getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); + + int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), + FileTransfer.getInstance() }; + viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); + viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); + } + + /** + * This is the method called to load a resource into the editing domain's resource set based on the editor's input. + * + * + * @generated + */ + public void createModel() { + URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter()); + Exception exception = null; + Resource resource = null; + try { + // Load the resource through the editing domain. + // + resource = editingDomain.getResourceSet().getResource(resourceURI, true); + } catch (Exception e) { + exception = e; + resource = editingDomain.getResourceSet().getResource(resourceURI, false); + } + + Diagnostic diagnostic = analyzeResourceProblems(resource, exception); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); + } + + /** + * Returns a diagnostic describing the errors and warnings listed in the resource + * and the specified exception (if any). + * + * + * @generated + */ + public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { + boolean hasErrors = !resource.getErrors().isEmpty(); + if (hasErrors || !resource.getWarnings().isEmpty()) { + BasicDiagnostic basicDiagnostic = new BasicDiagnostic(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, + "workload.emf.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), + new Object[] { exception == null ? (Object) resource : exception }); + basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); + return basicDiagnostic; + } else if (exception != null) { + return new BasicDiagnostic(Diagnostic.ERROR, "workload.emf.editor", 0, + getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception }); + } else { + return Diagnostic.OK_INSTANCE; + } + } + + /** + * This is the method used by the framework to install your own controls. + * + * + * @generated + */ + @Override + public void createPages() { + // Creates the model from the editor input + // + createModel(); + + // Only creates the other pages if there is something that can be edited + // + if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { + // Create a page for the selection tree view. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), WorkloadEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + selectionViewer = (TreeViewer) viewerPane.getViewer(); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection( + new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + viewerPane.setTitle(editingDomain.getResourceSet()); + + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); + + createContextMenuFor(selectionViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); + } + + // Create a page for the parent tree view. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), WorkloadEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + parentViewer = (TreeViewer) viewerPane.getViewer(); + parentViewer.setAutoExpandLevel(30); + parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); + parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(parentViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ParentPage_label")); + } + + // This is the page for the list viewer + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), WorkloadEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new ListViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + listViewer = (ListViewer) viewerPane.getViewer(); + listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(listViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ListPage_label")); + } + + // This is the page for the tree viewer + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), WorkloadEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + treeViewer = (TreeViewer) viewerPane.getViewer(); + treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + + createContextMenuFor(treeViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreePage_label")); + } + + // This is the page for the table viewer. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), WorkloadEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TableViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + tableViewer = (TableViewer) viewerPane.getViewer(); + + Table table = tableViewer.getTable(); + TableLayout layout = new TableLayout(); + table.setLayout(layout); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + TableColumn objectColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(3, 100, true)); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + + TableColumn selfColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(2, 100, true)); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + + tableViewer.setColumnProperties(new String[] { "a", "b" }); + tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(tableViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TablePage_label")); + } + + // This is the page for the table tree viewer. + // + { + ViewerPane viewerPane = new ViewerPane(getSite().getPage(), WorkloadEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + treeViewerWithColumns = (TreeViewer) viewerPane.getViewer(); + + Tree tree = treeViewerWithColumns.getTree(); + tree.setLayoutData(new FillLayout()); + tree.setHeaderVisible(true); + tree.setLinesVisible(true); + + TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + objectColumn.setWidth(250); + + TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + selfColumn.setWidth(200); + + treeViewerWithColumns.setColumnProperties(new String[] { "a", "b" }); + treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(treeViewerWithColumns); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); + } + + getSite().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + if (!getContainer().isDisposed()) { + setActivePage(0); + } + } + }); + } + + // Ensures that this editor will only display the page's tab + // area if there are more than one page + // + getContainer().addControlListener(new ControlAdapter() { + boolean guard = false; + + @Override + public void controlResized(ControlEvent event) { + if (!guard) { + guard = true; + hideTabs(); + guard = false; + } + } + }); + + getSite().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + updateProblemIndication(); + } + }); + } + + /** + * If there is just one page in the multi-page editor part, + * this hides the single tab at the bottom. + * + * + * @generated + */ + protected void hideTabs() { + if (getPageCount() <= 1) { + setPageText(0, ""); + if (getContainer() instanceof CTabFolder) { + Point point = getContainer().getSize(); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); + } + } + } + + /** + * If there is more than one page in the multi-page editor part, + * this shows the tabs at the bottom. + * + * + * @generated + */ + protected void showTabs() { + if (getPageCount() > 1) { + setPageText(0, getString("_UI_SelectionPage_label")); + if (getContainer() instanceof CTabFolder) { + Point point = getContainer().getSize(); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); + } + } + } + + /** + * This is used to track the active viewer. + * + * + * @generated + */ + @Override + protected void pageChange(int pageIndex) { + super.pageChange(pageIndex); + + if (contentOutlinePage != null) { + handleContentOutlineSelection(contentOutlinePage.getSelection()); + } + } + + /** + * This is how the framework determines which interfaces we implement. + * + * + * @generated + */ + @Override + public T getAdapter(Class key) { + if (key.equals(IContentOutlinePage.class)) { + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; + } else if (key.equals(IPropertySheetPage.class)) { + return key.cast(getPropertySheetPage()); + } else if (key.equals(IGotoMarker.class)) { + return key.cast(this); + } else { + return super.getAdapter(key); + } + } + + /** + * This accesses a cached version of the content outliner. + * + * + * @generated + */ + public IContentOutlinePage getContentOutlinePage() { + if (contentOutlinePage == null) { + // The content outline is just a tree. + // + class MyContentOutlinePage extends ContentOutlinePage { + @Override + public void createControl(Composite parent) { + super.createControl(parent); + contentOutlineViewer = getTreeViewer(); + contentOutlineViewer.addSelectionChangedListener(this); + + // Set up the tree viewer. + // + contentOutlineViewer.setUseHashlookup(true); + contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + contentOutlineViewer.setInput(editingDomain.getResourceSet()); + + // Make sure our popups work. + // + createContextMenuFor(contentOutlineViewer); + + if (!editingDomain.getResourceSet().getResources().isEmpty()) { + // Select the root object in the view. + // + contentOutlineViewer.setSelection( + new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + } + } + + @Override + public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, + IStatusLineManager statusLineManager) { + super.makeContributions(menuManager, toolBarManager, statusLineManager); + contentOutlineStatusLineManager = statusLineManager; + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + } + + contentOutlinePage = new MyContentOutlinePage(); + + // Listen to selection so that we can handle it is a special way. + // + contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() { + // This ensures that we handle selections correctly. + // + public void selectionChanged(SelectionChangedEvent event) { + handleContentOutlineSelection(event.getSelection()); + } + }); + } + + return contentOutlinePage; + } + + /** + * This accesses a cached version of the property sheet. + * + * + * @generated + */ + public IPropertySheetPage getPropertySheetPage() { + PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage(editingDomain, + ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { + @Override + public void setSelectionToViewer(List selection) { + WorkloadEditor.this.setSelectionToViewer(selection); + WorkloadEditor.this.setFocus(); + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + propertySheetPages.add(propertySheetPage); + + return propertySheetPage; + } + + /** + * This deals with how we want selection in the outliner to affect the other views. + * + * + * @generated + */ + public void handleContentOutlineSelection(ISelection selection) { + if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + Iterator selectedElements = ((IStructuredSelection) selection).iterator(); + if (selectedElements.hasNext()) { + // Get the first selected element. + // + Object selectedElement = selectedElements.next(); + + // If it's the selection viewer, then we want it to select the same selection as this selection. + // + if (currentViewerPane.getViewer() == selectionViewer) { + ArrayList selectionList = new ArrayList(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); + } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); + } else { + // Set the input to the widget. + // + if (currentViewerPane.getViewer().getInput() != selectedElement) { + currentViewerPane.getViewer().setInput(selectedElement); + currentViewerPane.setTitle(selectedElement); + } + } + } + } + } + + /** + * This is for implementing {@link IEditorPart} and simply tests the command stack. + * + * + * @generated + */ + @Override + public boolean isDirty() { + return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded(); + } + + /** + * This is for implementing {@link IEditorPart} and simply saves the model file. + * + * + * @generated + */ + @Override + public void doSave(IProgressMonitor progressMonitor) { + // Save only resources that have actually changed. + // + final Map saveOptions = new HashMap(); + saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); + saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); + + // Do the work within an operation because this is a long running activity that modifies the workbench. + // + WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { + // This is the method that gets invoked when the operation runs. + // + @Override + public void execute(IProgressMonitor monitor) { + // Save the resources to the file system. + // + boolean first = true; + List resources = editingDomain.getResourceSet().getResources(); + for (int i = 0; i < resources.size(); ++i) { + Resource resource = resources.get(i); + if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) + && !editingDomain.isReadOnly(resource)) { + try { + long timeStamp = resource.getTimeStamp(); + resource.save(saveOptions); + if (resource.getTimeStamp() != timeStamp) { + savedResources.add(resource); + } + } catch (Exception exception) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + first = false; + } + } + } + }; + + updateProblemIndication = false; + try { + // This runs the options, and shows progress. + // + new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); + + // Refresh the necessary state. + // + ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone(); + firePropertyChange(IEditorPart.PROP_DIRTY); + } catch (Exception exception) { + // Something went wrong that shouldn't. + // + WorkloadEditorPlugin.INSTANCE.log(exception); + } + updateProblemIndication = true; + updateProblemIndication(); + } + + /** + * This returns whether something has been persisted to the URI of the specified resource. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * + * + * @generated + */ + protected boolean isPersisted(Resource resource) { + boolean result = false; + try { + InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); + if (stream != null) { + result = true; + stream.close(); + } + } catch (IOException e) { + // Ignore + } + return result; + } + + /** + * This always returns true because it is not currently supported. + * + * + * @generated + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * This also changes the editor's input. + * + * + * @generated + */ + @Override + public void doSaveAs() { + SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); + saveAsDialog.open(); + IPath path = saveAsDialog.getResult(); + if (path != null) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + if (file != null) { + doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); + } + } + } + + /** + * + * + * @generated + */ + protected void doSaveAs(URI uri, IEditorInput editorInput) { + (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null + ? getActionBars().getStatusLineManager().getProgressMonitor() + : new NullProgressMonitor(); + doSave(progressMonitor); + } + + /** + * + * + * @generated + */ + public void gotoMarker(IMarker marker) { + List targetObjects = markerHelper.getTargetObjects(editingDomain, marker); + if (!targetObjects.isEmpty()) { + setSelectionToViewer(targetObjects); + } + } + + /** + * This is called during startup. + * + * + * @generated + */ + @Override + public void init(IEditorSite site, IEditorInput editorInput) { + setSite(site); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + site.setSelectionProvider(this); + site.getPage().addPartListener(partListener); + ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, + IResourceChangeEvent.POST_CHANGE); + } + + /** + * + * + * @generated + */ + @Override + public void setFocus() { + if (currentViewerPane != null) { + currentViewerPane.setFocus(); + } else { + getControl(getActivePage()).setFocus(); + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * @generated + */ + public void addSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.add(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * @generated + */ + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.remove(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. + * + * + * @generated + */ + public ISelection getSelection() { + return editorSelection; + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. + * Calling this result will notify the listeners. + * + * + * @generated + */ + public void setSelection(ISelection selection) { + editorSelection = selection; + + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + setStatusLineManager(selection); + } + + /** + * + * + * @generated + */ + public void setStatusLineManager(ISelection selection) { + IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer + ? contentOutlineStatusLineManager + : getActionBars().getStatusLineManager(); + + if (statusLineManager != null) { + if (selection instanceof IStructuredSelection) { + Collection collection = ((IStructuredSelection) selection).toList(); + switch (collection.size()) { + case 0: { + statusLineManager.setMessage(getString("_UI_NoObjectSelected")); + break; + } + case 1: { + String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); + statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); + break; + } + default: { + statusLineManager + .setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); + break; + } + } + } else { + statusLineManager.setMessage(""); + } + } + } + + /** + * This looks up a string in the plugin's plugin.properties file. + * + * + * @generated + */ + private static String getString(String key) { + return WorkloadEditorPlugin.INSTANCE.getString(key); + } + + /** + * This looks up a string in plugin.properties, making a substitution. + * + * + * @generated + */ + private static String getString(String key, Object s1) { + return WorkloadEditorPlugin.INSTANCE.getString(key, new Object[] { s1 }); + } + + /** + * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. + * + * + * @generated + */ + public void menuAboutToShow(IMenuManager menuManager) { + ((IMenuListener) getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); + } + + /** + * + * + * @generated + */ + public EditingDomainActionBarContributor getActionBarContributor() { + return (EditingDomainActionBarContributor) getEditorSite().getActionBarContributor(); + } + + /** + * + * + * @generated + */ + public IActionBars getActionBars() { + return getActionBarContributor().getActionBars(); + } + + /** + * + * + * @generated + */ + public AdapterFactory getAdapterFactory() { + return adapterFactory; + } + + /** + * + * + * @generated + */ + @Override + public void dispose() { + updateProblemIndication = false; + + ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); + + getSite().getPage().removePartListener(partListener); + + adapterFactory.dispose(); + + if (getActionBarContributor().getActiveEditor() == this) { + getActionBarContributor().setActiveEditor(null); + } + + for (PropertySheetPage propertySheetPage : propertySheetPages) { + propertySheetPage.dispose(); + } + + if (contentOutlinePage != null) { + contentOutlinePage.dispose(); + } + + super.dispose(); + } + + /** + * Returns whether the outline view should be presented to the user. + * + * + * @generated + */ + protected boolean showOutlineView() { + return true; + } +} diff --git a/workload.emf.editor/src/workload/presentation/WorkloadEditorPlugin.java b/workload.emf.editor/src/workload/presentation/WorkloadEditorPlugin.java new file mode 100644 index 0000000..315c81b --- /dev/null +++ b/workload.emf.editor/src/workload/presentation/WorkloadEditorPlugin.java @@ -0,0 +1,89 @@ +/** + */ +package workload.presentation; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.ui.EclipseUIPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Workload editor plugin. + * + * + * @generated + */ +public final class WorkloadEditorPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final WorkloadEditorPlugin INSTANCE = new WorkloadEditorPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public WorkloadEditorPlugin() { + super(new ResourceLocator[] {}); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * @generated + */ + public static class Implementation extends EclipseUIPlugin { + /** + * Creates an instance. + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/workload.emf.editor/src/workload/presentation/WorkloadModelWizard.java b/workload.emf.editor/src/workload/presentation/WorkloadModelWizard.java new file mode 100644 index 0000000..f8b64f4 --- /dev/null +++ b/workload.emf.editor/src/workload/presentation/WorkloadModelWizard.java @@ -0,0 +1,624 @@ +/** + */ +package workload.presentation; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.StringTokenizer; + +import org.eclipse.emf.common.CommonPlugin; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.ecore.xmi.XMLResource; + +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; + +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.jface.dialogs.MessageDialog; + +import org.eclipse.jface.viewers.IStructuredSelection; + +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.ModifyEvent; + +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; + +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +import org.eclipse.ui.actions.WorkspaceModifyOperation; + +import org.eclipse.ui.dialogs.WizardNewFileCreationPage; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; + +import workload.WorkloadFactory; +import workload.WorkloadPackage; +import workload.provider.WorkloadEditPlugin; + +import org.eclipse.core.runtime.Path; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; + +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; + +/** + * This is a simple wizard for creating a new model file. + * + * + * @generated + */ +public class WorkloadModelWizard extends Wizard implements INewWizard { + /** + * The supported extensions for created files. + * + * + * @generated + */ + public static final List FILE_EXTENSIONS = Collections.unmodifiableList(Arrays.asList( + WorkloadEditorPlugin.INSTANCE.getString("_UI_WorkloadEditorFilenameExtensions").split("\\s*,\\s*"))); + + /** + * A formatted list of supported file extensions, suitable for display. + * + * + * @generated + */ + public static final String FORMATTED_FILE_EXTENSIONS = WorkloadEditorPlugin.INSTANCE + .getString("_UI_WorkloadEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); + + /** + * This caches an instance of the model package. + * + * + * @generated + */ + protected WorkloadPackage workloadPackage = WorkloadPackage.eINSTANCE; + + /** + * This caches an instance of the model factory. + * + * + * @generated + */ + protected WorkloadFactory workloadFactory = workloadPackage.getWorkloadFactory(); + + /** + * This is the file creation page. + * + * + * @generated + */ + protected WorkloadModelWizardNewFileCreationPage newFileCreationPage; + + /** + * This is the initial object creation page. + * + * + * @generated + */ + protected WorkloadModelWizardInitialObjectCreationPage initialObjectCreationPage; + + /** + * Remember the selection during initialization for populating the default container. + * + * + * @generated + */ + protected IStructuredSelection selection; + + /** + * Remember the workbench during initialization. + * + * + * @generated + */ + protected IWorkbench workbench; + + /** + * Caches the names of the types that can be created as the root object. + * + * + * @generated + */ + protected List initialObjectNames; + + /** + * This just records the information. + * + * + * @generated + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + setWindowTitle(WorkloadEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); + setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE + .getImageDescriptor(WorkloadEditorPlugin.INSTANCE.getImage("full/wizban/NewWorkload"))); + } + + /** + * Returns the names of the types that can be created as the root object. + * + * + * @generated + */ + protected Collection getInitialObjectNames() { + if (initialObjectNames == null) { + initialObjectNames = new ArrayList(); + for (EClassifier eClassifier : workloadPackage.getEClassifiers()) { + if (eClassifier instanceof EClass) { + EClass eClass = (EClass) eClassifier; + if (!eClass.isAbstract()) { + initialObjectNames.add(eClass.getName()); + } + } + } + Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); + } + return initialObjectNames; + } + + /** + * Create a new model. + * + * + * @generated + */ + protected EObject createInitialModel() { + EClass eClass = (EClass) workloadPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); + EObject rootObject = workloadFactory.create(eClass); + return rootObject; + } + + /** + * Do the work after everything is specified. + * + * + * @generated + */ + @Override + public boolean performFinish() { + try { + // Remember the file. + // + final IFile modelFile = getModelFile(); + + // Do the work within an operation. + // + WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor progressMonitor) { + try { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI); + + // Add the initial model object to the contents. + // + EObject rootObject = createInitialModel(); + if (rootObject != null) { + resource.getContents().add(rootObject); + } + + // Save the contents of the resource to the file system. + // + Map options = new HashMap(); + options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); + resource.save(options); + } catch (Exception exception) { + WorkloadEditorPlugin.INSTANCE.log(exception); + } finally { + progressMonitor.done(); + } + } + }; + + getContainer().run(false, false, operation); + + // Select the new file resource in the current view. + // + IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + final IWorkbenchPart activePart = page.getActivePart(); + if (activePart instanceof ISetSelectionTarget) { + final ISelection targetSelection = new StructuredSelection(modelFile); + getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + ((ISetSelectionTarget) activePart).selectReveal(targetSelection); + } + }); + } + + // Open an editor on the new file. + // + try { + page.openEditor(new FileEditorInput(modelFile), + workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); + } catch (PartInitException exception) { + MessageDialog.openError(workbenchWindow.getShell(), + WorkloadEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); + return false; + } + + return true; + } catch (Exception exception) { + WorkloadEditorPlugin.INSTANCE.log(exception); + return false; + } + } + + /** + * This is the one page of the wizard. + * + * + * @generated + */ + public class WorkloadModelWizardNewFileCreationPage extends WizardNewFileCreationPage { + /** + * Pass in the selection. + * + * + * @generated + */ + public WorkloadModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { + super(pageId, selection); + } + + /** + * The framework calls this to see if the file is correct. + * + * + * @generated + */ + @Override + protected boolean validatePage() { + if (super.validatePage()) { + String extension = new Path(getFileName()).getFileExtension(); + if (extension == null || !FILE_EXTENSIONS.contains(extension)) { + String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; + setErrorMessage( + WorkloadEditorPlugin.INSTANCE.getString(key, new Object[] { FORMATTED_FILE_EXTENSIONS })); + return false; + } + return true; + } + return false; + } + + /** + * + * + * @generated + */ + public IFile getModelFile() { + return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); + } + } + + /** + * This is the page where the type of object to create is selected. + * + * + * @generated + */ + public class WorkloadModelWizardInitialObjectCreationPage extends WizardPage { + /** + * + * + * @generated + */ + protected Combo initialObjectField; + + /** + * @generated + * + * + */ + protected List encodings; + + /** + * + * + * @generated + */ + protected Combo encodingField; + + /** + * Pass in the selection. + * + * + * @generated + */ + public WorkloadModelWizardInitialObjectCreationPage(String pageId) { + super(pageId); + } + + /** + * + * + * @generated + */ + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + { + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.verticalSpacing = 12; + composite.setLayout(layout); + + GridData data = new GridData(); + data.verticalAlignment = GridData.FILL; + data.grabExcessVerticalSpace = true; + data.horizontalAlignment = GridData.FILL; + composite.setLayoutData(data); + } + + Label containerLabel = new Label(composite, SWT.LEFT); + { + containerLabel.setText(WorkloadEditorPlugin.INSTANCE.getString("_UI_ModelObject")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + containerLabel.setLayoutData(data); + } + + initialObjectField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + initialObjectField.setLayoutData(data); + } + + for (String objectName : getInitialObjectNames()) { + initialObjectField.add(getLabel(objectName)); + } + + if (initialObjectField.getItemCount() == 1) { + initialObjectField.select(0); + } + initialObjectField.addModifyListener(validator); + + Label encodingLabel = new Label(composite, SWT.LEFT); + { + encodingLabel.setText(WorkloadEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + encodingLabel.setLayoutData(data); + } + encodingField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + encodingField.setLayoutData(data); + } + + for (String encoding : getEncodings()) { + encodingField.add(encoding); + } + + encodingField.select(0); + encodingField.addModifyListener(validator); + + setPageComplete(validatePage()); + setControl(composite); + } + + /** + * + * + * @generated + */ + protected ModifyListener validator = new ModifyListener() { + public void modifyText(ModifyEvent e) { + setPageComplete(validatePage()); + } + }; + + /** + * + * + * @generated + */ + protected boolean validatePage() { + return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); + } + + /** + * + * + * @generated + */ + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + if (initialObjectField.getItemCount() == 1) { + initialObjectField.clearSelection(); + encodingField.setFocus(); + } else { + encodingField.clearSelection(); + initialObjectField.setFocus(); + } + } + } + + /** + * + * + * @generated + */ + public String getInitialObjectName() { + String label = initialObjectField.getText(); + + for (String name : getInitialObjectNames()) { + if (getLabel(name).equals(label)) { + return name; + } + } + return null; + } + + /** + * + * + * @generated + */ + public String getEncoding() { + return encodingField.getText(); + } + + /** + * Returns the label for the specified type name. + * + * + * @generated + */ + protected String getLabel(String typeName) { + try { + return WorkloadEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); + } catch (MissingResourceException mre) { + WorkloadEditorPlugin.INSTANCE.log(mre); + } + return typeName; + } + + /** + * + * + * @generated + */ + protected Collection getEncodings() { + if (encodings == null) { + encodings = new ArrayList(); + for (StringTokenizer stringTokenizer = new StringTokenizer( + WorkloadEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer + .hasMoreTokens();) { + encodings.add(stringTokenizer.nextToken()); + } + } + return encodings; + } + } + + /** + * The framework calls this to create the contents of the wizard. + * + * + * @generated + */ + @Override + public void addPages() { + // Create a page, set the title, and the initial model file name. + // + newFileCreationPage = new WorkloadModelWizardNewFileCreationPage("Whatever", selection); + newFileCreationPage.setTitle(WorkloadEditorPlugin.INSTANCE.getString("_UI_WorkloadModelWizard_label")); + newFileCreationPage + .setDescription(WorkloadEditorPlugin.INSTANCE.getString("_UI_WorkloadModelWizard_description")); + newFileCreationPage.setFileName(WorkloadEditorPlugin.INSTANCE.getString("_UI_WorkloadEditorFilenameDefaultBase") + + "." + FILE_EXTENSIONS.get(0)); + addPage(newFileCreationPage); + + // Try and get the resource selection to determine a current directory for the file dialog. + // + if (selection != null && !selection.isEmpty()) { + // Get the resource... + // + Object selectedElement = selection.iterator().next(); + if (selectedElement instanceof IResource) { + // Get the resource parent, if its a file. + // + IResource selectedResource = (IResource) selectedElement; + if (selectedResource.getType() == IResource.FILE) { + selectedResource = selectedResource.getParent(); + } + + // This gives us a directory... + // + if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { + // Set this for the container. + // + newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); + + // Make up a unique new name here. + // + String defaultModelBaseFilename = WorkloadEditorPlugin.INSTANCE + .getString("_UI_WorkloadEditorFilenameDefaultBase"); + String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); + String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; + for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) { + modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; + } + newFileCreationPage.setFileName(modelFilename); + } + } + } + initialObjectCreationPage = new WorkloadModelWizardInitialObjectCreationPage("Whatever2"); + initialObjectCreationPage.setTitle(WorkloadEditorPlugin.INSTANCE.getString("_UI_WorkloadModelWizard_label")); + initialObjectCreationPage + .setDescription(WorkloadEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); + addPage(initialObjectCreationPage); + } + + /** + * Get the file from the page. + * + * + * @generated + */ + public IFile getModelFile() { + return newFileCreationPage.getModelFile(); + } + +} diff --git a/workload.emf/.classpath b/workload.emf/.classpath new file mode 100644 index 0000000..099e24f --- /dev/null +++ b/workload.emf/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/workload.emf/.project b/workload.emf/.project new file mode 100644 index 0000000..20b34b2 --- /dev/null +++ b/workload.emf/.project @@ -0,0 +1,29 @@ + + + workload.emf + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.sirius.nature.modelingproject + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workload.emf/.settings/org.eclipse.core.resources.prefs b/workload.emf/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.emf/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.emf/META-INF/MANIFEST.MF b/workload.emf/META-INF/MANIFEST.MF new file mode 100644 index 0000000..721ee8f --- /dev/null +++ b/workload.emf/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: workload.emf;singleton:=true +Automatic-Module-Name: workload.emf +Bundle-Version: 0.1.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: workload, + workload.impl, + workload.util +Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport, + org.eclipse.core.runtime, + org.eclipse.ui;bundle-version="3.201.200", + org.eclipse.xtext;bundle-version="2.30.0", + workload.xtext_grammar;bundle-version="1.0.0", + workload.xtext_grammar.ui;bundle-version="1.0.0", + graphite;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy diff --git a/workload.emf/build.properties b/workload.emf/build.properties new file mode 100644 index 0000000..3f189f2 --- /dev/null +++ b/workload.emf/build.properties @@ -0,0 +1,11 @@ +# + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/,\ + src-gen/ +output.. = bin/ diff --git a/workload.emf/model/workload.aird b/workload.emf/model/workload.aird new file mode 100644 index 0000000..c44e452 --- /dev/null +++ b/workload.emf/model/workload.aird @@ -0,0 +1,735 @@ + + + + workload.ecore + workload.genmodel + workload.emf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + + diff --git a/workload.emf/model/workload.ecore b/workload.emf/model/workload.ecore new file mode 100644 index 0000000..09c51bc --- /dev/null +++ b/workload.emf/model/workload.ecore @@ -0,0 +1,36 @@ + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + diff --git a/workload.emf/model/workload.emf b/workload.emf/model/workload.emf new file mode 100644 index 0000000..8012aa2 --- /dev/null +++ b/workload.emf/model/workload.emf @@ -0,0 +1,32 @@ +@namespace(uri="ProjectWorkloadsDSL", prefix="workload") +package workload; + +class Project { + val Task[*] tasks; + val Person[*] people; +} + +class Task { + attr String name; + + @syntax(grammar="workload.xtext_grammar.Efforts", derive="efforts") + attr String effortsExpression; + val Effort[*] efforts; + + ref Person leader; + ref Task[*] dependencies; +} + +class Person { + attr String name; +} + +class Effort { + ref Person person; + attr int months; +} + +class CostCentre { + attr String name; + ref Effort[*] efforts; +} \ No newline at end of file diff --git a/workload.emf/model/workload.genmodel b/workload.emf/model/workload.genmodel new file mode 100644 index 0000000..60c48ca --- /dev/null +++ b/workload.emf/model/workload.genmodel @@ -0,0 +1,34 @@ + + + workload.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workload.emf/plugin.properties b/workload.emf/plugin.properties new file mode 100644 index 0000000..bbf3cc8 --- /dev/null +++ b/workload.emf/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = workload.emf +providerName = www.example.org diff --git a/workload.emf/plugin.xml b/workload.emf/plugin.xml new file mode 100644 index 0000000..b10b09a --- /dev/null +++ b/workload.emf/plugin.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + diff --git a/workload.emf/src-gen/workload/impl/PropertiesData.java b/workload.emf/src-gen/workload/impl/PropertiesData.java new file mode 100644 index 0000000..16efb00 --- /dev/null +++ b/workload.emf/src-gen/workload/impl/PropertiesData.java @@ -0,0 +1,69 @@ +package workload.impl; + +import java.util.Map; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.xtext.ISetup; + +import graphite.shared.DerivedPropertyData; + +import graphite.shared.ITransformationService; + +import workload.Effort; + +import workload.xtext_grammar.EffortsStandaloneSetup; +import workload.xtext_grammar.ui.internal.Xtext_grammarActivator; + +@SuppressWarnings("rawtypes") +public class PropertiesData { + + public static EFactory xtextFactory = workload.impl.WorkloadFactoryImpl.init(); + + public static class DerivedObjectClassContainer { + public final static Class TASK = XtextTaskImpl.class; + } + + public static class DerivedObjectName { + public final static String TASK__EFFORTS = "efforts"; + } + + public static class DerivedObjectType { + public final static Class TASK__EFFORTS = Effort.class; + } + + public static class DerivedObjectIsMany { + public final static boolean TASK__EFFORTS = true; + } + + public static class DerivedObjectTransformationService { + public final static ITransformationService TASK__EFFORTS = null; + } + + public static class ParsedStringName { + public final static String TASK__EFFORTS_EXPRESSION = "effortsExpression"; + } + + public static class GrammarName { + public final static String TASK__EFFORTS_EXPRESSION = "workload.xtext_grammar.Efforts"; + } + + public static class GrammarSetup { + public final static ISetup TASK__EFFORTS_EXPRESSION = new EffortsStandaloneSetup(); + } + + public static class GrammarPlugin { + public final static Plugin TASK__EFFORTS_EXPRESSION = Xtext_grammarActivator.getInstance(); + } + + public final static Map> derivedPropertiesData = Map.ofEntries( + Map.entry(DerivedObjectClassContainer.TASK, Map.ofEntries( + Map.entry(DerivedObjectName.TASK__EFFORTS, new DerivedPropertyData(DerivedObjectName.TASK__EFFORTS, ParsedStringName.TASK__EFFORTS_EXPRESSION, GrammarName.TASK__EFFORTS_EXPRESSION, GrammarSetup.TASK__EFFORTS_EXPRESSION, GrammarPlugin.TASK__EFFORTS_EXPRESSION, DerivedObjectClassContainer.TASK, DerivedObjectType.TASK__EFFORTS, DerivedObjectIsMany.TASK__EFFORTS, DerivedObjectTransformationService.TASK__EFFORTS))))); + + public final static Map> derivedPairsMappings = Map.ofEntries( + Map.entry(DerivedObjectClassContainer.TASK, Map.ofEntries( + Map.entry(ParsedStringName.TASK__EFFORTS_EXPRESSION, DerivedObjectName.TASK__EFFORTS)))); + + public final static Map identifierByType = Map.ofEntries(Map.entry(Effort.class, "person")); + +} \ No newline at end of file diff --git a/workload.emf/src-gen/workload/impl/WorkloadEditorStartup.java b/workload.emf/src-gen/workload/impl/WorkloadEditorStartup.java new file mode 100644 index 0000000..f90e6be --- /dev/null +++ b/workload.emf/src-gen/workload/impl/WorkloadEditorStartup.java @@ -0,0 +1,16 @@ +package workload.impl; + +import workload.WorkloadPackage; + +import org.eclipse.emf.ecore.EValidator; +import org.eclipse.ui.IStartup; + +import graphite.shared.CustomValidator; + +public class WorkloadEditorStartup implements IStartup { + + public void earlyStartup() { + EValidator.Registry.INSTANCE.put(WorkloadPackage.eINSTANCE, new CustomValidator()); + } + +} \ No newline at end of file diff --git a/workload.emf/src-gen/workload/impl/XtextTaskImpl.java b/workload.emf/src-gen/workload/impl/XtextTaskImpl.java new file mode 100644 index 0000000..0cbf30d --- /dev/null +++ b/workload.emf/src-gen/workload/impl/XtextTaskImpl.java @@ -0,0 +1,15 @@ +package workload.impl; + +import graphite.textual.XtextEObject; +import graphite.textual.DerivedObjectUtility; +import workload.impl.PropertiesData.DerivedObjectName; + +public class XtextTaskImpl extends TaskImpl implements XtextEObject { + + @Override + public void setEffortsExpression(String effortsExpression) { + super.setEffortsExpression(effortsExpression); + DerivedObjectUtility.setDeriveObject(derivedObjectsProperties.get(DerivedObjectName.TASK__EFFORTS), effortsExpression, getEfforts()); + } + +} //XtextTaskImpl \ No newline at end of file diff --git a/workload.emf/src-gen/workload/impl/XtextWorkloadFactoryImpl.java b/workload.emf/src-gen/workload/impl/XtextWorkloadFactoryImpl.java new file mode 100644 index 0000000..6bfef45 --- /dev/null +++ b/workload.emf/src-gen/workload/impl/XtextWorkloadFactoryImpl.java @@ -0,0 +1,22 @@ +package workload.impl; + +import graphite.shared.ModelData; +import graphite.shared.WorkbenchData; +import workload.WorkloadFactory; +import workload.Task; + +public class XtextWorkloadFactoryImpl extends WorkloadFactoryImpl { + + public static WorkloadFactory init() { + ModelData modelData = new ModelData(PropertiesData.xtextFactory, PropertiesData.derivedPropertiesData, PropertiesData.derivedPairsMappings, PropertiesData.identifierByType); + WorkbenchData.setModelData(modelData); + return new XtextWorkloadFactoryImpl(); + } + + @Override + public Task createTask() { + TaskImpl task = new XtextTaskImpl(); + return task; + } + +} //XtextWorkloadFactoryImpl \ No newline at end of file diff --git a/workload.emf/src/workload/CostCentre.java b/workload.emf/src/workload/CostCentre.java new file mode 100644 index 0000000..e762834 --- /dev/null +++ b/workload.emf/src/workload/CostCentre.java @@ -0,0 +1,61 @@ +/** + */ +package workload; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Cost Centre'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link workload.CostCentre#getName Name}
  • + *
  • {@link workload.CostCentre#getEfforts Efforts}
  • + *
+ * + * @see workload.WorkloadPackage#getCostCentre() + * @model + * @generated + */ +public interface CostCentre extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see workload.WorkloadPackage#getCostCentre_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link workload.CostCentre#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Efforts' reference list. + * The list contents are of type {@link workload.Effort}. + * + * + * @return the value of the 'Efforts' reference list. + * @see workload.WorkloadPackage#getCostCentre_Efforts() + * @model + * @generated + */ + EList getEfforts(); + +} // CostCentre diff --git a/workload.emf/src/workload/Effort.java b/workload.emf/src/workload/Effort.java new file mode 100644 index 0000000..b629888 --- /dev/null +++ b/workload.emf/src/workload/Effort.java @@ -0,0 +1,69 @@ +/** + */ +package workload; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Effort'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link workload.Effort#getPerson Person}
  • + *
  • {@link workload.Effort#getMonths Months}
  • + *
+ * + * @see workload.WorkloadPackage#getEffort() + * @model + * @generated + */ +public interface Effort extends EObject { + /** + * Returns the value of the 'Person' reference. + * + * + * @return the value of the 'Person' reference. + * @see #setPerson(Person) + * @see workload.WorkloadPackage#getEffort_Person() + * @model + * @generated + */ + Person getPerson(); + + /** + * Sets the value of the '{@link workload.Effort#getPerson Person}' reference. + * + * + * @param value the new value of the 'Person' reference. + * @see #getPerson() + * @generated + */ + void setPerson(Person value); + + /** + * Returns the value of the 'Months' attribute. + * + * + * @return the value of the 'Months' attribute. + * @see #setMonths(int) + * @see workload.WorkloadPackage#getEffort_Months() + * @model + * @generated + */ + int getMonths(); + + /** + * Sets the value of the '{@link workload.Effort#getMonths Months}' attribute. + * + * + * @param value the new value of the 'Months' attribute. + * @see #getMonths() + * @generated + */ + void setMonths(int value); + +} // Effort diff --git a/workload.emf/src/workload/Person.java b/workload.emf/src/workload/Person.java new file mode 100644 index 0000000..03ee644 --- /dev/null +++ b/workload.emf/src/workload/Person.java @@ -0,0 +1,46 @@ +/** + */ +package workload; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Person'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link workload.Person#getName Name}
  • + *
+ * + * @see workload.WorkloadPackage#getPerson() + * @model + * @generated + */ +public interface Person extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see workload.WorkloadPackage#getPerson_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link workload.Person#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // Person diff --git a/workload.emf/src/workload/Project.java b/workload.emf/src/workload/Project.java new file mode 100644 index 0000000..b6ad273 --- /dev/null +++ b/workload.emf/src/workload/Project.java @@ -0,0 +1,51 @@ +/** + */ +package workload; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Project'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link workload.Project#getTasks Tasks}
  • + *
  • {@link workload.Project#getPeople People}
  • + *
+ * + * @see workload.WorkloadPackage#getProject() + * @model + * @generated + */ +public interface Project extends EObject { + /** + * Returns the value of the 'Tasks' containment reference list. + * The list contents are of type {@link workload.Task}. + * + * + * @return the value of the 'Tasks' containment reference list. + * @see workload.WorkloadPackage#getProject_Tasks() + * @model containment="true" + * @generated + */ + EList getTasks(); + + /** + * Returns the value of the 'People' containment reference list. + * The list contents are of type {@link workload.Person}. + * + * + * @return the value of the 'People' containment reference list. + * @see workload.WorkloadPackage#getProject_People() + * @model containment="true" + * @generated + */ + EList getPeople(); + +} // Project diff --git a/workload.emf/src/workload/Task.java b/workload.emf/src/workload/Task.java new file mode 100644 index 0000000..8374181 --- /dev/null +++ b/workload.emf/src/workload/Task.java @@ -0,0 +1,120 @@ +/** + */ +package workload; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Task'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link workload.Task#getName Name}
  • + *
  • {@link workload.Task#getEffortsExpression Efforts Expression}
  • + *
  • {@link workload.Task#getEfforts Efforts}
  • + *
  • {@link workload.Task#getLeader Leader}
  • + *
  • {@link workload.Task#getDependencies Dependencies}
  • + *
+ * + * @see workload.WorkloadPackage#getTask() + * @model + * @generated + */ +public interface Task extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see workload.WorkloadPackage#getTask_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link workload.Task#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Efforts Expression' attribute. + * + * + * @return the value of the 'Efforts Expression' attribute. + * @see #setEffortsExpression(String) + * @see workload.WorkloadPackage#getTask_EffortsExpression() + * @model annotation="syntax grammar='workload.xtext_grammar.Efforts' derive='efforts'" + * @generated + */ + String getEffortsExpression(); + + /** + * Sets the value of the '{@link workload.Task#getEffortsExpression Efforts Expression}' attribute. + * + * + * @param value the new value of the 'Efforts Expression' attribute. + * @see #getEffortsExpression() + * @generated + */ + void setEffortsExpression(String value); + + /** + * Returns the value of the 'Efforts' containment reference list. + * The list contents are of type {@link workload.Effort}. + * + * + * @return the value of the 'Efforts' containment reference list. + * @see workload.WorkloadPackage#getTask_Efforts() + * @model containment="true" + * @generated + */ + EList getEfforts(); + + /** + * Returns the value of the 'Leader' reference. + * + * + * @return the value of the 'Leader' reference. + * @see #setLeader(Person) + * @see workload.WorkloadPackage#getTask_Leader() + * @model + * @generated + */ + Person getLeader(); + + /** + * Sets the value of the '{@link workload.Task#getLeader Leader}' reference. + * + * + * @param value the new value of the 'Leader' reference. + * @see #getLeader() + * @generated + */ + void setLeader(Person value); + + /** + * Returns the value of the 'Dependencies' reference list. + * The list contents are of type {@link workload.Task}. + * + * + * @return the value of the 'Dependencies' reference list. + * @see workload.WorkloadPackage#getTask_Dependencies() + * @model + * @generated + */ + EList getDependencies(); + +} // Task diff --git a/workload.emf/src/workload/WorkloadFactory.java b/workload.emf/src/workload/WorkloadFactory.java new file mode 100644 index 0000000..8a0ed43 --- /dev/null +++ b/workload.emf/src/workload/WorkloadFactory.java @@ -0,0 +1,78 @@ +/** + */ +package workload; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see workload.WorkloadPackage + * @generated + */ +public interface WorkloadFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated NOT + */ + WorkloadFactory eINSTANCE = workload.impl.XtextWorkloadFactoryImpl.init(); + + /** + * Returns a new object of class 'Project'. + * + * + * @return a new object of class 'Project'. + * @generated + */ + Project createProject(); + + /** + * Returns a new object of class 'Task'. + * + * + * @return a new object of class 'Task'. + * @generated + */ + Task createTask(); + + /** + * Returns a new object of class 'Person'. + * + * + * @return a new object of class 'Person'. + * @generated + */ + Person createPerson(); + + /** + * Returns a new object of class 'Effort'. + * + * + * @return a new object of class 'Effort'. + * @generated + */ + Effort createEffort(); + + /** + * Returns a new object of class 'Cost Centre'. + * + * + * @return a new object of class 'Cost Centre'. + * @generated + */ + CostCentre createCostCentre(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + WorkloadPackage getWorkloadPackage(); + +} //WorkloadFactory (Patched) \ No newline at end of file diff --git a/workload.emf/src/workload/WorkloadPackage.java b/workload.emf/src/workload/WorkloadPackage.java new file mode 100644 index 0000000..0aeb619 --- /dev/null +++ b/workload.emf/src/workload/WorkloadPackage.java @@ -0,0 +1,660 @@ +/** + */ +package workload; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see workload.WorkloadFactory + * @model kind="package" + * @generated + */ +public interface WorkloadPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "workload"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "ProjectWorkloadsDSL"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "workload"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + WorkloadPackage eINSTANCE = workload.impl.WorkloadPackageImpl.init(); + + /** + * The meta object id for the '{@link workload.impl.ProjectImpl Project}' class. + * + * + * @see workload.impl.ProjectImpl + * @see workload.impl.WorkloadPackageImpl#getProject() + * @generated + */ + int PROJECT = 0; + + /** + * The feature id for the 'Tasks' containment reference list. + * + * + * @generated + * @ordered + */ + int PROJECT__TASKS = 0; + + /** + * The feature id for the 'People' containment reference list. + * + * + * @generated + * @ordered + */ + int PROJECT__PEOPLE = 1; + + /** + * The number of structural features of the 'Project' class. + * + * + * @generated + * @ordered + */ + int PROJECT_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Project' class. + * + * + * @generated + * @ordered + */ + int PROJECT_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link workload.impl.TaskImpl Task}' class. + * + * + * @see workload.impl.TaskImpl + * @see workload.impl.WorkloadPackageImpl#getTask() + * @generated + */ + int TASK = 1; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int TASK__NAME = 0; + + /** + * The feature id for the 'Efforts Expression' attribute. + * + * + * @generated + * @ordered + */ + int TASK__EFFORTS_EXPRESSION = 1; + + /** + * The feature id for the 'Efforts' containment reference list. + * + * + * @generated + * @ordered + */ + int TASK__EFFORTS = 2; + + /** + * The feature id for the 'Leader' reference. + * + * + * @generated + * @ordered + */ + int TASK__LEADER = 3; + + /** + * The feature id for the 'Dependencies' reference list. + * + * + * @generated + * @ordered + */ + int TASK__DEPENDENCIES = 4; + + /** + * The number of structural features of the 'Task' class. + * + * + * @generated + * @ordered + */ + int TASK_FEATURE_COUNT = 5; + + /** + * The number of operations of the 'Task' class. + * + * + * @generated + * @ordered + */ + int TASK_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link workload.impl.PersonImpl Person}' class. + * + * + * @see workload.impl.PersonImpl + * @see workload.impl.WorkloadPackageImpl#getPerson() + * @generated + */ + int PERSON = 2; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int PERSON__NAME = 0; + + /** + * The number of structural features of the 'Person' class. + * + * + * @generated + * @ordered + */ + int PERSON_FEATURE_COUNT = 1; + + /** + * The number of operations of the 'Person' class. + * + * + * @generated + * @ordered + */ + int PERSON_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link workload.impl.EffortImpl Effort}' class. + * + * + * @see workload.impl.EffortImpl + * @see workload.impl.WorkloadPackageImpl#getEffort() + * @generated + */ + int EFFORT = 3; + + /** + * The feature id for the 'Person' reference. + * + * + * @generated + * @ordered + */ + int EFFORT__PERSON = 0; + + /** + * The feature id for the 'Months' attribute. + * + * + * @generated + * @ordered + */ + int EFFORT__MONTHS = 1; + + /** + * The number of structural features of the 'Effort' class. + * + * + * @generated + * @ordered + */ + int EFFORT_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Effort' class. + * + * + * @generated + * @ordered + */ + int EFFORT_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link workload.impl.CostCentreImpl Cost Centre}' class. + * + * + * @see workload.impl.CostCentreImpl + * @see workload.impl.WorkloadPackageImpl#getCostCentre() + * @generated + */ + int COST_CENTRE = 4; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int COST_CENTRE__NAME = 0; + + /** + * The feature id for the 'Efforts' reference list. + * + * + * @generated + * @ordered + */ + int COST_CENTRE__EFFORTS = 1; + + /** + * The number of structural features of the 'Cost Centre' class. + * + * + * @generated + * @ordered + */ + int COST_CENTRE_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Cost Centre' class. + * + * + * @generated + * @ordered + */ + int COST_CENTRE_OPERATION_COUNT = 0; + + /** + * Returns the meta object for class '{@link workload.Project Project}'. + * + * + * @return the meta object for class 'Project'. + * @see workload.Project + * @generated + */ + EClass getProject(); + + /** + * Returns the meta object for the containment reference list '{@link workload.Project#getTasks Tasks}'. + * + * + * @return the meta object for the containment reference list 'Tasks'. + * @see workload.Project#getTasks() + * @see #getProject() + * @generated + */ + EReference getProject_Tasks(); + + /** + * Returns the meta object for the containment reference list '{@link workload.Project#getPeople People}'. + * + * + * @return the meta object for the containment reference list 'People'. + * @see workload.Project#getPeople() + * @see #getProject() + * @generated + */ + EReference getProject_People(); + + /** + * Returns the meta object for class '{@link workload.Task Task}'. + * + * + * @return the meta object for class 'Task'. + * @see workload.Task + * @generated + */ + EClass getTask(); + + /** + * Returns the meta object for the attribute '{@link workload.Task#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see workload.Task#getName() + * @see #getTask() + * @generated + */ + EAttribute getTask_Name(); + + /** + * Returns the meta object for the attribute '{@link workload.Task#getEffortsExpression Efforts Expression}'. + * + * + * @return the meta object for the attribute 'Efforts Expression'. + * @see workload.Task#getEffortsExpression() + * @see #getTask() + * @generated + */ + EAttribute getTask_EffortsExpression(); + + /** + * Returns the meta object for the containment reference list '{@link workload.Task#getEfforts Efforts}'. + * + * + * @return the meta object for the containment reference list 'Efforts'. + * @see workload.Task#getEfforts() + * @see #getTask() + * @generated + */ + EReference getTask_Efforts(); + + /** + * Returns the meta object for the reference '{@link workload.Task#getLeader Leader}'. + * + * + * @return the meta object for the reference 'Leader'. + * @see workload.Task#getLeader() + * @see #getTask() + * @generated + */ + EReference getTask_Leader(); + + /** + * Returns the meta object for the reference list '{@link workload.Task#getDependencies Dependencies}'. + * + * + * @return the meta object for the reference list 'Dependencies'. + * @see workload.Task#getDependencies() + * @see #getTask() + * @generated + */ + EReference getTask_Dependencies(); + + /** + * Returns the meta object for class '{@link workload.Person Person}'. + * + * + * @return the meta object for class 'Person'. + * @see workload.Person + * @generated + */ + EClass getPerson(); + + /** + * Returns the meta object for the attribute '{@link workload.Person#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see workload.Person#getName() + * @see #getPerson() + * @generated + */ + EAttribute getPerson_Name(); + + /** + * Returns the meta object for class '{@link workload.Effort Effort}'. + * + * + * @return the meta object for class 'Effort'. + * @see workload.Effort + * @generated + */ + EClass getEffort(); + + /** + * Returns the meta object for the reference '{@link workload.Effort#getPerson Person}'. + * + * + * @return the meta object for the reference 'Person'. + * @see workload.Effort#getPerson() + * @see #getEffort() + * @generated + */ + EReference getEffort_Person(); + + /** + * Returns the meta object for the attribute '{@link workload.Effort#getMonths Months}'. + * + * + * @return the meta object for the attribute 'Months'. + * @see workload.Effort#getMonths() + * @see #getEffort() + * @generated + */ + EAttribute getEffort_Months(); + + /** + * Returns the meta object for class '{@link workload.CostCentre Cost Centre}'. + * + * + * @return the meta object for class 'Cost Centre'. + * @see workload.CostCentre + * @generated + */ + EClass getCostCentre(); + + /** + * Returns the meta object for the attribute '{@link workload.CostCentre#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see workload.CostCentre#getName() + * @see #getCostCentre() + * @generated + */ + EAttribute getCostCentre_Name(); + + /** + * Returns the meta object for the reference list '{@link workload.CostCentre#getEfforts Efforts}'. + * + * + * @return the meta object for the reference list 'Efforts'. + * @see workload.CostCentre#getEfforts() + * @see #getCostCentre() + * @generated + */ + EReference getCostCentre_Efforts(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + WorkloadFactory getWorkloadFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link workload.impl.ProjectImpl Project}' class. + * + * + * @see workload.impl.ProjectImpl + * @see workload.impl.WorkloadPackageImpl#getProject() + * @generated + */ + EClass PROJECT = eINSTANCE.getProject(); + + /** + * The meta object literal for the 'Tasks' containment reference list feature. + * + * + * @generated + */ + EReference PROJECT__TASKS = eINSTANCE.getProject_Tasks(); + + /** + * The meta object literal for the 'People' containment reference list feature. + * + * + * @generated + */ + EReference PROJECT__PEOPLE = eINSTANCE.getProject_People(); + + /** + * The meta object literal for the '{@link workload.impl.TaskImpl Task}' class. + * + * + * @see workload.impl.TaskImpl + * @see workload.impl.WorkloadPackageImpl#getTask() + * @generated + */ + EClass TASK = eINSTANCE.getTask(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute TASK__NAME = eINSTANCE.getTask_Name(); + + /** + * The meta object literal for the 'Efforts Expression' attribute feature. + * + * + * @generated + */ + EAttribute TASK__EFFORTS_EXPRESSION = eINSTANCE.getTask_EffortsExpression(); + + /** + * The meta object literal for the 'Efforts' containment reference list feature. + * + * + * @generated + */ + EReference TASK__EFFORTS = eINSTANCE.getTask_Efforts(); + + /** + * The meta object literal for the 'Leader' reference feature. + * + * + * @generated + */ + EReference TASK__LEADER = eINSTANCE.getTask_Leader(); + + /** + * The meta object literal for the 'Dependencies' reference list feature. + * + * + * @generated + */ + EReference TASK__DEPENDENCIES = eINSTANCE.getTask_Dependencies(); + + /** + * The meta object literal for the '{@link workload.impl.PersonImpl Person}' class. + * + * + * @see workload.impl.PersonImpl + * @see workload.impl.WorkloadPackageImpl#getPerson() + * @generated + */ + EClass PERSON = eINSTANCE.getPerson(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute PERSON__NAME = eINSTANCE.getPerson_Name(); + + /** + * The meta object literal for the '{@link workload.impl.EffortImpl Effort}' class. + * + * + * @see workload.impl.EffortImpl + * @see workload.impl.WorkloadPackageImpl#getEffort() + * @generated + */ + EClass EFFORT = eINSTANCE.getEffort(); + + /** + * The meta object literal for the 'Person' reference feature. + * + * + * @generated + */ + EReference EFFORT__PERSON = eINSTANCE.getEffort_Person(); + + /** + * The meta object literal for the 'Months' attribute feature. + * + * + * @generated + */ + EAttribute EFFORT__MONTHS = eINSTANCE.getEffort_Months(); + + /** + * The meta object literal for the '{@link workload.impl.CostCentreImpl Cost Centre}' class. + * + * + * @see workload.impl.CostCentreImpl + * @see workload.impl.WorkloadPackageImpl#getCostCentre() + * @generated + */ + EClass COST_CENTRE = eINSTANCE.getCostCentre(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute COST_CENTRE__NAME = eINSTANCE.getCostCentre_Name(); + + /** + * The meta object literal for the 'Efforts' reference list feature. + * + * + * @generated + */ + EReference COST_CENTRE__EFFORTS = eINSTANCE.getCostCentre_Efforts(); + + } + +} //WorkloadPackage diff --git a/workload.emf/src/workload/impl/CostCentreImpl.java b/workload.emf/src/workload/impl/CostCentreImpl.java new file mode 100644 index 0000000..941bc57 --- /dev/null +++ b/workload.emf/src/workload/impl/CostCentreImpl.java @@ -0,0 +1,207 @@ +/** + */ +package workload.impl; + +import graphite.shared.CustomEObjectImpl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; + +import workload.CostCentre; +import workload.Effort; +import workload.WorkloadPackage; + +/** + * + * An implementation of the model object 'Cost Centre'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link workload.impl.CostCentreImpl#getName Name}
  • + *
  • {@link workload.impl.CostCentreImpl#getEfforts Efforts}
  • + *
+ * + * @generated + */ +public class CostCentreImpl extends CustomEObjectImpl implements CostCentre { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getEfforts() Efforts}' reference list. + * + * + * @see #getEfforts() + * @generated + * @ordered + */ + protected EList efforts; + + /** + * + * + * @generated + */ + protected CostCentreImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return WorkloadPackage.Literals.COST_CENTRE; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, WorkloadPackage.COST_CENTRE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public EList getEfforts() { + if (efforts == null) { + efforts = new EObjectResolvingEList(Effort.class, this, WorkloadPackage.COST_CENTRE__EFFORTS); + } + return efforts; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case WorkloadPackage.COST_CENTRE__NAME: + return getName(); + case WorkloadPackage.COST_CENTRE__EFFORTS: + return getEfforts(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case WorkloadPackage.COST_CENTRE__NAME: + setName((String) newValue); + return; + case WorkloadPackage.COST_CENTRE__EFFORTS: + getEfforts().clear(); + getEfforts().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case WorkloadPackage.COST_CENTRE__NAME: + setName(NAME_EDEFAULT); + return; + case WorkloadPackage.COST_CENTRE__EFFORTS: + getEfforts().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case WorkloadPackage.COST_CENTRE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case WorkloadPackage.COST_CENTRE__EFFORTS: + return efforts != null && !efforts.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //CostCentreImpl diff --git a/workload.emf/src/workload/impl/EffortImpl.java b/workload.emf/src/workload/impl/EffortImpl.java new file mode 100644 index 0000000..0822f69 --- /dev/null +++ b/workload.emf/src/workload/impl/EffortImpl.java @@ -0,0 +1,229 @@ +/** + */ +package workload.impl; + +import graphite.shared.CustomEObjectImpl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import workload.Effort; +import workload.Person; +import workload.WorkloadPackage; + +/** + * + * An implementation of the model object 'Effort'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link workload.impl.EffortImpl#getPerson Person}
  • + *
  • {@link workload.impl.EffortImpl#getMonths Months}
  • + *
+ * + * @generated + */ +public class EffortImpl extends CustomEObjectImpl implements Effort { + /** + * The cached value of the '{@link #getPerson() Person}' reference. + * + * + * @see #getPerson() + * @generated + * @ordered + */ + protected Person person; + + /** + * The default value of the '{@link #getMonths() Months}' attribute. + * + * + * @see #getMonths() + * @generated + * @ordered + */ + protected static final int MONTHS_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getMonths() Months}' attribute. + * + * + * @see #getMonths() + * @generated + * @ordered + */ + protected int months = MONTHS_EDEFAULT; + + /** + * + * + * @generated + */ + protected EffortImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return WorkloadPackage.Literals.EFFORT; + } + + /** + * + * + * @generated + */ + public Person getPerson() { + if (person != null && person.eIsProxy()) { + InternalEObject oldPerson = (InternalEObject) person; + person = (Person) eResolveProxy(oldPerson); + if (person != oldPerson) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, WorkloadPackage.EFFORT__PERSON, oldPerson, + person)); + } + } + return person; + } + + /** + * + * + * @generated + */ + public Person basicGetPerson() { + return person; + } + + /** + * + * + * @generated + */ + public void setPerson(Person newPerson) { + Person oldPerson = person; + person = newPerson; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, WorkloadPackage.EFFORT__PERSON, oldPerson, person)); + } + + /** + * + * + * @generated + */ + public int getMonths() { + return months; + } + + /** + * + * + * @generated + */ + public void setMonths(int newMonths) { + int oldMonths = months; + months = newMonths; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, WorkloadPackage.EFFORT__MONTHS, oldMonths, months)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case WorkloadPackage.EFFORT__PERSON: + if (resolve) + return getPerson(); + return basicGetPerson(); + case WorkloadPackage.EFFORT__MONTHS: + return getMonths(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case WorkloadPackage.EFFORT__PERSON: + setPerson((Person) newValue); + return; + case WorkloadPackage.EFFORT__MONTHS: + setMonths((Integer) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case WorkloadPackage.EFFORT__PERSON: + setPerson((Person) null); + return; + case WorkloadPackage.EFFORT__MONTHS: + setMonths(MONTHS_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case WorkloadPackage.EFFORT__PERSON: + return person != null; + case WorkloadPackage.EFFORT__MONTHS: + return months != MONTHS_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (months: "); + result.append(months); + result.append(')'); + return result.toString(); + } + +} //EffortImpl diff --git a/workload.emf/src/workload/impl/PersonImpl.java b/workload.emf/src/workload/impl/PersonImpl.java new file mode 100644 index 0000000..10dd4bc --- /dev/null +++ b/workload.emf/src/workload/impl/PersonImpl.java @@ -0,0 +1,165 @@ +/** + */ +package workload.impl; + +import graphite.shared.CustomEObjectImpl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import workload.Person; +import workload.WorkloadPackage; + +/** + * + * An implementation of the model object 'Person'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link workload.impl.PersonImpl#getName Name}
  • + *
+ * + * @generated + */ +public class PersonImpl extends CustomEObjectImpl implements Person { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * + * + * @generated + */ + protected PersonImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return WorkloadPackage.Literals.PERSON; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, WorkloadPackage.PERSON__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case WorkloadPackage.PERSON__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case WorkloadPackage.PERSON__NAME: + setName((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case WorkloadPackage.PERSON__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case WorkloadPackage.PERSON__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //PersonImpl diff --git a/workload.emf/src/workload/impl/ProjectImpl.java b/workload.emf/src/workload/impl/ProjectImpl.java new file mode 100644 index 0000000..948b472 --- /dev/null +++ b/workload.emf/src/workload/impl/ProjectImpl.java @@ -0,0 +1,189 @@ +/** + */ +package workload.impl; + +import graphite.shared.CustomEObjectImpl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import workload.Person; +import workload.Project; +import workload.Task; +import workload.WorkloadPackage; + +/** + * + * An implementation of the model object 'Project'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link workload.impl.ProjectImpl#getTasks Tasks}
  • + *
  • {@link workload.impl.ProjectImpl#getPeople People}
  • + *
+ * + * @generated + */ +public class ProjectImpl extends CustomEObjectImpl implements Project { + /** + * The cached value of the '{@link #getTasks() Tasks}' containment reference list. + * + * + * @see #getTasks() + * @generated + * @ordered + */ + protected EList tasks; + + /** + * The cached value of the '{@link #getPeople() People}' containment reference list. + * + * + * @see #getPeople() + * @generated + * @ordered + */ + protected EList people; + + /** + * + * + * @generated + */ + protected ProjectImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return WorkloadPackage.Literals.PROJECT; + } + + /** + * + * + * @generated + */ + public EList getTasks() { + if (tasks == null) { + tasks = new EObjectContainmentEList(Task.class, this, WorkloadPackage.PROJECT__TASKS); + } + return tasks; + } + + /** + * + * + * @generated + */ + public EList getPeople() { + if (people == null) { + people = new EObjectContainmentEList(Person.class, this, WorkloadPackage.PROJECT__PEOPLE); + } + return people; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case WorkloadPackage.PROJECT__TASKS: + return ((InternalEList) getTasks()).basicRemove(otherEnd, msgs); + case WorkloadPackage.PROJECT__PEOPLE: + return ((InternalEList) getPeople()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case WorkloadPackage.PROJECT__TASKS: + return getTasks(); + case WorkloadPackage.PROJECT__PEOPLE: + return getPeople(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case WorkloadPackage.PROJECT__TASKS: + getTasks().clear(); + getTasks().addAll((Collection) newValue); + return; + case WorkloadPackage.PROJECT__PEOPLE: + getPeople().clear(); + getPeople().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case WorkloadPackage.PROJECT__TASKS: + getTasks().clear(); + return; + case WorkloadPackage.PROJECT__PEOPLE: + getPeople().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case WorkloadPackage.PROJECT__TASKS: + return tasks != null && !tasks.isEmpty(); + case WorkloadPackage.PROJECT__PEOPLE: + return people != null && !people.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ProjectImpl diff --git a/workload.emf/src/workload/impl/TaskImpl.java b/workload.emf/src/workload/impl/TaskImpl.java new file mode 100644 index 0000000..f956234 --- /dev/null +++ b/workload.emf/src/workload/impl/TaskImpl.java @@ -0,0 +1,378 @@ +/** + */ +package workload.impl; + +import graphite.shared.CustomEObjectImpl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import workload.Effort; +import workload.Person; +import workload.Task; +import workload.WorkloadPackage; + +/** + * + * An implementation of the model object 'Task'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link workload.impl.TaskImpl#getName Name}
  • + *
  • {@link workload.impl.TaskImpl#getEffortsExpression Efforts Expression}
  • + *
  • {@link workload.impl.TaskImpl#getEfforts Efforts}
  • + *
  • {@link workload.impl.TaskImpl#getLeader Leader}
  • + *
  • {@link workload.impl.TaskImpl#getDependencies Dependencies}
  • + *
+ * + * @generated + */ +public class TaskImpl extends CustomEObjectImpl implements Task { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #getEffortsExpression() Efforts Expression}' attribute. + * + * + * @see #getEffortsExpression() + * @generated + * @ordered + */ + protected static final String EFFORTS_EXPRESSION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getEffortsExpression() Efforts Expression}' attribute. + * + * + * @see #getEffortsExpression() + * @generated + * @ordered + */ + protected String effortsExpression = EFFORTS_EXPRESSION_EDEFAULT; + + /** + * The cached value of the '{@link #getEfforts() Efforts}' containment reference list. + * + * + * @see #getEfforts() + * @generated + * @ordered + */ + protected EList efforts; + + /** + * The cached value of the '{@link #getLeader() Leader}' reference. + * + * + * @see #getLeader() + * @generated + * @ordered + */ + protected Person leader; + + /** + * The cached value of the '{@link #getDependencies() Dependencies}' reference list. + * + * + * @see #getDependencies() + * @generated + * @ordered + */ + protected EList dependencies; + + /** + * + * + * @generated + */ + protected TaskImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return WorkloadPackage.Literals.TASK; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, WorkloadPackage.TASK__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public String getEffortsExpression() { + return effortsExpression; + } + + /** + * + * + * @generated + */ + public void setEffortsExpression(String newEffortsExpression) { + String oldEffortsExpression = effortsExpression; + effortsExpression = newEffortsExpression; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, WorkloadPackage.TASK__EFFORTS_EXPRESSION, + oldEffortsExpression, effortsExpression)); + } + + /** + * + * + * @generated + */ + public EList getEfforts() { + if (efforts == null) { + efforts = new EObjectContainmentEList(Effort.class, this, WorkloadPackage.TASK__EFFORTS); + } + return efforts; + } + + /** + * + * + * @generated + */ + public Person getLeader() { + if (leader != null && leader.eIsProxy()) { + InternalEObject oldLeader = (InternalEObject) leader; + leader = (Person) eResolveProxy(oldLeader); + if (leader != oldLeader) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, WorkloadPackage.TASK__LEADER, oldLeader, + leader)); + } + } + return leader; + } + + /** + * + * + * @generated + */ + public Person basicGetLeader() { + return leader; + } + + /** + * + * + * @generated + */ + public void setLeader(Person newLeader) { + Person oldLeader = leader; + leader = newLeader; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, WorkloadPackage.TASK__LEADER, oldLeader, leader)); + } + + /** + * + * + * @generated + */ + public EList getDependencies() { + if (dependencies == null) { + dependencies = new EObjectResolvingEList(Task.class, this, WorkloadPackage.TASK__DEPENDENCIES); + } + return dependencies; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case WorkloadPackage.TASK__EFFORTS: + return ((InternalEList) getEfforts()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case WorkloadPackage.TASK__NAME: + return getName(); + case WorkloadPackage.TASK__EFFORTS_EXPRESSION: + return getEffortsExpression(); + case WorkloadPackage.TASK__EFFORTS: + return getEfforts(); + case WorkloadPackage.TASK__LEADER: + if (resolve) + return getLeader(); + return basicGetLeader(); + case WorkloadPackage.TASK__DEPENDENCIES: + return getDependencies(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case WorkloadPackage.TASK__NAME: + setName((String) newValue); + return; + case WorkloadPackage.TASK__EFFORTS_EXPRESSION: + setEffortsExpression((String) newValue); + return; + case WorkloadPackage.TASK__EFFORTS: + getEfforts().clear(); + getEfforts().addAll((Collection) newValue); + return; + case WorkloadPackage.TASK__LEADER: + setLeader((Person) newValue); + return; + case WorkloadPackage.TASK__DEPENDENCIES: + getDependencies().clear(); + getDependencies().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case WorkloadPackage.TASK__NAME: + setName(NAME_EDEFAULT); + return; + case WorkloadPackage.TASK__EFFORTS_EXPRESSION: + setEffortsExpression(EFFORTS_EXPRESSION_EDEFAULT); + return; + case WorkloadPackage.TASK__EFFORTS: + getEfforts().clear(); + return; + case WorkloadPackage.TASK__LEADER: + setLeader((Person) null); + return; + case WorkloadPackage.TASK__DEPENDENCIES: + getDependencies().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case WorkloadPackage.TASK__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case WorkloadPackage.TASK__EFFORTS_EXPRESSION: + return EFFORTS_EXPRESSION_EDEFAULT == null ? effortsExpression != null + : !EFFORTS_EXPRESSION_EDEFAULT.equals(effortsExpression); + case WorkloadPackage.TASK__EFFORTS: + return efforts != null && !efforts.isEmpty(); + case WorkloadPackage.TASK__LEADER: + return leader != null; + case WorkloadPackage.TASK__DEPENDENCIES: + return dependencies != null && !dependencies.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(", effortsExpression: "); + result.append(effortsExpression); + result.append(')'); + return result.toString(); + } + +} //TaskImpl diff --git a/workload.emf/src/workload/impl/WorkloadFactoryImpl.java b/workload.emf/src/workload/impl/WorkloadFactoryImpl.java new file mode 100644 index 0000000..1fd14ac --- /dev/null +++ b/workload.emf/src/workload/impl/WorkloadFactoryImpl.java @@ -0,0 +1,144 @@ +/** + */ +package workload.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import workload.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class WorkloadFactoryImpl extends EFactoryImpl implements WorkloadFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static WorkloadFactory init() { + try { + WorkloadFactory theWorkloadFactory = (WorkloadFactory) EPackage.Registry.INSTANCE + .getEFactory(WorkloadPackage.eNS_URI); + if (theWorkloadFactory != null) { + return theWorkloadFactory; + } + } catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new WorkloadFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public WorkloadFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case WorkloadPackage.PROJECT: + return createProject(); + case WorkloadPackage.TASK: + return createTask(); + case WorkloadPackage.PERSON: + return createPerson(); + case WorkloadPackage.EFFORT: + return createEffort(); + case WorkloadPackage.COST_CENTRE: + return createCostCentre(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Project createProject() { + ProjectImpl project = new ProjectImpl(); + return project; + } + + /** + * + * + * @generated + */ + public Task createTask() { + TaskImpl task = new TaskImpl(); + return task; + } + + /** + * + * + * @generated + */ + public Person createPerson() { + PersonImpl person = new PersonImpl(); + return person; + } + + /** + * + * + * @generated + */ + public Effort createEffort() { + EffortImpl effort = new EffortImpl(); + return effort; + } + + /** + * + * + * @generated + */ + public CostCentre createCostCentre() { + CostCentreImpl costCentre = new CostCentreImpl(); + return costCentre; + } + + /** + * + * + * @generated + */ + public WorkloadPackage getWorkloadPackage() { + return (WorkloadPackage) getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static WorkloadPackage getPackage() { + return WorkloadPackage.eINSTANCE; + } + +} //WorkloadFactoryImpl diff --git a/workload.emf/src/workload/impl/WorkloadPackageImpl.java b/workload.emf/src/workload/impl/WorkloadPackageImpl.java new file mode 100644 index 0000000..1b106ec --- /dev/null +++ b/workload.emf/src/workload/impl/WorkloadPackageImpl.java @@ -0,0 +1,425 @@ +/** + */ +package workload.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import workload.CostCentre; +import workload.Effort; +import workload.Person; +import workload.Project; +import workload.Task; +import workload.WorkloadFactory; +import workload.WorkloadPackage; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class WorkloadPackageImpl extends EPackageImpl implements WorkloadPackage { + /** + * + * + * @generated + */ + private EClass projectEClass = null; + + /** + * + * + * @generated + */ + private EClass taskEClass = null; + + /** + * + * + * @generated + */ + private EClass personEClass = null; + + /** + * + * + * @generated + */ + private EClass effortEClass = null; + + /** + * + * + * @generated + */ + private EClass costCentreEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see workload.WorkloadPackage#eNS_URI + * @see #init() + * @generated + */ + private WorkloadPackageImpl() { + super(eNS_URI, WorkloadFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link WorkloadPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static WorkloadPackage init() { + if (isInited) + return (WorkloadPackage) EPackage.Registry.INSTANCE.getEPackage(WorkloadPackage.eNS_URI); + + // Obtain or create and register package + Object registeredWorkloadPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + WorkloadPackageImpl theWorkloadPackage = registeredWorkloadPackage instanceof WorkloadPackageImpl + ? (WorkloadPackageImpl) registeredWorkloadPackage + : new WorkloadPackageImpl(); + + isInited = true; + + // Create package meta-data objects + theWorkloadPackage.createPackageContents(); + + // Initialize created meta-data + theWorkloadPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theWorkloadPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(WorkloadPackage.eNS_URI, theWorkloadPackage); + return theWorkloadPackage; + } + + /** + * + * + * @generated + */ + public EClass getProject() { + return projectEClass; + } + + /** + * + * + * @generated + */ + public EReference getProject_Tasks() { + return (EReference) projectEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getProject_People() { + return (EReference) projectEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getTask() { + return taskEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getTask_Name() { + return (EAttribute) taskEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTask_EffortsExpression() { + return (EAttribute) taskEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getTask_Efforts() { + return (EReference) taskEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getTask_Leader() { + return (EReference) taskEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EReference getTask_Dependencies() { + return (EReference) taskEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EClass getPerson() { + return personEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getPerson_Name() { + return (EAttribute) personEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getEffort() { + return effortEClass; + } + + /** + * + * + * @generated + */ + public EReference getEffort_Person() { + return (EReference) effortEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getEffort_Months() { + return (EAttribute) effortEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getCostCentre() { + return costCentreEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getCostCentre_Name() { + return (EAttribute) costCentreEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getCostCentre_Efforts() { + return (EReference) costCentreEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public WorkloadFactory getWorkloadFactory() { + return (WorkloadFactory) getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) + return; + isCreated = true; + + // Create classes and their features + projectEClass = createEClass(PROJECT); + createEReference(projectEClass, PROJECT__TASKS); + createEReference(projectEClass, PROJECT__PEOPLE); + + taskEClass = createEClass(TASK); + createEAttribute(taskEClass, TASK__NAME); + createEAttribute(taskEClass, TASK__EFFORTS_EXPRESSION); + createEReference(taskEClass, TASK__EFFORTS); + createEReference(taskEClass, TASK__LEADER); + createEReference(taskEClass, TASK__DEPENDENCIES); + + personEClass = createEClass(PERSON); + createEAttribute(personEClass, PERSON__NAME); + + effortEClass = createEClass(EFFORT); + createEReference(effortEClass, EFFORT__PERSON); + createEAttribute(effortEClass, EFFORT__MONTHS); + + costCentreEClass = createEClass(COST_CENTRE); + createEAttribute(costCentreEClass, COST_CENTRE__NAME); + createEReference(costCentreEClass, COST_CENTRE__EFFORTS); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) + return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes, features, and operations; add parameters + initEClass(projectEClass, Project.class, "Project", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getProject_Tasks(), this.getTask(), null, "tasks", null, 0, -1, Project.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + initEReference(getProject_People(), this.getPerson(), null, "people", null, 0, -1, Project.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + + initEClass(taskEClass, Task.class, "Task", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTask_Name(), ecorePackage.getEString(), "name", null, 0, 1, Task.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTask_EffortsExpression(), ecorePackage.getEString(), "effortsExpression", null, 0, 1, + Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + initEReference(getTask_Efforts(), this.getEffort(), null, "efforts", null, 0, -1, Task.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + initEReference(getTask_Leader(), this.getPerson(), null, "leader", null, 0, 1, Task.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + initEReference(getTask_Dependencies(), this.getTask(), null, "dependencies", null, 0, -1, Task.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(personEClass, Person.class, "Person", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPerson_Name(), ecorePackage.getEString(), "name", null, 0, 1, Person.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(effortEClass, Effort.class, "Effort", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getEffort_Person(), this.getPerson(), null, "person", null, 0, 1, Effort.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + initEAttribute(getEffort_Months(), ecorePackage.getEInt(), "months", null, 0, 1, Effort.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(costCentreEClass, CostCentre.class, "CostCentre", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCostCentre_Name(), ecorePackage.getEString(), "name", null, 0, 1, CostCentre.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getCostCentre_Efforts(), this.getEffort(), null, "efforts", null, 0, -1, CostCentre.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // syntax + createSyntaxAnnotations(); + } + + /** + * Initializes the annotations for syntax. + * + * + * @generated + */ + protected void createSyntaxAnnotations() { + String source = "syntax"; + addAnnotation(getTask_EffortsExpression(), source, + new String[] { "grammar", "workload.xtext_grammar.Efforts", "derive", "efforts" }); + } + +} //WorkloadPackageImpl diff --git a/workload.emf/src/workload/util/WorkloadAdapterFactory.java b/workload.emf/src/workload/util/WorkloadAdapterFactory.java new file mode 100644 index 0000000..be8b25d --- /dev/null +++ b/workload.emf/src/workload/util/WorkloadAdapterFactory.java @@ -0,0 +1,195 @@ +/** + */ +package workload.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import workload.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see workload.WorkloadPackage + * @generated + */ +public class WorkloadAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static WorkloadPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public WorkloadAdapterFactory() { + if (modelPackage == null) { + modelPackage = WorkloadPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected WorkloadSwitch modelSwitch = new WorkloadSwitch() { + @Override + public Adapter caseProject(Project object) { + return createProjectAdapter(); + } + + @Override + public Adapter caseTask(Task object) { + return createTaskAdapter(); + } + + @Override + public Adapter casePerson(Person object) { + return createPersonAdapter(); + } + + @Override + public Adapter caseEffort(Effort object) { + return createEffortAdapter(); + } + + @Override + public Adapter caseCostCentre(CostCentre object) { + return createCostCentreAdapter(); + } + + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject) target); + } + + /** + * Creates a new adapter for an object of class '{@link workload.Project Project}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see workload.Project + * @generated + */ + public Adapter createProjectAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link workload.Task Task}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see workload.Task + * @generated + */ + public Adapter createTaskAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link workload.Person Person}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see workload.Person + * @generated + */ + public Adapter createPersonAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link workload.Effort Effort}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see workload.Effort + * @generated + */ + public Adapter createEffortAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link workload.CostCentre Cost Centre}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see workload.CostCentre + * @generated + */ + public Adapter createCostCentreAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //WorkloadAdapterFactory diff --git a/workload.emf/src/workload/util/WorkloadSwitch.java b/workload.emf/src/workload/util/WorkloadSwitch.java new file mode 100644 index 0000000..9c23d1b --- /dev/null +++ b/workload.emf/src/workload/util/WorkloadSwitch.java @@ -0,0 +1,200 @@ +/** + */ +package workload.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import workload.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see workload.WorkloadPackage + * @generated + */ +public class WorkloadSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static WorkloadPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public WorkloadSwitch() { + if (modelPackage == null) { + modelPackage = WorkloadPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case WorkloadPackage.PROJECT: { + Project project = (Project) theEObject; + T result = caseProject(project); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case WorkloadPackage.TASK: { + Task task = (Task) theEObject; + T result = caseTask(task); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case WorkloadPackage.PERSON: { + Person person = (Person) theEObject; + T result = casePerson(person); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case WorkloadPackage.EFFORT: { + Effort effort = (Effort) theEObject; + T result = caseEffort(effort); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case WorkloadPackage.COST_CENTRE: { + CostCentre costCentre = (CostCentre) theEObject; + T result = caseCostCentre(costCentre); + if (result == null) + result = defaultCase(theEObject); + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Project'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Project'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseProject(Project object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Task'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Task'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTask(Task object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Person'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Person'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePerson(Person object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Effort'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Effort'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEffort(Effort object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Cost Centre'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Cost Centre'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCostCentre(CostCentre object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //WorkloadSwitch diff --git a/workload.runtime/.project b/workload.runtime/.project new file mode 100644 index 0000000..0a406f8 --- /dev/null +++ b/workload.runtime/.project @@ -0,0 +1,18 @@ + + + workload.runtime + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + org.eclipse.sirius.nature.modelingproject + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/workload.runtime/.settings/org.eclipse.core.resources.prefs b/workload.runtime/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.runtime/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.runtime/model.workload b/workload.runtime/model.workload new file mode 100644 index 0000000..fc19e41 --- /dev/null +++ b/workload.runtime/model.workload @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/workload.runtime/representations.aird b/workload.runtime/representations.aird new file mode 100644 index 0000000..39d3f52 --- /dev/null +++ b/workload.runtime/representations.aird @@ -0,0 +1,279 @@ + + + + model.workload + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workload.sirius_design/.classpath b/workload.sirius_design/.classpath new file mode 100644 index 0000000..c3ba59e --- /dev/null +++ b/workload.sirius_design/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workload.sirius_design/.project b/workload.sirius_design/.project new file mode 100644 index 0000000..b2305b8 --- /dev/null +++ b/workload.sirius_design/.project @@ -0,0 +1,24 @@ + + + workload.sirius_design + + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.pde.ManifestBuilder + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/workload.sirius_design/.settings/org.eclipse.core.resources.prefs b/workload.sirius_design/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.sirius_design/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.sirius_design/.settings/org.eclipse.jdt.core.prefs b/workload.sirius_design/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7adc0fb --- /dev/null +++ b/workload.sirius_design/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/workload.sirius_design/META-INF/MANIFEST.MF b/workload.sirius_design/META-INF/MANIFEST.MF new file mode 100644 index 0000000..70f2fbf --- /dev/null +++ b/workload.sirius_design/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: workload.sirius_design;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: workload.sirius_design.Activator +Bundle-Localization: plugin +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.sirius, + org.eclipse.sirius.common.acceleo.aql, + graphite;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-Vendor: %providerName +Automatic-Module-Name: workload.sirius_design diff --git a/workload.sirius_design/build.properties b/workload.sirius_design/build.properties new file mode 100644 index 0000000..1ab7df2 --- /dev/null +++ b/workload.sirius_design/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + description/,\ + plugin.properties,\ + plugin.xml diff --git a/workload.sirius_design/description/workload.odesign b/workload.sirius_design/description/workload.odesign new file mode 100644 index 0000000..49f7c5f --- /dev/null +++ b/workload.sirius_design/description/workload.odesign @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workload.sirius_design/icons/person.png b/workload.sirius_design/icons/person.png new file mode 100644 index 0000000..b327d85 Binary files /dev/null and b/workload.sirius_design/icons/person.png differ diff --git a/workload.sirius_design/icons/task.png b/workload.sirius_design/icons/task.png new file mode 100644 index 0000000..8c0cc2b Binary files /dev/null and b/workload.sirius_design/icons/task.png differ diff --git a/workload.sirius_design/plugin.properties b/workload.sirius_design/plugin.properties new file mode 100644 index 0000000..f352b32 --- /dev/null +++ b/workload.sirius_design/plugin.properties @@ -0,0 +1,3 @@ +pluginName = workload.sirius_design +providerName = Eclipse Modeling Project +viewpointName = MyViewpoint diff --git a/workload.sirius_design/plugin.xml b/workload.sirius_design/plugin.xml new file mode 100644 index 0000000..9a39359 --- /dev/null +++ b/workload.sirius_design/plugin.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/workload.sirius_design/src/workload/sirius_design/Activator.java b/workload.sirius_design/src/workload/sirius_design/Activator.java new file mode 100644 index 0000000..e816797 --- /dev/null +++ b/workload.sirius_design/src/workload/sirius_design/Activator.java @@ -0,0 +1,66 @@ +package workload.sirius_design; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; +import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + // The plug-in ID + public static final String PLUGIN_ID = "workload.sirius_design"; + + // The shared instance + private static Activator plugin; + + private static Set viewpoints; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + viewpoints = new HashSet(); + viewpoints.addAll(ViewpointRegistry.getInstance().registerFromPlugin(PLUGIN_ID + "/description/workload.odesign")); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + if (viewpoints != null) { + for (final Viewpoint viewpoint: viewpoints) { + ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint); + } + viewpoints.clear(); + viewpoints = null; + } + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } +} diff --git a/workload.sirius_design/src/workload/sirius_design/Services.java b/workload.sirius_design/src/workload/sirius_design/Services.java new file mode 100644 index 0000000..600460c --- /dev/null +++ b/workload.sirius_design/src/workload/sirius_design/Services.java @@ -0,0 +1,19 @@ +package workload.sirius_design; + +import org.eclipse.emf.ecore.EObject; + +import graphite.graphical.SiriusServices; + +/** + * The services class used by VSM. + */ +public class Services extends SiriusServices { + + /** + * See http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Findex.html&cp=24 for documentation on how to write service methods. + */ + public EObject myService(EObject self, String arg) { + // TODO Auto-generated code + return self; + } +} diff --git a/workload.xtext_grammar.ide/.classpath b/workload.xtext_grammar.ide/.classpath new file mode 100644 index 0000000..a613544 --- /dev/null +++ b/workload.xtext_grammar.ide/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/workload.xtext_grammar.ide/.project b/workload.xtext_grammar.ide/.project new file mode 100644 index 0000000..4c2bcff --- /dev/null +++ b/workload.xtext_grammar.ide/.project @@ -0,0 +1,34 @@ + + + workload.xtext_grammar.ide + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.xtext.ui.shared.xtextNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workload.xtext_grammar.ide/.settings/org.eclipse.core.resources.prefs b/workload.xtext_grammar.ide/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.xtext_grammar.ide/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.xtext_grammar.ide/.settings/org.eclipse.jdt.core.prefs b/workload.xtext_grammar.ide/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7adc0fb --- /dev/null +++ b/workload.xtext_grammar.ide/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/workload.xtext_grammar.ide/META-INF/MANIFEST.MF b/workload.xtext_grammar.ide/META-INF/MANIFEST.MF new file mode 100644 index 0000000..19dab93 --- /dev/null +++ b/workload.xtext_grammar.ide/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Automatic-Module-Name: workload.xtext_grammar.ide +Bundle-ManifestVersion: 2 +Bundle-Name: workload.xtext_grammar.ide +Bundle-Vendor: My Company +Bundle-Version: 1.0.0.qualifier +Bundle-SymbolicName: workload.xtext_grammar.ide; singleton:=true +Bundle-ActivationPolicy: lazy +Require-Bundle: workload.xtext_grammar, + workload.emf, + org.eclipse.xtext.ide, + org.eclipse.xtext.xbase.ide, + org.antlr.runtime;bundle-version="[3.2.0,3.2.1)" +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: workload.xtext_grammar.ide.contentassist.antlr, + workload.xtext_grammar.ide.contentassist.antlr.internal diff --git a/workload.xtext_grammar.ide/build.properties b/workload.xtext_grammar.ide/build.properties new file mode 100644 index 0000000..5c6bbf9 --- /dev/null +++ b/workload.xtext_grammar.ide/build.properties @@ -0,0 +1,6 @@ +source.. = src/,\ + src-gen/,\ + xtend-gen/ +bin.includes = .,\ + META-INF/ +bin.excludes = **/*.xtend diff --git a/workload.xtext_grammar.ide/src-gen/META-INF/services/org.eclipse.xtext.ISetup b/workload.xtext_grammar.ide/src-gen/META-INF/services/org.eclipse.xtext.ISetup new file mode 100644 index 0000000..ff8bad1 --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/META-INF/services/org.eclipse.xtext.ISetup @@ -0,0 +1 @@ +workload.xtext_grammar.ide.EffortsIdeSetup diff --git a/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/AbstractEffortsIdeModule.java b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/AbstractEffortsIdeModule.java new file mode 100644 index 0000000..3e9d4ce --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/AbstractEffortsIdeModule.java @@ -0,0 +1,60 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ide; + +import com.google.inject.Binder; +import com.google.inject.name.Names; +import org.eclipse.xtext.ide.DefaultIdeModule; +import org.eclipse.xtext.ide.LexerIdeBindings; +import org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher; +import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher; +import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper; +import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper; +import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; +import org.eclipse.xtext.ide.refactoring.IRenameStrategy2; +import org.eclipse.xtext.ide.server.rename.IRenameService2; +import org.eclipse.xtext.ide.server.rename.RenameService2; +import workload.xtext_grammar.ide.contentassist.antlr.EffortsParser; +import workload.xtext_grammar.ide.contentassist.antlr.internal.InternalEffortsLexer; + +/** + * Manual modifications go to {@link EffortsIdeModule}. + */ +@SuppressWarnings("all") +public abstract class AbstractEffortsIdeModule extends DefaultIdeModule { + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureContentAssistLexer(Binder binder) { + binder.bind(Lexer.class) + .annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST)) + .to(InternalEffortsLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIContentAssistParser() { + return EffortsParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIProposalConflictHelper() { + return AntlrProposalConflictHelper.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 + public Class bindIPrefixMatcher() { + return FQNPrefixMatcher.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2 + public Class bindIRenameService2() { + return RenameService2.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2 + public Class bindIRenameStrategy2() { + return IRenameStrategy2.DefaultImpl.class; + } + +} diff --git a/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/EffortsParser.java b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/EffortsParser.java new file mode 100644 index 0000000..c54d8fe --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/EffortsParser.java @@ -0,0 +1,82 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ide.contentassist.antlr; + +import com.google.common.collect.ImmutableMap; +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.util.Map; +import org.eclipse.xtext.AbstractElement; +import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser; +import workload.xtext_grammar.ide.contentassist.antlr.internal.InternalEffortsParser; +import workload.xtext_grammar.services.EffortsGrammarAccess; + +public class EffortsParser extends AbstractContentAssistParser { + + @Singleton + public static final class NameMappings { + + private final Map mappings; + + @Inject + public NameMappings(EffortsGrammarAccess grammarAccess) { + ImmutableMap.Builder builder = ImmutableMap.builder(); + init(builder, grammarAccess); + this.mappings = builder.build(); + } + + public String getRuleName(AbstractElement element) { + return mappings.get(element); + } + + private static void init(ImmutableMap.Builder builder, EffortsGrammarAccess grammarAccess) { + builder.put(grammarAccess.getMainAccess().getGroup(), "rule__Main__Group__0"); + builder.put(grammarAccess.getMainAccess().getGroup_2(), "rule__Main__Group_2__0"); + builder.put(grammarAccess.getEffortAccess().getGroup(), "rule__Effort__Group__0"); + builder.put(grammarAccess.getMainAccess().getEffortsAssignment_1(), "rule__Main__EffortsAssignment_1"); + builder.put(grammarAccess.getMainAccess().getEffortsAssignment_2_1(), "rule__Main__EffortsAssignment_2_1"); + builder.put(grammarAccess.getEffortAccess().getPersonAssignment_1(), "rule__Effort__PersonAssignment_1"); + builder.put(grammarAccess.getEffortAccess().getMonthsAssignment_3(), "rule__Effort__MonthsAssignment_3"); + } + } + + @Inject + private NameMappings nameMappings; + + @Inject + private EffortsGrammarAccess grammarAccess; + + @Override + protected InternalEffortsParser createParser() { + InternalEffortsParser result = new InternalEffortsParser(null); + result.setGrammarAccess(grammarAccess); + return result; + } + + @Override + protected String getRuleName(AbstractElement element) { + return nameMappings.getRuleName(element); + } + + @Override + protected String[] getInitialHiddenTokens() { + return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" }; + } + + public EffortsGrammarAccess getGrammarAccess() { + return this.grammarAccess; + } + + public void setGrammarAccess(EffortsGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } + + public NameMappings getNameMappings() { + return nameMappings; + } + + public void setNameMappings(NameMappings nameMappings) { + this.nameMappings = nameMappings; + } +} diff --git a/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/PartialEffortsContentAssistParser.java b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/PartialEffortsContentAssistParser.java new file mode 100644 index 0000000..bb098d7 --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/PartialEffortsContentAssistParser.java @@ -0,0 +1,33 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ide.contentassist.antlr; + +import java.util.Collection; +import java.util.Collections; +import org.eclipse.xtext.AbstractRule; +import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; +import org.eclipse.xtext.util.PolymorphicDispatcher; + +public class PartialEffortsContentAssistParser extends EffortsParser { + + private AbstractRule rule; + + @Override + public void initializeFor(AbstractRule rule) { + this.rule = rule; + } + + @Override + protected Collection getFollowElements(AbstractInternalContentAssistParser parser) { + if (rule == null || rule.eIsProxy()) + return Collections.emptyList(); + String methodName = "entryRule" + rule.getName(); + PolymorphicDispatcher> dispatcher = + new PolymorphicDispatcher>(methodName, 0, 0, Collections.singletonList(parser)); + dispatcher.invoke(); + return parser.getFollowElements(); + } + +} diff --git a/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEfforts.g b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEfforts.g new file mode 100644 index 0000000..de877eb --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEfforts.g @@ -0,0 +1,423 @@ +/* + * generated by Xtext 2.30.0 + */ +grammar InternalEfforts; + +options { + superClass=AbstractInternalContentAssistParser; +} + +@lexer::header { +package workload.xtext_grammar.ide.contentassist.antlr.internal; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; +} + +@parser::header { +package workload.xtext_grammar.ide.contentassist.antlr.internal; + +import java.io.InputStream; +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.DFA; +import workload.xtext_grammar.services.EffortsGrammarAccess; + +} +@parser::members { + private EffortsGrammarAccess grammarAccess; + + public void setGrammarAccess(EffortsGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } + + @Override + protected Grammar getGrammar() { + return grammarAccess.getGrammar(); + } + + @Override + protected String getValueForTokenName(String tokenName) { + return tokenName; + } +} + +// Entry rule entryRuleMain +entryRuleMain +: +{ before(grammarAccess.getMainRule()); } + ruleMain +{ after(grammarAccess.getMainRule()); } + EOF +; + +// Rule Main +ruleMain + @init { + int stackSize = keepStackSize(); + } + : + ( + { before(grammarAccess.getMainAccess().getGroup()); } + (rule__Main__Group__0) + { after(grammarAccess.getMainAccess().getGroup()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +// Entry rule entryRuleEffort +entryRuleEffort +: +{ before(grammarAccess.getEffortRule()); } + ruleEffort +{ after(grammarAccess.getEffortRule()); } + EOF +; + +// Rule Effort +ruleEffort + @init { + int stackSize = keepStackSize(); + } + : + ( + { before(grammarAccess.getEffortAccess().getGroup()); } + (rule__Effort__Group__0) + { after(grammarAccess.getEffortAccess().getGroup()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__Main__Group__0__Impl + rule__Main__Group__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getMainAccess().getTaskAction_0()); } + () + { after(grammarAccess.getMainAccess().getTaskAction_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__Main__Group__1__Impl + rule__Main__Group__2 +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getMainAccess().getEffortsAssignment_1()); } + (rule__Main__EffortsAssignment_1) + { after(grammarAccess.getMainAccess().getEffortsAssignment_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group__2 + @init { + int stackSize = keepStackSize(); + } +: + rule__Main__Group__2__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group__2__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getMainAccess().getGroup_2()); } + (rule__Main__Group_2__0)* + { after(grammarAccess.getMainAccess().getGroup_2()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__Main__Group_2__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__Main__Group_2__0__Impl + rule__Main__Group_2__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group_2__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getMainAccess().getNEWLINETerminalRuleCall_2_0()); } + RULE_NEWLINE + { after(grammarAccess.getMainAccess().getNEWLINETerminalRuleCall_2_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group_2__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__Main__Group_2__1__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__Group_2__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getMainAccess().getEffortsAssignment_2_1()); } + (rule__Main__EffortsAssignment_2_1) + { after(grammarAccess.getMainAccess().getEffortsAssignment_2_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__Effort__Group__0 + @init { + int stackSize = keepStackSize(); + } +: + rule__Effort__Group__0__Impl + rule__Effort__Group__1 +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__Group__0__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getEffortAccess().getEffortAction_0()); } + () + { after(grammarAccess.getEffortAccess().getEffortAction_0()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__Group__1 + @init { + int stackSize = keepStackSize(); + } +: + rule__Effort__Group__1__Impl + rule__Effort__Group__2 +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__Group__1__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getEffortAccess().getPersonAssignment_1()); } + (rule__Effort__PersonAssignment_1)? + { after(grammarAccess.getEffortAccess().getPersonAssignment_1()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__Group__2 + @init { + int stackSize = keepStackSize(); + } +: + rule__Effort__Group__2__Impl + rule__Effort__Group__3 +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__Group__2__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getEffortAccess().getColonKeyword_2()); } + ':' + { after(grammarAccess.getEffortAccess().getColonKeyword_2()); } +) +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__Group__3 + @init { + int stackSize = keepStackSize(); + } +: + rule__Effort__Group__3__Impl +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__Group__3__Impl + @init { + int stackSize = keepStackSize(); + } +: +( + { before(grammarAccess.getEffortAccess().getMonthsAssignment_3()); } + (rule__Effort__MonthsAssignment_3) + { after(grammarAccess.getEffortAccess().getMonthsAssignment_3()); } +) +; +finally { + restoreStackSize(stackSize); +} + + +rule__Main__EffortsAssignment_1 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_1_0()); } + ruleEffort + { after(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_1_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__Main__EffortsAssignment_2_1 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_2_1_0()); } + ruleEffort + { after(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_2_1_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__PersonAssignment_1 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getEffortAccess().getPersonPersonCrossReference_1_0()); } + ( + { before(grammarAccess.getEffortAccess().getPersonPersonIDTerminalRuleCall_1_0_1()); } + RULE_ID + { after(grammarAccess.getEffortAccess().getPersonPersonIDTerminalRuleCall_1_0_1()); } + ) + { after(grammarAccess.getEffortAccess().getPersonPersonCrossReference_1_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +rule__Effort__MonthsAssignment_3 + @init { + int stackSize = keepStackSize(); + } +: + ( + { before(grammarAccess.getEffortAccess().getMonthsINTTerminalRuleCall_3_0()); } + RULE_INT + { after(grammarAccess.getEffortAccess().getMonthsINTTerminalRuleCall_3_0()); } + ) +; +finally { + restoreStackSize(stackSize); +} + +RULE_NEWLINE : (' '|'\t')* '\r'? '\n' (' '|'\t')*; + +RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; + +RULE_INT : ('0'..'9')+; + +RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\''); + +RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; + +RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?; + +RULE_WS : (' '|'\t'|'\r'|'\n')+; + +RULE_ANY_OTHER : .; diff --git a/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEfforts.tokens b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEfforts.tokens new file mode 100644 index 0000000..2701e2b --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEfforts.tokens @@ -0,0 +1,10 @@ +':'=12 +RULE_ANY_OTHER=11 +RULE_ID=5 +RULE_INT=6 +RULE_ML_COMMENT=8 +RULE_NEWLINE=4 +RULE_SL_COMMENT=9 +RULE_STRING=7 +RULE_WS=10 +T__12=12 diff --git a/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEffortsLexer.java b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEffortsLexer.java new file mode 100644 index 0000000..e60c2cf --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEffortsLexer.java @@ -0,0 +1,868 @@ +package workload.xtext_grammar.ide.contentassist.antlr.internal; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalEffortsLexer extends Lexer { + public static final int RULE_ID=5; + public static final int RULE_WS=10; + public static final int RULE_NEWLINE=4; + public static final int RULE_STRING=7; + public static final int RULE_ANY_OTHER=11; + public static final int RULE_SL_COMMENT=9; + public static final int RULE_INT=6; + public static final int RULE_ML_COMMENT=8; + public static final int T__12=12; + public static final int EOF=-1; + + // delegates + // delegators + + public InternalEffortsLexer() {;} + public InternalEffortsLexer(CharStream input) { + this(input, new RecognizerSharedState()); + } + public InternalEffortsLexer(CharStream input, RecognizerSharedState state) { + super(input,state); + + } + public String getGrammarFileName() { return "InternalEfforts.g"; } + + // $ANTLR start "T__12" + public final void mT__12() throws RecognitionException { + try { + int _type = T__12; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:11:7: ( ':' ) + // InternalEfforts.g:11:9: ':' + { + match(':'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__12" + + // $ANTLR start "RULE_NEWLINE" + public final void mRULE_NEWLINE() throws RecognitionException { + try { + int _type = RULE_NEWLINE; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:409:14: ( ( ' ' | '\\t' )* ( '\\r' )? '\\n' ( ' ' | '\\t' )* ) + // InternalEfforts.g:409:16: ( ' ' | '\\t' )* ( '\\r' )? '\\n' ( ' ' | '\\t' )* + { + // InternalEfforts.g:409:16: ( ' ' | '\\t' )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0=='\t'||LA1_0==' ') ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalEfforts.g: + { + if ( input.LA(1)=='\t'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop1; + } + } while (true); + + // InternalEfforts.g:409:28: ( '\\r' )? + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0=='\r') ) { + alt2=1; + } + switch (alt2) { + case 1 : + // InternalEfforts.g:409:28: '\\r' + { + match('\r'); + + } + break; + + } + + match('\n'); + // InternalEfforts.g:409:39: ( ' ' | '\\t' )* + loop3: + do { + int alt3=2; + int LA3_0 = input.LA(1); + + if ( (LA3_0=='\t'||LA3_0==' ') ) { + alt3=1; + } + + + switch (alt3) { + case 1 : + // InternalEfforts.g: + { + if ( input.LA(1)=='\t'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop3; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_NEWLINE" + + // $ANTLR start "RULE_ID" + public final void mRULE_ID() throws RecognitionException { + try { + int _type = RULE_ID; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:411:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // InternalEfforts.g:411:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + { + // InternalEfforts.g:411:11: ( '^' )? + int alt4=2; + int LA4_0 = input.LA(1); + + if ( (LA4_0=='^') ) { + alt4=1; + } + switch (alt4) { + case 1 : + // InternalEfforts.g:411:11: '^' + { + match('^'); + + } + break; + + } + + if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + // InternalEfforts.g:411:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + loop5: + do { + int alt5=2; + int LA5_0 = input.LA(1); + + if ( ((LA5_0>='0' && LA5_0<='9')||(LA5_0>='A' && LA5_0<='Z')||LA5_0=='_'||(LA5_0>='a' && LA5_0<='z')) ) { + alt5=1; + } + + + switch (alt5) { + case 1 : + // InternalEfforts.g: + { + if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop5; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ID" + + // $ANTLR start "RULE_INT" + public final void mRULE_INT() throws RecognitionException { + try { + int _type = RULE_INT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:413:10: ( ( '0' .. '9' )+ ) + // InternalEfforts.g:413:12: ( '0' .. '9' )+ + { + // InternalEfforts.g:413:12: ( '0' .. '9' )+ + int cnt6=0; + loop6: + do { + int alt6=2; + int LA6_0 = input.LA(1); + + if ( ((LA6_0>='0' && LA6_0<='9')) ) { + alt6=1; + } + + + switch (alt6) { + case 1 : + // InternalEfforts.g:413:13: '0' .. '9' + { + matchRange('0','9'); + + } + break; + + default : + if ( cnt6 >= 1 ) break loop6; + EarlyExitException eee = + new EarlyExitException(6, input); + throw eee; + } + cnt6++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_INT" + + // $ANTLR start "RULE_STRING" + public final void mRULE_STRING() throws RecognitionException { + try { + int _type = RULE_STRING; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:415:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // InternalEfforts.g:415:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + { + // InternalEfforts.g:415:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + int alt9=2; + int LA9_0 = input.LA(1); + + if ( (LA9_0=='\"') ) { + alt9=1; + } + else if ( (LA9_0=='\'') ) { + alt9=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 9, 0, input); + + throw nvae; + } + switch (alt9) { + case 1 : + // InternalEfforts.g:415:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' + { + match('\"'); + // InternalEfforts.g:415:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* + loop7: + do { + int alt7=3; + int LA7_0 = input.LA(1); + + if ( (LA7_0=='\\') ) { + alt7=1; + } + else if ( ((LA7_0>='\u0000' && LA7_0<='!')||(LA7_0>='#' && LA7_0<='[')||(LA7_0>=']' && LA7_0<='\uFFFF')) ) { + alt7=2; + } + + + switch (alt7) { + case 1 : + // InternalEfforts.g:415:21: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalEfforts.g:415:28: ~ ( ( '\\\\' | '\"' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop7; + } + } while (true); + + match('\"'); + + } + break; + case 2 : + // InternalEfforts.g:415:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + { + match('\''); + // InternalEfforts.g:415:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* + loop8: + do { + int alt8=3; + int LA8_0 = input.LA(1); + + if ( (LA8_0=='\\') ) { + alt8=1; + } + else if ( ((LA8_0>='\u0000' && LA8_0<='&')||(LA8_0>='(' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFF')) ) { + alt8=2; + } + + + switch (alt8) { + case 1 : + // InternalEfforts.g:415:54: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalEfforts.g:415:61: ~ ( ( '\\\\' | '\\'' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop8; + } + } while (true); + + match('\''); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_STRING" + + // $ANTLR start "RULE_ML_COMMENT" + public final void mRULE_ML_COMMENT() throws RecognitionException { + try { + int _type = RULE_ML_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:417:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // InternalEfforts.g:417:19: '/*' ( options {greedy=false; } : . )* '*/' + { + match("/*"); + + // InternalEfforts.g:417:24: ( options {greedy=false; } : . )* + loop10: + do { + int alt10=2; + int LA10_0 = input.LA(1); + + if ( (LA10_0=='*') ) { + int LA10_1 = input.LA(2); + + if ( (LA10_1=='/') ) { + alt10=2; + } + else if ( ((LA10_1>='\u0000' && LA10_1<='.')||(LA10_1>='0' && LA10_1<='\uFFFF')) ) { + alt10=1; + } + + + } + else if ( ((LA10_0>='\u0000' && LA10_0<=')')||(LA10_0>='+' && LA10_0<='\uFFFF')) ) { + alt10=1; + } + + + switch (alt10) { + case 1 : + // InternalEfforts.g:417:52: . + { + matchAny(); + + } + break; + + default : + break loop10; + } + } while (true); + + match("*/"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ML_COMMENT" + + // $ANTLR start "RULE_SL_COMMENT" + public final void mRULE_SL_COMMENT() throws RecognitionException { + try { + int _type = RULE_SL_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:419:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) + // InternalEfforts.g:419:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? + { + match("//"); + + // InternalEfforts.g:419:24: (~ ( ( '\\n' | '\\r' ) ) )* + loop11: + do { + int alt11=2; + int LA11_0 = input.LA(1); + + if ( ((LA11_0>='\u0000' && LA11_0<='\t')||(LA11_0>='\u000B' && LA11_0<='\f')||(LA11_0>='\u000E' && LA11_0<='\uFFFF')) ) { + alt11=1; + } + + + switch (alt11) { + case 1 : + // InternalEfforts.g:419:24: ~ ( ( '\\n' | '\\r' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop11; + } + } while (true); + + // InternalEfforts.g:419:40: ( ( '\\r' )? '\\n' )? + int alt13=2; + int LA13_0 = input.LA(1); + + if ( (LA13_0=='\n'||LA13_0=='\r') ) { + alt13=1; + } + switch (alt13) { + case 1 : + // InternalEfforts.g:419:41: ( '\\r' )? '\\n' + { + // InternalEfforts.g:419:41: ( '\\r' )? + int alt12=2; + int LA12_0 = input.LA(1); + + if ( (LA12_0=='\r') ) { + alt12=1; + } + switch (alt12) { + case 1 : + // InternalEfforts.g:419:41: '\\r' + { + match('\r'); + + } + break; + + } + + match('\n'); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_SL_COMMENT" + + // $ANTLR start "RULE_WS" + public final void mRULE_WS() throws RecognitionException { + try { + int _type = RULE_WS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:421:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // InternalEfforts.g:421:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + { + // InternalEfforts.g:421:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + int cnt14=0; + loop14: + do { + int alt14=2; + int LA14_0 = input.LA(1); + + if ( ((LA14_0>='\t' && LA14_0<='\n')||LA14_0=='\r'||LA14_0==' ') ) { + alt14=1; + } + + + switch (alt14) { + case 1 : + // InternalEfforts.g: + { + if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + if ( cnt14 >= 1 ) break loop14; + EarlyExitException eee = + new EarlyExitException(14, input); + throw eee; + } + cnt14++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_WS" + + // $ANTLR start "RULE_ANY_OTHER" + public final void mRULE_ANY_OTHER() throws RecognitionException { + try { + int _type = RULE_ANY_OTHER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:423:16: ( . ) + // InternalEfforts.g:423:18: . + { + matchAny(); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ANY_OTHER" + + public void mTokens() throws RecognitionException { + // InternalEfforts.g:1:8: ( T__12 | RULE_NEWLINE | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER ) + int alt15=9; + alt15 = dfa15.predict(input); + switch (alt15) { + case 1 : + // InternalEfforts.g:1:10: T__12 + { + mT__12(); + + } + break; + case 2 : + // InternalEfforts.g:1:16: RULE_NEWLINE + { + mRULE_NEWLINE(); + + } + break; + case 3 : + // InternalEfforts.g:1:29: RULE_ID + { + mRULE_ID(); + + } + break; + case 4 : + // InternalEfforts.g:1:37: RULE_INT + { + mRULE_INT(); + + } + break; + case 5 : + // InternalEfforts.g:1:46: RULE_STRING + { + mRULE_STRING(); + + } + break; + case 6 : + // InternalEfforts.g:1:58: RULE_ML_COMMENT + { + mRULE_ML_COMMENT(); + + } + break; + case 7 : + // InternalEfforts.g:1:74: RULE_SL_COMMENT + { + mRULE_SL_COMMENT(); + + } + break; + case 8 : + // InternalEfforts.g:1:90: RULE_WS + { + mRULE_WS(); + + } + break; + case 9 : + // InternalEfforts.g:1:98: RULE_ANY_OTHER + { + mRULE_ANY_OTHER(); + + } + break; + + } + + } + + + protected DFA15 dfa15 = new DFA15(this); + static final String DFA15_eotS = + "\2\uffff\2\15\1\22\1\13\2\uffff\3\13\3\uffff\1\15\1\22\1\15\1\22\6\uffff"; + static final String DFA15_eofS = + "\30\uffff"; + static final String DFA15_minS = + "\1\0\1\uffff\1\11\1\12\1\11\1\101\2\uffff\2\0\1\52\3\uffff\1\12\3\11\6\uffff"; + static final String DFA15_maxS = + "\1\uffff\1\uffff\1\40\1\12\1\40\1\172\2\uffff\2\uffff\1\57\3\uffff\1\12\3\40\6\uffff"; + static final String DFA15_acceptS = + "\1\uffff\1\1\4\uffff\1\3\1\4\3\uffff\1\11\1\1\1\10\4\uffff\1\2\1\3\1\4\1\5\1\6\1\7"; + static final String DFA15_specialS = + "\1\0\7\uffff\1\2\1\1\16\uffff}>"; + static final String[] DFA15_transitionS = { + "\11\13\1\2\1\4\2\13\1\3\22\13\1\2\1\13\1\10\4\13\1\11\7\13\1\12\12\7\1\1\6\13\32\6\3\13\1\5\1\6\1\13\32\6\uff85\13", + "", + "\1\20\1\17\2\uffff\1\16\22\uffff\1\20", + "\1\17", + "\1\21\1\15\2\uffff\1\15\22\uffff\1\21", + "\32\23\4\uffff\1\23\1\uffff\32\23", + "", + "", + "\0\25", + "\0\25", + "\1\26\4\uffff\1\27", + "", + "", + "", + "\1\17", + "\1\21\1\15\2\uffff\1\15\22\uffff\1\21", + "\1\20\1\17\2\uffff\1\16\22\uffff\1\20", + "\1\21\1\15\2\uffff\1\15\22\uffff\1\21", + "", + "", + "", + "", + "", + "" + }; + + static final short[] DFA15_eot = DFA.unpackEncodedString(DFA15_eotS); + static final short[] DFA15_eof = DFA.unpackEncodedString(DFA15_eofS); + static final char[] DFA15_min = DFA.unpackEncodedStringToUnsignedChars(DFA15_minS); + static final char[] DFA15_max = DFA.unpackEncodedStringToUnsignedChars(DFA15_maxS); + static final short[] DFA15_accept = DFA.unpackEncodedString(DFA15_acceptS); + static final short[] DFA15_special = DFA.unpackEncodedString(DFA15_specialS); + static final short[][] DFA15_transition; + + static { + int numStates = DFA15_transitionS.length; + DFA15_transition = new short[numStates][]; + for (int i=0; i='A' && LA15_0<='Z')||LA15_0=='_'||(LA15_0>='a' && LA15_0<='z')) ) {s = 6;} + + else if ( ((LA15_0>='0' && LA15_0<='9')) ) {s = 7;} + + else if ( (LA15_0=='\"') ) {s = 8;} + + else if ( (LA15_0=='\'') ) {s = 9;} + + else if ( (LA15_0=='/') ) {s = 10;} + + else if ( ((LA15_0>='\u0000' && LA15_0<='\b')||(LA15_0>='\u000B' && LA15_0<='\f')||(LA15_0>='\u000E' && LA15_0<='\u001F')||LA15_0=='!'||(LA15_0>='#' && LA15_0<='&')||(LA15_0>='(' && LA15_0<='.')||(LA15_0>=';' && LA15_0<='@')||(LA15_0>='[' && LA15_0<=']')||LA15_0=='`'||(LA15_0>='{' && LA15_0<='\uFFFF')) ) {s = 11;} + + if ( s>=0 ) return s; + break; + case 1 : + int LA15_9 = input.LA(1); + + s = -1; + if ( ((LA15_9>='\u0000' && LA15_9<='\uFFFF')) ) {s = 21;} + + else s = 11; + + if ( s>=0 ) return s; + break; + case 2 : + int LA15_8 = input.LA(1); + + s = -1; + if ( ((LA15_8>='\u0000' && LA15_8<='\uFFFF')) ) {s = 21;} + + else s = 11; + + if ( s>=0 ) return s; + break; + } + NoViableAltException nvae = + new NoViableAltException(getDescription(), 15, _s, input); + error(nvae); + throw nvae; + } + } + + +} \ No newline at end of file diff --git a/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEffortsParser.java b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEffortsParser.java new file mode 100644 index 0000000..8d121ef --- /dev/null +++ b/workload.xtext_grammar.ide/src-gen/workload/xtext_grammar/ide/contentassist/antlr/internal/InternalEffortsParser.java @@ -0,0 +1,1141 @@ +package workload.xtext_grammar.ide.contentassist.antlr.internal; + +import java.io.InputStream; +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.DFA; +import workload.xtext_grammar.services.EffortsGrammarAccess; + + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalEffortsParser extends AbstractInternalContentAssistParser { + public static final String[] tokenNames = new String[] { + "", "", "", "", "RULE_NEWLINE", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "':'" + }; + public static final int RULE_ID=5; + public static final int RULE_WS=10; + public static final int RULE_NEWLINE=4; + public static final int RULE_STRING=7; + public static final int RULE_ANY_OTHER=11; + public static final int RULE_SL_COMMENT=9; + public static final int RULE_INT=6; + public static final int RULE_ML_COMMENT=8; + public static final int T__12=12; + public static final int EOF=-1; + + // delegates + // delegators + + + public InternalEffortsParser(TokenStream input) { + this(input, new RecognizerSharedState()); + } + public InternalEffortsParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + + } + + + public String[] getTokenNames() { return InternalEffortsParser.tokenNames; } + public String getGrammarFileName() { return "InternalEfforts.g"; } + + + private EffortsGrammarAccess grammarAccess; + + public void setGrammarAccess(EffortsGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } + + @Override + protected Grammar getGrammar() { + return grammarAccess.getGrammar(); + } + + @Override + protected String getValueForTokenName(String tokenName) { + return tokenName; + } + + + + // $ANTLR start "entryRuleMain" + // InternalEfforts.g:53:1: entryRuleMain : ruleMain EOF ; + public final void entryRuleMain() throws RecognitionException { + try { + // InternalEfforts.g:54:1: ( ruleMain EOF ) + // InternalEfforts.g:55:1: ruleMain EOF + { + before(grammarAccess.getMainRule()); + pushFollow(FOLLOW_1); + ruleMain(); + + state._fsp--; + + after(grammarAccess.getMainRule()); + match(input,EOF,FOLLOW_2); + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "entryRuleMain" + + + // $ANTLR start "ruleMain" + // InternalEfforts.g:62:1: ruleMain : ( ( rule__Main__Group__0 ) ) ; + public final void ruleMain() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:66:2: ( ( ( rule__Main__Group__0 ) ) ) + // InternalEfforts.g:67:2: ( ( rule__Main__Group__0 ) ) + { + // InternalEfforts.g:67:2: ( ( rule__Main__Group__0 ) ) + // InternalEfforts.g:68:3: ( rule__Main__Group__0 ) + { + before(grammarAccess.getMainAccess().getGroup()); + // InternalEfforts.g:69:3: ( rule__Main__Group__0 ) + // InternalEfforts.g:69:4: rule__Main__Group__0 + { + pushFollow(FOLLOW_2); + rule__Main__Group__0(); + + state._fsp--; + + + } + + after(grammarAccess.getMainAccess().getGroup()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "ruleMain" + + + // $ANTLR start "entryRuleEffort" + // InternalEfforts.g:78:1: entryRuleEffort : ruleEffort EOF ; + public final void entryRuleEffort() throws RecognitionException { + try { + // InternalEfforts.g:79:1: ( ruleEffort EOF ) + // InternalEfforts.g:80:1: ruleEffort EOF + { + before(grammarAccess.getEffortRule()); + pushFollow(FOLLOW_1); + ruleEffort(); + + state._fsp--; + + after(grammarAccess.getEffortRule()); + match(input,EOF,FOLLOW_2); + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "entryRuleEffort" + + + // $ANTLR start "ruleEffort" + // InternalEfforts.g:87:1: ruleEffort : ( ( rule__Effort__Group__0 ) ) ; + public final void ruleEffort() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:91:2: ( ( ( rule__Effort__Group__0 ) ) ) + // InternalEfforts.g:92:2: ( ( rule__Effort__Group__0 ) ) + { + // InternalEfforts.g:92:2: ( ( rule__Effort__Group__0 ) ) + // InternalEfforts.g:93:3: ( rule__Effort__Group__0 ) + { + before(grammarAccess.getEffortAccess().getGroup()); + // InternalEfforts.g:94:3: ( rule__Effort__Group__0 ) + // InternalEfforts.g:94:4: rule__Effort__Group__0 + { + pushFollow(FOLLOW_2); + rule__Effort__Group__0(); + + state._fsp--; + + + } + + after(grammarAccess.getEffortAccess().getGroup()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "ruleEffort" + + + // $ANTLR start "rule__Main__Group__0" + // InternalEfforts.g:102:1: rule__Main__Group__0 : rule__Main__Group__0__Impl rule__Main__Group__1 ; + public final void rule__Main__Group__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:106:1: ( rule__Main__Group__0__Impl rule__Main__Group__1 ) + // InternalEfforts.g:107:2: rule__Main__Group__0__Impl rule__Main__Group__1 + { + pushFollow(FOLLOW_3); + rule__Main__Group__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Main__Group__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group__0" + + + // $ANTLR start "rule__Main__Group__0__Impl" + // InternalEfforts.g:114:1: rule__Main__Group__0__Impl : ( () ) ; + public final void rule__Main__Group__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:118:1: ( ( () ) ) + // InternalEfforts.g:119:1: ( () ) + { + // InternalEfforts.g:119:1: ( () ) + // InternalEfforts.g:120:2: () + { + before(grammarAccess.getMainAccess().getTaskAction_0()); + // InternalEfforts.g:121:2: () + // InternalEfforts.g:121:3: + { + } + + after(grammarAccess.getMainAccess().getTaskAction_0()); + + } + + + } + + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group__0__Impl" + + + // $ANTLR start "rule__Main__Group__1" + // InternalEfforts.g:129:1: rule__Main__Group__1 : rule__Main__Group__1__Impl rule__Main__Group__2 ; + public final void rule__Main__Group__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:133:1: ( rule__Main__Group__1__Impl rule__Main__Group__2 ) + // InternalEfforts.g:134:2: rule__Main__Group__1__Impl rule__Main__Group__2 + { + pushFollow(FOLLOW_4); + rule__Main__Group__1__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Main__Group__2(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group__1" + + + // $ANTLR start "rule__Main__Group__1__Impl" + // InternalEfforts.g:141:1: rule__Main__Group__1__Impl : ( ( rule__Main__EffortsAssignment_1 ) ) ; + public final void rule__Main__Group__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:145:1: ( ( ( rule__Main__EffortsAssignment_1 ) ) ) + // InternalEfforts.g:146:1: ( ( rule__Main__EffortsAssignment_1 ) ) + { + // InternalEfforts.g:146:1: ( ( rule__Main__EffortsAssignment_1 ) ) + // InternalEfforts.g:147:2: ( rule__Main__EffortsAssignment_1 ) + { + before(grammarAccess.getMainAccess().getEffortsAssignment_1()); + // InternalEfforts.g:148:2: ( rule__Main__EffortsAssignment_1 ) + // InternalEfforts.g:148:3: rule__Main__EffortsAssignment_1 + { + pushFollow(FOLLOW_2); + rule__Main__EffortsAssignment_1(); + + state._fsp--; + + + } + + after(grammarAccess.getMainAccess().getEffortsAssignment_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group__1__Impl" + + + // $ANTLR start "rule__Main__Group__2" + // InternalEfforts.g:156:1: rule__Main__Group__2 : rule__Main__Group__2__Impl ; + public final void rule__Main__Group__2() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:160:1: ( rule__Main__Group__2__Impl ) + // InternalEfforts.g:161:2: rule__Main__Group__2__Impl + { + pushFollow(FOLLOW_2); + rule__Main__Group__2__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group__2" + + + // $ANTLR start "rule__Main__Group__2__Impl" + // InternalEfforts.g:167:1: rule__Main__Group__2__Impl : ( ( rule__Main__Group_2__0 )* ) ; + public final void rule__Main__Group__2__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:171:1: ( ( ( rule__Main__Group_2__0 )* ) ) + // InternalEfforts.g:172:1: ( ( rule__Main__Group_2__0 )* ) + { + // InternalEfforts.g:172:1: ( ( rule__Main__Group_2__0 )* ) + // InternalEfforts.g:173:2: ( rule__Main__Group_2__0 )* + { + before(grammarAccess.getMainAccess().getGroup_2()); + // InternalEfforts.g:174:2: ( rule__Main__Group_2__0 )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0==RULE_NEWLINE) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalEfforts.g:174:3: rule__Main__Group_2__0 + { + pushFollow(FOLLOW_5); + rule__Main__Group_2__0(); + + state._fsp--; + + + } + break; + + default : + break loop1; + } + } while (true); + + after(grammarAccess.getMainAccess().getGroup_2()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group__2__Impl" + + + // $ANTLR start "rule__Main__Group_2__0" + // InternalEfforts.g:183:1: rule__Main__Group_2__0 : rule__Main__Group_2__0__Impl rule__Main__Group_2__1 ; + public final void rule__Main__Group_2__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:187:1: ( rule__Main__Group_2__0__Impl rule__Main__Group_2__1 ) + // InternalEfforts.g:188:2: rule__Main__Group_2__0__Impl rule__Main__Group_2__1 + { + pushFollow(FOLLOW_3); + rule__Main__Group_2__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Main__Group_2__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group_2__0" + + + // $ANTLR start "rule__Main__Group_2__0__Impl" + // InternalEfforts.g:195:1: rule__Main__Group_2__0__Impl : ( RULE_NEWLINE ) ; + public final void rule__Main__Group_2__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:199:1: ( ( RULE_NEWLINE ) ) + // InternalEfforts.g:200:1: ( RULE_NEWLINE ) + { + // InternalEfforts.g:200:1: ( RULE_NEWLINE ) + // InternalEfforts.g:201:2: RULE_NEWLINE + { + before(grammarAccess.getMainAccess().getNEWLINETerminalRuleCall_2_0()); + match(input,RULE_NEWLINE,FOLLOW_2); + after(grammarAccess.getMainAccess().getNEWLINETerminalRuleCall_2_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group_2__0__Impl" + + + // $ANTLR start "rule__Main__Group_2__1" + // InternalEfforts.g:210:1: rule__Main__Group_2__1 : rule__Main__Group_2__1__Impl ; + public final void rule__Main__Group_2__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:214:1: ( rule__Main__Group_2__1__Impl ) + // InternalEfforts.g:215:2: rule__Main__Group_2__1__Impl + { + pushFollow(FOLLOW_2); + rule__Main__Group_2__1__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group_2__1" + + + // $ANTLR start "rule__Main__Group_2__1__Impl" + // InternalEfforts.g:221:1: rule__Main__Group_2__1__Impl : ( ( rule__Main__EffortsAssignment_2_1 ) ) ; + public final void rule__Main__Group_2__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:225:1: ( ( ( rule__Main__EffortsAssignment_2_1 ) ) ) + // InternalEfforts.g:226:1: ( ( rule__Main__EffortsAssignment_2_1 ) ) + { + // InternalEfforts.g:226:1: ( ( rule__Main__EffortsAssignment_2_1 ) ) + // InternalEfforts.g:227:2: ( rule__Main__EffortsAssignment_2_1 ) + { + before(grammarAccess.getMainAccess().getEffortsAssignment_2_1()); + // InternalEfforts.g:228:2: ( rule__Main__EffortsAssignment_2_1 ) + // InternalEfforts.g:228:3: rule__Main__EffortsAssignment_2_1 + { + pushFollow(FOLLOW_2); + rule__Main__EffortsAssignment_2_1(); + + state._fsp--; + + + } + + after(grammarAccess.getMainAccess().getEffortsAssignment_2_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__Group_2__1__Impl" + + + // $ANTLR start "rule__Effort__Group__0" + // InternalEfforts.g:237:1: rule__Effort__Group__0 : rule__Effort__Group__0__Impl rule__Effort__Group__1 ; + public final void rule__Effort__Group__0() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:241:1: ( rule__Effort__Group__0__Impl rule__Effort__Group__1 ) + // InternalEfforts.g:242:2: rule__Effort__Group__0__Impl rule__Effort__Group__1 + { + pushFollow(FOLLOW_3); + rule__Effort__Group__0__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Effort__Group__1(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__0" + + + // $ANTLR start "rule__Effort__Group__0__Impl" + // InternalEfforts.g:249:1: rule__Effort__Group__0__Impl : ( () ) ; + public final void rule__Effort__Group__0__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:253:1: ( ( () ) ) + // InternalEfforts.g:254:1: ( () ) + { + // InternalEfforts.g:254:1: ( () ) + // InternalEfforts.g:255:2: () + { + before(grammarAccess.getEffortAccess().getEffortAction_0()); + // InternalEfforts.g:256:2: () + // InternalEfforts.g:256:3: + { + } + + after(grammarAccess.getEffortAccess().getEffortAction_0()); + + } + + + } + + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__0__Impl" + + + // $ANTLR start "rule__Effort__Group__1" + // InternalEfforts.g:264:1: rule__Effort__Group__1 : rule__Effort__Group__1__Impl rule__Effort__Group__2 ; + public final void rule__Effort__Group__1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:268:1: ( rule__Effort__Group__1__Impl rule__Effort__Group__2 ) + // InternalEfforts.g:269:2: rule__Effort__Group__1__Impl rule__Effort__Group__2 + { + pushFollow(FOLLOW_3); + rule__Effort__Group__1__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Effort__Group__2(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__1" + + + // $ANTLR start "rule__Effort__Group__1__Impl" + // InternalEfforts.g:276:1: rule__Effort__Group__1__Impl : ( ( rule__Effort__PersonAssignment_1 )? ) ; + public final void rule__Effort__Group__1__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:280:1: ( ( ( rule__Effort__PersonAssignment_1 )? ) ) + // InternalEfforts.g:281:1: ( ( rule__Effort__PersonAssignment_1 )? ) + { + // InternalEfforts.g:281:1: ( ( rule__Effort__PersonAssignment_1 )? ) + // InternalEfforts.g:282:2: ( rule__Effort__PersonAssignment_1 )? + { + before(grammarAccess.getEffortAccess().getPersonAssignment_1()); + // InternalEfforts.g:283:2: ( rule__Effort__PersonAssignment_1 )? + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0==RULE_ID) ) { + alt2=1; + } + switch (alt2) { + case 1 : + // InternalEfforts.g:283:3: rule__Effort__PersonAssignment_1 + { + pushFollow(FOLLOW_2); + rule__Effort__PersonAssignment_1(); + + state._fsp--; + + + } + break; + + } + + after(grammarAccess.getEffortAccess().getPersonAssignment_1()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__1__Impl" + + + // $ANTLR start "rule__Effort__Group__2" + // InternalEfforts.g:291:1: rule__Effort__Group__2 : rule__Effort__Group__2__Impl rule__Effort__Group__3 ; + public final void rule__Effort__Group__2() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:295:1: ( rule__Effort__Group__2__Impl rule__Effort__Group__3 ) + // InternalEfforts.g:296:2: rule__Effort__Group__2__Impl rule__Effort__Group__3 + { + pushFollow(FOLLOW_6); + rule__Effort__Group__2__Impl(); + + state._fsp--; + + pushFollow(FOLLOW_2); + rule__Effort__Group__3(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__2" + + + // $ANTLR start "rule__Effort__Group__2__Impl" + // InternalEfforts.g:303:1: rule__Effort__Group__2__Impl : ( ':' ) ; + public final void rule__Effort__Group__2__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:307:1: ( ( ':' ) ) + // InternalEfforts.g:308:1: ( ':' ) + { + // InternalEfforts.g:308:1: ( ':' ) + // InternalEfforts.g:309:2: ':' + { + before(grammarAccess.getEffortAccess().getColonKeyword_2()); + match(input,12,FOLLOW_2); + after(grammarAccess.getEffortAccess().getColonKeyword_2()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__2__Impl" + + + // $ANTLR start "rule__Effort__Group__3" + // InternalEfforts.g:318:1: rule__Effort__Group__3 : rule__Effort__Group__3__Impl ; + public final void rule__Effort__Group__3() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:322:1: ( rule__Effort__Group__3__Impl ) + // InternalEfforts.g:323:2: rule__Effort__Group__3__Impl + { + pushFollow(FOLLOW_2); + rule__Effort__Group__3__Impl(); + + state._fsp--; + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__3" + + + // $ANTLR start "rule__Effort__Group__3__Impl" + // InternalEfforts.g:329:1: rule__Effort__Group__3__Impl : ( ( rule__Effort__MonthsAssignment_3 ) ) ; + public final void rule__Effort__Group__3__Impl() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:333:1: ( ( ( rule__Effort__MonthsAssignment_3 ) ) ) + // InternalEfforts.g:334:1: ( ( rule__Effort__MonthsAssignment_3 ) ) + { + // InternalEfforts.g:334:1: ( ( rule__Effort__MonthsAssignment_3 ) ) + // InternalEfforts.g:335:2: ( rule__Effort__MonthsAssignment_3 ) + { + before(grammarAccess.getEffortAccess().getMonthsAssignment_3()); + // InternalEfforts.g:336:2: ( rule__Effort__MonthsAssignment_3 ) + // InternalEfforts.g:336:3: rule__Effort__MonthsAssignment_3 + { + pushFollow(FOLLOW_2); + rule__Effort__MonthsAssignment_3(); + + state._fsp--; + + + } + + after(grammarAccess.getEffortAccess().getMonthsAssignment_3()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__Group__3__Impl" + + + // $ANTLR start "rule__Main__EffortsAssignment_1" + // InternalEfforts.g:345:1: rule__Main__EffortsAssignment_1 : ( ruleEffort ) ; + public final void rule__Main__EffortsAssignment_1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:349:1: ( ( ruleEffort ) ) + // InternalEfforts.g:350:2: ( ruleEffort ) + { + // InternalEfforts.g:350:2: ( ruleEffort ) + // InternalEfforts.g:351:3: ruleEffort + { + before(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_1_0()); + pushFollow(FOLLOW_2); + ruleEffort(); + + state._fsp--; + + after(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_1_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__EffortsAssignment_1" + + + // $ANTLR start "rule__Main__EffortsAssignment_2_1" + // InternalEfforts.g:360:1: rule__Main__EffortsAssignment_2_1 : ( ruleEffort ) ; + public final void rule__Main__EffortsAssignment_2_1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:364:1: ( ( ruleEffort ) ) + // InternalEfforts.g:365:2: ( ruleEffort ) + { + // InternalEfforts.g:365:2: ( ruleEffort ) + // InternalEfforts.g:366:3: ruleEffort + { + before(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_2_1_0()); + pushFollow(FOLLOW_2); + ruleEffort(); + + state._fsp--; + + after(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_2_1_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Main__EffortsAssignment_2_1" + + + // $ANTLR start "rule__Effort__PersonAssignment_1" + // InternalEfforts.g:375:1: rule__Effort__PersonAssignment_1 : ( ( RULE_ID ) ) ; + public final void rule__Effort__PersonAssignment_1() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:379:1: ( ( ( RULE_ID ) ) ) + // InternalEfforts.g:380:2: ( ( RULE_ID ) ) + { + // InternalEfforts.g:380:2: ( ( RULE_ID ) ) + // InternalEfforts.g:381:3: ( RULE_ID ) + { + before(grammarAccess.getEffortAccess().getPersonPersonCrossReference_1_0()); + // InternalEfforts.g:382:3: ( RULE_ID ) + // InternalEfforts.g:383:4: RULE_ID + { + before(grammarAccess.getEffortAccess().getPersonPersonIDTerminalRuleCall_1_0_1()); + match(input,RULE_ID,FOLLOW_2); + after(grammarAccess.getEffortAccess().getPersonPersonIDTerminalRuleCall_1_0_1()); + + } + + after(grammarAccess.getEffortAccess().getPersonPersonCrossReference_1_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__PersonAssignment_1" + + + // $ANTLR start "rule__Effort__MonthsAssignment_3" + // InternalEfforts.g:394:1: rule__Effort__MonthsAssignment_3 : ( RULE_INT ) ; + public final void rule__Effort__MonthsAssignment_3() throws RecognitionException { + + int stackSize = keepStackSize(); + + try { + // InternalEfforts.g:398:1: ( ( RULE_INT ) ) + // InternalEfforts.g:399:2: ( RULE_INT ) + { + // InternalEfforts.g:399:2: ( RULE_INT ) + // InternalEfforts.g:400:3: RULE_INT + { + before(grammarAccess.getEffortAccess().getMonthsINTTerminalRuleCall_3_0()); + match(input,RULE_INT,FOLLOW_2); + after(grammarAccess.getEffortAccess().getMonthsINTTerminalRuleCall_3_0()); + + } + + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + + restoreStackSize(stackSize); + + } + return ; + } + // $ANTLR end "rule__Effort__MonthsAssignment_3" + + // Delegated rules + + + + + public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000001020L}); + public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000000010L}); + public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000000012L}); + public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000000040L}); + +} \ No newline at end of file diff --git a/workload.xtext_grammar.ide/src/workload/xtext_grammar/ide/EffortsIdeModule.java b/workload.xtext_grammar.ide/src/workload/xtext_grammar/ide/EffortsIdeModule.java new file mode 100644 index 0000000..a398d97 --- /dev/null +++ b/workload.xtext_grammar.ide/src/workload/xtext_grammar/ide/EffortsIdeModule.java @@ -0,0 +1,11 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ide; + + +/** + * Use this class to register ide components. + */ +public class EffortsIdeModule extends AbstractEffortsIdeModule { +} diff --git a/workload.xtext_grammar.ide/src/workload/xtext_grammar/ide/EffortsIdeSetup.java b/workload.xtext_grammar.ide/src/workload/xtext_grammar/ide/EffortsIdeSetup.java new file mode 100644 index 0000000..45873f1 --- /dev/null +++ b/workload.xtext_grammar.ide/src/workload/xtext_grammar/ide/EffortsIdeSetup.java @@ -0,0 +1,22 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ide; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.xtext.util.Modules2; +import workload.xtext_grammar.EffortsRuntimeModule; +import workload.xtext_grammar.EffortsStandaloneSetup; + +/** + * Initialization support for running Xtext languages as language servers. + */ +public class EffortsIdeSetup extends EffortsStandaloneSetup { + + @Override + public Injector createInjector() { + return Guice.createInjector(Modules2.mixin(new EffortsRuntimeModule(), new EffortsIdeModule())); + } + +} diff --git a/workload.xtext_grammar.ui/.classpath b/workload.xtext_grammar.ui/.classpath new file mode 100644 index 0000000..a613544 --- /dev/null +++ b/workload.xtext_grammar.ui/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/workload.xtext_grammar.ui/.project b/workload.xtext_grammar.ui/.project new file mode 100644 index 0000000..c0d95d9 --- /dev/null +++ b/workload.xtext_grammar.ui/.project @@ -0,0 +1,34 @@ + + + workload.xtext_grammar.ui + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.xtext.ui.shared.xtextNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workload.xtext_grammar.ui/.settings/org.eclipse.core.resources.prefs b/workload.xtext_grammar.ui/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.xtext_grammar.ui/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.xtext_grammar.ui/.settings/org.eclipse.jdt.core.prefs b/workload.xtext_grammar.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7adc0fb --- /dev/null +++ b/workload.xtext_grammar.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/workload.xtext_grammar.ui/META-INF/MANIFEST.MF b/workload.xtext_grammar.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..3c65eb0 --- /dev/null +++ b/workload.xtext_grammar.ui/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Automatic-Module-Name: workload.xtext_grammar.ui +Bundle-ManifestVersion: 2 +Bundle-Name: workload.xtext_grammar.ui +Bundle-Vendor: My Company +Bundle-Version: 1.0.0.qualifier +Bundle-SymbolicName: workload.xtext_grammar.ui; singleton:=true +Bundle-ActivationPolicy: lazy +Require-Bundle: workload.xtext_grammar, + workload.xtext_grammar.ide, + workload.emf, + org.eclipse.xtext.ui, + org.eclipse.xtext.ui.shared, + org.eclipse.xtext.ui.codetemplates.ui, + org.eclipse.ui.editors;bundle-version="3.14.300", + org.eclipse.ui.ide;bundle-version="3.18.500", + org.eclipse.ui, + org.eclipse.compare, + org.eclipse.xtext.builder +Import-Package: org.apache.log4j +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: workload.xtext_grammar.ui.internal, + workload.xtext_grammar.ui.quickfix, + workload.xtext_grammar.ui.contentassist +Bundle-Activator: workload.xtext_grammar.ui.internal.Xtext_grammarActivator diff --git a/workload.xtext_grammar.ui/build.properties b/workload.xtext_grammar.ui/build.properties new file mode 100644 index 0000000..323f56c --- /dev/null +++ b/workload.xtext_grammar.ui/build.properties @@ -0,0 +1,7 @@ +source.. = src/,\ + src-gen/,\ + xtend-gen/ +bin.includes = .,\ + META-INF/,\ + plugin.xml +bin.excludes = **/*.xtend diff --git a/workload.xtext_grammar.ui/plugin.xml b/workload.xtext_grammar.ui/plugin.xml new file mode 100644 index 0000000..3e5681f --- /dev/null +++ b/workload.xtext_grammar.ui/plugin.xml @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/AbstractEffortsUiModule.java b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/AbstractEffortsUiModule.java new file mode 100644 index 0000000..18a7c4c --- /dev/null +++ b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/AbstractEffortsUiModule.java @@ -0,0 +1,300 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui; + +import com.google.inject.Binder; +import com.google.inject.Provider; +import com.google.inject.name.Names; +import org.eclipse.compare.IViewerCreator; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.xtext.builder.BuilderParticipant; +import org.eclipse.xtext.builder.EclipseOutputConfigurationProvider; +import org.eclipse.xtext.builder.IXtextBuilderParticipant; +import org.eclipse.xtext.builder.builderState.IBuilderState; +import org.eclipse.xtext.builder.clustering.CurrentDescriptions; +import org.eclipse.xtext.builder.impl.PersistentDataAwareDirtyResource; +import org.eclipse.xtext.builder.nature.NatureAddingEditorCallback; +import org.eclipse.xtext.builder.preferences.BuilderPreferenceAccess; +import org.eclipse.xtext.generator.IContextualOutputConfigurationProvider; +import org.eclipse.xtext.ide.LexerIdeBindings; +import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; +import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser; +import org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider; +import org.eclipse.xtext.parser.antlr.ITokenDefProvider; +import org.eclipse.xtext.parser.antlr.LexerProvider; +import org.eclipse.xtext.resource.IResourceDescriptions; +import org.eclipse.xtext.resource.containers.IAllContainersState; +import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; +import org.eclipse.xtext.service.SingletonBinding; +import org.eclipse.xtext.ui.DefaultUiModule; +import org.eclipse.xtext.ui.UIBindings; +import org.eclipse.xtext.ui.codetemplates.ui.AccessibleCodetemplatesActivator; +import org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialEditingContentAssistContextFactory; +import org.eclipse.xtext.ui.codetemplates.ui.partialEditing.PartialEditingContentAssistContextFactory; +import org.eclipse.xtext.ui.codetemplates.ui.preferences.AdvancedTemplatesPreferencePage; +import org.eclipse.xtext.ui.codetemplates.ui.preferences.TemplatesLanguageConfiguration; +import org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar; +import org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistry; +import org.eclipse.xtext.ui.compare.DefaultViewerCreator; +import org.eclipse.xtext.ui.editor.DocumentBasedDirtyResource; +import org.eclipse.xtext.ui.editor.IXtextEditorCallback; +import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext; +import org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher; +import org.eclipse.xtext.ui.editor.contentassist.IContentProposalProvider; +import org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper; +import org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher; +import org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper; +import org.eclipse.xtext.ui.editor.contentassist.antlr.DelegatingContentAssistContextFactory; +import org.eclipse.xtext.ui.editor.formatting.IContentFormatterFactory; +import org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory; +import org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider; +import org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider; +import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer; +import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider; +import org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage; +import org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator; +import org.eclipse.xtext.ui.refactoring.IReferenceUpdater; +import org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider; +import org.eclipse.xtext.ui.refactoring.IRenameStrategy; +import org.eclipse.xtext.ui.refactoring.impl.DefaultDependentElementsCalculator; +import org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater; +import org.eclipse.xtext.ui.refactoring.impl.DefaultRenameRefactoringProvider; +import org.eclipse.xtext.ui.refactoring.impl.DefaultRenameStrategy; +import org.eclipse.xtext.ui.refactoring.ui.DefaultRenameSupport; +import org.eclipse.xtext.ui.refactoring.ui.IRenameSupport; +import org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferences; +import org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider; +import org.eclipse.xtext.ui.shared.Access; +import org.eclipse.xtext.ui.validation.AbstractValidatorConfigurationBlock; +import workload.xtext_grammar.ide.contentassist.antlr.EffortsParser; +import workload.xtext_grammar.ide.contentassist.antlr.PartialEffortsContentAssistParser; +import workload.xtext_grammar.ide.contentassist.antlr.internal.InternalEffortsLexer; +import workload.xtext_grammar.ui.contentassist.EffortsProposalProvider; +import workload.xtext_grammar.ui.labeling.EffortsDescriptionLabelProvider; +import workload.xtext_grammar.ui.labeling.EffortsLabelProvider; +import workload.xtext_grammar.ui.outline.EffortsOutlineTreeProvider; +import workload.xtext_grammar.ui.quickfix.EffortsQuickfixProvider; +import workload.xtext_grammar.validation.EffortsValidatorConfigurationBlock; + +/** + * Manual modifications go to {@link EffortsUiModule}. + */ +@SuppressWarnings("all") +public abstract class AbstractEffortsUiModule extends DefaultUiModule { + + public AbstractEffortsUiModule(AbstractUIPlugin plugin) { + super(plugin); + } + + // contributed by org.eclipse.xtext.xtext.generator.ImplicitFragment + public Provider provideIAllContainersState() { + return Access.getJavaProjectsState(); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIProposalConflictHelper() { + return AntlrProposalConflictHelper.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureContentAssistLexer(Binder binder) { + binder.bind(Lexer.class) + .annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST)) + .to(InternalEffortsLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureHighlightingLexer(Binder binder) { + binder.bind(org.eclipse.xtext.parser.antlr.Lexer.class) + .annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING)) + .to(workload.xtext_grammar.parser.antlr.internal.InternalEffortsLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureHighlightingTokenDefProvider(Binder binder) { + binder.bind(ITokenDefProvider.class) + .annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING)) + .to(AntlrTokenDefProvider.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindContentAssistContext$Factory() { + return DelegatingContentAssistContextFactory.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIContentAssistParser() { + return EffortsParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureContentAssistLexerProvider(Binder binder) { + binder.bind(InternalEffortsLexer.class).toProvider(LexerProvider.create(InternalEffortsLexer.class)); + } + + // contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2 + public Class bindAbstractValidatorConfigurationBlock() { + return EffortsValidatorConfigurationBlock.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 + public Class bindPrefixMatcher() { + return FQNPrefixMatcher.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 + public Class bindIDependentElementsCalculator() { + return DefaultDependentElementsCalculator.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptionsBuilderScope(Binder binder) { + binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE)).to(CurrentDescriptions.ResourceSetAware.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIXtextEditorCallback() { + return NatureAddingEditorCallback.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIContextualOutputConfigurationProvider() { + return EclipseOutputConfigurationProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptionsPersisted(Binder binder) { + binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(IBuilderState.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindDocumentBasedDirtyResource() { + return PersistentDataAwareDirtyResource.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2 + public Class bindIXtextBuilderParticipant() { + return BuilderParticipant.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2 + public IWorkspaceRoot bindIWorkspaceRootToInstance() { + return ResourcesPlugin.getWorkspace().getRoot(); + } + + // contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2 + public void configureBuilderPreferenceStoreInitializer(Binder binder) { + binder.bind(IPreferenceStoreInitializer.class) + .annotatedWith(Names.named("builderPreferenceInitializer")) + .to(BuilderPreferenceAccess.Initializer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2 + public Class bindIContentFormatterFactory() { + return ContentFormatterFactory.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.labeling.LabelProviderFragment2 + public Class bindILabelProvider() { + return EffortsLabelProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.labeling.LabelProviderFragment2 + public void configureResourceUIServiceLabelProvider(Binder binder) { + binder.bind(ILabelProvider.class).annotatedWith(ResourceServiceDescriptionLabelProvider.class).to(EffortsDescriptionLabelProvider.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.outline.OutlineTreeProviderFragment2 + public Class bindIOutlineTreeProvider() { + return EffortsOutlineTreeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.outline.OutlineTreeProviderFragment2 + public Class bindIOutlineTreeStructureProvider() { + return EffortsOutlineTreeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.quickfix.QuickfixProviderFragment2 + public Class bindIssueResolutionProvider() { + return EffortsQuickfixProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.contentAssist.ContentAssistFragment2 + public Class bindIContentProposalProvider() { + return EffortsProposalProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2 + public void configureIPreferenceStoreInitializer(Binder binder) { + binder.bind(IPreferenceStoreInitializer.class) + .annotatedWith(Names.named("RefactoringPreferences")) + .to(RefactoringPreferences.Initializer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2 + public Class bindIRenameStrategy() { + return DefaultRenameStrategy.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2 + public Class bindIReferenceUpdater() { + return DefaultReferenceUpdater.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2 + public Class bindIRenameRefactoringProvider() { + return DefaultRenameRefactoringProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2 + public Class bindIRenameSupport$Factory() { + return DefaultRenameSupport.Factory.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 + public Provider provideTemplatesLanguageConfiguration() { + return AccessibleCodetemplatesActivator.getTemplatesLanguageConfigurationProvider(); + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 + public Provider provideLanguageRegistry() { + return AccessibleCodetemplatesActivator.getLanguageRegistry(); + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 + @SingletonBinding(eager=true) + public Class bindLanguageRegistrar() { + return LanguageRegistrar.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 + public Class bindXtextTemplatePreferencePage() { + return AdvancedTemplatesPreferencePage.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 + public Class bindIPartialEditingContentAssistParser() { + return PartialEffortsContentAssistParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 + public Class bindIPartialEditingContentAssistContextFactory() { + return PartialEditingContentAssistContextFactory.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.compare.CompareFragment2 + public Class bindIViewerCreator() { + return DefaultViewerCreator.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.ui.compare.CompareFragment2 + public void configureCompareViewerTitle(Binder binder) { + binder.bind(String.class).annotatedWith(Names.named(UIBindings.COMPARE_VIEWER_TITLE)).toInstance("Efforts Compare"); + } + +} diff --git a/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/EffortsExecutableExtensionFactory.java b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/EffortsExecutableExtensionFactory.java new file mode 100644 index 0000000..dd223da --- /dev/null +++ b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/EffortsExecutableExtensionFactory.java @@ -0,0 +1,29 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui; + +import com.google.inject.Injector; +import org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; +import workload.xtext_grammar.ui.internal.Xtext_grammarActivator; + +/** + * This class was generated. Customizations should only happen in a newly + * introduced subclass. + */ +public class EffortsExecutableExtensionFactory extends AbstractGuiceAwareExecutableExtensionFactory { + + @Override + protected Bundle getBundle() { + return FrameworkUtil.getBundle(Xtext_grammarActivator.class); + } + + @Override + protected Injector getInjector() { + Xtext_grammarActivator activator = Xtext_grammarActivator.getInstance(); + return activator != null ? activator.getInjector(Xtext_grammarActivator.WORKLOAD_XTEXT_GRAMMAR_EFFORTS) : null; + } + +} diff --git a/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/contentassist/AbstractEffortsProposalProvider.java b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/contentassist/AbstractEffortsProposalProvider.java new file mode 100644 index 0000000..8384bec --- /dev/null +++ b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/contentassist/AbstractEffortsProposalProvider.java @@ -0,0 +1,40 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui.contentassist; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.Assignment; +import org.eclipse.xtext.CrossReference; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider; +import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext; +import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor; + +/** + * Represents a generated, default implementation of superclass {@link TerminalsProposalProvider}. + * Methods are dynamically dispatched on the first parameter, i.e., you can override them + * with a more concrete subtype. + */ +public abstract class AbstractEffortsProposalProvider extends TerminalsProposalProvider { + + public void completeMain_Efforts(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); + } + public void completeEffort_Person(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); + } + public void completeEffort_Months(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); + } + + public void complete_Main(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + // subclasses may override + } + public void complete_Effort(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + // subclasses may override + } + public void complete_NEWLINE(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + // subclasses may override + } +} diff --git a/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/internal/Xtext_grammarActivator.java b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/internal/Xtext_grammarActivator.java new file mode 100644 index 0000000..6b3719f --- /dev/null +++ b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/ui/internal/Xtext_grammarActivator.java @@ -0,0 +1,94 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui.internal; + +import com.google.common.collect.Maps; +import com.google.inject.Guice; +import com.google.inject.Injector; +import java.util.Collections; +import java.util.Map; +import org.apache.log4j.Logger; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.xtext.ui.shared.SharedStateModule; +import org.eclipse.xtext.util.Modules2; +import org.osgi.framework.BundleContext; +import workload.xtext_grammar.EffortsRuntimeModule; +import workload.xtext_grammar.ui.EffortsUiModule; + +/** + * This class was generated. Customizations should only happen in a newly + * introduced subclass. + */ +public class Xtext_grammarActivator extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "workload.xtext_grammar.ui"; + public static final String WORKLOAD_XTEXT_GRAMMAR_EFFORTS = "workload.xtext_grammar.Efforts"; + + private static final Logger logger = Logger.getLogger(Xtext_grammarActivator.class); + + private static Xtext_grammarActivator INSTANCE; + + private Map injectors = Collections.synchronizedMap(Maps. newHashMapWithExpectedSize(1)); + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + INSTANCE = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + injectors.clear(); + INSTANCE = null; + super.stop(context); + } + + public static Xtext_grammarActivator getInstance() { + return INSTANCE; + } + + public Injector getInjector(String language) { + synchronized (injectors) { + Injector injector = injectors.get(language); + if (injector == null) { + injectors.put(language, injector = createInjector(language)); + } + return injector; + } + } + + protected Injector createInjector(String language) { + try { + com.google.inject.Module runtimeModule = getRuntimeModule(language); + com.google.inject.Module sharedStateModule = getSharedStateModule(); + com.google.inject.Module uiModule = getUiModule(language); + com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule); + return Guice.createInjector(mergedModule); + } catch (Exception e) { + logger.error("Failed to create injector for " + language); + logger.error(e.getMessage(), e); + throw new RuntimeException("Failed to create injector for " + language, e); + } + } + + protected com.google.inject.Module getRuntimeModule(String grammar) { + if (WORKLOAD_XTEXT_GRAMMAR_EFFORTS.equals(grammar)) { + return new EffortsRuntimeModule(); + } + throw new IllegalArgumentException(grammar); + } + + protected com.google.inject.Module getUiModule(String grammar) { + if (WORKLOAD_XTEXT_GRAMMAR_EFFORTS.equals(grammar)) { + return new EffortsUiModule(this); + } + throw new IllegalArgumentException(grammar); + } + + protected com.google.inject.Module getSharedStateModule() { + return new SharedStateModule(); + } + + +} diff --git a/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/validation/EffortsValidatorConfigurationBlock.java b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/validation/EffortsValidatorConfigurationBlock.java new file mode 100644 index 0000000..be745bb --- /dev/null +++ b/workload.xtext_grammar.ui/src-gen/workload/xtext_grammar/validation/EffortsValidatorConfigurationBlock.java @@ -0,0 +1,35 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.validation; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.xtext.ui.validation.AbstractValidatorConfigurationBlock; + +@SuppressWarnings("restriction") +public class EffortsValidatorConfigurationBlock extends AbstractValidatorConfigurationBlock { + + protected static final String SETTINGS_SECTION_NAME = "Efforts"; + + @Override + protected void fillSettingsPage(Composite composite, int nColumns, int defaultIndent) { + addComboBox(EffortsConfigurableIssueCodesProvider.DEPRECATED_MODEL_PART, "Deprecated Model Part", composite, defaultIndent); + } + + @Override + public void dispose() { + storeSectionExpansionStates(getDialogSettings()); + super.dispose(); + } + + @Override + protected IDialogSettings getDialogSettings() { + IDialogSettings dialogSettings = super.getDialogSettings(); + IDialogSettings section = dialogSettings.getSection(SETTINGS_SECTION_NAME); + if (section == null) { + return dialogSettings.addNewSection(SETTINGS_SECTION_NAME); + } + return section; + } +} diff --git a/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/EffortsUiModule.java b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/EffortsUiModule.java new file mode 100644 index 0000000..cb5fc3b --- /dev/null +++ b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/EffortsUiModule.java @@ -0,0 +1,16 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui; + +import org.eclipse.ui.plugin.AbstractUIPlugin; + +/** + * Use this class to register components to be used within the Eclipse IDE. + */ +public class EffortsUiModule extends AbstractEffortsUiModule { + + public EffortsUiModule(AbstractUIPlugin plugin) { + super(plugin); + } +} diff --git a/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/contentassist/EffortsProposalProvider.java b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/contentassist/EffortsProposalProvider.java new file mode 100644 index 0000000..71d1dd1 --- /dev/null +++ b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/contentassist/EffortsProposalProvider.java @@ -0,0 +1,12 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui.contentassist; + + +/** + * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#content-assist + * on how to customize the content assistant. + */ +public class EffortsProposalProvider extends AbstractEffortsProposalProvider { +} diff --git a/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/labeling/EffortsDescriptionLabelProvider.java b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/labeling/EffortsDescriptionLabelProvider.java new file mode 100644 index 0000000..4ba9512 --- /dev/null +++ b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/labeling/EffortsDescriptionLabelProvider.java @@ -0,0 +1,25 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui.labeling; + +import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider; + +/** + * Provides labels for IEObjectDescriptions and IResourceDescriptions. + * + * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#label-provider + */ +public class EffortsDescriptionLabelProvider extends DefaultDescriptionLabelProvider { + + // Labels and icons can be computed like this: +// @Override +// public String text(IEObjectDescription ele) { +// return ele.getName().toString(); +// } +// +// @Override +// public String image(IEObjectDescription ele) { +// return ele.getEClass().getName() + ".gif"; +// } +} diff --git a/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/labeling/EffortsLabelProvider.java b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/labeling/EffortsLabelProvider.java new file mode 100644 index 0000000..aa0251e --- /dev/null +++ b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/labeling/EffortsLabelProvider.java @@ -0,0 +1,31 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui.labeling; + +import com.google.inject.Inject; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider; + +/** + * Provides labels for EObjects. + * + * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#label-provider + */ +public class EffortsLabelProvider extends DefaultEObjectLabelProvider { + + @Inject + public EffortsLabelProvider(AdapterFactoryLabelProvider delegate) { + super(delegate); + } + + // Labels and icons can be computed like this: + +// String text(Greeting ele) { +// return "A greeting to " + ele.getName(); +// } +// +// String image(Greeting ele) { +// return "Greeting.gif"; +// } +} diff --git a/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/outline/EffortsOutlineTreeProvider.java b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/outline/EffortsOutlineTreeProvider.java new file mode 100644 index 0000000..e5f06a5 --- /dev/null +++ b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/outline/EffortsOutlineTreeProvider.java @@ -0,0 +1,15 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui.outline; + +import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; + +/** + * Customization of the default outline structure. + * + * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#outline + */ +public class EffortsOutlineTreeProvider extends DefaultOutlineTreeProvider { + +} diff --git a/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/quickfix/EffortsQuickfixProvider.java b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/quickfix/EffortsQuickfixProvider.java new file mode 100644 index 0000000..31363b4 --- /dev/null +++ b/workload.xtext_grammar.ui/src/workload/xtext_grammar/ui/quickfix/EffortsQuickfixProvider.java @@ -0,0 +1,26 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.ui.quickfix; + +import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider; + +/** + * Custom quickfixes. + * + * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#quick-fixes + */ +public class EffortsQuickfixProvider extends DefaultQuickfixProvider { + +// @Fix(EffortsValidator.INVALID_NAME) +// public void capitalizeName(final Issue issue, IssueResolutionAcceptor acceptor) { +// acceptor.accept(issue, "Capitalize name", "Capitalize the name.", "upcase.png", new IModification() { +// public void apply(IModificationContext context) throws BadLocationException { +// IXtextDocument xtextDocument = context.getXtextDocument(); +// String firstLetter = xtextDocument.get(issue.getOffset(), 1); +// xtextDocument.replace(issue.getOffset(), 1, firstLetter.toUpperCase()); +// } +// }); +// } + +} diff --git a/workload.xtext_grammar/.antlr-generator-3.2.0-patch.jar b/workload.xtext_grammar/.antlr-generator-3.2.0-patch.jar new file mode 100644 index 0000000..90516fd Binary files /dev/null and b/workload.xtext_grammar/.antlr-generator-3.2.0-patch.jar differ diff --git a/workload.xtext_grammar/.classpath b/workload.xtext_grammar/.classpath new file mode 100644 index 0000000..a613544 --- /dev/null +++ b/workload.xtext_grammar/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/workload.xtext_grammar/.launch/Generate Efforts (eff) Language Infrastructure.launch b/workload.xtext_grammar/.launch/Generate Efforts (eff) Language Infrastructure.launch new file mode 100644 index 0000000..26f35a5 --- /dev/null +++ b/workload.xtext_grammar/.launch/Generate Efforts (eff) Language Infrastructure.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/workload.xtext_grammar/.launch/Launch Runtime Eclipse.launch b/workload.xtext_grammar/.launch/Launch Runtime Eclipse.launch new file mode 100644 index 0000000..440cb7e --- /dev/null +++ b/workload.xtext_grammar/.launch/Launch Runtime Eclipse.launch @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workload.xtext_grammar/.project b/workload.xtext_grammar/.project new file mode 100644 index 0000000..41bae3a --- /dev/null +++ b/workload.xtext_grammar/.project @@ -0,0 +1,34 @@ + + + workload.xtext_grammar + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.xtext.ui.shared.xtextNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workload.xtext_grammar/.settings/org.eclipse.core.resources.prefs b/workload.xtext_grammar/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/workload.xtext_grammar/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/workload.xtext_grammar/.settings/org.eclipse.jdt.core.prefs b/workload.xtext_grammar/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7adc0fb --- /dev/null +++ b/workload.xtext_grammar/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/workload.xtext_grammar/META-INF/MANIFEST.MF b/workload.xtext_grammar/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c85cfa7 --- /dev/null +++ b/workload.xtext_grammar/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Automatic-Module-Name: workload.xtext_grammar +Bundle-ManifestVersion: 2 +Bundle-Name: workload.xtext_grammar +Bundle-Vendor: My Company +Bundle-Version: 1.0.0.qualifier +Bundle-SymbolicName: workload.xtext_grammar; singleton:=true +Bundle-ActivationPolicy: lazy +Require-Bundle: workload.emf, + org.eclipse.xtext, + org.eclipse.xtext.xbase, + org.eclipse.equinox.common;bundle-version="3.16.0", + org.eclipse.xtext.xbase.lib;bundle-version="2.14.0", + org.eclipse.xtext.util, + org.antlr.runtime;bundle-version="[3.2.0,3.2.1)", + graphite;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: workload.xtext_grammar.generator, + workload.xtext_grammar.serializer, + workload.xtext_grammar.parser.antlr.internal, + workload.xtext_grammar, + workload.xtext_grammar.formatting2, + workload.xtext_grammar.scoping, + workload.xtext_grammar.parser.antlr, + workload.xtext_grammar.validation, + workload.xtext_grammar.services +Import-Package: org.apache.log4j diff --git a/workload.xtext_grammar/build.properties b/workload.xtext_grammar/build.properties new file mode 100644 index 0000000..c24ff36 --- /dev/null +++ b/workload.xtext_grammar/build.properties @@ -0,0 +1,17 @@ +source.. = src/,\ + src-gen/,\ + xtend-gen/ +bin.includes = .,\ + META-INF/ +bin.excludes = **/*.mwe2,\ + **/*.xtend +additional.bundles = org.eclipse.xtext.xbase,\ + org.eclipse.xtext.common.types,\ + org.eclipse.xtext.xtext.generator,\ + org.eclipse.emf.codegen.ecore,\ + org.eclipse.emf.mwe.utils,\ + org.eclipse.emf.mwe2.launch,\ + org.eclipse.emf.mwe2.lib,\ + org.objectweb.asm,\ + org.apache.commons.logging,\ + org.apache.log4j diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/AbstractEffortsRuntimeModule.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/AbstractEffortsRuntimeModule.java new file mode 100644 index 0000000..68916a4 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/AbstractEffortsRuntimeModule.java @@ -0,0 +1,223 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar; + +import com.google.inject.Binder; +import com.google.inject.Provider; +import com.google.inject.name.Names; +import java.util.Properties; +import org.eclipse.xtext.Constants; +import org.eclipse.xtext.IGrammarAccess; +import org.eclipse.xtext.common.services.Ecore2XtextTerminalConverters; +import org.eclipse.xtext.conversion.IValueConverterService; +import org.eclipse.xtext.formatting2.FormatterPreferenceValuesProvider; +import org.eclipse.xtext.formatting2.FormatterPreferences; +import org.eclipse.xtext.formatting2.IFormatter2; +import org.eclipse.xtext.generator.IGenerator2; +import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider; +import org.eclipse.xtext.naming.IQualifiedNameProvider; +import org.eclipse.xtext.parser.IParser; +import org.eclipse.xtext.parser.ITokenToStringConverter; +import org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider; +import org.eclipse.xtext.parser.antlr.AntlrTokenToStringConverter; +import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; +import org.eclipse.xtext.parser.antlr.ITokenDefProvider; +import org.eclipse.xtext.parser.antlr.Lexer; +import org.eclipse.xtext.parser.antlr.LexerBindings; +import org.eclipse.xtext.parser.antlr.LexerProvider; +import org.eclipse.xtext.preferences.IPreferenceValuesProvider; +import org.eclipse.xtext.resource.IContainer; +import org.eclipse.xtext.resource.IResourceDescriptions; +import org.eclipse.xtext.resource.containers.IAllContainersState; +import org.eclipse.xtext.resource.containers.ResourceSetBasedAllContainersStateProvider; +import org.eclipse.xtext.resource.containers.StateBasedContainerManager; +import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; +import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions; +import org.eclipse.xtext.scoping.IGlobalScopeProvider; +import org.eclipse.xtext.scoping.IScopeProvider; +import org.eclipse.xtext.scoping.IgnoreCaseLinking; +import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; +import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider; +import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider; +import org.eclipse.xtext.serializer.ISerializer; +import org.eclipse.xtext.serializer.impl.Serializer; +import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; +import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer; +import org.eclipse.xtext.service.DefaultRuntimeModule; +import org.eclipse.xtext.service.SingletonBinding; +import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider; +import workload.xtext_grammar.formatting2.EffortsFormatter; +import workload.xtext_grammar.generator.EffortsGenerator; +import workload.xtext_grammar.parser.antlr.EffortsAntlrTokenFileProvider; +import workload.xtext_grammar.parser.antlr.EffortsParser; +import workload.xtext_grammar.parser.antlr.internal.InternalEffortsLexer; +import workload.xtext_grammar.scoping.EffortsScopeProvider; +import workload.xtext_grammar.serializer.EffortsSemanticSequencer; +import workload.xtext_grammar.serializer.EffortsSyntacticSequencer; +import workload.xtext_grammar.services.EffortsGrammarAccess; +import workload.xtext_grammar.validation.EffortsConfigurableIssueCodesProvider; +import workload.xtext_grammar.validation.EffortsValidator; + +/** + * Manual modifications go to {@link EffortsRuntimeModule}. + */ +@SuppressWarnings("all") +public abstract class AbstractEffortsRuntimeModule extends DefaultRuntimeModule { + + protected Properties properties = null; + + @Override + public void configure(Binder binder) { + properties = tryBindProperties(binder, "workload/xtext_grammar/Efforts.properties"); + super.configure(binder); + } + + public void configureLanguageName(Binder binder) { + binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("workload.xtext_grammar.Efforts"); + } + + public void configureFileExtensions(Binder binder) { + if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null) + binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("eff"); + } + + // contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2 + public ClassLoader bindClassLoaderToInstance() { + return getClass().getClassLoader(); + } + + // contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2 + public Class bindIGrammarAccess() { + return EffortsGrammarAccess.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISemanticSequencer() { + return EffortsSemanticSequencer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISyntacticSequencer() { + return EffortsSyntacticSequencer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISerializer() { + return Serializer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIParser() { + return EffortsParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindITokenToStringConverter() { + return AntlrTokenToStringConverter.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIAntlrTokenFileProvider() { + return EffortsAntlrTokenFileProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindLexer() { + return InternalEffortsLexer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindITokenDefProvider() { + return AntlrTokenDefProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Provider provideInternalEffortsLexer() { + return LexerProvider.create(InternalEffortsLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureRuntimeLexer(Binder binder) { + binder.bind(Lexer.class) + .annotatedWith(Names.named(LexerBindings.RUNTIME)) + .to(InternalEffortsLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2 + @SingletonBinding(eager=true) + public Class bindEffortsValidator() { + return EffortsValidator.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2 + public Class bindConfigurableIssueCodesProvider() { + return EffortsConfigurableIssueCodesProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public Class bindIScopeProvider() { + return EffortsScopeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public void configureIScopeProviderDelegate(Binder binder) { + binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public Class bindIGlobalScopeProvider() { + return DefaultGlobalScopeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public void configureIgnoreCaseLinking(Binder binder) { + binder.bindConstant().annotatedWith(IgnoreCaseLinking.class).to(false); + } + + // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 + public Class bindIQualifiedNameProvider() { + return DefaultDeclarativeQualifiedNameProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIContainer$Manager() { + return StateBasedContainerManager.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIAllContainersState$Provider() { + return ResourceSetBasedAllContainersStateProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptions(Binder binder) { + binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptionsPersisted(Binder binder) { + binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2 + public Class bindIGenerator2() { + return EffortsGenerator.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2 + public Class bindIFormatter2() { + return EffortsFormatter.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2 + public void configureFormatterPreferences(Binder binder) { + binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.ecore2xtext.Ecore2XtextValueConverterServiceFragment2 + public Class bindIValueConverterService() { + return Ecore2XtextTerminalConverters.class; + } + +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/Efforts.xtextbin b/workload.xtext_grammar/src-gen/workload/xtext_grammar/Efforts.xtextbin new file mode 100644 index 0000000..ac6ceba Binary files /dev/null and b/workload.xtext_grammar/src-gen/workload/xtext_grammar/Efforts.xtextbin differ diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/EffortsStandaloneSetupGenerated.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/EffortsStandaloneSetupGenerated.java new file mode 100644 index 0000000..04d2563 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/EffortsStandaloneSetupGenerated.java @@ -0,0 +1,37 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.ISetup; +import org.eclipse.xtext.common.TerminalsStandaloneSetup; +import org.eclipse.xtext.resource.IResourceFactory; +import org.eclipse.xtext.resource.IResourceServiceProvider; + +@SuppressWarnings("all") +public class EffortsStandaloneSetupGenerated implements ISetup { + + @Override + public Injector createInjectorAndDoEMFRegistration() { + TerminalsStandaloneSetup.doSetup(); + + Injector injector = createInjector(); + register(injector); + return injector; + } + + public Injector createInjector() { + return Guice.createInjector(new EffortsRuntimeModule()); + } + + public void register(Injector injector) { + IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class); + IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class); + + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("eff", resourceFactory); + IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("eff", serviceProvider); + } +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/EffortsAntlrTokenFileProvider.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/EffortsAntlrTokenFileProvider.java new file mode 100644 index 0000000..470701a --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/EffortsAntlrTokenFileProvider.java @@ -0,0 +1,16 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.parser.antlr; + +import java.io.InputStream; +import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; + +public class EffortsAntlrTokenFileProvider implements IAntlrTokenFileProvider { + + @Override + public InputStream getAntlrTokenFile() { + ClassLoader classLoader = getClass().getClassLoader(); + return classLoader.getResourceAsStream("workload/xtext_grammar/parser/antlr/internal/InternalEfforts.tokens"); + } +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/EffortsParser.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/EffortsParser.java new file mode 100644 index 0000000..d60d1bf --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/EffortsParser.java @@ -0,0 +1,40 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.parser.antlr; + +import com.google.inject.Inject; +import org.eclipse.xtext.parser.antlr.AbstractAntlrParser; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import workload.xtext_grammar.parser.antlr.internal.InternalEffortsParser; +import workload.xtext_grammar.services.EffortsGrammarAccess; + +public class EffortsParser extends AbstractAntlrParser { + + @Inject + private EffortsGrammarAccess grammarAccess; + + @Override + protected void setInitialHiddenTokens(XtextTokenStream tokenStream) { + tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT"); + } + + + @Override + protected InternalEffortsParser createParser(XtextTokenStream stream) { + return new InternalEffortsParser(stream, getGrammarAccess()); + } + + @Override + protected String getDefaultRuleName() { + return "Main"; + } + + public EffortsGrammarAccess getGrammarAccess() { + return this.grammarAccess; + } + + public void setGrammarAccess(EffortsGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEfforts.g b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEfforts.g new file mode 100644 index 0000000..bd5629d --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEfforts.g @@ -0,0 +1,208 @@ +/* + * generated by Xtext 2.30.0 + */ +grammar InternalEfforts; + +options { + superClass=AbstractInternalAntlrParser; +} + +@lexer::header { +package workload.xtext_grammar.parser.antlr.internal; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.parser.antlr.Lexer; +} + +@parser::header { +package workload.xtext_grammar.parser.antlr.internal; + +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken; +import workload.xtext_grammar.services.EffortsGrammarAccess; + +} + +@parser::members { + + private EffortsGrammarAccess grammarAccess; + + public InternalEffortsParser(TokenStream input, EffortsGrammarAccess grammarAccess) { + this(input); + this.grammarAccess = grammarAccess; + registerRules(grammarAccess.getGrammar()); + } + + @Override + protected String getFirstRuleName() { + return "Main"; + } + + @Override + protected EffortsGrammarAccess getGrammarAccess() { + return grammarAccess; + } + +} + +@rulecatch { + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } +} + +// Entry rule entryRuleMain +entryRuleMain returns [EObject current=null]: + { newCompositeNode(grammarAccess.getMainRule()); } + iv_ruleMain=ruleMain + { $current=$iv_ruleMain.current; } + EOF; + +// Rule Main +ruleMain returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + { + $current = forceCreateModelElement( + grammarAccess.getMainAccess().getTaskAction_0(), + $current); + } + ) + ( + ( + { + newCompositeNode(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_1_0()); + } + lv_efforts_1_0=ruleEffort + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getMainRule()); + } + add( + $current, + "efforts", + lv_efforts_1_0, + "workload.xtext_grammar.Efforts.Effort"); + afterParserOrEnumRuleCall(); + } + ) + ) + ( + this_NEWLINE_2=RULE_NEWLINE + { + newLeafNode(this_NEWLINE_2, grammarAccess.getMainAccess().getNEWLINETerminalRuleCall_2_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_2_1_0()); + } + lv_efforts_3_0=ruleEffort + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getMainRule()); + } + add( + $current, + "efforts", + lv_efforts_3_0, + "workload.xtext_grammar.Efforts.Effort"); + afterParserOrEnumRuleCall(); + } + ) + ) + )* + ) +; + +// Entry rule entryRuleEffort +entryRuleEffort returns [EObject current=null]: + { newCompositeNode(grammarAccess.getEffortRule()); } + iv_ruleEffort=ruleEffort + { $current=$iv_ruleEffort.current; } + EOF; + +// Rule Effort +ruleEffort returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + { + $current = forceCreateModelElement( + grammarAccess.getEffortAccess().getEffortAction_0(), + $current); + } + ) + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getEffortRule()); + } + } + otherlv_1=RULE_ID + { + newLeafNode(otherlv_1, grammarAccess.getEffortAccess().getPersonPersonCrossReference_1_0()); + } + ) + )? + otherlv_2=':' + { + newLeafNode(otherlv_2, grammarAccess.getEffortAccess().getColonKeyword_2()); + } + ( + ( + lv_months_3_0=RULE_INT + { + newLeafNode(lv_months_3_0, grammarAccess.getEffortAccess().getMonthsINTTerminalRuleCall_3_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getEffortRule()); + } + setWithLastConsumed( + $current, + "months", + lv_months_3_0, + "org.eclipse.xtext.common.Terminals.INT"); + } + ) + ) + ) +; + +RULE_NEWLINE : (' '|'\t')* '\r'? '\n' (' '|'\t')*; + +RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; + +RULE_INT : ('0'..'9')+; + +RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\''); + +RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; + +RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?; + +RULE_WS : (' '|'\t'|'\r'|'\n')+; + +RULE_ANY_OTHER : .; diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEfforts.tokens b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEfforts.tokens new file mode 100644 index 0000000..2701e2b --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEfforts.tokens @@ -0,0 +1,10 @@ +':'=12 +RULE_ANY_OTHER=11 +RULE_ID=5 +RULE_INT=6 +RULE_ML_COMMENT=8 +RULE_NEWLINE=4 +RULE_SL_COMMENT=9 +RULE_STRING=7 +RULE_WS=10 +T__12=12 diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEffortsLexer.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEffortsLexer.java new file mode 100644 index 0000000..74f5df8 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEffortsLexer.java @@ -0,0 +1,868 @@ +package workload.xtext_grammar.parser.antlr.internal; + +// Hack: Use our own Lexer superclass by means of import. +// Currently there is no other way to specify the superclass for the lexer. +import org.eclipse.xtext.parser.antlr.Lexer; + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalEffortsLexer extends Lexer { + public static final int RULE_ID=5; + public static final int RULE_WS=10; + public static final int RULE_NEWLINE=4; + public static final int RULE_STRING=7; + public static final int RULE_ANY_OTHER=11; + public static final int RULE_SL_COMMENT=9; + public static final int RULE_INT=6; + public static final int RULE_ML_COMMENT=8; + public static final int T__12=12; + public static final int EOF=-1; + + // delegates + // delegators + + public InternalEffortsLexer() {;} + public InternalEffortsLexer(CharStream input) { + this(input, new RecognizerSharedState()); + } + public InternalEffortsLexer(CharStream input, RecognizerSharedState state) { + super(input,state); + + } + public String getGrammarFileName() { return "InternalEfforts.g"; } + + // $ANTLR start "T__12" + public final void mT__12() throws RecognitionException { + try { + int _type = T__12; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:11:7: ( ':' ) + // InternalEfforts.g:11:9: ':' + { + match(':'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__12" + + // $ANTLR start "RULE_NEWLINE" + public final void mRULE_NEWLINE() throws RecognitionException { + try { + int _type = RULE_NEWLINE; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:194:14: ( ( ' ' | '\\t' )* ( '\\r' )? '\\n' ( ' ' | '\\t' )* ) + // InternalEfforts.g:194:16: ( ' ' | '\\t' )* ( '\\r' )? '\\n' ( ' ' | '\\t' )* + { + // InternalEfforts.g:194:16: ( ' ' | '\\t' )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0=='\t'||LA1_0==' ') ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalEfforts.g: + { + if ( input.LA(1)=='\t'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop1; + } + } while (true); + + // InternalEfforts.g:194:28: ( '\\r' )? + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0=='\r') ) { + alt2=1; + } + switch (alt2) { + case 1 : + // InternalEfforts.g:194:28: '\\r' + { + match('\r'); + + } + break; + + } + + match('\n'); + // InternalEfforts.g:194:39: ( ' ' | '\\t' )* + loop3: + do { + int alt3=2; + int LA3_0 = input.LA(1); + + if ( (LA3_0=='\t'||LA3_0==' ') ) { + alt3=1; + } + + + switch (alt3) { + case 1 : + // InternalEfforts.g: + { + if ( input.LA(1)=='\t'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop3; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_NEWLINE" + + // $ANTLR start "RULE_ID" + public final void mRULE_ID() throws RecognitionException { + try { + int _type = RULE_ID; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:196:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // InternalEfforts.g:196:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + { + // InternalEfforts.g:196:11: ( '^' )? + int alt4=2; + int LA4_0 = input.LA(1); + + if ( (LA4_0=='^') ) { + alt4=1; + } + switch (alt4) { + case 1 : + // InternalEfforts.g:196:11: '^' + { + match('^'); + + } + break; + + } + + if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + // InternalEfforts.g:196:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + loop5: + do { + int alt5=2; + int LA5_0 = input.LA(1); + + if ( ((LA5_0>='0' && LA5_0<='9')||(LA5_0>='A' && LA5_0<='Z')||LA5_0=='_'||(LA5_0>='a' && LA5_0<='z')) ) { + alt5=1; + } + + + switch (alt5) { + case 1 : + // InternalEfforts.g: + { + if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop5; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ID" + + // $ANTLR start "RULE_INT" + public final void mRULE_INT() throws RecognitionException { + try { + int _type = RULE_INT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:198:10: ( ( '0' .. '9' )+ ) + // InternalEfforts.g:198:12: ( '0' .. '9' )+ + { + // InternalEfforts.g:198:12: ( '0' .. '9' )+ + int cnt6=0; + loop6: + do { + int alt6=2; + int LA6_0 = input.LA(1); + + if ( ((LA6_0>='0' && LA6_0<='9')) ) { + alt6=1; + } + + + switch (alt6) { + case 1 : + // InternalEfforts.g:198:13: '0' .. '9' + { + matchRange('0','9'); + + } + break; + + default : + if ( cnt6 >= 1 ) break loop6; + EarlyExitException eee = + new EarlyExitException(6, input); + throw eee; + } + cnt6++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_INT" + + // $ANTLR start "RULE_STRING" + public final void mRULE_STRING() throws RecognitionException { + try { + int _type = RULE_STRING; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:200:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // InternalEfforts.g:200:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + { + // InternalEfforts.g:200:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + int alt9=2; + int LA9_0 = input.LA(1); + + if ( (LA9_0=='\"') ) { + alt9=1; + } + else if ( (LA9_0=='\'') ) { + alt9=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 9, 0, input); + + throw nvae; + } + switch (alt9) { + case 1 : + // InternalEfforts.g:200:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' + { + match('\"'); + // InternalEfforts.g:200:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* + loop7: + do { + int alt7=3; + int LA7_0 = input.LA(1); + + if ( (LA7_0=='\\') ) { + alt7=1; + } + else if ( ((LA7_0>='\u0000' && LA7_0<='!')||(LA7_0>='#' && LA7_0<='[')||(LA7_0>=']' && LA7_0<='\uFFFF')) ) { + alt7=2; + } + + + switch (alt7) { + case 1 : + // InternalEfforts.g:200:21: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalEfforts.g:200:28: ~ ( ( '\\\\' | '\"' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop7; + } + } while (true); + + match('\"'); + + } + break; + case 2 : + // InternalEfforts.g:200:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + { + match('\''); + // InternalEfforts.g:200:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* + loop8: + do { + int alt8=3; + int LA8_0 = input.LA(1); + + if ( (LA8_0=='\\') ) { + alt8=1; + } + else if ( ((LA8_0>='\u0000' && LA8_0<='&')||(LA8_0>='(' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFF')) ) { + alt8=2; + } + + + switch (alt8) { + case 1 : + // InternalEfforts.g:200:54: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalEfforts.g:200:61: ~ ( ( '\\\\' | '\\'' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop8; + } + } while (true); + + match('\''); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_STRING" + + // $ANTLR start "RULE_ML_COMMENT" + public final void mRULE_ML_COMMENT() throws RecognitionException { + try { + int _type = RULE_ML_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:202:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // InternalEfforts.g:202:19: '/*' ( options {greedy=false; } : . )* '*/' + { + match("/*"); + + // InternalEfforts.g:202:24: ( options {greedy=false; } : . )* + loop10: + do { + int alt10=2; + int LA10_0 = input.LA(1); + + if ( (LA10_0=='*') ) { + int LA10_1 = input.LA(2); + + if ( (LA10_1=='/') ) { + alt10=2; + } + else if ( ((LA10_1>='\u0000' && LA10_1<='.')||(LA10_1>='0' && LA10_1<='\uFFFF')) ) { + alt10=1; + } + + + } + else if ( ((LA10_0>='\u0000' && LA10_0<=')')||(LA10_0>='+' && LA10_0<='\uFFFF')) ) { + alt10=1; + } + + + switch (alt10) { + case 1 : + // InternalEfforts.g:202:52: . + { + matchAny(); + + } + break; + + default : + break loop10; + } + } while (true); + + match("*/"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ML_COMMENT" + + // $ANTLR start "RULE_SL_COMMENT" + public final void mRULE_SL_COMMENT() throws RecognitionException { + try { + int _type = RULE_SL_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:204:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) + // InternalEfforts.g:204:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? + { + match("//"); + + // InternalEfforts.g:204:24: (~ ( ( '\\n' | '\\r' ) ) )* + loop11: + do { + int alt11=2; + int LA11_0 = input.LA(1); + + if ( ((LA11_0>='\u0000' && LA11_0<='\t')||(LA11_0>='\u000B' && LA11_0<='\f')||(LA11_0>='\u000E' && LA11_0<='\uFFFF')) ) { + alt11=1; + } + + + switch (alt11) { + case 1 : + // InternalEfforts.g:204:24: ~ ( ( '\\n' | '\\r' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop11; + } + } while (true); + + // InternalEfforts.g:204:40: ( ( '\\r' )? '\\n' )? + int alt13=2; + int LA13_0 = input.LA(1); + + if ( (LA13_0=='\n'||LA13_0=='\r') ) { + alt13=1; + } + switch (alt13) { + case 1 : + // InternalEfforts.g:204:41: ( '\\r' )? '\\n' + { + // InternalEfforts.g:204:41: ( '\\r' )? + int alt12=2; + int LA12_0 = input.LA(1); + + if ( (LA12_0=='\r') ) { + alt12=1; + } + switch (alt12) { + case 1 : + // InternalEfforts.g:204:41: '\\r' + { + match('\r'); + + } + break; + + } + + match('\n'); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_SL_COMMENT" + + // $ANTLR start "RULE_WS" + public final void mRULE_WS() throws RecognitionException { + try { + int _type = RULE_WS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:206:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // InternalEfforts.g:206:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + { + // InternalEfforts.g:206:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + int cnt14=0; + loop14: + do { + int alt14=2; + int LA14_0 = input.LA(1); + + if ( ((LA14_0>='\t' && LA14_0<='\n')||LA14_0=='\r'||LA14_0==' ') ) { + alt14=1; + } + + + switch (alt14) { + case 1 : + // InternalEfforts.g: + { + if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + if ( cnt14 >= 1 ) break loop14; + EarlyExitException eee = + new EarlyExitException(14, input); + throw eee; + } + cnt14++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_WS" + + // $ANTLR start "RULE_ANY_OTHER" + public final void mRULE_ANY_OTHER() throws RecognitionException { + try { + int _type = RULE_ANY_OTHER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalEfforts.g:208:16: ( . ) + // InternalEfforts.g:208:18: . + { + matchAny(); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ANY_OTHER" + + public void mTokens() throws RecognitionException { + // InternalEfforts.g:1:8: ( T__12 | RULE_NEWLINE | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER ) + int alt15=9; + alt15 = dfa15.predict(input); + switch (alt15) { + case 1 : + // InternalEfforts.g:1:10: T__12 + { + mT__12(); + + } + break; + case 2 : + // InternalEfforts.g:1:16: RULE_NEWLINE + { + mRULE_NEWLINE(); + + } + break; + case 3 : + // InternalEfforts.g:1:29: RULE_ID + { + mRULE_ID(); + + } + break; + case 4 : + // InternalEfforts.g:1:37: RULE_INT + { + mRULE_INT(); + + } + break; + case 5 : + // InternalEfforts.g:1:46: RULE_STRING + { + mRULE_STRING(); + + } + break; + case 6 : + // InternalEfforts.g:1:58: RULE_ML_COMMENT + { + mRULE_ML_COMMENT(); + + } + break; + case 7 : + // InternalEfforts.g:1:74: RULE_SL_COMMENT + { + mRULE_SL_COMMENT(); + + } + break; + case 8 : + // InternalEfforts.g:1:90: RULE_WS + { + mRULE_WS(); + + } + break; + case 9 : + // InternalEfforts.g:1:98: RULE_ANY_OTHER + { + mRULE_ANY_OTHER(); + + } + break; + + } + + } + + + protected DFA15 dfa15 = new DFA15(this); + static final String DFA15_eotS = + "\2\uffff\2\15\1\22\1\13\2\uffff\3\13\3\uffff\1\15\1\22\1\15\1\22\6\uffff"; + static final String DFA15_eofS = + "\30\uffff"; + static final String DFA15_minS = + "\1\0\1\uffff\1\11\1\12\1\11\1\101\2\uffff\2\0\1\52\3\uffff\1\12\3\11\6\uffff"; + static final String DFA15_maxS = + "\1\uffff\1\uffff\1\40\1\12\1\40\1\172\2\uffff\2\uffff\1\57\3\uffff\1\12\3\40\6\uffff"; + static final String DFA15_acceptS = + "\1\uffff\1\1\4\uffff\1\3\1\4\3\uffff\1\11\1\1\1\10\4\uffff\1\2\1\3\1\4\1\5\1\6\1\7"; + static final String DFA15_specialS = + "\1\0\7\uffff\1\2\1\1\16\uffff}>"; + static final String[] DFA15_transitionS = { + "\11\13\1\2\1\4\2\13\1\3\22\13\1\2\1\13\1\10\4\13\1\11\7\13\1\12\12\7\1\1\6\13\32\6\3\13\1\5\1\6\1\13\32\6\uff85\13", + "", + "\1\20\1\17\2\uffff\1\16\22\uffff\1\20", + "\1\17", + "\1\21\1\15\2\uffff\1\15\22\uffff\1\21", + "\32\23\4\uffff\1\23\1\uffff\32\23", + "", + "", + "\0\25", + "\0\25", + "\1\26\4\uffff\1\27", + "", + "", + "", + "\1\17", + "\1\21\1\15\2\uffff\1\15\22\uffff\1\21", + "\1\20\1\17\2\uffff\1\16\22\uffff\1\20", + "\1\21\1\15\2\uffff\1\15\22\uffff\1\21", + "", + "", + "", + "", + "", + "" + }; + + static final short[] DFA15_eot = DFA.unpackEncodedString(DFA15_eotS); + static final short[] DFA15_eof = DFA.unpackEncodedString(DFA15_eofS); + static final char[] DFA15_min = DFA.unpackEncodedStringToUnsignedChars(DFA15_minS); + static final char[] DFA15_max = DFA.unpackEncodedStringToUnsignedChars(DFA15_maxS); + static final short[] DFA15_accept = DFA.unpackEncodedString(DFA15_acceptS); + static final short[] DFA15_special = DFA.unpackEncodedString(DFA15_specialS); + static final short[][] DFA15_transition; + + static { + int numStates = DFA15_transitionS.length; + DFA15_transition = new short[numStates][]; + for (int i=0; i='A' && LA15_0<='Z')||LA15_0=='_'||(LA15_0>='a' && LA15_0<='z')) ) {s = 6;} + + else if ( ((LA15_0>='0' && LA15_0<='9')) ) {s = 7;} + + else if ( (LA15_0=='\"') ) {s = 8;} + + else if ( (LA15_0=='\'') ) {s = 9;} + + else if ( (LA15_0=='/') ) {s = 10;} + + else if ( ((LA15_0>='\u0000' && LA15_0<='\b')||(LA15_0>='\u000B' && LA15_0<='\f')||(LA15_0>='\u000E' && LA15_0<='\u001F')||LA15_0=='!'||(LA15_0>='#' && LA15_0<='&')||(LA15_0>='(' && LA15_0<='.')||(LA15_0>=';' && LA15_0<='@')||(LA15_0>='[' && LA15_0<=']')||LA15_0=='`'||(LA15_0>='{' && LA15_0<='\uFFFF')) ) {s = 11;} + + if ( s>=0 ) return s; + break; + case 1 : + int LA15_9 = input.LA(1); + + s = -1; + if ( ((LA15_9>='\u0000' && LA15_9<='\uFFFF')) ) {s = 21;} + + else s = 11; + + if ( s>=0 ) return s; + break; + case 2 : + int LA15_8 = input.LA(1); + + s = -1; + if ( ((LA15_8>='\u0000' && LA15_8<='\uFFFF')) ) {s = 21;} + + else s = 11; + + if ( s>=0 ) return s; + break; + } + NoViableAltException nvae = + new NoViableAltException(getDescription(), 15, _s, input); + error(nvae); + throw nvae; + } + } + + +} \ No newline at end of file diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEffortsParser.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEffortsParser.java new file mode 100644 index 0000000..bb38405 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/parser/antlr/internal/InternalEffortsParser.java @@ -0,0 +1,417 @@ +package workload.xtext_grammar.parser.antlr.internal; + +import org.eclipse.xtext.*; +import org.eclipse.xtext.parser.*; +import org.eclipse.xtext.parser.impl.*; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; +import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; +import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken; +import workload.xtext_grammar.services.EffortsGrammarAccess; + + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalEffortsParser extends AbstractInternalAntlrParser { + public static final String[] tokenNames = new String[] { + "", "", "", "", "RULE_NEWLINE", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "':'" + }; + public static final int RULE_ID=5; + public static final int RULE_WS=10; + public static final int RULE_NEWLINE=4; + public static final int RULE_STRING=7; + public static final int RULE_ANY_OTHER=11; + public static final int RULE_SL_COMMENT=9; + public static final int RULE_INT=6; + public static final int RULE_ML_COMMENT=8; + public static final int T__12=12; + public static final int EOF=-1; + + // delegates + // delegators + + + public InternalEffortsParser(TokenStream input) { + this(input, new RecognizerSharedState()); + } + public InternalEffortsParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + + } + + + public String[] getTokenNames() { return InternalEffortsParser.tokenNames; } + public String getGrammarFileName() { return "InternalEfforts.g"; } + + + + private EffortsGrammarAccess grammarAccess; + + public InternalEffortsParser(TokenStream input, EffortsGrammarAccess grammarAccess) { + this(input); + this.grammarAccess = grammarAccess; + registerRules(grammarAccess.getGrammar()); + } + + @Override + protected String getFirstRuleName() { + return "Main"; + } + + @Override + protected EffortsGrammarAccess getGrammarAccess() { + return grammarAccess; + } + + + + + // $ANTLR start "entryRuleMain" + // InternalEfforts.g:64:1: entryRuleMain returns [EObject current=null] : iv_ruleMain= ruleMain EOF ; + public final EObject entryRuleMain() throws RecognitionException { + EObject current = null; + + EObject iv_ruleMain = null; + + + try { + // InternalEfforts.g:64:45: (iv_ruleMain= ruleMain EOF ) + // InternalEfforts.g:65:2: iv_ruleMain= ruleMain EOF + { + newCompositeNode(grammarAccess.getMainRule()); + pushFollow(FOLLOW_1); + iv_ruleMain=ruleMain(); + + state._fsp--; + + current =iv_ruleMain; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleMain" + + + // $ANTLR start "ruleMain" + // InternalEfforts.g:71:1: ruleMain returns [EObject current=null] : ( () ( (lv_efforts_1_0= ruleEffort ) ) (this_NEWLINE_2= RULE_NEWLINE ( (lv_efforts_3_0= ruleEffort ) ) )* ) ; + public final EObject ruleMain() throws RecognitionException { + EObject current = null; + + Token this_NEWLINE_2=null; + EObject lv_efforts_1_0 = null; + + EObject lv_efforts_3_0 = null; + + + + enterRule(); + + try { + // InternalEfforts.g:77:2: ( ( () ( (lv_efforts_1_0= ruleEffort ) ) (this_NEWLINE_2= RULE_NEWLINE ( (lv_efforts_3_0= ruleEffort ) ) )* ) ) + // InternalEfforts.g:78:2: ( () ( (lv_efforts_1_0= ruleEffort ) ) (this_NEWLINE_2= RULE_NEWLINE ( (lv_efforts_3_0= ruleEffort ) ) )* ) + { + // InternalEfforts.g:78:2: ( () ( (lv_efforts_1_0= ruleEffort ) ) (this_NEWLINE_2= RULE_NEWLINE ( (lv_efforts_3_0= ruleEffort ) ) )* ) + // InternalEfforts.g:79:3: () ( (lv_efforts_1_0= ruleEffort ) ) (this_NEWLINE_2= RULE_NEWLINE ( (lv_efforts_3_0= ruleEffort ) ) )* + { + // InternalEfforts.g:79:3: () + // InternalEfforts.g:80:4: + { + + current = forceCreateModelElement( + grammarAccess.getMainAccess().getTaskAction_0(), + current); + + + } + + // InternalEfforts.g:86:3: ( (lv_efforts_1_0= ruleEffort ) ) + // InternalEfforts.g:87:4: (lv_efforts_1_0= ruleEffort ) + { + // InternalEfforts.g:87:4: (lv_efforts_1_0= ruleEffort ) + // InternalEfforts.g:88:5: lv_efforts_1_0= ruleEffort + { + + newCompositeNode(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_1_0()); + + pushFollow(FOLLOW_3); + lv_efforts_1_0=ruleEffort(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getMainRule()); + } + add( + current, + "efforts", + lv_efforts_1_0, + "workload.xtext_grammar.Efforts.Effort"); + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalEfforts.g:105:3: (this_NEWLINE_2= RULE_NEWLINE ( (lv_efforts_3_0= ruleEffort ) ) )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0==RULE_NEWLINE) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalEfforts.g:106:4: this_NEWLINE_2= RULE_NEWLINE ( (lv_efforts_3_0= ruleEffort ) ) + { + this_NEWLINE_2=(Token)match(input,RULE_NEWLINE,FOLLOW_4); + + newLeafNode(this_NEWLINE_2, grammarAccess.getMainAccess().getNEWLINETerminalRuleCall_2_0()); + + // InternalEfforts.g:110:4: ( (lv_efforts_3_0= ruleEffort ) ) + // InternalEfforts.g:111:5: (lv_efforts_3_0= ruleEffort ) + { + // InternalEfforts.g:111:5: (lv_efforts_3_0= ruleEffort ) + // InternalEfforts.g:112:6: lv_efforts_3_0= ruleEffort + { + + newCompositeNode(grammarAccess.getMainAccess().getEffortsEffortParserRuleCall_2_1_0()); + + pushFollow(FOLLOW_3); + lv_efforts_3_0=ruleEffort(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getMainRule()); + } + add( + current, + "efforts", + lv_efforts_3_0, + "workload.xtext_grammar.Efforts.Effort"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop1; + } + } while (true); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleMain" + + + // $ANTLR start "entryRuleEffort" + // InternalEfforts.g:134:1: entryRuleEffort returns [EObject current=null] : iv_ruleEffort= ruleEffort EOF ; + public final EObject entryRuleEffort() throws RecognitionException { + EObject current = null; + + EObject iv_ruleEffort = null; + + + try { + // InternalEfforts.g:134:47: (iv_ruleEffort= ruleEffort EOF ) + // InternalEfforts.g:135:2: iv_ruleEffort= ruleEffort EOF + { + newCompositeNode(grammarAccess.getEffortRule()); + pushFollow(FOLLOW_1); + iv_ruleEffort=ruleEffort(); + + state._fsp--; + + current =iv_ruleEffort; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleEffort" + + + // $ANTLR start "ruleEffort" + // InternalEfforts.g:141:1: ruleEffort returns [EObject current=null] : ( () ( (otherlv_1= RULE_ID ) )? otherlv_2= ':' ( (lv_months_3_0= RULE_INT ) ) ) ; + public final EObject ruleEffort() throws RecognitionException { + EObject current = null; + + Token otherlv_1=null; + Token otherlv_2=null; + Token lv_months_3_0=null; + + + enterRule(); + + try { + // InternalEfforts.g:147:2: ( ( () ( (otherlv_1= RULE_ID ) )? otherlv_2= ':' ( (lv_months_3_0= RULE_INT ) ) ) ) + // InternalEfforts.g:148:2: ( () ( (otherlv_1= RULE_ID ) )? otherlv_2= ':' ( (lv_months_3_0= RULE_INT ) ) ) + { + // InternalEfforts.g:148:2: ( () ( (otherlv_1= RULE_ID ) )? otherlv_2= ':' ( (lv_months_3_0= RULE_INT ) ) ) + // InternalEfforts.g:149:3: () ( (otherlv_1= RULE_ID ) )? otherlv_2= ':' ( (lv_months_3_0= RULE_INT ) ) + { + // InternalEfforts.g:149:3: () + // InternalEfforts.g:150:4: + { + + current = forceCreateModelElement( + grammarAccess.getEffortAccess().getEffortAction_0(), + current); + + + } + + // InternalEfforts.g:156:3: ( (otherlv_1= RULE_ID ) )? + int alt2=2; + int LA2_0 = input.LA(1); + + if ( (LA2_0==RULE_ID) ) { + alt2=1; + } + switch (alt2) { + case 1 : + // InternalEfforts.g:157:4: (otherlv_1= RULE_ID ) + { + // InternalEfforts.g:157:4: (otherlv_1= RULE_ID ) + // InternalEfforts.g:158:5: otherlv_1= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getEffortRule()); + } + + otherlv_1=(Token)match(input,RULE_ID,FOLLOW_5); + + newLeafNode(otherlv_1, grammarAccess.getEffortAccess().getPersonPersonCrossReference_1_0()); + + + } + + + } + break; + + } + + otherlv_2=(Token)match(input,12,FOLLOW_6); + + newLeafNode(otherlv_2, grammarAccess.getEffortAccess().getColonKeyword_2()); + + // InternalEfforts.g:173:3: ( (lv_months_3_0= RULE_INT ) ) + // InternalEfforts.g:174:4: (lv_months_3_0= RULE_INT ) + { + // InternalEfforts.g:174:4: (lv_months_3_0= RULE_INT ) + // InternalEfforts.g:175:5: lv_months_3_0= RULE_INT + { + lv_months_3_0=(Token)match(input,RULE_INT,FOLLOW_2); + + newLeafNode(lv_months_3_0, grammarAccess.getEffortAccess().getMonthsINTTerminalRuleCall_3_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getEffortRule()); + } + setWithLastConsumed( + current, + "months", + lv_months_3_0, + "org.eclipse.xtext.common.Terminals.INT"); + + + } + + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleEffort" + + // Delegated rules + + + + + public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000012L}); + public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000001020L}); + public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000001000L}); + public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000000040L}); + +} \ No newline at end of file diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/scoping/AbstractEffortsScopeProvider.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/scoping/AbstractEffortsScopeProvider.java new file mode 100644 index 0000000..4c8f4a7 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/scoping/AbstractEffortsScopeProvider.java @@ -0,0 +1,9 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.scoping; + +import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider; + +public abstract class AbstractEffortsScopeProvider extends DelegatingScopeProvider { +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/serializer/EffortsSemanticSequencer.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/serializer/EffortsSemanticSequencer.java new file mode 100644 index 0000000..94ca2c3 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/serializer/EffortsSemanticSequencer.java @@ -0,0 +1,73 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.serializer; + +import com.google.inject.Inject; +import java.util.Set; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.xtext.Action; +import org.eclipse.xtext.Parameter; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.serializer.ISerializationContext; +import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer; +import workload.Effort; +import workload.Task; +import workload.WorkloadPackage; +import workload.xtext_grammar.services.EffortsGrammarAccess; + +@SuppressWarnings("all") +public class EffortsSemanticSequencer extends AbstractDelegatingSemanticSequencer { + + @Inject + private EffortsGrammarAccess grammarAccess; + + @Override + public void sequence(ISerializationContext context, EObject semanticObject) { + EPackage epackage = semanticObject.eClass().getEPackage(); + ParserRule rule = context.getParserRule(); + Action action = context.getAssignedAction(); + Set parameters = context.getEnabledBooleanParameters(); + if (epackage == WorkloadPackage.eINSTANCE) + switch (semanticObject.eClass().getClassifierID()) { + case WorkloadPackage.EFFORT: + sequence_Effort(context, (Effort) semanticObject); + return; + case WorkloadPackage.TASK: + sequence_Main(context, (Task) semanticObject); + return; + } + if (errorAcceptor != null) + errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); + } + + /** + *

+	 * Contexts:
+	 *     Effort returns Effort
+	 *
+	 * Constraint:
+	 *     (person=[Person|ID]? months=INT)
+	 * 
+ */ + protected void sequence_Effort(ISerializationContext context, Effort semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + *
+	 * Contexts:
+	 *     Main returns Task
+	 *
+	 * Constraint:
+	 *     (efforts+=Effort efforts+=Effort*)
+	 * 
+ */ + protected void sequence_Main(ISerializationContext context, Task semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/serializer/EffortsSyntacticSequencer.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/serializer/EffortsSyntacticSequencer.java new file mode 100644 index 0000000..dc15a8c --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/serializer/EffortsSyntacticSequencer.java @@ -0,0 +1,54 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.serializer; + +import com.google.inject.Inject; +import java.util.List; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.IGrammarAccess; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias; +import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition; +import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer; +import workload.xtext_grammar.services.EffortsGrammarAccess; + +@SuppressWarnings("all") +public class EffortsSyntacticSequencer extends AbstractSyntacticSequencer { + + protected EffortsGrammarAccess grammarAccess; + + @Inject + protected void init(IGrammarAccess access) { + grammarAccess = (EffortsGrammarAccess) access; + } + + @Override + protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { + if (ruleCall.getRule() == grammarAccess.getNEWLINERule()) + return getNEWLINEToken(semanticObject, ruleCall, node); + return ""; + } + + /** + * terminal NEWLINE: + * (' '|'\t')* '\r'? '\n' (' '|'\t')*; + */ + protected String getNEWLINEToken(EObject semanticObject, RuleCall ruleCall, INode node) { + if (node != null) + return getTokenText(node); + return "\n"; + } + + @Override + protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { + if (transition.getAmbiguousSyntaxes().isEmpty()) return; + List transitionNodes = collectNodes(fromNode, toNode); + for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { + List syntaxNodes = getNodesFor(transitionNodes, syntax); + acceptNodes(getLastNavigableState(), syntaxNodes); + } + } + +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/services/EffortsGrammarAccess.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/services/EffortsGrammarAccess.java new file mode 100644 index 0000000..a5ee0c5 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/services/EffortsGrammarAccess.java @@ -0,0 +1,220 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.services; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.util.List; +import org.eclipse.xtext.Action; +import org.eclipse.xtext.Assignment; +import org.eclipse.xtext.CrossReference; +import org.eclipse.xtext.Grammar; +import org.eclipse.xtext.GrammarUtil; +import org.eclipse.xtext.Group; +import org.eclipse.xtext.Keyword; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.TerminalRule; +import org.eclipse.xtext.common.services.TerminalsGrammarAccess; +import org.eclipse.xtext.service.AbstractElementFinder; +import org.eclipse.xtext.service.GrammarProvider; + +@Singleton +public class EffortsGrammarAccess extends AbstractElementFinder.AbstractGrammarElementFinder { + + public class MainElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "workload.xtext_grammar.Efforts.Main"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Action cTaskAction_0 = (Action)cGroup.eContents().get(0); + private final Assignment cEffortsAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cEffortsEffortParserRuleCall_1_0 = (RuleCall)cEffortsAssignment_1.eContents().get(0); + private final Group cGroup_2 = (Group)cGroup.eContents().get(2); + private final RuleCall cNEWLINETerminalRuleCall_2_0 = (RuleCall)cGroup_2.eContents().get(0); + private final Assignment cEffortsAssignment_2_1 = (Assignment)cGroup_2.eContents().get(1); + private final RuleCall cEffortsEffortParserRuleCall_2_1_0 = (RuleCall)cEffortsAssignment_2_1.eContents().get(0); + + //Main returns Task: + // {Task} + // efforts+=Effort (NEWLINE efforts+=Effort)*; + @Override public ParserRule getRule() { return rule; } + + //{Task} + //efforts+=Effort (NEWLINE efforts+=Effort)* + public Group getGroup() { return cGroup; } + + //{Task} + public Action getTaskAction_0() { return cTaskAction_0; } + + //efforts+=Effort + public Assignment getEffortsAssignment_1() { return cEffortsAssignment_1; } + + //Effort + public RuleCall getEffortsEffortParserRuleCall_1_0() { return cEffortsEffortParserRuleCall_1_0; } + + //(NEWLINE efforts+=Effort)* + public Group getGroup_2() { return cGroup_2; } + + //NEWLINE + public RuleCall getNEWLINETerminalRuleCall_2_0() { return cNEWLINETerminalRuleCall_2_0; } + + //efforts+=Effort + public Assignment getEffortsAssignment_2_1() { return cEffortsAssignment_2_1; } + + //Effort + public RuleCall getEffortsEffortParserRuleCall_2_1_0() { return cEffortsEffortParserRuleCall_2_1_0; } + } + public class EffortElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "workload.xtext_grammar.Efforts.Effort"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Action cEffortAction_0 = (Action)cGroup.eContents().get(0); + private final Assignment cPersonAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final CrossReference cPersonPersonCrossReference_1_0 = (CrossReference)cPersonAssignment_1.eContents().get(0); + private final RuleCall cPersonPersonIDTerminalRuleCall_1_0_1 = (RuleCall)cPersonPersonCrossReference_1_0.eContents().get(1); + private final Keyword cColonKeyword_2 = (Keyword)cGroup.eContents().get(2); + private final Assignment cMonthsAssignment_3 = (Assignment)cGroup.eContents().get(3); + private final RuleCall cMonthsINTTerminalRuleCall_3_0 = (RuleCall)cMonthsAssignment_3.eContents().get(0); + + //Effort returns Effort: + // {Effort} + // (person=[Person])? ':' months=INT; + @Override public ParserRule getRule() { return rule; } + + //{Effort} + //(person=[Person])? ':' months=INT + public Group getGroup() { return cGroup; } + + //{Effort} + public Action getEffortAction_0() { return cEffortAction_0; } + + //(person=[Person])? + public Assignment getPersonAssignment_1() { return cPersonAssignment_1; } + + //[Person] + public CrossReference getPersonPersonCrossReference_1_0() { return cPersonPersonCrossReference_1_0; } + + //ID + public RuleCall getPersonPersonIDTerminalRuleCall_1_0_1() { return cPersonPersonIDTerminalRuleCall_1_0_1; } + + //':' + public Keyword getColonKeyword_2() { return cColonKeyword_2; } + + //months=INT + public Assignment getMonthsAssignment_3() { return cMonthsAssignment_3; } + + //INT + public RuleCall getMonthsINTTerminalRuleCall_3_0() { return cMonthsINTTerminalRuleCall_3_0; } + } + + + private final MainElements pMain; + private final EffortElements pEffort; + private final TerminalRule tNEWLINE; + + private final Grammar grammar; + + private final TerminalsGrammarAccess gaTerminals; + + @Inject + public EffortsGrammarAccess(GrammarProvider grammarProvider, + TerminalsGrammarAccess gaTerminals) { + this.grammar = internalFindGrammar(grammarProvider); + this.gaTerminals = gaTerminals; + this.pMain = new MainElements(); + this.pEffort = new EffortElements(); + this.tNEWLINE = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "workload.xtext_grammar.Efforts.NEWLINE"); + } + + protected Grammar internalFindGrammar(GrammarProvider grammarProvider) { + Grammar grammar = grammarProvider.getGrammar(this); + while (grammar != null) { + if ("workload.xtext_grammar.Efforts".equals(grammar.getName())) { + return grammar; + } + List grammars = grammar.getUsedGrammars(); + if (!grammars.isEmpty()) { + grammar = grammars.iterator().next(); + } else { + return null; + } + } + return grammar; + } + + @Override + public Grammar getGrammar() { + return grammar; + } + + + public TerminalsGrammarAccess getTerminalsGrammarAccess() { + return gaTerminals; + } + + + //Main returns Task: + // {Task} + // efforts+=Effort (NEWLINE efforts+=Effort)*; + public MainElements getMainAccess() { + return pMain; + } + + public ParserRule getMainRule() { + return getMainAccess().getRule(); + } + + //Effort returns Effort: + // {Effort} + // (person=[Person])? ':' months=INT; + public EffortElements getEffortAccess() { + return pEffort; + } + + public ParserRule getEffortRule() { + return getEffortAccess().getRule(); + } + + //terminal NEWLINE: + // (' '|'\t')* '\r'? '\n' (' '|'\t')*; + public TerminalRule getNEWLINERule() { + return tNEWLINE; + } + + //terminal ID: '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; + public TerminalRule getIDRule() { + return gaTerminals.getIDRule(); + } + + //terminal INT returns ecore::EInt: ('0'..'9')+; + public TerminalRule getINTRule() { + return gaTerminals.getINTRule(); + } + + //terminal STRING: + // '"' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'"') )* '"' | + // "'" ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|"'") )* "'" + // ; + public TerminalRule getSTRINGRule() { + return gaTerminals.getSTRINGRule(); + } + + //terminal ML_COMMENT : '/*' -> '*/'; + public TerminalRule getML_COMMENTRule() { + return gaTerminals.getML_COMMENTRule(); + } + + //terminal SL_COMMENT : '//' !('\n'|'\r')* ('\r'? '\n')?; + public TerminalRule getSL_COMMENTRule() { + return gaTerminals.getSL_COMMENTRule(); + } + + //terminal WS : (' '|'\t'|'\r'|'\n')+; + public TerminalRule getWSRule() { + return gaTerminals.getWSRule(); + } + + //terminal ANY_OTHER: .; + public TerminalRule getANY_OTHERRule() { + return gaTerminals.getANY_OTHERRule(); + } +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/validation/AbstractEffortsValidator.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/validation/AbstractEffortsValidator.java new file mode 100644 index 0000000..d7c6d0d --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/validation/AbstractEffortsValidator.java @@ -0,0 +1,19 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.validation; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.xtext.validation.AbstractDeclarativeValidator; + +public abstract class AbstractEffortsValidator extends AbstractDeclarativeValidator { + + @Override + protected List getEPackages() { + List result = new ArrayList(); + result.add(EPackage.Registry.INSTANCE.getEPackage("ProjectWorkloadsDSL")); + return result; + } +} diff --git a/workload.xtext_grammar/src-gen/workload/xtext_grammar/validation/EffortsConfigurableIssueCodesProvider.java b/workload.xtext_grammar/src-gen/workload/xtext_grammar/validation/EffortsConfigurableIssueCodesProvider.java new file mode 100644 index 0000000..ad9e050 --- /dev/null +++ b/workload.xtext_grammar/src-gen/workload/xtext_grammar/validation/EffortsConfigurableIssueCodesProvider.java @@ -0,0 +1,21 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.validation; + +import org.eclipse.xtext.preferences.PreferenceKey; +import org.eclipse.xtext.util.IAcceptor; +import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider; +import org.eclipse.xtext.validation.SeverityConverter; + +public class EffortsConfigurableIssueCodesProvider extends ConfigurableIssueCodesProvider { + protected static final String ISSUE_CODE_PREFIX = "workload.xtext_grammar."; + + public static final String DEPRECATED_MODEL_PART = ISSUE_CODE_PREFIX + "deprecatedModelPart"; + + @Override + protected void initialize(IAcceptor acceptor) { + super.initialize(acceptor); + acceptor.accept(create(DEPRECATED_MODEL_PART, SeverityConverter.SEVERITY_WARNING)); + } +} diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/Efforts.xtext b/workload.xtext_grammar/src/workload/xtext_grammar/Efforts.xtext new file mode 100644 index 0000000..5cac8d6 --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/Efforts.xtext @@ -0,0 +1,15 @@ +grammar workload.xtext_grammar.Efforts with org.eclipse.xtext.common.Terminals + +import "ProjectWorkloadsDSL" +import "http://www.eclipse.org/emf/2002/Ecore" + +Main returns Task: + {Task} + efforts+=Effort (NEWLINE efforts+=Effort)*; + +Effort returns Effort: + {Effort} + (person=[Person])? ':' months=INT; + +terminal NEWLINE: + (' '|'\t')* '\r'? '\n' (' '|'\t')*; \ No newline at end of file diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/EffortsRuntimeModule.java b/workload.xtext_grammar/src/workload/xtext_grammar/EffortsRuntimeModule.java new file mode 100644 index 0000000..cef9d6a --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/EffortsRuntimeModule.java @@ -0,0 +1,27 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar; + +import org.eclipse.xtext.parser.IAstFactory; +import org.eclipse.xtext.scoping.IGlobalScopeProvider; + +import graphite.textual.AstFactory; +import graphite.textual.GlobalScopeProvider; + + +/** + * Use this class to register components to be used at runtime / without the Equinox extension registry. + */ +public class EffortsRuntimeModule extends AbstractEffortsRuntimeModule { // (Patched) + + @Override + public Class bindIAstFactory() { + return AstFactory.class; + } + + @Override + public Class bindIGlobalScopeProvider() { + return GlobalScopeProvider.class; + } +} \ No newline at end of file diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/EffortsStandaloneSetup.java b/workload.xtext_grammar/src/workload/xtext_grammar/EffortsStandaloneSetup.java new file mode 100644 index 0000000..56fdc71 --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/EffortsStandaloneSetup.java @@ -0,0 +1,15 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar; + + +/** + * Initialization support for running Xtext languages without Equinox extension registry. + */ +public class EffortsStandaloneSetup extends EffortsStandaloneSetupGenerated { + + public static void doSetup() { + new EffortsStandaloneSetup().createInjectorAndDoEMFRegistration(); + } +} diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/GenerateEfforts.mwe2 b/workload.xtext_grammar/src/workload/xtext_grammar/GenerateEfforts.mwe2 new file mode 100644 index 0000000..29995e0 --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/GenerateEfforts.mwe2 @@ -0,0 +1,55 @@ +module workload.xtext_grammar.GenerateEfforts + +import org.eclipse.xtext.xtext.generator.* +import org.eclipse.xtext.xtext.generator.model.project.* + +var rootPath = ".." + +Workflow { + + component = XtextGenerator { + configuration = { + project = StandardProjectConfig { + baseName = "workload.xtext_grammar" + rootPath = rootPath + eclipsePlugin = { + enabled = true + } + createEclipseMetaData = true + } + code = { + encoding = "UTF-8" + lineDelimiter = "\r\n" + fileHeader = "/*\n * generated by Xtext \${version}\n */" + preferXtendStubs = false + } + } + language = StandardLanguage { + name = "workload.xtext_grammar.Efforts" + fileExtensions = "eff" + referencedResource = "platform:/resource/workload.emf/model/workload.genmodel" + + fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {} + + formatter = { + generateStub = true + generateXtendStub = true + } + + serializer = { + generateStub = false + } + validator = { + // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" + // Generates checks for @Deprecated grammar annotations, an IssueProvider and a corresponding PropertyPage + generateDeprecationValidation = true + } + generator = { + generateXtendStub = true + } + junitSupport = { + junitVersion = "5" + } + } + } +} diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/formatting2/EffortsFormatter.xtend b/workload.xtext_grammar/src/workload/xtext_grammar/formatting2/EffortsFormatter.xtend new file mode 100644 index 0000000..50b39e7 --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/formatting2/EffortsFormatter.xtend @@ -0,0 +1,23 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.formatting2 + +import com.google.inject.Inject +import org.eclipse.xtext.formatting2.AbstractFormatter2 +import org.eclipse.xtext.formatting2.IFormattableDocument +import workload.Task +import workload.xtext_grammar.services.EffortsGrammarAccess + +class EffortsFormatter extends AbstractFormatter2 { + + @Inject extension EffortsGrammarAccess + + def dispatch void format(Task task, extension IFormattableDocument document) { + // TODO: format HiddenRegions around keywords, attributes, cross references, etc. + for (effort : task.efforts) { + effort.format + } + } + +} diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/generator/EffortsGenerator.xtend b/workload.xtext_grammar/src/workload/xtext_grammar/generator/EffortsGenerator.xtend new file mode 100644 index 0000000..07df6c1 --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/generator/EffortsGenerator.xtend @@ -0,0 +1,25 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.generator + +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.xtext.generator.AbstractGenerator +import org.eclipse.xtext.generator.IFileSystemAccess2 +import org.eclipse.xtext.generator.IGeneratorContext + +/** + * Generates code from your model files on save. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation + */ +class EffortsGenerator extends AbstractGenerator { + + override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) { +// fsa.generateFile('greetings.txt', 'People to greet: ' + +// resource.allContents +// .filter(Greeting) +// .map[name] +// .join(', ')) + } +} diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/scoping/EffortsScopeProvider.java b/workload.xtext_grammar/src/workload/xtext_grammar/scoping/EffortsScopeProvider.java new file mode 100644 index 0000000..bf88918 --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/scoping/EffortsScopeProvider.java @@ -0,0 +1,15 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.scoping; + + +/** + * This class contains custom scoping description. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping + * on how and when to use it. + */ +public class EffortsScopeProvider extends AbstractEffortsScopeProvider { + +} diff --git a/workload.xtext_grammar/src/workload/xtext_grammar/validation/EffortsValidator.java b/workload.xtext_grammar/src/workload/xtext_grammar/validation/EffortsValidator.java new file mode 100644 index 0000000..61f9b14 --- /dev/null +++ b/workload.xtext_grammar/src/workload/xtext_grammar/validation/EffortsValidator.java @@ -0,0 +1,25 @@ +/* + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.validation; + + +/** + * This class contains custom validation rules. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation + */ +public class EffortsValidator extends AbstractEffortsValidator { + +// public static final String INVALID_NAME = "invalidName"; +// +// @Check +// public void checkGreetingStartsWithCapital(Greeting greeting) { +// if (!Character.isUpperCase(greeting.getName().charAt(0))) { +// warning("Name should start with a capital", +// EffortsPackage.Literals.GREETING__NAME, +// INVALID_NAME); +// } +// } + +} diff --git a/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/.EffortsFormatter.java._trace b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/.EffortsFormatter.java._trace new file mode 100644 index 0000000..1539fb2 Binary files /dev/null and b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/.EffortsFormatter.java._trace differ diff --git a/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/.EffortsFormatter.xtendbin b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/.EffortsFormatter.xtendbin new file mode 100644 index 0000000..e699211 Binary files /dev/null and b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/.EffortsFormatter.xtendbin differ diff --git a/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/EffortsFormatter.java b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/EffortsFormatter.java new file mode 100644 index 0000000..ee0bb8b --- /dev/null +++ b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/formatting2/EffortsFormatter.java @@ -0,0 +1,52 @@ +/** + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.formatting2; + +import com.google.inject.Inject; +import java.util.Arrays; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.formatting2.AbstractFormatter2; +import org.eclipse.xtext.formatting2.IFormattableDocument; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.xbase.lib.Extension; +import workload.Effort; +import workload.Task; +import workload.xtext_grammar.services.EffortsGrammarAccess; + +@SuppressWarnings("all") +public class EffortsFormatter extends AbstractFormatter2 { + @Inject + @Extension + private EffortsGrammarAccess _effortsGrammarAccess; + + protected void _format(final Task task, @Extension final IFormattableDocument document) { + EList _efforts = task.getEfforts(); + for (final Effort effort : _efforts) { + document.format(effort); + } + } + + public void format(final Object task, final IFormattableDocument document) { + if (task instanceof XtextResource) { + _format((XtextResource)task, document); + return; + } else if (task instanceof Task) { + _format((Task)task, document); + return; + } else if (task instanceof EObject) { + _format((EObject)task, document); + return; + } else if (task == null) { + _format((Void)null, document); + return; + } else if (task != null) { + _format(task, document); + return; + } else { + throw new IllegalArgumentException("Unhandled parameter types: " + + Arrays.asList(task, document).toString()); + } + } +} diff --git a/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/.EffortsGenerator.java._trace b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/.EffortsGenerator.java._trace new file mode 100644 index 0000000..7afa3ed Binary files /dev/null and b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/.EffortsGenerator.java._trace differ diff --git a/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/.EffortsGenerator.xtendbin b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/.EffortsGenerator.xtendbin new file mode 100644 index 0000000..1539d66 Binary files /dev/null and b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/.EffortsGenerator.xtendbin differ diff --git a/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/EffortsGenerator.java b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/EffortsGenerator.java new file mode 100644 index 0000000..538247a --- /dev/null +++ b/workload.xtext_grammar/xtend-gen/workload/xtext_grammar/generator/EffortsGenerator.java @@ -0,0 +1,21 @@ +/** + * generated by Xtext 2.30.0 + */ +package workload.xtext_grammar.generator; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.generator.AbstractGenerator; +import org.eclipse.xtext.generator.IFileSystemAccess2; +import org.eclipse.xtext.generator.IGeneratorContext; + +/** + * Generates code from your model files on save. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation + */ +@SuppressWarnings("all") +public class EffortsGenerator extends AbstractGenerator { + @Override + public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) { + } +}