[428712] Old Java files migrated to Xtend and deleted / xtend-gen and

src-gen check-in

Signed-off-by: Oliver Libutzki <oliver@libutzki.de>
This commit is contained in:
Oliver Libutzki 2014-02-21 12:32:30 +01:00
Родитель 8f2c460884
Коммит 92f753848a
170 изменённых файлов: 2915 добавлений и 2313 удалений

Просмотреть файл

@ -4,5 +4,6 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
bundles/model/org.eclipse.smarthome.model.item.ui/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
/plugin.xml_gen

Просмотреть файл

@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>

Просмотреть файл

@ -12,14 +12,19 @@ Require-Bundle: org.eclipse.smarthome.model.item;visibility:=reexport,
org.eclipse.xtext.ui.shared,
org.eclipse.ui,
org.eclipse.xtext.builder,
org.antlr.runtime
org.antlr.runtime,
org.eclipse.xtext.common.types.ui,
org.eclipse.xtext.ui.codetemplates.ui,
org.eclipse.compare
Import-Package: com.google.common.collect,
org.apache.log4j,
org.eclipse.smarthome.core.items,
org.eclipse.smarthome.designer.ui,
org.osgi.service.event
org.osgi.service.event,
org.eclipse.xtext.xbase.lib
Export-Package: org.eclipse.smarthome.model.ui.contentassist.antlr,
org.eclipse.smarthome.model.ui.contentassist,
org.eclipse.smarthome.model.ui.quickfix
org.eclipse.smarthome.model.ui.quickfix,
org.eclipse.smarthome.model.ui.internal
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Activator: org.eclipse.smarthome.model.ui.internal.ItemsActivator

Просмотреть файл

@ -1,5 +1,6 @@
source.. = src/,\
src-gen/
src-gen/,\
xtend-gen/
bin.includes = META-INF/,\
.,\
plugin.xml,\

Просмотреть файл

@ -6,13 +6,12 @@
<extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.XtextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="true"
extensions="items"
icon="icons/items.png"
id="org.eclipse.smarthome.model.Items"
name="Items Editor">
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.XtextEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="true"
extensions="items"
id="org.eclipse.smarthome.model.Items"
name="Items Editor">
</editor>
</extension>
<extension
@ -34,7 +33,27 @@
definitionId="org.eclipse.smarthome.model.Items.Editor.opened">
</reference>
</activeWhen>
</handler>
</handler>
<!-- copy qualified name -->
<handler
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedNameHandler"
commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName">
<activeWhen>
<reference definitionId="org.eclipse.smarthome.model.Items.Editor.opened" />
</activeWhen>
</handler>
<handler
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedNameHandler"
commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName">
<activeWhen>
<and>
<reference definitionId="org.eclipse.smarthome.model.Items.XtextEditor.opened" />
<iterate>
<adapt type="org.eclipse.xtext.ui.editor.outline.IOutlineNode" />
</iterate>
</and>
</activeWhen>
</handler>
</extension>
<extension point="org.eclipse.core.expressions.definitions">
<definition id="org.eclipse.smarthome.model.Items.Editor.opened">
@ -47,6 +66,16 @@
</with>
</and>
</definition>
<definition id="org.eclipse.smarthome.model.Items.XtextEditor.opened">
<and>
<reference definitionId="isXtextEditorActive"/>
<with variable="activeEditor">
<test property="org.eclipse.xtext.ui.editor.XtextEditor.languageName"
value="org.eclipse.smarthome.model.Items"
forcePluginActivation="true"/>
</with>
</and>
</definition>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
@ -71,6 +100,19 @@
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
</page>
</extension>
<extension
point="org.eclipse.ui.propertyPages">
<page
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage"
id="org.eclipse.smarthome.model.Items"
name="Items">
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
<enabledWhen>
<adapt type="org.eclipse.core.resources.IProject"/>
</enabledWhen>
<filter name="projectNature" value="org.eclipse.xtext.ui.shared.xtextNature"/>
</page>
</extension>
<extension
point="org.eclipse.ui.keywords">
<keyword
@ -84,6 +126,19 @@
id="org.eclipse.smarthome.model.Items.validate"
name="Validate">
</command>
<!-- copy qualified name -->
<command
id="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName"
categoryId="org.eclipse.ui.category.edit"
description="Copy the qualified name for the selected element"
name="Copy Qualified Name">
</command>
<command
id="org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName"
categoryId="org.eclipse.ui.category.edit"
description="Copy the qualified name for the selected element"
name="Copy Qualified Name">
</command>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
@ -99,6 +154,36 @@
</visibleWhen>
</command>
</menuContribution>
<!-- copy qualified name -->
<menuContribution locationURI="popup:#TextEditorContext?after=copy">
<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName"
style="push" tooltip="Copy Qualified Name">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.smarthome.model.Items.Editor.opened" />
</visibleWhen>
</command>
</menuContribution>
<menuContribution locationURI="menu:edit?after=copy">
<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.EditorCopyQualifiedName"
style="push" tooltip="Copy Qualified Name">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.smarthome.model.Items.Editor.opened" />
</visibleWhen>
</command>
</menuContribution>
<menuContribution locationURI="popup:org.eclipse.xtext.ui.outline?after=additions">
<command commandId="org.eclipse.xtext.ui.editor.copyqualifiedname.OutlineCopyQualifiedName"
style="push" tooltip="Copy Qualified Name">
<visibleWhen checkEnabled="false">
<and>
<reference definitionId="org.eclipse.smarthome.model.Items.XtextEditor.opened" />
<iterate>
<adapt type="org.eclipse.xtext.ui.editor.outline.IOutlineNode" />
</iterate>
</and>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="popup:#TextEditorContext?endof=group.find">
@ -123,7 +208,7 @@
</extension>
<!-- adding resource factories -->
<!--
<extension
point="org.eclipse.emf.ecore.extension_parser">
<parser
@ -137,9 +222,61 @@
uriExtension="items">
</resourceServiceProvider>
</extension>
-->
<!-- marker definitions for org.eclipse.smarthome.model.Items -->
<extension
id="items.check.fast"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.fast"/>
<persistent value="true"/>
</extension>
<extension
id="items.check.normal"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.normal"/>
<persistent value="true"/>
</extension>
<extension
id="items.check.expensive"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.expensive"/>
<persistent value="true"/>
</extension>
<extension
point="org.eclipse.xtext.builder.participant">
<participant
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.builder.IXtextBuilderParticipant">
</participant>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.smarthome.model.Items"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
id="org.eclipse.smarthome.model.Items.compiler.preferencePage"
name="Compiler">
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
</page>
</extension>
<extension
point="org.eclipse.ui.propertyPages">
<page
category="org.eclipse.smarthome.model.Items"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
id="org.eclipse.smarthome.model.Items.compiler.propertyPage"
name="Compiler">
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
<enabledWhen>
<adapt type="org.eclipse.core.resources.IProject"/>
</enabledWhen>
<filter name="projectNature" value="org.eclipse.xtext.ui.shared.xtextNature"/>
</page>
</extension>
<!-- Quick Outline -->
<extension
@ -174,12 +311,86 @@
</command>
</menuContribution>
</extension>
<!-- quickfix marker resolution generator -->
<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator">
</markerResolutionGenerator>
<!-- quickfix marker resolution generator for org.eclipse.smarthome.model.Items -->
<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="org.eclipse.smarthome.model.ui.items.check.fast">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
<markerResolutionGenerator
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="org.eclipse.smarthome.model.ui.items.check.normal">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
<markerResolutionGenerator
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator"
markerType="org.eclipse.smarthome.model.ui.items.check.expensive">
<attribute
name="FIXABLE_KEY"
value="true">
</attribute>
</markerResolutionGenerator>
</extension>
<!-- Rename Refactoring -->
<extension point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler"
commandId="org.eclipse.xtext.ui.refactoring.RenameElement">
<activeWhen>
<reference
definitionId="org.eclipse.smarthome.model.Items.Editor.opened">
</reference>
</activeWhen>
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:#TextEditorContext?after=group.edit">
<command commandId="org.eclipse.xtext.ui.refactoring.RenameElement"
style="push">
<visibleWhen checkEnabled="false">
<reference
definitionId="org.eclipse.smarthome.model.Items.Editor.opened">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.smarthome.model.Items"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferencePage"
id="org.eclipse.smarthome.model.Items.refactoring"
name="Refactoring">
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
</page>
</extension>
<extension point="org.eclipse.compare.contentViewers">
<viewer id="org.eclipse.smarthome.model.Items.compare.contentViewers"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
extensions="items">
</viewer>
</extension>
<extension point="org.eclipse.compare.contentMergeViewers">
<viewer id="org.eclipse.smarthome.model.Items.compare.contentMergeViewers"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
extensions="items" label="Items Compare">
</viewer>
</extension>
<extension point="org.eclipse.ui.editors.documentProviders">
<provider id="org.eclipse.smarthome.model.Items.editors.documentProviders"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.model.XtextDocumentProvider"
extensions="items">
</provider>
</extension>
</plugin>

Просмотреть файл

@ -224,27 +224,58 @@
</extension>
<!-- marker definitions for org.eclipse.smarthome.model.Items -->
<extension
id="items.check.fast"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.fast"/>
<persistent value="true"/>
<!-- marker definitions for org.eclipse.smarthome.model.Items -->
<extension
id="items.check.fast"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.fast"/>
<persistent value="true"/>
</extension>
<extension
id="items.check.normal"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.normal"/>
<persistent value="true"/>
</extension>
<extension
id="items.check.expensive"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.expensive"/>
<persistent value="true"/>
</extension>
<extension
point="org.eclipse.xtext.builder.participant">
<participant
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.builder.IXtextBuilderParticipant">
</participant>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.smarthome.model.Items"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
id="org.eclipse.smarthome.model.Items.compiler.preferencePage"
name="Compiler">
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
</page>
</extension>
<extension
id="items.check.normal"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.normal"/>
<persistent value="true"/>
</extension>
<extension
id="items.check.expensive"
name="Items Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.expensive"/>
<persistent value="true"/>
point="org.eclipse.ui.propertyPages">
<page
category="org.eclipse.smarthome.model.Items"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
id="org.eclipse.smarthome.model.Items.compiler.propertyPage"
name="Compiler">
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
<enabledWhen>
<adapt type="org.eclipse.core.resources.IProject"/>
</enabledWhen>
<filter name="projectNature" value="org.eclipse.xtext.ui.shared.xtextNature"/>
</page>
</extension>
<!-- Quick Outline -->
@ -308,5 +339,58 @@
</attribute>
</markerResolutionGenerator>
</extension>
<!-- Rename Refactoring -->
<extension point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler"
commandId="org.eclipse.xtext.ui.refactoring.RenameElement">
<activeWhen>
<reference
definitionId="org.eclipse.smarthome.model.Items.Editor.opened">
</reference>
</activeWhen>
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:#TextEditorContext?after=group.edit">
<command commandId="org.eclipse.xtext.ui.refactoring.RenameElement"
style="push">
<visibleWhen checkEnabled="false">
<reference
definitionId="org.eclipse.smarthome.model.Items.Editor.opened">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.smarthome.model.Items"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferencePage"
id="org.eclipse.smarthome.model.Items.refactoring"
name="Refactoring">
<keywordReference id="org.eclipse.smarthome.model.ui.keyword_Items"/>
</page>
</extension>
<extension point="org.eclipse.compare.contentViewers">
<viewer id="org.eclipse.smarthome.model.Items.compare.contentViewers"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
extensions="items">
</viewer>
</extension>
<extension point="org.eclipse.compare.contentMergeViewers">
<viewer id="org.eclipse.smarthome.model.Items.compare.contentMergeViewers"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
extensions="items" label="Items Compare">
</viewer>
</extension>
<extension point="org.eclipse.ui.editors.documentProviders">
<provider id="org.eclipse.smarthome.model.Items.editors.documentProviders"
class="org.eclipse.smarthome.model.ui.ItemsExecutableExtensionFactory:org.eclipse.xtext.ui.editor.model.XtextDocumentProvider"
extensions="items">
</provider>
</extension>
</plugin>

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -1,72 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.contentassist;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.smarthome.core.items.GroupItem;
import org.eclipse.smarthome.core.items.Item;
import org.eclipse.smarthome.core.items.ItemRegistry;
import org.eclipse.smarthome.designer.ui.UIActivator;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
import org.eclipse.smarthome.model.ui.contentassist.AbstractItemsProposalProvider;
/**
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
*/
public class ItemsProposalProvider extends AbstractItemsProposalProvider {
protected static final Set<String> ITEMTYPES = new HashSet<String>();
static {
ITEMTYPES.add("Group");
ITEMTYPES.add("Switch");
ITEMTYPES.add("Number");
ITEMTYPES.add("String");
ITEMTYPES.add("Dimmer");
ITEMTYPES.add("Color");
ITEMTYPES.add("Contact");
ITEMTYPES.add("Rollershutter");
ITEMTYPES.add("DateTime");
}
@Override
public void completeModelNormalItem_Type(EObject model,
Assignment assignment, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
super.completeModelNormalItem_Type(model, assignment, context, acceptor);
for(String itemType : ITEMTYPES) {
if(itemType.startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(itemType, context));
}
}
}
@Override
public void completeModelItem_Groups(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.completeModelItem_Groups(model, assignment, context, acceptor);
ItemRegistry registry = (ItemRegistry) UIActivator.itemRegistryTracker.getService();
if(registry!=null) {
for(Item item : registry.getItems(context.getPrefix() + "*")) {
if(item instanceof GroupItem) {
ICompletionProposal completionProposal = createCompletionProposal(item.getName(), context);
acceptor.accept(completionProposal);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,51 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.contentassist
import java.util.Set
import org.eclipse.emf.ecore.EObject
import org.eclipse.smarthome.core.items.GroupItem
import org.eclipse.smarthome.core.items.Item
import org.eclipse.smarthome.core.items.ItemRegistry
import org.eclipse.smarthome.designer.ui.UIActivator
import org.eclipse.xtext.Assignment
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor
/**
* see http://www.eclipse.org/Xtext/documentation.html#contentAssist on how to customize content assistant
*/
class ItemsProposalProvider extends AbstractItemsProposalProvider {
protected static final Set<String> ITEMTYPES = newHashSet("Group", "Switch", "Number", "String", "Dimmer", "Color", "Contact", "Rollershutter", "DateTime")
override void completeModelNormalItem_Type(EObject model,
Assignment assignment, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
super.completeModelNormalItem_Type(model, assignment, context, acceptor);
for(String itemType : ITEMTYPES) {
if(itemType.startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(itemType, context));
}
}
}
override void completeModelItem_Groups(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.completeModelItem_Groups(model, assignment, context, acceptor);
val registry = UIActivator.itemRegistryTracker.getService() as ItemRegistry
if(registry!=null) {
for(Item item : registry.getItems(context.getPrefix() + "*")) {
if(item instanceof GroupItem) {
val completionProposal = createCompletionProposal(item.getName(), context);
acceptor.accept(completionProposal);
}
}
}
}
}

Просмотреть файл

@ -1,34 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.labeling;
import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class ItemsDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
/*
//Labels and icons can be computed like this:
String text(IEObjectDescription ele) {
return "my "+ele.getName();
}
String image(IEObjectDescription ele) {
return ele.getEClass().getName() + ".gif";
}
*/
}

Просмотреть файл

@ -0,0 +1,24 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.labeling
//import org.eclipse.xtext.resource.IEObjectDescription
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class ItemsDescriptionLabelProvider extends org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider {
// Labels and icons can be computed like this:
// override text(IEObjectDescription ele) {
// ele.name.toString
// }
//
// override image(IEObjectDescription ele) {
// ele.EClass.name + '.gif'
// }
}

Просмотреть файл

@ -1,62 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.labeling;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
import org.eclipse.smarthome.model.items.ModelBinding;
import org.eclipse.smarthome.model.items.ModelGroupItem;
import org.eclipse.smarthome.model.items.ModelItem;
import org.eclipse.smarthome.model.items.ModelNormalItem;
import com.google.inject.Inject;
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class ItemsLabelProvider extends DefaultEObjectLabelProvider {
@Inject
public ItemsLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
String text(ModelItem item) {
if(item instanceof ModelGroupItem) {
return "Group " + item.getName();
}
if(item instanceof ModelNormalItem) {
String name = item.getName();
return ((ModelNormalItem) item).getType() + " " + name;
}
return item.getLabel();
}
String text(ModelBinding binding) {
return binding.getType();
}
String image(ModelItem item) {
if(item instanceof ModelGroupItem) {
return "group.png";
}
if(item instanceof ModelNormalItem) {
return ((ModelNormalItem) item).getType().toLowerCase() + ".png";
}
return null;
}
String image(ModelBinding binding) {
return "binding.png";
}
}

Просмотреть файл

@ -0,0 +1,54 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.labeling
import com.google.inject.Inject
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider
import org.eclipse.smarthome.model.items.ModelBinding
import org.eclipse.smarthome.model.items.ModelGroupItem
import org.eclipse.smarthome.model.items.ModelItem
import org.eclipse.smarthome.model.items.ModelNormalItem
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class ItemsLabelProvider extends DefaultEObjectLabelProvider {
@Inject
new(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
def protected String text(ModelItem item) {
if(item instanceof ModelGroupItem) {
return "Group " + item.getName();
}
if(item instanceof ModelNormalItem) {
val name = item.getName();
return item.getType() + " " + name;
}
return item.getLabel();
}
def protected String text(ModelBinding binding) {
return binding.getType();
}
def protected String image(ModelItem item) {
if(item instanceof ModelGroupItem) {
return "group.png";
}
if(item instanceof ModelNormalItem) {
return item.getType().toLowerCase() + ".png";
}
return null;
}
def protected String image(ModelBinding binding) {
return "binding.png";
}
}

Просмотреть файл

@ -1,21 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.outline;
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
/**
* customization of the default outline structure
*
*/
public class ItemsOutlineTreeProvider extends DefaultOutlineTreeProvider {
}

Просмотреть файл

@ -0,0 +1,13 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.outline
/**
* Customization of the default outline structure.
*
* see http://www.eclipse.org/Xtext/documentation.html#outline
*/
class ItemsOutlineTreeProvider extends org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider {
}

Просмотреть файл

@ -1,25 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.model.ui.quickfix;
import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
public class ItemsQuickfixProvider extends DefaultQuickfixProvider {
// @Fix(MyJavaValidator.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());
// }
// });
// }
}

Просмотреть файл

@ -0,0 +1,26 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.ui.quickfix
//import org.eclipse.xtext.ui.editor.quickfix.Fix
//import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor
//import org.eclipse.xtext.validation.Issue
/**
* Custom quickfixes.
*
* see http://www.eclipse.org/Xtext/documentation.html#quickfixes
*/
class ItemsQuickfixProvider extends org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider {
// @Fix(MyDslValidator::INVALID_NAME)
// def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) {
// acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png') [
// context |
// val xtextDocument = context.xtextDocument
// val firstLetter = xtextDocument.get(issue.offset, 1)
// xtextDocument.replace(issue.offset, 1, firstLetter.toUpperCase)
// ]
// }
}

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -4,6 +4,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>

2
bundles/model/org.eclipse.smarthome.model.item/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,2 @@
model
/plugin.xml_gen

Просмотреть файл

@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.xtext.util,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.common,
org.antlr.runtime
org.antlr.runtime,
org.eclipse.xtext.common.types
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.smarthome.model,
org.eclipse.smarthome.model.formatting,
@ -26,9 +27,10 @@ Export-Package: org.eclipse.smarthome.model,
org.eclipse.smarthome.model.items,
org.eclipse.smarthome.model.items.impl,
org.eclipse.smarthome.model.items.util,
org.eclipse.smarthome.model.parseTreeConstruction,
org.eclipse.smarthome.model.parser.antlr,
org.eclipse.smarthome.model.parser.antlr.internal
org.eclipse.smarthome.model.parser.antlr.internal,
org.eclipse.smarthome.model.serializer,
org.eclipse.smarthome.model.generator
Import-Package: org.apache.log4j,
org.eclipse.smarthome.core.binding,
org.eclipse.smarthome.core.items,
@ -38,6 +40,7 @@ Import-Package: org.apache.log4j,
org.eclipse.smarthome.core.types,
org.eclipse.smarthome.model.core,
org.osgi.framework,
org.slf4j
org.slf4j,
org.eclipse.xtext.xbase.lib
Bundle-Activator: org.eclipse.smarthome.model.item.internal.ItemModelActivator
Service-Component: OSGI-INF/genericitemprovider.xml

Просмотреть файл

@ -3,7 +3,7 @@ bin.includes = META-INF/,\
plugin.xml,\
OSGI-INF/,\
OSGI-INF/genericitemprovider.xml,\
src-gen/org/eclipse/smarthome/model/Items.genmodel,\
src-gen/org/eclipse/smarthome/model/Items.ecore
model/
source.. = src/,\
src-gen/
src-gen/,\
xtend-gen/

Просмотреть файл

@ -5,10 +5,12 @@
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.eclipse.org/SmartHome/model/Items"
uri = "http://www.eclipse.org/smarthome/model/Items"
class = "org.eclipse.smarthome.model.items.ItemsPackage"
genModel = "org/eclipse/smarthome/model/Items.genmodel" />
genModel = "model/generated/Items.genmodel" />
</extension>
</plugin>

Просмотреть файл

@ -7,11 +7,10 @@
<package
uri = "http://www.eclipse.org/smarthome/model/Items"
class = "org.eclipse.smarthome.model.items.ItemsPackage"
genModel = "org/eclipse/smarthome/model/Items.genmodel" />
genModel = "model/generated/Items.genmodel" />
</extension>
</plugin>

Просмотреть файл

@ -1,52 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.smarthome.bundles</groupId>
<artifactId>model</artifactId>
<version>0.7.0-SNAPSHOT</version>
</parent>
<parent>
<groupId>org.eclipse.smarthome.bundles</groupId>
<artifactId>model</artifactId>
<version>0.7.0-SNAPSHOT</version>
</parent>
<properties>
<bundle.symbolicName>org.eclipse.smarthome.model.item</bundle.symbolicName>
<bundle.namespace>org.eclipse.smarthome.model.item</bundle.namespace>
</properties>
<properties>
<bundle.symbolicName>org.eclipse.smarthome.model.item</bundle.symbolicName>
<bundle.namespace>org.eclipse.smarthome.model.item</bundle.namespace>
</properties>
<groupId>org.eclipse.smarthome.model</groupId>
<artifactId>org.eclipse.smarthome.model.item</artifactId>
<groupId>org.eclipse.smarthome.model</groupId>
<artifactId>org.eclipse.smarthome.model.item</artifactId>
<name>Eclipse SmartHome Model Items</name>
<packaging>eclipse-plugin</packaging>
<name>Eclipse SmartHome Model Items</name>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.fornax.toolsupport</groupId>
<artifactId>fornax-oaw-m2-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<workflowEngine>mwe2</workflowEngine>
<workflowDescriptor>src/org/eclipse/smarthome/model/GenerateItems.mwe2</workflowDescriptor>
<jvmSettings>
<jvmArgs>
<jvmArg>-Xmx512m</jvmArg>
</jvmArgs>
</jvmSettings>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run-workflow</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource><directory>src</directory></resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
<arguments>
<argument>file://${project.basedir}/src/org/eclipse/smarthome/model/GenerateItems.mwe2</argument>
<argument>
-p
</argument>
<argument>
runtimeProject=/${project.basedir}
</argument>
</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xtext</artifactId>
<version>${xtext-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase</artifactId>
<version>${xtext-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -4,98 +4,138 @@ import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*
var grammarURI = "classpath:/org/eclipse/smarthome/model/Items.xtext"
var file.extensions = "items"
var fileExtensions = "items"
var projectName = "org.eclipse.smarthome.model.item"
var grammarURI = "platform:/resource/${projectName}/src/org/eclipse/smarthome/model/Items.xtext"
var runtimeProject = "../${projectName}"
var generateXtendStub = true
var encoding = "UTF-8"
Workflow {
bean = StandaloneSetup {
platformUri = "${runtimeProject}/.."
bean = StandaloneSetup {
// use an XtextResourceset throughout the process, which is able to resolve classpath:/ URIs.
resourceSet = org.eclipse.xtext.resource.XtextResourceSet : theResourceSet {}
// add mappings from platform:/resource to classpath:/
// uriMap = {
// from = "platform:/resource/org.eclipse.xtext.xbase/"
// to = "classpath:/"
// }
// uriMap = {
// from = "platform:/resource/org.eclipse.xtext.common.types/"
// to = "classpath:/"
// }
// register current projects and its siblings for platform URI map, as they are not on the classpath.
platformUri = "${runtimeProject}/.."// The following two lines can be removed, if Xbase is not used.
//registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
//registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
exclude = ".empty"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/model"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
exclude = ".empty"
}
component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathUiProject = "${runtimeProject}.ui"// pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
language = {
encoding = encoding
language = auto-inject {
// make sure we use the resourceSet created during standalone setup.
forcedResourceSet = theResourceSet
uri = grammarURI
fileExtensions = file.extensions
fileExtensions = fileExtensions
// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment {}
fragment = grammarAccess.GrammarAccessFragment auto-inject {}
// generates Java API for the generated EPackages
fragment = ecore.EcoreGeneratorFragment {
// referencedGenModels = "uri to genmodel, uri to next genmodel"
// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {
javaModelDirectory = "/${projectName}/src-gen"
}
// the serialization component
fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
// the old serialization component
// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
// serializer 2.0
fragment = serializer.SerializerFragment auto-inject {
generateStub = false
}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment {
// options = {
// backtrack = true
// }
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
// options = {
// backtrack = true
// }
}
// java-based API for validation
fragment = validation.JavaValidatorFragment {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
// registerForImportedPackages = true
// Xtend-based API for validation
fragment = validation.ValidatorFragment auto-inject {
// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// old scoping and exporting API
// fragment = scoping.ImportURIScopingFragment auto-inject {}
// fragment = exporting.SimpleNamesFragment auto-inject {}
// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}
fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
fragment = exporting.QualifiedNamesFragment auto-inject {}
fragment = builder.BuilderIntegrationFragment auto-inject {}
// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment {}
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}
// generator API
fragment = generator.GeneratorFragment auto-inject {}
// formatter API
fragment = formatting.FormatterFragment {}
// formatter API
fragment = formatting.FormatterFragment auto-inject {}
// labeling API
fragment = labeling.LabelProviderFragment {}
// labeling API
fragment = labeling.LabelProviderFragment auto-inject {}
// outline API
fragment = outline.OutlineTreeProviderFragment {}
fragment = outline.QuickOutlineFragment {}
// outline API
fragment = outline.OutlineTreeProviderFragment auto-inject {}
fragment = outline.QuickOutlineFragment auto-inject {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment auto-inject {}
// content assist API
fragment = contentAssist.JavaBasedContentAssistFragment {}
// content assist API
fragment = contentAssist.ContentAssistFragment auto-inject {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}
// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment {
// generatorProjectName = "${projectName}.generator"
// modelFileExtension = file.extensions
// }
// generates junit test support classes into Generator#pathTestProject
// fragment = junit.Junit4Fragment auto-inject {}
// rename refactoring
fragment = refactoring.RefactorElementNameFragment auto-inject {}
// provides the necessary bindings for java types integration
// fragment = types.TypesGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xbase
// fragment = xbase.XbaseGeneratorFragment auto-inject {}
// provides a preference page for template proposals
fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
// provides a compare view
fragment = compare.CompareFragment auto-inject {}
}
}
}

Просмотреть файл

@ -1,57 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.formatting;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
import org.eclipse.xtext.formatting.impl.FormattingConfig;
/**
* This class contains custom formatting description.
*
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting
* on how and when to use it
*
* Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
*/
public class ItemsFormatter extends AbstractDeclarativeFormatter {
@Override
protected void configureFormatting(FormattingConfig c) {
org.eclipse.smarthome.model.services.ItemsGrammarAccess f = (org.eclipse.smarthome.model.services.ItemsGrammarAccess) getGrammarAccess();
c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
c.setLinewrap().after(f.getModelNormalItemRule());
c.setLinewrap().after(f.getModelGroupItemRule());
c.setNoSpace().after(f.getModelItemAccess().getLeftParenthesisKeyword_4_0());
c.setNoSpace().before(f.getModelItemAccess().getRightParenthesisKeyword_4_3());
c.setNoSpace().before(f.getModelGroupItemAccess().getLeftParenthesisKeyword_2_2_2_0());
for (Keyword comma : f.findKeywords(",")) {
c.setNoSpace().before(comma);
}
for (Keyword colon : f.findKeywords(":")) {
c.setNoSpace().before(colon);
c.setNoSpace().after(colon);
}
for (Keyword eq : f.findKeywords("=")) {
c.setNoSpace().before(eq);
c.setNoSpace().after(eq);
}
}
}

Просмотреть файл

@ -1,24 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.scoping;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
/**
* This class contains custom scoping description.
*
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping
* on how and when to use it
*
*/
public class ItemsScopeProvider extends AbstractDeclarativeScopeProvider {
}

Просмотреть файл

@ -1,22 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.model.validation;
import org.eclipse.smarthome.model.validation.AbstractItemsJavaValidator;
public class ItemsJavaValidator extends AbstractItemsJavaValidator {
// @Check
// public void checkGreetingStartsWithCapital(Greeting greeting) {
// if (!Character.isUpperCase(greeting.getName().charAt(0))) {
// warning("Name should start with a capital", MyDslPackage.GREETING__NAME);
// }
// }
}

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -4,5 +4,6 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>

Просмотреть файл

@ -0,0 +1 @@
/plugin.xml_gen

Просмотреть файл

@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>

Просмотреть файл

@ -20,7 +20,8 @@ Import-Package: com.google.common.collect,
org.apache.commons.logging,
org.apache.log4j,
org.eclipse.smarthome.core.items,
org.eclipse.smarthome.designer.ui
org.eclipse.smarthome.designer.ui,
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.smarthome.model.persistence.ui.contentassist,
org.eclipse.smarthome.model.persistence.ui.contentassist.antlr,

Просмотреть файл

@ -1,5 +1,6 @@
source.. = src/,\
src-gen/
src-gen/,\
xtend-gen/
bin.includes = META-INF/,\
.,\
plugin.xml
plugin.xml

Просмотреть файл

@ -224,27 +224,58 @@
</extension>
<!-- marker definitions for org.eclipse.smarthome.model.persistence.Persistence -->
<extension
id="persistence.check.fast"
name="Persistence Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.fast"/>
<persistent value="true"/>
<!-- marker definitions for org.eclipse.smarthome.model.persistence.Persistence -->
<extension
id="persistence.check.fast"
name="Persistence Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.fast"/>
<persistent value="true"/>
</extension>
<extension
id="persistence.check.normal"
name="Persistence Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.normal"/>
<persistent value="true"/>
</extension>
<extension
id="persistence.check.expensive"
name="Persistence Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.expensive"/>
<persistent value="true"/>
</extension>
<extension
point="org.eclipse.xtext.builder.participant">
<participant
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.builder.IXtextBuilderParticipant">
</participant>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.smarthome.model.persistence.Persistence"
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
id="org.eclipse.smarthome.model.persistence.Persistence.compiler.preferencePage"
name="Compiler">
<keywordReference id="org.eclipse.smarthome.model.persistence.ui.keyword_Persistence"/>
</page>
</extension>
<extension
id="persistence.check.normal"
name="Persistence Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.normal"/>
<persistent value="true"/>
</extension>
<extension
id="persistence.check.expensive"
name="Persistence Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.expensive"/>
<persistent value="true"/>
point="org.eclipse.ui.propertyPages">
<page
category="org.eclipse.smarthome.model.persistence.Persistence"
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.builder.preferences.BuilderPreferencePage"
id="org.eclipse.smarthome.model.persistence.Persistence.compiler.propertyPage"
name="Compiler">
<keywordReference id="org.eclipse.smarthome.model.persistence.ui.keyword_Persistence"/>
<enabledWhen>
<adapt type="org.eclipse.core.resources.IProject"/>
</enabledWhen>
<filter name="projectNature" value="org.eclipse.xtext.ui.shared.xtextNature"/>
</page>
</extension>
<!-- Quick Outline -->
@ -308,5 +339,58 @@
</attribute>
</markerResolutionGenerator>
</extension>
<!-- Rename Refactoring -->
<extension point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler"
commandId="org.eclipse.xtext.ui.refactoring.RenameElement">
<activeWhen>
<reference
definitionId="org.eclipse.smarthome.model.persistence.Persistence.Editor.opened">
</reference>
</activeWhen>
</handler>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:#TextEditorContext?after=group.edit">
<command commandId="org.eclipse.xtext.ui.refactoring.RenameElement"
style="push">
<visibleWhen checkEnabled="false">
<reference
definitionId="org.eclipse.smarthome.model.persistence.Persistence.Editor.opened">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.smarthome.model.persistence.Persistence"
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferencePage"
id="org.eclipse.smarthome.model.persistence.Persistence.refactoring"
name="Refactoring">
<keywordReference id="org.eclipse.smarthome.model.persistence.ui.keyword_Persistence"/>
</page>
</extension>
<extension point="org.eclipse.compare.contentViewers">
<viewer id="org.eclipse.smarthome.model.persistence.Persistence.compare.contentViewers"
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
extensions="persist">
</viewer>
</extension>
<extension point="org.eclipse.compare.contentMergeViewers">
<viewer id="org.eclipse.smarthome.model.persistence.Persistence.compare.contentMergeViewers"
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.ui.compare.InjectableViewerCreator"
extensions="persist" label="Persistence Compare">
</viewer>
</extension>
<extension point="org.eclipse.ui.editors.documentProviders">
<provider id="org.eclipse.smarthome.model.persistence.Persistence.editors.documentProviders"
class="org.eclipse.smarthome.model.persistence.ui.PersistenceExecutableExtensionFactory:org.eclipse.xtext.ui.editor.model.XtextDocumentProvider"
extensions="persist">
</provider>
</extension>
</plugin>

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -1,55 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.contentassist;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.smarthome.core.items.GroupItem;
import org.eclipse.smarthome.core.items.Item;
import org.eclipse.smarthome.core.items.ItemRegistry;
import org.eclipse.smarthome.designer.ui.UIActivator;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
import org.eclipse.smarthome.model.persistence.ui.contentassist.AbstractPersistenceProposalProvider;
/**
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
*/
public class PersistenceProposalProvider extends AbstractPersistenceProposalProvider {
@Override
public void completeGroupConfig_Group(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.completeGroupConfig_Group(model, assignment, context, acceptor);
ItemRegistry registry = (ItemRegistry) UIActivator.itemRegistryTracker.getService();
if(registry!=null) {
for(Item item : registry.getItems(context.getPrefix() + "*")) {
if(item instanceof GroupItem) {
ICompletionProposal completionProposal = createCompletionProposal(item.getName(), context);
acceptor.accept(completionProposal);
}
}
}
}
@Override
public void completeItemConfig_Item(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
ItemRegistry registry = (ItemRegistry) UIActivator.itemRegistryTracker.getService();
if(registry!=null) {
for(Item item : registry.getItems(context.getPrefix() + "*")) {
ICompletionProposal completionProposal = createCompletionProposal(item.getName(), context);
acceptor.accept(completionProposal);
}
}
}
}

Просмотреть файл

@ -0,0 +1,46 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.contentassist
import org.eclipse.emf.ecore.EObject
import org.eclipse.smarthome.core.items.GroupItem
import org.eclipse.smarthome.core.items.Item
import org.eclipse.smarthome.core.items.ItemRegistry
import org.eclipse.smarthome.designer.ui.UIActivator
import org.eclipse.xtext.Assignment
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor
/**
* see http://www.eclipse.org/Xtext/documentation.html#contentAssist on how to customize content assistant
*/
class PersistenceProposalProvider extends AbstractPersistenceProposalProvider {
override void completeGroupConfig_Group(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.completeGroupConfig_Group(model, assignment, context, acceptor);
val registry = UIActivator.itemRegistryTracker.getService() as ItemRegistry
if(registry!=null) {
for(Item item : registry.getItems(context.getPrefix() + "*")) {
if(item instanceof GroupItem) {
val completionProposal = createCompletionProposal(item.getName(), context);
acceptor.accept(completionProposal);
}
}
}
}
override void completeItemConfig_Item(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val registry = UIActivator.itemRegistryTracker.getService() as ItemRegistry
if(registry!=null) {
for(Item item : registry.getItems(context.getPrefix() + "*")) {
val completionProposal = createCompletionProposal(item.getName(), context);
acceptor.accept(completionProposal);
}
}
}
}

Просмотреть файл

@ -1,34 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.labeling;
import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class PersistenceDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
/*
//Labels and icons can be computed like this:
String text(IEObjectDescription ele) {
return "my "+ele.getName();
}
String image(IEObjectDescription ele) {
return ele.getEClass().getName() + ".gif";
}
*/
}

Просмотреть файл

@ -0,0 +1,24 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.labeling
//import org.eclipse.xtext.resource.IEObjectDescription
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class PersistenceDescriptionLabelProvider extends org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider {
// Labels and icons can be computed like this:
// override text(IEObjectDescription ele) {
// ele.name.toString
// }
//
// override image(IEObjectDescription ele) {
// ele.EClass.name + '.gif'
// }
}

Просмотреть файл

@ -1,41 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.labeling;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
import com.google.inject.Inject;
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class PersistenceLabelProvider extends DefaultEObjectLabelProvider {
@Inject
public PersistenceLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
/*
//Labels and icons can be computed like this:
String text(MyModel ele) {
return "my "+ele.getName();
}
String image(MyModel ele) {
return "MyModel.gif";
}
*/
}

Просмотреть файл

@ -0,0 +1,29 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.labeling
import com.google.inject.Inject
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class PersistenceLabelProvider extends org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider {
@Inject
new(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider delegate) {
super(delegate);
}
// Labels and icons can be computed like this:
// def text(Greeting ele) {
// 'A greeting to ' + ele.name
// }
//
// def image(Greeting ele) {
// 'Greeting.gif'
// }
}

Просмотреть файл

@ -1,21 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.outline;
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
/**
* customization of the default outline structure
*
*/
public class PersistenceOutlineTreeProvider extends DefaultOutlineTreeProvider {
}

Просмотреть файл

@ -0,0 +1,13 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.outline
/**
* Customization of the default outline structure.
*
* see http://www.eclipse.org/Xtext/documentation.html#outline
*/
class PersistenceOutlineTreeProvider extends org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider {
}

Просмотреть файл

@ -1,25 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.model.persistence.ui.quickfix;
import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
public class PersistenceQuickfixProvider extends DefaultQuickfixProvider {
// @Fix(MyJavaValidator.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());
// }
// });
// }
}

Просмотреть файл

@ -0,0 +1,26 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.ui.quickfix
//import org.eclipse.xtext.ui.editor.quickfix.Fix
//import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor
//import org.eclipse.xtext.validation.Issue
/**
* Custom quickfixes.
*
* see http://www.eclipse.org/Xtext/documentation.html#quickfixes
*/
class PersistenceQuickfixProvider extends org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider {
// @Fix(MyDslValidator::INVALID_NAME)
// def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) {
// acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png') [
// context |
// val xtextDocument = context.xtextDocument
// val firstLetter = xtextDocument.get(issue.offset, 1)
// xtextDocument.replace(issue.offset, 1, firstLetter.toUpperCase)
// ]
// }
}

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -0,0 +1,2 @@
/model
/plugin.xml_gen

Просмотреть файл

@ -47,6 +47,6 @@ Export-Package: org.eclipse.smarthome.model.persistence,
org.eclipse.smarthome.model.persistence.scoping,
org.eclipse.smarthome.model.persistence.generator,
org.eclipse.smarthome.model.persistence.formatting,
org.eclipse.smarthome.model.persistence.parseTreeConstruction
org.eclipse.smarthome.model.persistence.serializer
Bundle-Activator: org.eclipse.smarthome.model.persistence.internal.PersistenceModelActivator
Service-Component: OSGI-INF/persistencemanager.xml

Просмотреть файл

@ -1,7 +1,8 @@
source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = META-INF/,\
bin.includes = model/,\
META-INF/,\
.,\
plugin.xml,\
OSGI-INF/

Просмотреть файл

@ -7,11 +7,10 @@
<package
uri = "http://www.eclipse.org/smarthome/model/Persistence"
class = "org.eclipse.smarthome.model.persistence.persistence.PersistencePackage"
genModel = "org/eclipse/smarthome/model/persistence/Persistence.genmodel" />
genModel = "model/generated/Persistence.genmodel" />
</extension>
</plugin>

Просмотреть файл

@ -1,53 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.smarthome.bundles</groupId>
<artifactId>model</artifactId>
<version>0.7.0-SNAPSHOT</version>
</parent>
<parent>
<groupId>org.eclipse.smarthome.bundles</groupId>
<artifactId>model</artifactId>
<version>0.7.0-SNAPSHOT</version>
</parent>
<properties>
<bundle.symbolicName>org.eclipse.smarthome.model.persistence</bundle.symbolicName>
<bundle.namespace>org.eclipse.smarthome.model.persistence</bundle.namespace>
</properties>
<properties>
<bundle.symbolicName>org.eclipse.smarthome.model.persistence</bundle.symbolicName>
<bundle.namespace>org.eclipse.smarthome.model.persistence</bundle.namespace>
</properties>
<groupId>org.eclipse.smarthome.model</groupId>
<artifactId>org.eclipse.smarthome.model.persistence</artifactId>
<groupId>org.eclipse.smarthome.model</groupId>
<artifactId>org.eclipse.smarthome.model.persistence</artifactId>
<name>Eclipse SmartHome Model Persistence</name>
<packaging>eclipse-plugin</packaging>
<name>Eclipse SmartHome Model Persistence</name>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.fornax.toolsupport</groupId>
<artifactId>fornax-oaw-m2-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<workflowEngine>mwe2</workflowEngine>
<workflowDescriptor>src/org/eclipse/smarthome/model/persistence/GeneratePersistence.mwe2</workflowDescriptor>
<jvmSettings>
<jvmArgs>
<jvmArg>-Xmx512m</jvmArg>
</jvmArgs>
</jvmSettings>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run-workflow</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource><directory>src</directory></resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
<arguments>
<argument>file://${project.basedir}/src/org/eclipse/smarthome/model/persistence/GeneratePersistence.mwe2</argument>
<argument>
-p
</argument>
<argument>
runtimeProject=/${project.basedir}
</argument>
</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xtext</artifactId>
<version>${xtext-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase</artifactId>
<version>${xtext-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -4,103 +4,142 @@ import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*
var grammarURI = "classpath:/org/eclipse/smarthome/model/persistence/Persistence.xtext"
var file.extensions = "persist"
var projectName = "org.eclipse.smarthome.model.persistence"
var fileExtensions = "persist"
var grammarURI = "platform:/resource/${projectName}/src/org/eclipse/smarthome/model/persistence/Persistence.xtext"
var runtimeProject = "../${projectName}"
var generateXtendStub = true
var encoding = "UTF-8"
Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
// The following two lines can be removed, if Xbase is not used.
registerGenModelFile = "platform:/resource/org.eclipse.smarthome.model.item/src-gen/org/eclipse/smarthome/model/Items.genmodel"
registerGeneratedEPackage = "org.eclipse.smarthome.model.items.ItemsPackage"
}
bean = StandaloneSetup {
// use an XtextResourceset throughout the process, which is able to resolve classpath:/ URIs.
resourceSet = org.eclipse.xtext.resource.XtextResourceSet : theResourceSet {}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
exclude = ".empty"
}
// add mappings from platform:/resource to classpath:/
// uriMap = {
// from = "platform:/resource/org.eclipse.xtext.xbase/"
// to = "classpath:/"
// }
// uriMap = {
// from = "platform:/resource/org.eclipse.smarthome.model.item/"
// to = "classpath:/"
// }
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
exclude = ".empty"
}
// register current projects and its siblings for platform URI map, as they are not on the classpath.
platformUri = "${runtimeProject}/.."
// The following two lines can be removed, if Xbase is not used.
//registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
//registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
// registerGeneratedEPackage = "org.eclipse.smarthome.model.items.ItemsPackage"
// registerGenModelFile = "platform:/resource/org.eclipse.smarthome.model.item/model/generated/Items.genmodel"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/model"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}
component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathUiProject = "${runtimeProject}.ui"// pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
language = {
encoding = encoding
language = auto-inject {
// make sure we use the resourceSet created during standalone setup.
forcedResourceSet = theResourceSet
uri = grammarURI
fileExtensions = file.extensions
fileExtensions = fileExtensions
// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment {}
// generates Java API for the generated EPackages
fragment = ecore.EcoreGeneratorFragment {
// referencedGenModels = "uri to genmodel, uri to next genmodel"
fragment = grammarAccess.GrammarAccessFragment auto-inject {}
// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {
javaModelDirectory = "/${projectName}/src-gen"
}
// the serialization component
fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
// the old serialization component
// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}
// serializer 2.0
fragment = serializer.SerializerFragment auto-inject {
generateStub = false
}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment {
// options = {
// backtrack = true
// }
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
// options = {
// backtrack = true
// }
}
// java-based API for validation
fragment = validation.JavaValidatorFragment {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
// registerForImportedPackages = true
// Xtend-based API for validation
fragment = validation.ValidatorFragment auto-inject {
// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// old scoping and exporting API
// fragment = scoping.ImportURIScopingFragment auto-inject {}
// fragment = exporting.SimpleNamesFragment auto-inject {}
// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}
fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
fragment = exporting.QualifiedNamesFragment auto-inject {}
fragment = builder.BuilderIntegrationFragment auto-inject {}
// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment {}
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}
// generator API
fragment = generator.GeneratorFragment auto-inject {}
// formatter API
fragment = formatting.FormatterFragment {}
// formatter API
fragment = formatting.FormatterFragment auto-inject {}
// labeling API
fragment = labeling.LabelProviderFragment {}
// labeling API
fragment = labeling.LabelProviderFragment auto-inject {}
// outline API
fragment = outline.OutlineTreeProviderFragment {}
fragment = outline.QuickOutlineFragment {}
// outline API
fragment = outline.OutlineTreeProviderFragment auto-inject {}
fragment = outline.QuickOutlineFragment auto-inject {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment auto-inject {}
// content assist API
fragment = contentAssist.JavaBasedContentAssistFragment {}
// content assist API
fragment = contentAssist.ContentAssistFragment auto-inject {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}
// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment {
// generatorProjectName = "${projectName}.generator"
// modelFileExtension = file.extensions
// }
// generates junit test support classes into Generator#pathTestProject
// fragment = junit.Junit4Fragment auto-inject {}
// rename refactoring
fragment = refactoring.RefactorElementNameFragment auto-inject {}
// provides the necessary bindings for java types integration
// fragment = types.TypesGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xbase
// fragment = xbase.XbaseGeneratorFragment auto-inject {}
// provides a preference page for template proposals
fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
// provides a compare view
fragment = compare.CompareFragment auto-inject {}
}
}
}
}

Просмотреть файл

@ -1,6 +1,5 @@
grammar org.eclipse.smarthome.model.persistence.Persistence with org.eclipse.xtext.common.Terminals
import "http://www.eclipse.org/smarthome/model/Items"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
generate persistence "http://www.eclipse.org/smarthome/model/Persistence"

Просмотреть файл

@ -1,34 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.formatting;
import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
import org.eclipse.xtext.formatting.impl.FormattingConfig;
/**
* This class contains custom formatting description.
*
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting
* on how and when to use it
*
* Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
*/
public class PersistenceFormatter extends AbstractDeclarativeFormatter {
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}
}

Просмотреть файл

@ -0,0 +1,30 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.formatting
import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter
import org.eclipse.xtext.formatting.impl.FormattingConfig
// import com.google.inject.Inject;
// import org.eclipse.smarthome.model.persistence.services.PersistenceGrammarAccess
/**
* This class contains custom formatting description.
*
* see : http://www.eclipse.org/Xtext/documentation.html#formatting
* on how and when to use it
*
* Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
*/
class PersistenceFormatter extends AbstractDeclarativeFormatter {
// @Inject extension PersistenceGrammarAccess
override protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(SL_COMMENTRule)
// c.setLinewrap(0, 1, 2).before(ML_COMMENTRule)
// c.setLinewrap(0, 1, 1).after(ML_COMMENTRule)
}
}

Просмотреть файл

@ -1,24 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.scoping;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
/**
* This class contains custom scoping description.
*
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping
* on how and when to use it
*
*/
public class PersistenceScopeProvider extends AbstractDeclarativeScopeProvider {
}

Просмотреть файл

@ -0,0 +1,15 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.scoping
/**
* This class contains custom scoping description.
*
* see : http://www.eclipse.org/Xtext/documentation.html#scoping
* on how and when to use it
*
*/
class PersistenceScopeProvider extends org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider {
}

Просмотреть файл

@ -1,22 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.model.persistence.validation;
import org.eclipse.smarthome.model.persistence.validation.AbstractPersistenceJavaValidator;
public class PersistenceJavaValidator extends AbstractPersistenceJavaValidator {
// @Check
// public void checkGreetingStartsWithCapital(Greeting greeting) {
// if (!Character.isUpperCase(greeting.getName().charAt(0))) {
// warning("Name should start with a capital", MyDslPackage.Literals.GREETING__NAME);
// }
// }
}

Просмотреть файл

@ -0,0 +1,24 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.persistence.validation
//import org.eclipse.xtext.validation.Check
/**
* Custom validation rules.
*
* see http://www.eclipse.org/Xtext/documentation.html#validation
*/
class PersistenceValidator extends AbstractPersistenceValidator {
// public static val INVALID_NAME = 'invalidName'
//
// @Check
// def checkGreetingStartsWithCapital(Greeting greeting) {
// if (!Character.isUpperCase(greeting.name.charAt(0))) {
// warning('Name should start with a capital',
// MyDslPackage.Literals.GREETING__NAME,
// INVALID_NAME)
// }
// }
}

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -4,6 +4,5 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>

Просмотреть файл

@ -7,14 +7,11 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Vendor: Eclipse.org/SmartHome
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.smarthome.model.rule,
org.eclipse.smarthome.model.rule.ui,
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtend.lib,
com.google.guava,
org.eclipse.xtext.xbase.lib
Export-Package: org.eclipse.smarthome.model.rule
Import-Package: org.eclipse.smarthome.core.items,
org.eclipse.smarthome.core.library.items,
org.eclipse.smarthome.core.scriptengine.action,

Просмотреть файл

@ -1,5 +1,4 @@
source.. = src-gen/,\
src/,\
source.. = src/,\
xtend-gen/
output.. = bin/
bin.includes = META-INF/,\

Просмотреть файл

@ -0,0 +1 @@
!.gitignore

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -4,5 +4,6 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
bundles/model/org.eclipse.smarthome.model.rule.ui/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
/plugin.xml_gen

Просмотреть файл

@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>

Просмотреть файл

@ -1,6 +1,7 @@
source.. = src/,\
src-gen/
src-gen/,\
xtend-gen/
bin.includes = META-INF/,\
.,\
plugin.xml,\
templates/
templates/

Просмотреть файл

@ -225,28 +225,28 @@
</extension>
<!-- marker definitions for org.eclipse.smarthome.model.rule.Rules -->
<extension
id="rules.check.fast"
name="Rules Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.fast"/>
<persistent value="true"/>
</extension>
<extension
id="rules.check.normal"
name="Rules Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.normal"/>
<persistent value="true"/>
</extension>
<extension
id="rules.check.expensive"
name="Rules Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.expensive"/>
<persistent value="true"/>
</extension>
<!-- marker definitions for org.eclipse.smarthome.model.rule.Rules -->
<extension
id="rules.check.fast"
name="Rules Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.fast"/>
<persistent value="true"/>
</extension>
<extension
id="rules.check.normal"
name="Rules Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.normal"/>
<persistent value="true"/>
</extension>
<extension
id="rules.check.expensive"
name="Rules Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.xtext.ui.check.expensive"/>
<persistent value="true"/>
</extension>
<extension
point="org.eclipse.xtext.builder.participant">

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -1,68 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.contentassist;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.smarthome.core.items.Item;
import org.eclipse.smarthome.core.items.ItemRegistry;
import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.core.types.State;
import org.eclipse.smarthome.model.rule.ui.internal.RuleModelUIActivator;
import org.eclipse.smarthome.model.script.scoping.StateAndCommandProvider;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
import com.google.inject.Inject;
/**
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
*/
@SuppressWarnings("restriction")
public class RulesProposalProvider extends AbstractRulesProposalProvider {
@Inject
StateAndCommandProvider stateAndCommandProvider;
@Override
public void complete_ItemName(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_ItemName(model, ruleCall, context, acceptor);
ItemRegistry itemRegistry = RuleModelUIActivator.itemRegistryTracker.getService();
for(Item item : itemRegistry.getItems()) {
if(item.getName().startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(item.getName(), context));
}
}
}
@Override
public void complete_ValidState(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_ValidState(model, ruleCall, context, acceptor);
for(State state : stateAndCommandProvider.getAllStates()) {
if(state.toString().startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(state.toString(), context));
}
}
}
@Override
public void complete_ValidCommand(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_ValidState(model, ruleCall, context, acceptor);
for(Command command : stateAndCommandProvider.getAllCommands()) {
if(command.toString().startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(command.toString(), context));
}
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.contentassist
import com.google.inject.Inject
import org.eclipse.emf.ecore.EObject
import org.eclipse.smarthome.core.items.Item
import org.eclipse.smarthome.core.items.ItemRegistry
import org.eclipse.smarthome.core.types.Command
import org.eclipse.smarthome.core.types.State
import org.eclipse.smarthome.model.rule.ui.internal.RuleModelUIActivator
import org.eclipse.smarthome.model.script.scoping.StateAndCommandProvider
import org.eclipse.xtext.RuleCall
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor
/**
* see http://www.eclipse.org/Xtext/documentation.html#contentAssist on how to customize content assistant
*/
class RulesProposalProvider extends AbstractRulesProposalProvider {
@Inject
StateAndCommandProvider stateAndCommandProvider
override void complete_ItemName(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_ItemName(model, ruleCall, context, acceptor);
val itemRegistry = RuleModelUIActivator.itemRegistryTracker.getService();
for(Item item : itemRegistry.getItems()) {
if(item.getName().startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(item.getName(), context));
}
}
}
override void complete_ValidState(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_ValidState(model, ruleCall, context, acceptor);
for(State state : stateAndCommandProvider.getAllStates()) {
if(state.toString().startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(state.toString(), context));
}
}
}
override void complete_ValidCommand(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_ValidState(model, ruleCall, context, acceptor);
for(Command command : stateAndCommandProvider.getAllCommands()) {
if(command.toString().startsWith(context.getPrefix())) {
acceptor.accept(createCompletionProposal(command.toString(), context));
}
}
}
}

Просмотреть файл

@ -1,34 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.labeling;
import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class RulesDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
/*
//Labels and icons can be computed like this:
String text(IEObjectDescription ele) {
return "my "+ele.getName();
}
String image(IEObjectDescription ele) {
return ele.getEClass().getName() + ".gif";
}
*/
}

Просмотреть файл

@ -0,0 +1,24 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.labeling
//import org.eclipse.xtext.resource.IEObjectDescription
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class RulesDescriptionLabelProvider extends org.eclipse.xtext.xbase.ui.labeling.XbaseDescriptionLabelProvider {
// Labels and icons can be computed like this:
// override text(IEObjectDescription ele) {
// ele.name.toString
// }
//
// override image(IEObjectDescription ele) {
// ele.EClass.name + '.gif'
// }
}

Просмотреть файл

@ -1,41 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.labeling;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
import com.google.inject.Inject;
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class RulesLabelProvider extends DefaultEObjectLabelProvider {
@Inject
public RulesLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
/*
//Labels and icons can be computed like this:
String text(MyModel ele) {
return "my "+ele.getName();
}
String image(MyModel ele) {
return "MyModel.gif";
}
*/
}

Просмотреть файл

@ -0,0 +1,29 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.labeling
import com.google.inject.Inject
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class RulesLabelProvider extends org.eclipse.xtext.xbase.ui.labeling.XbaseLabelProvider {
@Inject
new(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider delegate) {
super(delegate);
}
// Labels and icons can be computed like this:
// def text(Greeting ele) {
// 'A greeting to ' + ele.name
// }
//
// def image(Greeting ele) {
// 'Greeting.gif'
// }
}

Просмотреть файл

@ -1,21 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.outline;
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
/**
* customization of the default outline structure
*
*/
public class RulesOutlineTreeProvider extends DefaultOutlineTreeProvider {
}

Просмотреть файл

@ -0,0 +1,13 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.outline
/**
* Customization of the default outline structure.
*
* see http://www.eclipse.org/Xtext/documentation.html#outline
*/
class RulesOutlineTreeProvider extends org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider {
}

Просмотреть файл

@ -1,25 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.model.rule.ui.quickfix;
import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
public class RulesQuickfixProvider extends DefaultQuickfixProvider {
// @Fix(MyJavaValidator.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());
// }
// });
// }
}

Просмотреть файл

@ -0,0 +1,26 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.ui.quickfix
//import org.eclipse.xtext.ui.editor.quickfix.Fix
//import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor
//import org.eclipse.xtext.validation.Issue
/**
* Custom quickfixes.
*
* see http://www.eclipse.org/Xtext/documentation.html#quickfixes
*/
class RulesQuickfixProvider extends org.eclipse.smarthome.model.script.ui.quickfix.ScriptQuickfixProvider {
// @Fix(MyDslValidator::INVALID_NAME)
// def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) {
// acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png') [
// context |
// val xtextDocument = context.xtextDocument
// val firstLetter = xtextDocument.get(issue.offset, 1)
// xtextDocument.replace(issue.offset, 1, firstLetter.toUpperCase)
// ]
// }
}

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

2
bundles/model/org.eclipse.smarthome.model.rule/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,2 @@
/model
/plugin.xml_gen

Просмотреть файл

@ -43,7 +43,8 @@ Import-Package: com.google.common.collect,
org.quartz.impl,
org.quartz.impl.matchers,
org.quartz.utils,
org.slf4j
org.slf4j,
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.smarthome.model.rule,
org.eclipse.smarthome.model.rule.services,

Просмотреть файл

@ -1,7 +1,8 @@
source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = META-INF/,\
bin.includes = model/,\
META-INF/,\
.,\
plugin.xml,\
OSGI-INF/

Просмотреть файл

@ -7,12 +7,11 @@
<package
uri = "http://www.eclipse.org/smarthome/model/Rules"
class = "org.eclipse.smarthome.model.rule.rules.RulesPackage"
genModel = "org/eclipse/smarthome/model/rule/Rules.genmodel" />
genModel = "model/generated/Rules.genmodel" />
</extension>
</plugin>

Просмотреть файл

@ -21,33 +21,56 @@
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.fornax.toolsupport</groupId>
<artifactId>fornax-oaw-m2-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<workflowEngine>mwe2</workflowEngine>
<workflowDescriptor>src/org/eclipse/smarthome/model/rule/GenerateRules.mwe2</workflowDescriptor>
<jvmSettings>
<jvmArgs>
<jvmArg>-Xmx512m</jvmArg>
</jvmArgs>
</jvmSettings>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run-workflow</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource><directory>src</directory></resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
<arguments>
<argument>file://${project.basedir}/src/org/eclipse/smarthome/model/rule/GenerateRules.mwe2</argument>
<argument>
-p
</argument>
<argument>
runtimeProject=/${project.basedir}
</argument>
</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xtext</artifactId>
<version>${xtext-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase</artifactId>
<version>${xtext-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.smarthome.model</groupId>
<artifactId>org.eclipse.smarthome.model.script</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Просмотреть файл

@ -4,139 +4,148 @@ import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*
var grammarURI = "classpath:/org/eclipse/smarthome/model/rule/Rules.xtext"
var file.extensions = "rules"
var projectName = "org.eclipse.smarthome.model.rule"
var fileExtensions = "rules"
var grammarURI = "platform:/resource/${projectName}/src/org/eclipse/smarthome/model/rule/Rules.xtext"
var runtimeProject = "../${projectName}"
var generateXtendStub = true
var encoding = "UTF-8"
Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.smarthome.model.script/src-gen/org/eclipse/smarthome/model/script/Script.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.smarthome.model.item/src-gen/org/eclipse/smarthome/model/Items.genmodel"
registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
registerGeneratedEPackage = "org.eclipse.smarthome.model.items.ItemsPackage"
}
bean = StandaloneSetup {
// use an XtextResourceset throughout the process, which is able to resolve classpath:/ URIs.
resourceSet = org.eclipse.xtext.resource.XtextResourceSet : theResourceSet {}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
exclude = ".empty"
}
// add mappings from platform:/resource to classpath:/
uriMap = {
from = "platform:/resource/org.eclipse.xtext.xbase/"
to = "classpath:/"
}
uriMap = {
from = "platform:/resource/org.eclipse.xtext.common.types/"
to = "classpath:/"
}
// uriMap = {
// from = "platform:/resource/org.eclipse.smarthome.model.item/"
// to = "classpath:/"
// }
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
exclude = ".empty"
}
// register current projects and its siblings for platform URI map, as they are not on the classpath.
platformUri = "${runtimeProject}/.."
// The following two lines can be removed, if Xbase is not used.
registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
registerGeneratedEPackage = "org.eclipse.smarthome.model.script.script.ScriptPackage"
registerGenModelFile = "platform:/resource/org.eclipse.smarthome.model.script/model/generated/Script.genmodel"
}
component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
language = {
uri = grammarURI
fileExtensions = file.extensions
// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment {}
// generates Java API for the generated EPackages
fragment = ecore.EcoreGeneratorFragment {
// referencedGenModels = "
// platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
// platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
// "
}
// Serializer 2.0
fragment = serializer.SerializerFragment {
generateStub = false
}
// the serialization component (1.0)
// fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
}
// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment {
// options = {
// backtrack = true
// }
}
// java-based API for validation
fragment = validation.JavaValidatorFragment {
// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}
// scoping and exporting API
// fragment = scoping.ImportNamespacesScopingFragment {}
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}
// generator API
fragment = generator.GeneratorFragment {
generateMwe = false
generateJavaMain = false
}
// formatter API
fragment = formatting.FormatterFragment {}
// labeling API
fragment = labeling.LabelProviderFragment {}
// outline API
fragment = outline.OutlineTreeProviderFragment {}
fragment = outline.QuickOutlineFragment {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment {}
// content assist API
fragment = contentAssist.JavaBasedContentAssistFragment {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
// generates junit test support classes into Generator#pathTestProject
fragment = junit.Junit4Fragment {}
// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment {
// generatorProjectName = "${projectName}"
// modelFileExtension = file.extensions
// }
// rename refactoring
fragment = refactoring.RefactorElementNameFragment {}
// provides the necessary bindings for java types integration
fragment = types.TypesGeneratorFragment {}
// generates the required bindings only if the grammar inherits from Xbase
fragment = xbase.XbaseGeneratorFragment {}
// provides a preference page for template proposals
fragment = templates.CodetemplatesGeneratorFragment {}
// provides a compare view
fragment = compare.CompareFragment {
fileExtensions = file.extensions
}
}
}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/model"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}
component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
//pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
encoding = encoding
language = auto-inject {
// make sure we use the resourceSet created during standalone setup.
forcedResourceSet = theResourceSet
uri = grammarURI
fileExtensions = fileExtensions
// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment auto-inject {}
// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {
javaModelDirectory = "/${projectName}/src-gen"
}
// the old serialization component
// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}
// serializer 2.0
fragment = serializer.SerializerFragment auto-inject {
generateStub = false
}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
// options = {
// backtrack = true
// }
}
// Xtend-based API for validation
fragment = validation.ValidatorFragment auto-inject {
// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// old scoping and exporting API
// fragment = scoping.ImportURIScopingFragment auto-inject {}
// fragment = exporting.SimpleNamesFragment auto-inject {}
// scoping and exporting API
// fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
fragment = exporting.QualifiedNamesFragment auto-inject {}
fragment = builder.BuilderIntegrationFragment auto-inject {}
// generator API
fragment = generator.GeneratorFragment auto-inject {}
// formatter API
fragment = formatting.FormatterFragment auto-inject {}
// labeling API
fragment = labeling.LabelProviderFragment auto-inject {}
// outline API
fragment = outline.OutlineTreeProviderFragment auto-inject {}
fragment = outline.QuickOutlineFragment auto-inject {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment auto-inject {}
// content assist API
fragment = contentAssist.ContentAssistFragment auto-inject {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}
// generates junit test support classes into Generator#pathTestProject
// fragment = junit.Junit4Fragment auto-inject {}
// rename refactoring
fragment = refactoring.RefactorElementNameFragment auto-inject {}
// provides the necessary bindings for java types integration
fragment = types.TypesGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xbase
fragment = xbase.XbaseGeneratorFragment auto-inject {}
// provides a preference page for template proposals
fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
// provides a compare view
fragment = compare.CompareFragment auto-inject {}
}
}
}

Просмотреть файл

@ -1,7 +1,6 @@
grammar org.eclipse.smarthome.model.rule.Rules with org.eclipse.smarthome.model.script.Script
import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
import "http://www.eclipse.org/smarthome/model/Items"
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as types
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Просмотреть файл

@ -1,37 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.formatting;
import org.eclipse.xtext.formatting.impl.FormattingConfig;
import org.eclipse.xtext.xbase.formatting.XbaseFormatter;
/**
* This class contains custom formatting description.
*
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting
* on how and when to use it
*
* Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
*
* @author Oliver Libutzki - Xtext 2.5.0 migration
*
*/
public class RulesFormatter extends XbaseFormatter {
@Override
protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
// c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
// c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
}
}

Просмотреть файл

@ -0,0 +1,30 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.formatting
import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter
import org.eclipse.xtext.formatting.impl.FormattingConfig
// import com.google.inject.Inject;
// import org.eclipse.smarthome.model.rule.services.RulesGrammarAccess
/**
* This class contains custom formatting description.
*
* see : http://www.eclipse.org/Xtext/documentation.html#formatting
* on how and when to use it
*
* Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
*/
class RulesFormatter extends AbstractDeclarativeFormatter {
// @Inject extension RulesGrammarAccess
override protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
// c.setLinewrap(0, 1, 2).before(SL_COMMENTRule)
// c.setLinewrap(0, 1, 2).before(ML_COMMENTRule)
// c.setLinewrap(0, 1, 1).after(ML_COMMENTRule)
}
}

Просмотреть файл

@ -1,16 +0,0 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschränkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.model.rule.validation;
import org.eclipse.smarthome.model.rule.validation.AbstractRulesJavaValidator;
public class RulesJavaValidator extends AbstractRulesJavaValidator {
}

Просмотреть файл

@ -0,0 +1,24 @@
/*
* generated by Xtext
*/
package org.eclipse.smarthome.model.rule.validation
//import org.eclipse.xtext.validation.Check
/**
* Custom validation rules.
*
* see http://www.eclipse.org/Xtext/documentation.html#validation
*/
class RulesValidator extends AbstractRulesValidator {
// public static val INVALID_NAME = 'invalidName'
//
// @Check
// def checkGreetingStartsWithCapital(Greeting greeting) {
// if (!Character.isUpperCase(greeting.name.charAt(0))) {
// warning('Name should start with a capital',
// MyDslPackage.Literals.GREETING__NAME,
// INVALID_NAME)
// }
// }
}

Просмотреть файл

@ -0,0 +1,2 @@
*
!.gitignore

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше