diff options
44 files changed, 2517 insertions, 2516 deletions
diff --git a/modellib/org.eclipse.etrice.modellib/META-INF/MANIFEST.MF b/modellib/org.eclipse.etrice.modellib/META-INF/MANIFEST.MF index 1052970a0..199a9d8ea 100644 --- a/modellib/org.eclipse.etrice.modellib/META-INF/MANIFEST.MF +++ b/modellib/org.eclipse.etrice.modellib/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: eTrice Model Library -Bundle-SymbolicName: org.eclipse.etrice.modellib -Bundle-Version: 0.1.0 -Bundle-Vendor: eTrice (Incubation) +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eTrice Model Library
+Bundle-SymbolicName: org.eclipse.etrice.modellib
+Bundle-Version: 0.1.0
+Bundle-Vendor: eTrice (Incubation)
diff --git a/plugins/org.eclipse.etrice.core.room.ui/.gitignore b/plugins/org.eclipse.etrice.core.room.ui/.gitignore index ba077a403..092357e47 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/.gitignore +++ b/plugins/org.eclipse.etrice.core.room.ui/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/plugins/org.eclipse.etrice.core.room.ui/build.properties b/plugins/org.eclipse.etrice.core.room.ui/build.properties index a0c7d1504..2ec6ec11e 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/build.properties +++ b/plugins/org.eclipse.etrice.core.room.ui/build.properties @@ -1,6 +1,6 @@ -source.. = src/,src-gen/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/ - +source.. = src/,src-gen/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
+
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java index 68da579fc..94086de72 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java @@ -1,29 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.ui; - -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * Use this class to register components to be used within the IDE. - */ -public class RoomUiModule extends org.eclipse.etrice.core.ui.AbstractRoomUiModule { - public RoomUiModule(AbstractUIPlugin plugin) { - super(plugin); - } - - // contributed by org.eclipse.xtext.generator.validation.JavaValidatorFragment - @org.eclipse.xtext.service.SingletonBinding(eager=true) public Class<? extends org.eclipse.etrice.core.validation.RoomJavaValidator> bindRoomJavaValidator() { - return org.eclipse.etrice.core.ui.RoomModelValidator.class; - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Use this class to register components to be used within the IDE.
+ */
+public class RoomUiModule extends org.eclipse.etrice.core.ui.AbstractRoomUiModule {
+ public RoomUiModule(AbstractUIPlugin plugin) {
+ super(plugin);
+ }
+
+ // contributed by org.eclipse.xtext.generator.validation.JavaValidatorFragment
+ @org.eclipse.xtext.service.SingletonBinding(eager=true) public Class<? extends org.eclipse.etrice.core.validation.RoomJavaValidator> bindRoomJavaValidator() {
+ return org.eclipse.etrice.core.ui.RoomModelValidator.class;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java index 1982c4b69..e8dc61237 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java @@ -1,110 +1,110 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.ui.contentassist; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.ui.contentassist.AbstractRoomProposalProvider; -import org.eclipse.etrice.core.validation.ValidationUtil; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.swt.graphics.Image; -import org.eclipse.xtext.resource.IEObjectDescription; -import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext; - -import com.google.common.base.Function; - -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.RoomPackage; -/** - * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant - */ -public class RoomProposalProvider extends AbstractRoomProposalProvider { - - protected class FilteredProposalCreator implements Function<IEObjectDescription, ICompletionProposal> { - private IProposalFilter filter; - private final ContentAssistContext contentAssistContext; - private final String ruleName; - - protected FilteredProposalCreator(IProposalFilter filter, ContentAssistContext contentAssistContext, String ruleName) { - this.filter = filter; - this.contentAssistContext = contentAssistContext; - this.ruleName = ruleName; - } - - public ICompletionProposal apply(IEObjectDescription candidate) { - if (candidate == null) - return null; - ICompletionProposal result = null; - String proposal = candidate.getName(); - if (ruleName != null) - proposal = getValueConverter().toString(proposal, ruleName); - EObject objectOrProxy = candidate.getEObjectOrProxy(); - - // three new lines in code taken from org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.DefaultProposalCreator - if (!objectOrProxy.eIsProxy() && filter!=null) - if (!filter.accept(contentAssistContext, candidate)) - return null; - - StyledString displayString = getStyledDisplayString(objectOrProxy, candidate.getQualifiedName(), candidate.getName()); - Image image = getImage(objectOrProxy); - result = createCompletionProposal(proposal, displayString, image, contentAssistContext); - getPriorityHelper().adjustCrossReferencePriority(result, contentAssistContext.getPrefix()); - return result; - } - - } - - protected class ActorRefFilter implements IProposalFilter { - - @Override - public boolean accept(ContentAssistContext context, IEObjectDescription candidate) { - if (!(context.getCurrentModel() instanceof ActorRef)) - // unexpected call?? - return false; - - ActorRef ar = (ActorRef) context.getCurrentModel(); - if (!(ar.eContainer() instanceof ActorClass)) - // can not filter due to lack of information - return true; - - ActorClass ac = (ActorClass) ar.eContainer(); - - EObject objectOrProxy = candidate.getEObjectOrProxy(); - - if (objectOrProxy instanceof ActorClass) { - ActorClass referenced = (ActorClass) objectOrProxy; - return !ValidationUtil.isReferencing(referenced, ac); - } - - return false; - } - - } - - protected Function<IEObjectDescription, ICompletionProposal> getProposalFactory(String ruleName, ContentAssistContext contentAssistContext) { - if (contentAssistContext!=null && contentAssistContext.getCurrentModel().eClass()==RoomPackage.eINSTANCE.getActorRef()) - return new FilteredProposalCreator(new ActorRefFilter(), contentAssistContext, ruleName); - - // delegate to default - return super.getProposalFactory(ruleName, contentAssistContext); - } - -// public void completeActorRef_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { -// super.completeActorRef_Type( -// model, -// assignment, -// context, -// acceptor); -// } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui.contentassist;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.ui.contentassist.AbstractRoomProposalProvider;
+import org.eclipse.etrice.core.validation.ValidationUtil;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+
+import com.google.common.base.Function;
+
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.etrice.core.room.RoomPackage;
+/**
+ * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
+ */
+public class RoomProposalProvider extends AbstractRoomProposalProvider {
+
+ protected class FilteredProposalCreator implements Function<IEObjectDescription, ICompletionProposal> {
+ private IProposalFilter filter;
+ private final ContentAssistContext contentAssistContext;
+ private final String ruleName;
+
+ protected FilteredProposalCreator(IProposalFilter filter, ContentAssistContext contentAssistContext, String ruleName) {
+ this.filter = filter;
+ this.contentAssistContext = contentAssistContext;
+ this.ruleName = ruleName;
+ }
+
+ public ICompletionProposal apply(IEObjectDescription candidate) {
+ if (candidate == null)
+ return null;
+ ICompletionProposal result = null;
+ String proposal = candidate.getName();
+ if (ruleName != null)
+ proposal = getValueConverter().toString(proposal, ruleName);
+ EObject objectOrProxy = candidate.getEObjectOrProxy();
+
+ // three new lines in code taken from org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.DefaultProposalCreator
+ if (!objectOrProxy.eIsProxy() && filter!=null)
+ if (!filter.accept(contentAssistContext, candidate))
+ return null;
+
+ StyledString displayString = getStyledDisplayString(objectOrProxy, candidate.getQualifiedName(), candidate.getName());
+ Image image = getImage(objectOrProxy);
+ result = createCompletionProposal(proposal, displayString, image, contentAssistContext);
+ getPriorityHelper().adjustCrossReferencePriority(result, contentAssistContext.getPrefix());
+ return result;
+ }
+
+ }
+
+ protected class ActorRefFilter implements IProposalFilter {
+
+ @Override
+ public boolean accept(ContentAssistContext context, IEObjectDescription candidate) {
+ if (!(context.getCurrentModel() instanceof ActorRef))
+ // unexpected call??
+ return false;
+
+ ActorRef ar = (ActorRef) context.getCurrentModel();
+ if (!(ar.eContainer() instanceof ActorClass))
+ // can not filter due to lack of information
+ return true;
+
+ ActorClass ac = (ActorClass) ar.eContainer();
+
+ EObject objectOrProxy = candidate.getEObjectOrProxy();
+
+ if (objectOrProxy instanceof ActorClass) {
+ ActorClass referenced = (ActorClass) objectOrProxy;
+ return !ValidationUtil.isReferencing(referenced, ac);
+ }
+
+ return false;
+ }
+
+ }
+
+ protected Function<IEObjectDescription, ICompletionProposal> getProposalFactory(String ruleName, ContentAssistContext contentAssistContext) {
+ if (contentAssistContext!=null && contentAssistContext.getCurrentModel().eClass()==RoomPackage.eINSTANCE.getActorRef())
+ return new FilteredProposalCreator(new ActorRefFilter(), contentAssistContext, ruleName);
+
+ // delegate to default
+ return super.getProposalFactory(ruleName, contentAssistContext);
+ }
+
+// public void completeActorRef_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+// super.completeActorRef_Type(
+// model,
+// assignment,
+// context,
+// acceptor);
+// }
+}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomDescriptionLabelProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomDescriptionLabelProvider.java index 50479b063..f73106cfc 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomDescriptionLabelProvider.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomDescriptionLabelProvider.java @@ -1,36 +1,36 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.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 RoomDescriptionLabelProvider 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"; - } -*/ - -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.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 RoomDescriptionLabelProvider 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";
+ }
+*/
+
+}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java index f36cc0add..51c17a8b9 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java @@ -1,303 +1,303 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.ui.labeling; - -import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; -import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider; - -import com.google.inject.Inject; - -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.BaseState; -import org.eclipse.etrice.core.room.Import; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.SubSystemRef; -import org.eclipse.etrice.core.room.LogicalSystem; -import org.eclipse.etrice.core.room.DataClass; -import org.eclipse.etrice.core.room.ExternalPort; -import org.eclipse.etrice.core.room.FreeType; -import org.eclipse.etrice.core.room.FreeTypedID; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefinedState; -import org.eclipse.etrice.core.room.SAPRef; -import org.eclipse.etrice.core.room.SPPRef; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.Type; -import org.eclipse.etrice.core.room.TypedID; - -/** - * Provides labels for a EObjects. - * - * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider - */ -public class RoomLabelProvider extends DefaultEObjectLabelProvider { - - @Inject - public RoomLabelProvider(AdapterFactoryLabelProvider delegate) { - super(delegate); - } - - // custom images for ROOM classes - - String image(RoomModel rm) { - return "RoomModel.gif"; - } - - String image(Import im) { - return "RoomModelImport.gif"; - } - - String image(DataClass dc) { - return "DataClass.gif"; - } - - String image(ProtocolClass pc) { - return "ProtocolClass.gif"; - } - - String image(ActorClass ac) { - return "ActorClass.gif"; - } - - String image(SubSystemClass cc) { - return "SubSystemClass.gif"; - } - - String image(LogicalSystem sys) { - return "LogicalSystem.gif"; - } - - String image(SAPRef sap) { - return "SAP.gif"; - } - - String image(SPPRef spp) { - return "SPP.gif"; - } - - String image(ActorRef ar) { - return "ActorRef.gif"; - } - - String image(SubSystemRef ar) { - return "SubSystemRef.gif"; - } - - String image(BaseState state) { - return "State.gif"; - } - - String image(RefinedState state) { - return "RefinedState.gif"; - } - - String image(ServiceImplementation svc) { - return "ServiceImpl.gif"; - } - - String image(Message state) { - return "Message.gif"; - } - - String image(Operation op) { - return "Operation.gif"; - } - - String image(Port p) { - ActorClass ac = (ActorClass) p.eContainer(); - boolean relay = true; - if (ac.getIntPorts().contains(p)) { - relay = false; - } - else { - for (ExternalPort ep : ac.getExtPorts()) { - if (ep.getIfport()==p) { - relay = false; - break; - } - } - } - if (relay) - if (p.isConjugated()) - if (p.getMultiplicity()>1) - return "ConjReplRelayPort.gif"; - else - return "ConjRelayPort.gif"; - else - if (p.getMultiplicity()>1) - return "ReplRelayPort.gif"; - else - return "RelayPort.gif"; - else - if (p.isConjugated()) - if (p.getMultiplicity()>1) - return "ConjReplPort.gif"; - else - return "ConjPort.gif"; - else - if (p.getMultiplicity()>1) - return "ReplPort.gif"; - else - return "Port.gif"; - } - - // custom labels - - String text(Import im) { - return "import "+im.getImportedNamespace(); - } - - String text(DataClass dc) { - String base = dc.getBase()!=null? " extends "+dc.getBase().getName():""; - return dc.getName()+base; - } - - String text(ProtocolClass pc) { - String base = pc.getBase()!=null? " extends "+pc.getBase().getName():""; - return pc.getName()+base; - } - - String text(ActorClass ac) { - String base = ac.getBase()!=null? " extends "+ac.getBase().getName():""; - return ac.getName()+base; - } - - String text(Port p) { - String location = null; - ActorClass ac = (ActorClass) p.eContainer(); - if (ac.getIntPorts().contains(p)) - location = "internal"; - else { - for (ExternalPort ep : ac.getExtPorts()) { - if (ep.getIfport()==p) { - location = "external"; - break; - } - } - } - if (location==null) - location = "relay"; - String conjugated = p.isConjugated()?"conjugated ":""; - String multiplicity = p.getMultiplicity()>1? ("["+p.getMultiplicity()+"]"):""; - String protocol = p.getProtocol()!=null? (" : "+p.getProtocol().getName()):""; - return conjugated+" "+location+" Port "+p.getName()+multiplicity+protocol; - } - - String text(ExternalPort ep) { - return text(ep.getIfport()); - } - - String text(SAPRef sap) { - String protocol = sap.getProtocol()!=null? (" : "+sap.getProtocol().getName()):""; - return "SAP "+sap.getName()+protocol; - } - - String text(SPPRef spp) { - String protocol = spp.getProtocol()!=null? (" : "+spp.getProtocol().getName()):""; - return "SPP "+spp.getName()+protocol; - } - - String text(ServiceImplementation svc) { - if (svc.getSpp()==null) - return "Implementation"; - - String protocol = svc.getSpp().getProtocol()!=null? (" : "+svc.getSpp().getProtocol().getName()):""; - return "Implementation of "+svc.getSpp().getName()+protocol; - } - - String text(ActorRef ref) { - String cls = ref.getType()!=null? (" : "+ref.getType().getName()):""; - return "ref "+ref.getName()+cls; - } - - String text(SubSystemRef ref) { - String cls = ref.getType()!=null? (" : "+ref.getType().getName()):""; - return "ref "+ref.getName()+cls; - } - - private String getName(Type tp) { - if (tp.getType()!=null) - return tp.getType().getName(); - else if (tp.getPrim()!=null) - return tp.getPrim().getName(); - else - return "?"; - } - - private String getName(FreeType tp) { - if (tp.getType()!=null) - return tp.getType(); - else if (tp.getPrim()!=null) - return tp.getPrim().getName(); - else - return "?"; - } - - String text(Attribute attr) { - String type = attr.getType()!=null? (" : "+getName(attr.getType())):""; - return "Attr "+attr.getName()+type; - } - - String text(Operation op) { - String rt = op.getReturntype()!=null? ": "+getName(op.getReturntype()):""; - String signature = ""; - for (FreeTypedID arg : op.getArguments()) { - if (signature.isEmpty()) - signature = arg.getName()+": "+getName(arg.getType()); - else - signature += ", "+arg.getName()+": "+getName(arg.getType()); - } - signature = "("+signature+")"; - return op.getName()+signature+rt; - } - - String text(Message m) { - String signature = ""; - for (TypedID arg : m.getArguments()) { - if (signature.isEmpty()) - signature = arg.getName()+":"+getName(arg.getType()); - else - signature += ","+arg.getName()+":"+getName(arg.getType()); - } - signature = "("+signature+")"; - return m.getName()+signature; - } - - String text(BaseState s) { - return s.getName(); - } - - String text(RefinedState rs) { - if (rs.getBase()!=null) - return text(rs.getBase()); - - return ""; - } -/* - //Labels and icons can be computed like this: - - String text(MyModel ele) { - return "my "+ele.getName(); - } - - String image(MyModel ele) { - return "MyModel.gif"; - } -*/ -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui.labeling;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
+
+import com.google.inject.Inject;
+
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.etrice.core.room.Attribute;
+import org.eclipse.etrice.core.room.BaseState;
+import org.eclipse.etrice.core.room.Import;
+import org.eclipse.etrice.core.room.RoomModel;
+import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.room.SubSystemRef;
+import org.eclipse.etrice.core.room.LogicalSystem;
+import org.eclipse.etrice.core.room.DataClass;
+import org.eclipse.etrice.core.room.ExternalPort;
+import org.eclipse.etrice.core.room.FreeType;
+import org.eclipse.etrice.core.room.FreeTypedID;
+import org.eclipse.etrice.core.room.Message;
+import org.eclipse.etrice.core.room.Operation;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.core.room.RefinedState;
+import org.eclipse.etrice.core.room.SAPRef;
+import org.eclipse.etrice.core.room.SPPRef;
+import org.eclipse.etrice.core.room.ServiceImplementation;
+import org.eclipse.etrice.core.room.Type;
+import org.eclipse.etrice.core.room.TypedID;
+
+/**
+ * Provides labels for a EObjects.
+ *
+ * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
+ */
+public class RoomLabelProvider extends DefaultEObjectLabelProvider {
+
+ @Inject
+ public RoomLabelProvider(AdapterFactoryLabelProvider delegate) {
+ super(delegate);
+ }
+
+ // custom images for ROOM classes
+
+ String image(RoomModel rm) {
+ return "RoomModel.gif";
+ }
+
+ String image(Import im) {
+ return "RoomModelImport.gif";
+ }
+
+ String image(DataClass dc) {
+ return "DataClass.gif";
+ }
+
+ String image(ProtocolClass pc) {
+ return "ProtocolClass.gif";
+ }
+
+ String image(ActorClass ac) {
+ return "ActorClass.gif";
+ }
+
+ String image(SubSystemClass cc) {
+ return "SubSystemClass.gif";
+ }
+
+ String image(LogicalSystem sys) {
+ return "LogicalSystem.gif";
+ }
+
+ String image(SAPRef sap) {
+ return "SAP.gif";
+ }
+
+ String image(SPPRef spp) {
+ return "SPP.gif";
+ }
+
+ String image(ActorRef ar) {
+ return "ActorRef.gif";
+ }
+
+ String image(SubSystemRef ar) {
+ return "SubSystemRef.gif";
+ }
+
+ String image(BaseState state) {
+ return "State.gif";
+ }
+
+ String image(RefinedState state) {
+ return "RefinedState.gif";
+ }
+
+ String image(ServiceImplementation svc) {
+ return "ServiceImpl.gif";
+ }
+
+ String image(Message state) {
+ return "Message.gif";
+ }
+
+ String image(Operation op) {
+ return "Operation.gif";
+ }
+
+ String image(Port p) {
+ ActorClass ac = (ActorClass) p.eContainer();
+ boolean relay = true;
+ if (ac.getIntPorts().contains(p)) {
+ relay = false;
+ }
+ else {
+ for (ExternalPort ep : ac.getExtPorts()) {
+ if (ep.getIfport()==p) {
+ relay = false;
+ break;
+ }
+ }
+ }
+ if (relay)
+ if (p.isConjugated())
+ if (p.getMultiplicity()>1)
+ return "ConjReplRelayPort.gif";
+ else
+ return "ConjRelayPort.gif";
+ else
+ if (p.getMultiplicity()>1)
+ return "ReplRelayPort.gif";
+ else
+ return "RelayPort.gif";
+ else
+ if (p.isConjugated())
+ if (p.getMultiplicity()>1)
+ return "ConjReplPort.gif";
+ else
+ return "ConjPort.gif";
+ else
+ if (p.getMultiplicity()>1)
+ return "ReplPort.gif";
+ else
+ return "Port.gif";
+ }
+
+ // custom labels
+
+ String text(Import im) {
+ return "import "+im.getImportedNamespace();
+ }
+
+ String text(DataClass dc) {
+ String base = dc.getBase()!=null? " extends "+dc.getBase().getName():"";
+ return dc.getName()+base;
+ }
+
+ String text(ProtocolClass pc) {
+ String base = pc.getBase()!=null? " extends "+pc.getBase().getName():"";
+ return pc.getName()+base;
+ }
+
+ String text(ActorClass ac) {
+ String base = ac.getBase()!=null? " extends "+ac.getBase().getName():"";
+ return ac.getName()+base;
+ }
+
+ String text(Port p) {
+ String location = null;
+ ActorClass ac = (ActorClass) p.eContainer();
+ if (ac.getIntPorts().contains(p))
+ location = "internal";
+ else {
+ for (ExternalPort ep : ac.getExtPorts()) {
+ if (ep.getIfport()==p) {
+ location = "external";
+ break;
+ }
+ }
+ }
+ if (location==null)
+ location = "relay";
+ String conjugated = p.isConjugated()?"conjugated ":"";
+ String multiplicity = p.getMultiplicity()>1? ("["+p.getMultiplicity()+"]"):"";
+ String protocol = p.getProtocol()!=null? (" : "+p.getProtocol().getName()):"";
+ return conjugated+" "+location+" Port "+p.getName()+multiplicity+protocol;
+ }
+
+ String text(ExternalPort ep) {
+ return text(ep.getIfport());
+ }
+
+ String text(SAPRef sap) {
+ String protocol = sap.getProtocol()!=null? (" : "+sap.getProtocol().getName()):"";
+ return "SAP "+sap.getName()+protocol;
+ }
+
+ String text(SPPRef spp) {
+ String protocol = spp.getProtocol()!=null? (" : "+spp.getProtocol().getName()):"";
+ return "SPP "+spp.getName()+protocol;
+ }
+
+ String text(ServiceImplementation svc) {
+ if (svc.getSpp()==null)
+ return "Implementation";
+
+ String protocol = svc.getSpp().getProtocol()!=null? (" : "+svc.getSpp().getProtocol().getName()):"";
+ return "Implementation of "+svc.getSpp().getName()+protocol;
+ }
+
+ String text(ActorRef ref) {
+ String cls = ref.getType()!=null? (" : "+ref.getType().getName()):"";
+ return "ref "+ref.getName()+cls;
+ }
+
+ String text(SubSystemRef ref) {
+ String cls = ref.getType()!=null? (" : "+ref.getType().getName()):"";
+ return "ref "+ref.getName()+cls;
+ }
+
+ private String getName(Type tp) {
+ if (tp.getType()!=null)
+ return tp.getType().getName();
+ else if (tp.getPrim()!=null)
+ return tp.getPrim().getName();
+ else
+ return "?";
+ }
+
+ private String getName(FreeType tp) {
+ if (tp.getType()!=null)
+ return tp.getType();
+ else if (tp.getPrim()!=null)
+ return tp.getPrim().getName();
+ else
+ return "?";
+ }
+
+ String text(Attribute attr) {
+ String type = attr.getType()!=null? (" : "+getName(attr.getType())):"";
+ return "Attr "+attr.getName()+type;
+ }
+
+ String text(Operation op) {
+ String rt = op.getReturntype()!=null? ": "+getName(op.getReturntype()):"";
+ String signature = "";
+ for (FreeTypedID arg : op.getArguments()) {
+ if (signature.isEmpty())
+ signature = arg.getName()+": "+getName(arg.getType());
+ else
+ signature += ", "+arg.getName()+": "+getName(arg.getType());
+ }
+ signature = "("+signature+")";
+ return op.getName()+signature+rt;
+ }
+
+ String text(Message m) {
+ String signature = "";
+ for (TypedID arg : m.getArguments()) {
+ if (signature.isEmpty())
+ signature = arg.getName()+":"+getName(arg.getType());
+ else
+ signature += ","+arg.getName()+":"+getName(arg.getType());
+ }
+ signature = "("+signature+")";
+ return m.getName()+signature;
+ }
+
+ String text(BaseState s) {
+ return s.getName();
+ }
+
+ String text(RefinedState rs) {
+ if (rs.getBase()!=null)
+ return text(rs.getBase());
+
+ return "";
+ }
+/*
+ //Labels and icons can be computed like this:
+
+ String text(MyModel ele) {
+ return "my "+ele.getName();
+ }
+
+ String image(MyModel ele) {
+ return "MyModel.gif";
+ }
+*/
+}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineNodeAdapterFactory.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineNodeAdapterFactory.java index 807f0c17a..41e9611a6 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineNodeAdapterFactory.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineNodeAdapterFactory.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.ui.outline; - -import org.eclipse.xtext.ui.editor.outline.actions.DefaultContentOutlineNodeAdapterFactory; - -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.LogicalSystem; - -public class RoomOutlineNodeAdapterFactory extends DefaultContentOutlineNodeAdapterFactory { - - private static final Class<?>[] types = { - // provide list of classes to adapt to, e.g.: - // Entity.class - // Service.class - ActorClass.class, - SubSystemClass.class, - LogicalSystem.class - }; - - @Override - public Class<?>[] getAdapterList() { - return types; - } - -} - +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui.outline;
+
+import org.eclipse.xtext.ui.editor.outline.actions.DefaultContentOutlineNodeAdapterFactory;
+
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.room.LogicalSystem;
+
+public class RoomOutlineNodeAdapterFactory extends DefaultContentOutlineNodeAdapterFactory {
+
+ private static final Class<?>[] types = {
+ // provide list of classes to adapt to, e.g.:
+ // Entity.class
+ // Service.class
+ ActorClass.class,
+ SubSystemClass.class,
+ LogicalSystem.class
+ };
+
+ @Override
+ public Class<?>[] getAdapterList() {
+ return types;
+ }
+
+}
+
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomTransformer.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomTransformer.java index bb301453d..9482fdd94 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomTransformer.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomTransformer.java @@ -1,159 +1,159 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.ui.outline; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.xtext.ui.editor.outline.ContentOutlineNode; -import org.eclipse.xtext.ui.editor.outline.transformer.AbstractDeclarativeSemanticModelTransformer; - -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.Operation; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.SAPRef; -import org.eclipse.etrice.core.room.SPPRef; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.State; - -/** - * customization of the default outline structure - * - */ -public class RoomTransformer extends AbstractDeclarativeSemanticModelTransformer { - // cf. org.eclipse.xtext.example.ui.outline.FowlerDslTransformer - - // transform actor class - - public boolean consumeNode(ActorClass ac) { - return true; - } - - public ContentOutlineNode createNode(ActorClass ac, ContentOutlineNode outlineParentNode) { - ContentOutlineNode result = super.createNode(ac, outlineParentNode); - if (ac.getIfPorts().size()>0 || ac.getIfSPPs().size()>0) { - ContentOutlineNode iface = new ContentOutlineNode("Interface"); - result.getChildren().add(iface); - for (Port port : ac.getIfPorts()) - transformSemanticNode(port, iface); - for (SPPRef spp : ac.getIfSPPs()) - transformSemanticNode(spp, iface); - } - if (ac.getIntPorts().size()>0 || ac.getServiceImplementations().size()>0 || - ac.getStrSAPs().size()>0 || ac.getAttributes().size()>0 || - ac.getActorRefs().size()>0) { - ContentOutlineNode structure = new ContentOutlineNode("Structure"); - result.getChildren().add(structure); - for (Port port : ac.getIntPorts()) - transformSemanticNode(port, structure); - for (ServiceImplementation svc : ac.getServiceImplementations()) - transformSemanticNode(svc, structure); - for (SAPRef sap : ac.getStrSAPs()) - transformSemanticNode(sap, structure); - for (Attribute attr : ac.getAttributes()) - transformSemanticNode(attr, structure); - for (ActorRef ar : ac.getActorRefs()) - transformSemanticNode(ar, structure); - } - if (ac.getOperations().size()>0 || ac.getStateMachine()!=null) { - ContentOutlineNode behavior = new ContentOutlineNode("Behavior"); - result.getChildren().add(behavior); - for (Operation op : ac.getOperations()) - transformSemanticNode(op, behavior); - if (ac.getStateMachine()!=null) { - ContentOutlineNode sm = new ContentOutlineNode("StateMachine"); - behavior.getChildren().add(sm); - for (State s : ac.getStateMachine().getStates()) { - transformSemanticNode(s, sm); - } - } - } - return result; - } - - public List<EObject> getChildren(ActorClass ac) { - return Collections.emptyList(); - } - - // transform state - - public boolean consumeNode(State state) { - return true; - } - - public ContentOutlineNode createNode(State state, ContentOutlineNode outlineParentNode) { - ContentOutlineNode result = super.createNode(state, outlineParentNode); - - if (state.getSubgraph()!=null) - for (State s : state.getSubgraph().getStates()) { - transformSemanticNode(s, result); - } - - return result; - } - - public List<EObject> getChildren(State state) { - return Collections.emptyList(); - } - - // transform protocol - - public boolean consumeNode(ProtocolClass pc) { - return true; - } - - public ContentOutlineNode createNode(ProtocolClass pc, ContentOutlineNode outlineParentNode) { - ContentOutlineNode result = super.createNode(pc, outlineParentNode); - - if (pc.getIncomingMessages().size()>0) { - ContentOutlineNode msgs = new ContentOutlineNode("incoming"); - result.getChildren().add(msgs); - for (Message m : pc.getIncomingMessages()) - transformSemanticNode(m, msgs); - } - - if (pc.getOutgoingMessages().size()>0) { - ContentOutlineNode msgs = new ContentOutlineNode("outgoing"); - result.getChildren().add(msgs); - for (Message m : pc.getOutgoingMessages()) - transformSemanticNode(m, msgs); - } - - return result; - } - - public List<EObject> getChildren(ProtocolClass pc) { - return Collections.emptyList(); - } - - public boolean consumeNode(Message m) { - return true; - } - - public List<EObject> getChildren(Message m) { - return Collections.emptyList(); - } - - public boolean consumeNode(Operation op) { - return true; - } - - public List<EObject> getChildren(Operation op) { - return Collections.emptyList(); - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui.outline;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.ui.editor.outline.ContentOutlineNode;
+import org.eclipse.xtext.ui.editor.outline.transformer.AbstractDeclarativeSemanticModelTransformer;
+
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.etrice.core.room.Attribute;
+import org.eclipse.etrice.core.room.Message;
+import org.eclipse.etrice.core.room.Operation;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.core.room.SAPRef;
+import org.eclipse.etrice.core.room.SPPRef;
+import org.eclipse.etrice.core.room.ServiceImplementation;
+import org.eclipse.etrice.core.room.State;
+
+/**
+ * customization of the default outline structure
+ *
+ */
+public class RoomTransformer extends AbstractDeclarativeSemanticModelTransformer {
+ // cf. org.eclipse.xtext.example.ui.outline.FowlerDslTransformer
+
+ // transform actor class
+
+ public boolean consumeNode(ActorClass ac) {
+ return true;
+ }
+
+ public ContentOutlineNode createNode(ActorClass ac, ContentOutlineNode outlineParentNode) {
+ ContentOutlineNode result = super.createNode(ac, outlineParentNode);
+ if (ac.getIfPorts().size()>0 || ac.getIfSPPs().size()>0) {
+ ContentOutlineNode iface = new ContentOutlineNode("Interface");
+ result.getChildren().add(iface);
+ for (Port port : ac.getIfPorts())
+ transformSemanticNode(port, iface);
+ for (SPPRef spp : ac.getIfSPPs())
+ transformSemanticNode(spp, iface);
+ }
+ if (ac.getIntPorts().size()>0 || ac.getServiceImplementations().size()>0 ||
+ ac.getStrSAPs().size()>0 || ac.getAttributes().size()>0 ||
+ ac.getActorRefs().size()>0) {
+ ContentOutlineNode structure = new ContentOutlineNode("Structure");
+ result.getChildren().add(structure);
+ for (Port port : ac.getIntPorts())
+ transformSemanticNode(port, structure);
+ for (ServiceImplementation svc : ac.getServiceImplementations())
+ transformSemanticNode(svc, structure);
+ for (SAPRef sap : ac.getStrSAPs())
+ transformSemanticNode(sap, structure);
+ for (Attribute attr : ac.getAttributes())
+ transformSemanticNode(attr, structure);
+ for (ActorRef ar : ac.getActorRefs())
+ transformSemanticNode(ar, structure);
+ }
+ if (ac.getOperations().size()>0 || ac.getStateMachine()!=null) {
+ ContentOutlineNode behavior = new ContentOutlineNode("Behavior");
+ result.getChildren().add(behavior);
+ for (Operation op : ac.getOperations())
+ transformSemanticNode(op, behavior);
+ if (ac.getStateMachine()!=null) {
+ ContentOutlineNode sm = new ContentOutlineNode("StateMachine");
+ behavior.getChildren().add(sm);
+ for (State s : ac.getStateMachine().getStates()) {
+ transformSemanticNode(s, sm);
+ }
+ }
+ }
+ return result;
+ }
+
+ public List<EObject> getChildren(ActorClass ac) {
+ return Collections.emptyList();
+ }
+
+ // transform state
+
+ public boolean consumeNode(State state) {
+ return true;
+ }
+
+ public ContentOutlineNode createNode(State state, ContentOutlineNode outlineParentNode) {
+ ContentOutlineNode result = super.createNode(state, outlineParentNode);
+
+ if (state.getSubgraph()!=null)
+ for (State s : state.getSubgraph().getStates()) {
+ transformSemanticNode(s, result);
+ }
+
+ return result;
+ }
+
+ public List<EObject> getChildren(State state) {
+ return Collections.emptyList();
+ }
+
+ // transform protocol
+
+ public boolean consumeNode(ProtocolClass pc) {
+ return true;
+ }
+
+ public ContentOutlineNode createNode(ProtocolClass pc, ContentOutlineNode outlineParentNode) {
+ ContentOutlineNode result = super.createNode(pc, outlineParentNode);
+
+ if (pc.getIncomingMessages().size()>0) {
+ ContentOutlineNode msgs = new ContentOutlineNode("incoming");
+ result.getChildren().add(msgs);
+ for (Message m : pc.getIncomingMessages())
+ transformSemanticNode(m, msgs);
+ }
+
+ if (pc.getOutgoingMessages().size()>0) {
+ ContentOutlineNode msgs = new ContentOutlineNode("outgoing");
+ result.getChildren().add(msgs);
+ for (Message m : pc.getOutgoingMessages())
+ transformSemanticNode(m, msgs);
+ }
+
+ return result;
+ }
+
+ public List<EObject> getChildren(ProtocolClass pc) {
+ return Collections.emptyList();
+ }
+
+ public boolean consumeNode(Message m) {
+ return true;
+ }
+
+ public List<EObject> getChildren(Message m) {
+ return Collections.emptyList();
+ }
+
+ public boolean consumeNode(Operation op) {
+ return true;
+ }
+
+ public List<EObject> getChildren(Operation op) {
+ return Collections.emptyList();
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/RoomQuickfixProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/RoomQuickfixProvider.java index 5cc555bbb..c52b11d6d 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/RoomQuickfixProvider.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/quickfix/RoomQuickfixProvider.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.ui.quickfix; - -import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider; - -public class RoomQuickfixProvider extends DefaultQuickfixProvider { - -// @Fix(MyJavaValidator.INVALID_TYPE_NAME) -// public void capitalizeName(final Issue issue, IssueResolutionAcceptor acceptor) { -// acceptor.accept(issue, "Capitalize name", "Capitalize name of type", "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, Strings.toFirstUpper(firstLetter)); -// } -// }); -// } - -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui.quickfix;
+
+import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
+
+public class RoomQuickfixProvider extends DefaultQuickfixProvider {
+
+// @Fix(MyJavaValidator.INVALID_TYPE_NAME)
+// public void capitalizeName(final Issue issue, IssueResolutionAcceptor acceptor) {
+// acceptor.accept(issue, "Capitalize name", "Capitalize name of type", "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, Strings.toFirstUpper(firstLetter));
+// }
+// });
+// }
+
+}
diff --git a/plugins/org.eclipse.etrice.core.room/.gitignore b/plugins/org.eclipse.etrice.core.room/.gitignore index ba077a403..092357e47 100644 --- a/plugins/org.eclipse.etrice.core.room/.gitignore +++ b/plugins/org.eclipse.etrice.core.room/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/plugins/org.eclipse.etrice.core.room/build.properties b/plugins/org.eclipse.etrice.core.room/build.properties index bed6e1e91..8dae154d1 100644 --- a/plugins/org.eclipse.etrice.core.room/build.properties +++ b/plugins/org.eclipse.etrice.core.room/build.properties @@ -1,4 +1,4 @@ -source.. = src/,src-gen/ -bin.includes = META-INF/,\ - .,\ +source.. = src/,src-gen/
+bin.includes = META-INF/,\
+ .,\
plugin.xml
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.room/plugin.xml b/plugins/org.eclipse.etrice.core.room/plugin.xml index efcfcd738..14513883a 100644 --- a/plugins/org.eclipse.etrice.core.room/plugin.xml +++ b/plugins/org.eclipse.etrice.core.room/plugin.xml @@ -1,18 +1,18 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> - -<plugin> - - <extension point="org.eclipse.emf.ecore.generated_package"> - <package - uri = "http://www.eclipse.org/etrice/Room" - class = "org.eclipse.etrice.core.room.RoomPackage" - genModel = "org/eclipse/etrice/core/Room.genmodel" /> - - </extension> - - - - - -</plugin> +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri = "http://www.eclipse.org/etrice/Room"
+ class = "org.eclipse.etrice.core.room.RoomPackage"
+ genModel = "org/eclipse/etrice/core/Room.genmodel" />
+
+ </extension>
+
+
+
+
+
+</plugin>
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2 b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2 index e88ae0055..dd947e340 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2 +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2 @@ -1,129 +1,129 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - - -module org.eclipse.etrice.core.Room - -import org.eclipse.emf.mwe.utils.* -import org.eclipse.xtext.generator.* -import org.eclipse.xtext.ui.generator.* - -var grammarURI = "classpath:/org/eclipse/etrice/core/Room.xtext" -var file.extensions = "room" -var projectName = "org.eclipse.etrice.core.room" -var runtimeProject = "../${projectName}" - -Workflow { - bean = StandaloneSetup { - platformUri = "${runtimeProject}/.." - } - - component = DirectoryCleaner { - directory = "${runtimeProject}/src-gen" - } - - component = DirectoryCleaner { - directory = "${runtimeProject}.ui/src-gen" - } - - component = Generator { - pathRtProject = runtimeProject - pathUiProject = "${runtimeProject}.ui" - 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 = "uri to genmodel, uri to next genmodel" - } - - // the serialization component - fragment = parseTreeConstructor.ParseTreeConstructorFragment {} - - // a custom ResourceFactory for use with EMF - fragment = resourceFactory.ResourceFactoryFragment { - fileExtensions = file.extensions - } - - // the following fragment tries to use the Antlr Generator fragment which can be installed via update manager from http://download.itemis.com/updates/ - fragment = AntlrDelegatingFragment {} - - /* - If you don't want to use the Antlr fragment for some reason, remove the antlr fragment and uncomment the packrat parser fragment below. - fragment = parser.PackratParserFragment {} - */ - - // check-based API for validation - /* - fragment = validation.CheckFragment {} - */ - - // 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 {} - - // formatter API - fragment = formatting.FormatterFragment {} - - // labeling API - fragment = labeling.LabelProviderFragment {} - - // outline API - fragment = outline.TransformerFragment {} - fragment = outline.OutlineNodeAdapterFactoryFragment {} - fragment = outline.QuickOutlineFragment {} - - // java-based API for content assistance - fragment = contentAssist.JavaBasedContentAssistFragment {} - - // the following fragment tries to use the Antlr based content assist - // fragment which can be downloaded from http://www.itemis.com - // and will be ignored if it's not available. - fragment = DelegatingGeneratorFragment { - delegate = "de.itemis.xtext.antlr.XtextAntlrUiGeneratorFragment" - message="You are generating without ANTLR. It is highly recommended to download and use the plugin \'de.itemis.xtext.antlr\' \n\t using the update site http://download.itemis.com/updates/." - } - - fragment = builder.BuilderIntegrationFragment {} - - // project wizard (optional) - /* - fragment = projectWizard.SimpleProjectWizardFragment { - generatorProjectName = "${projectName}.generator" - modelFileExtension = file.extensions - } - */ - - // quickfix API - fragment = quickfix.QuickfixProviderFragment {} - } - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+
+module org.eclipse.etrice.core.Room
+
+import org.eclipse.emf.mwe.utils.*
+import org.eclipse.xtext.generator.*
+import org.eclipse.xtext.ui.generator.*
+
+var grammarURI = "classpath:/org/eclipse/etrice/core/Room.xtext"
+var file.extensions = "room"
+var projectName = "org.eclipse.etrice.core.room"
+var runtimeProject = "../${projectName}"
+
+Workflow {
+ bean = StandaloneSetup {
+ platformUri = "${runtimeProject}/.."
+ }
+
+ component = DirectoryCleaner {
+ directory = "${runtimeProject}/src-gen"
+ }
+
+ component = DirectoryCleaner {
+ directory = "${runtimeProject}.ui/src-gen"
+ }
+
+ component = Generator {
+ pathRtProject = runtimeProject
+ pathUiProject = "${runtimeProject}.ui"
+ 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 = "uri to genmodel, uri to next genmodel"
+ }
+
+ // the serialization component
+ fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
+
+ // a custom ResourceFactory for use with EMF
+ fragment = resourceFactory.ResourceFactoryFragment {
+ fileExtensions = file.extensions
+ }
+
+ // the following fragment tries to use the Antlr Generator fragment which can be installed via update manager from http://download.itemis.com/updates/
+ fragment = AntlrDelegatingFragment {}
+
+ /*
+ If you don't want to use the Antlr fragment for some reason, remove the antlr fragment and uncomment the packrat parser fragment below.
+ fragment = parser.PackratParserFragment {}
+ */
+
+ // check-based API for validation
+ /*
+ fragment = validation.CheckFragment {}
+ */
+
+ // 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 {}
+
+ // formatter API
+ fragment = formatting.FormatterFragment {}
+
+ // labeling API
+ fragment = labeling.LabelProviderFragment {}
+
+ // outline API
+ fragment = outline.TransformerFragment {}
+ fragment = outline.OutlineNodeAdapterFactoryFragment {}
+ fragment = outline.QuickOutlineFragment {}
+
+ // java-based API for content assistance
+ fragment = contentAssist.JavaBasedContentAssistFragment {}
+
+ // the following fragment tries to use the Antlr based content assist
+ // fragment which can be downloaded from http://www.itemis.com
+ // and will be ignored if it's not available.
+ fragment = DelegatingGeneratorFragment {
+ delegate = "de.itemis.xtext.antlr.XtextAntlrUiGeneratorFragment"
+ message="You are generating without ANTLR. It is highly recommended to download and use the plugin \'de.itemis.xtext.antlr\' \n\t using the update site http://download.itemis.com/updates/."
+ }
+
+ fragment = builder.BuilderIntegrationFragment {}
+
+ // project wizard (optional)
+ /*
+ fragment = projectWizard.SimpleProjectWizardFragment {
+ generatorProjectName = "${projectName}.generator"
+ modelFileExtension = file.extensions
+ }
+ */
+
+ // quickfix API
+ fragment = quickfix.QuickfixProviderFragment {}
+ }
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.properties b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.properties index 8b01fc0dd..74519ad8f 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.properties +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.properties @@ -1,3 +1,3 @@ -grammarURI=classpath:/org/eclipse/etrice/core/Room.xtext -file.extensions=room -projectName=org.eclipse.etrice.core.room +grammarURI=classpath:/org/eclipse/etrice/core/Room.xtext
+file.extensions=room
+projectName=org.eclipse.etrice.core.room
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext index c2126f7b3..3d8519934 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext @@ -1,376 +1,376 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -/** - * @author Henrik Rentz-Reichert and Thomas Schuetz - * - * XText Grammar for ROOM models - * this grammar is the base for the ROOM tool eTrice - * - */ - -grammar org.eclipse.etrice.core.Room with org.eclipse.xtext.common.Terminals - -generate room "http://www.eclipse.org/etrice/Room" - -RoomModel : -'RoomModel' name=FQN '{' - (imports+=Import)* - ( - dataClasses+=DataClass | - protocolClasses+=ProtocolClass | - actorClasses+=ActorClass | - subSystemClasses+=SubSystemClass | - systems+=LogicalSystem - )+ - '}' -; - -RoomClass: DataClass | ProtocolClass | StructureClass; -StructureClass: ActorContainerClass | LogicalSystem; -ActorContainerClass: ActorClass | SubSystemClass; - -// ************************************************************** -// data class - -// cf. decision DSL2: fixed size data types -// convert appropriately for Java and issue an error if size not available -enum PrimitiveType: - void = 'void' | - int8 = 'int8' | - int16 = 'int16' | - int32 = 'int32' | - uint8 = 'uint8' | - uint16 = 'uint16' | - uint32 = 'uint32' | - float32 = 'float32' | - float64 = 'float64' | - boolean = 'boolean' | - string = 'string' | - char = 'char'; - - -TypedID: - name=ID ':' type=Type; -FreeTypedID: - name=ID ':' type=FreeType; - -Type: prim=PrimitiveType | type=[DataClass|FQN]; -FreeType: prim=PrimitiveType | type=ID; - -// TODOHRR: define detail level language? -DataClass: - 'DataClass' name=ID ('extends' base=[DataClass|FQN])? '{' - (imports+=Import)* - attributes+=Attribute+ - operations+=Operation* - '}'; - -Attribute: - 'Attribute' name=ID ('[' size=INT ']')? ':' type=Type; - -// TODOHRR: pass arguments and return value by value/reference -Operation: - 'Operation' name=ID '(' (arguments+=FreeTypedID (',' arguments+=FreeTypedID)*)? ')' (':' returntype=FreeType)? - detailCode=DetailCode - ; - -// ************************************************************** -// protocol class - -ProtocolClass: - 'ProtocolClass' name=ID ('extends' base=[ProtocolClass|FQN])? '{' - ('usercode1' userCode1=DetailCode)? - ('usercode2' userCode2=DetailCode)? - 'incoming' '{' incomingMessages+=Message* '}' - 'outgoing' '{' outgoingMessages+=Message* '}' - ('regular' 'PortClass' regular=PortClass)? - ('conjugate' 'PortClass' conjugate=PortClass)? - (semantics=ProtocolSemantics)? - '}'; - -Message: - 'Message' name=ID '(' (arguments+=TypedID (',' arguments+=TypedID)*)? ')'; - -PortClass: - '{' - ('usercode' userCode=DetailCode)? - (attributes+=Attribute | - operations+=Operation | - msgHandlers+=MessageHandler)+ - '}'; - -MessageHandler: - 'handle' msg=[Message|ID] - detailCode=DetailCode - ; - -ProtocolSemantics: - 'semantics' '{' - rules+=SemanticsRule+ - '}'; - -SemanticsRule: SemanticsInRule | SemanticsOutRule; - -SemanticsInRule: 'in' msg=[Message|ID] '->' '{' - followUps+=SemanticsRule* - '}'; - -SemanticsOutRule: 'out' msg=[Message|ID] '->' '{' - followUps+=SemanticsRule* - '}'; - -// ************************************************************** -// actor class - -// some notes on ports -// -// in ROOM ports can be contained in the structure and/or the interface -// p in s ==> internal end port -// p in i ==> relay port -// p in i and p in s ==> external end port -// since double containment is not supported we decided to define external ports as reference to interface ports -ActorClass: - (abstract?='abstract')? 'ActorClass' name=ID ('extends' base=[ActorClass|FQN])? '{' - ('Interface' '{' - ifPorts+=Port* - ifSPPs+=SPPRef* - '}')? - ('Structure' '{' - ('usercode1' userCode1=DetailCode)? - ('usercode2' userCode2=DetailCode)? - (intPorts+=Port | - extPorts+=ExternalPort)* - serviceImplementations+=ServiceImplementation* - strSAPs+=SAPRef* - attributes+=Attribute* - actorRefs+=ActorRef* - bindings+=Binding* - connections+=LayerConnection* - '}')? - ('Behavior' '{' - operations+=Operation* - (stateMachine=StateMachine)? - '}')? - '}'; - -InterfaceItem: Port | SAPRef | SPPRef; - -Port: - (conjugated?='conjugated')? 'Port' name=ID ('[' multiplicity=INT ']')? ':' protocol=[ProtocolClass|FQN] ; -ExternalPort: - 'external' 'Port' ifport=[Port|ID] ; - -SAPRef: - // we omitted the SAP type (Timing/Frame/Exception) - 'SAP' name=ID ':' protocol=[ProtocolClass|FQN] ; - -SPPRef: - 'SPP' name=ID ':' protocol=[ProtocolClass|FQN] ; -ServiceImplementation: - 'ServiceImplementation' 'of' spp=[SPPRef|ID]; - -LogicalSystem: - 'LogicalSystem' name=ID '{' - subSystems+=SubSystemRef+ - bindings+=Binding* - connections+=LayerConnection* - '}'; - -ActorContainerRef: SubSystemRef | ActorRef; - -SubSystemRef: - 'SubSystemRef' name=ID ':' type=[SubSystemClass|FQN]; - -SubSystemClass: - 'SubSystemClass' name=ID '{' - relayPorts+=Port* - ifSPPs+=SPPRef* - actorRefs+=ActorRef+ - bindings+=Binding* - connections+=LayerConnection* - threads+=LogicalThread* - '}'; - -LogicalThread: - 'LogicalThread' name=ID '{' - instances+=ActorInstancePath (',' instances+=ActorInstancePath)* - '}'; - -ActorInstancePath: - segments+=ID ('.' segments+=ID)*; - -// TODOHRR: bindings for replicated ports -// (1) declare several bindings -// (2) use a notation with 1 to n bindings -Binding: - 'Binding' endpoint1=BindingEndPoint 'and' endpoint2=BindingEndPoint ; - -BindingEndPoint: - (actorRef=[ActorContainerRef|ID]'.')? port=[Port|ID]; - -LayerConnection: - 'LayerConnection' from=SAPoint 'satisfied_by' to=SPPoint -; - -SAPoint: RefSAPoint | RelaySAPoint; - -RefSAPoint: - // satisfies a sub actor - 'ref' ref=[ActorContainerRef|ID]; -RelaySAPoint: - // relays from own interface - 'relay_sap' relay=[SPPRef|ID]; - -SPPoint: - ref=[ActorContainerRef|ID] '.' service=[SPPRef|ID] -; - -// TODOHRR: support replicated actors -ActorRef: - 'ActorRef' name=ID ':' type=[ActorClass|FQN]; - - -// ************************************************************** -// state machine - -StateGraphNode: State | ChoicePoint | TrPoint; -StateGraphItem: StateGraphNode | Transition; - -State: BaseState | RefinedState; - -StateGraph: - '{' - ( - states+=State | - trPoints+=TrPoint | - chPoints+=ChoicePoint | - transitions+=Transition - )+ - '}'; - -StateMachine returns StateGraph: - 'StateMachine' '{' - ( - states+=State | - trPoints+=TrPoint | - chPoints+=ChoicePoint | - transitions+=Transition - )+ - '}'; - -// entry and exit code have multiplicity many: in BaseState to be able to add derived class codes here, -// in RefinedState to still have both features in the common base class State -BaseState: - 'State' name=ID '{' - ('entry' entryCode=DetailCode)? - ('exit' exitCode=DetailCode)? - ('subgraph' subgraph=StateGraph)? - '}'; - -RefinedState: - 'RefinedState' base=[BaseState|FQN] '{' - ('entry' entryCode=DetailCode)? - ('exit' exitCode=DetailCode)? - ('subgraph' subgraph=StateGraph)? - '}'; - -// TODOHRR: provide a means to call super class code (cf. ROOM p. 310f) -// super() keyword or flag like in Trice -DetailCode: - '{' - commands+=STRING+ - '}'; - -TrPoint: TransitionPoint | EntryPoint | ExitPoint; - -TransitionPoint: - (handler?='handler')? 'TransitionPoint' name=ID; - -EntryPoint: - 'EntryPoint' name=ID; - -ExitPoint: - 'ExitPoint' name=ID; - -ChoicePoint: - 'ChoicePoint' name=ID; - -Transition: InitialTransition | NonInitialTransition; -NonInitialTransition: TriggeredTransition | ContinuationTransition | CPBranchTransition; - -InitialTransition: - 'Transition' (name=ID)? ':' 'initial' '->' to=TransitionTerminal '{' - ('action' action=DetailCode)? - '}'; - -ContinuationTransition: - 'Transition' (name=ID)? ':' from=TransitionTerminal '->' to=TransitionTerminal '{' - ('action' action=DetailCode)? - '}'; - -TriggeredTransition: - 'Transition' (name=ID)? ':' from=TransitionTerminal '->' to=TransitionTerminal '{' - 'triggers' '{' - triggers+=Trigger ('or' triggers+=Trigger)* - '}' - ('action' action=DetailCode)? - '}'; - -CPBranchTransition: - 'Transition' (name=ID)? ':' from=TransitionTerminal '->' to=TransitionTerminal '{' - 'cond' condition=DetailCode - ('action' action=DetailCode)? - '}'; - -TransitionTerminal: StateTerminal | TrPointTerminal | SubStateTrPointTerminal | ChoicepointTerminal; - -StateTerminal: - state=[BaseState|ID]; -TrPointTerminal: - 'my' trPoint=[TrPoint|ID]; -SubStateTrPointTerminal: - trPoint=[TrPoint|ID] 'of' state=[BaseState|ID]; -ChoicepointTerminal: - 'cp' cp=[ChoicePoint|ID]; - -//TransitionSource: TransitionTerminal|ChoicePointCaseRef|ChoicePointDefaultRef; -//TransitionSource: TransitionTerminal|ChoicePointRef; -//TransitionDest: TransitionTerminal|ChoicePointRef; - -//ChoicePointCaseRef: 'cp' cp=[ChoicePoint|ID] 'case' case=[ChoicePointCase|ID]; -//ChoicePointDefaultRef: 'cp' cp=[ChoicePoint|ID] 'default'; -//ChoicePointRef: 'cp' cp=[ChoicePoint|ID]; - -Trigger: - '<' msgFromIfPairs+=MessageFromIf ('|' msgFromIfPairs+=MessageFromIf)* - (guard=Guard)? '>' -; - -MessageFromIf: - message=[Message|ID] ':' from=[InterfaceItem|ID] -; - -Guard: - 'guard' guard=DetailCode; - -// ************************************************************** -// general - -Import : - 'import' importedNamespace=ImportedFQN; - -ImportedFQN: - FQN ('.' '*')?; - -FQN: - ID ('.' ID)*; +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ * @author Henrik Rentz-Reichert and Thomas Schuetz
+ *
+ * XText Grammar for ROOM models
+ * this grammar is the base for the ROOM tool eTrice
+ *
+ */
+
+grammar org.eclipse.etrice.core.Room with org.eclipse.xtext.common.Terminals
+
+generate room "http://www.eclipse.org/etrice/Room"
+
+RoomModel :
+'RoomModel' name=FQN '{'
+ (imports+=Import)*
+ (
+ dataClasses+=DataClass |
+ protocolClasses+=ProtocolClass |
+ actorClasses+=ActorClass |
+ subSystemClasses+=SubSystemClass |
+ systems+=LogicalSystem
+ )+
+ '}'
+;
+
+RoomClass: DataClass | ProtocolClass | StructureClass;
+StructureClass: ActorContainerClass | LogicalSystem;
+ActorContainerClass: ActorClass | SubSystemClass;
+
+// **************************************************************
+// data class
+
+// cf. decision DSL2: fixed size data types
+// convert appropriately for Java and issue an error if size not available
+enum PrimitiveType:
+ void = 'void' |
+ int8 = 'int8' |
+ int16 = 'int16' |
+ int32 = 'int32' |
+ uint8 = 'uint8' |
+ uint16 = 'uint16' |
+ uint32 = 'uint32' |
+ float32 = 'float32' |
+ float64 = 'float64' |
+ boolean = 'boolean' |
+ string = 'string' |
+ char = 'char';
+
+
+TypedID:
+ name=ID ':' type=Type;
+FreeTypedID:
+ name=ID ':' type=FreeType;
+
+Type: prim=PrimitiveType | type=[DataClass|FQN];
+FreeType: prim=PrimitiveType | type=ID;
+
+// TODOHRR: define detail level language?
+DataClass:
+ 'DataClass' name=ID ('extends' base=[DataClass|FQN])? '{'
+ (imports+=Import)*
+ attributes+=Attribute+
+ operations+=Operation*
+ '}';
+
+Attribute:
+ 'Attribute' name=ID ('[' size=INT ']')? ':' type=Type;
+
+// TODOHRR: pass arguments and return value by value/reference
+Operation:
+ 'Operation' name=ID '(' (arguments+=FreeTypedID (',' arguments+=FreeTypedID)*)? ')' (':' returntype=FreeType)?
+ detailCode=DetailCode
+ ;
+
+// **************************************************************
+// protocol class
+
+ProtocolClass:
+ 'ProtocolClass' name=ID ('extends' base=[ProtocolClass|FQN])? '{'
+ ('usercode1' userCode1=DetailCode)?
+ ('usercode2' userCode2=DetailCode)?
+ 'incoming' '{' incomingMessages+=Message* '}'
+ 'outgoing' '{' outgoingMessages+=Message* '}'
+ ('regular' 'PortClass' regular=PortClass)?
+ ('conjugate' 'PortClass' conjugate=PortClass)?
+ (semantics=ProtocolSemantics)?
+ '}';
+
+Message:
+ 'Message' name=ID '(' (arguments+=TypedID (',' arguments+=TypedID)*)? ')';
+
+PortClass:
+ '{'
+ ('usercode' userCode=DetailCode)?
+ (attributes+=Attribute |
+ operations+=Operation |
+ msgHandlers+=MessageHandler)+
+ '}';
+
+MessageHandler:
+ 'handle' msg=[Message|ID]
+ detailCode=DetailCode
+ ;
+
+ProtocolSemantics:
+ 'semantics' '{'
+ rules+=SemanticsRule+
+ '}';
+
+SemanticsRule: SemanticsInRule | SemanticsOutRule;
+
+SemanticsInRule: 'in' msg=[Message|ID] '->' '{'
+ followUps+=SemanticsRule*
+ '}';
+
+SemanticsOutRule: 'out' msg=[Message|ID] '->' '{'
+ followUps+=SemanticsRule*
+ '}';
+
+// **************************************************************
+// actor class
+
+// some notes on ports
+//
+// in ROOM ports can be contained in the structure and/or the interface
+// p in s ==> internal end port
+// p in i ==> relay port
+// p in i and p in s ==> external end port
+// since double containment is not supported we decided to define external ports as reference to interface ports
+ActorClass:
+ (abstract?='abstract')? 'ActorClass' name=ID ('extends' base=[ActorClass|FQN])? '{'
+ ('Interface' '{'
+ ifPorts+=Port*
+ ifSPPs+=SPPRef*
+ '}')?
+ ('Structure' '{'
+ ('usercode1' userCode1=DetailCode)?
+ ('usercode2' userCode2=DetailCode)?
+ (intPorts+=Port |
+ extPorts+=ExternalPort)*
+ serviceImplementations+=ServiceImplementation*
+ strSAPs+=SAPRef*
+ attributes+=Attribute*
+ actorRefs+=ActorRef*
+ bindings+=Binding*
+ connections+=LayerConnection*
+ '}')?
+ ('Behavior' '{'
+ operations+=Operation*
+ (stateMachine=StateMachine)?
+ '}')?
+ '}';
+
+InterfaceItem: Port | SAPRef | SPPRef;
+
+Port:
+ (conjugated?='conjugated')? 'Port' name=ID ('[' multiplicity=INT ']')? ':' protocol=[ProtocolClass|FQN] ;
+ExternalPort:
+ 'external' 'Port' ifport=[Port|ID] ;
+
+SAPRef:
+ // we omitted the SAP type (Timing/Frame/Exception)
+ 'SAP' name=ID ':' protocol=[ProtocolClass|FQN] ;
+
+SPPRef:
+ 'SPP' name=ID ':' protocol=[ProtocolClass|FQN] ;
+ServiceImplementation:
+ 'ServiceImplementation' 'of' spp=[SPPRef|ID];
+
+LogicalSystem:
+ 'LogicalSystem' name=ID '{'
+ subSystems+=SubSystemRef+
+ bindings+=Binding*
+ connections+=LayerConnection*
+ '}';
+
+ActorContainerRef: SubSystemRef | ActorRef;
+
+SubSystemRef:
+ 'SubSystemRef' name=ID ':' type=[SubSystemClass|FQN];
+
+SubSystemClass:
+ 'SubSystemClass' name=ID '{'
+ relayPorts+=Port*
+ ifSPPs+=SPPRef*
+ actorRefs+=ActorRef+
+ bindings+=Binding*
+ connections+=LayerConnection*
+ threads+=LogicalThread*
+ '}';
+
+LogicalThread:
+ 'LogicalThread' name=ID '{'
+ instances+=ActorInstancePath (',' instances+=ActorInstancePath)*
+ '}';
+
+ActorInstancePath:
+ segments+=ID ('.' segments+=ID)*;
+
+// TODOHRR: bindings for replicated ports
+// (1) declare several bindings
+// (2) use a notation with 1 to n bindings
+Binding:
+ 'Binding' endpoint1=BindingEndPoint 'and' endpoint2=BindingEndPoint ;
+
+BindingEndPoint:
+ (actorRef=[ActorContainerRef|ID]'.')? port=[Port|ID];
+
+LayerConnection:
+ 'LayerConnection' from=SAPoint 'satisfied_by' to=SPPoint
+;
+
+SAPoint: RefSAPoint | RelaySAPoint;
+
+RefSAPoint:
+ // satisfies a sub actor
+ 'ref' ref=[ActorContainerRef|ID];
+RelaySAPoint:
+ // relays from own interface
+ 'relay_sap' relay=[SPPRef|ID];
+
+SPPoint:
+ ref=[ActorContainerRef|ID] '.' service=[SPPRef|ID]
+;
+
+// TODOHRR: support replicated actors
+ActorRef:
+ 'ActorRef' name=ID ':' type=[ActorClass|FQN];
+
+
+// **************************************************************
+// state machine
+
+StateGraphNode: State | ChoicePoint | TrPoint;
+StateGraphItem: StateGraphNode | Transition;
+
+State: BaseState | RefinedState;
+
+StateGraph:
+ '{'
+ (
+ states+=State |
+ trPoints+=TrPoint |
+ chPoints+=ChoicePoint |
+ transitions+=Transition
+ )+
+ '}';
+
+StateMachine returns StateGraph:
+ 'StateMachine' '{'
+ (
+ states+=State |
+ trPoints+=TrPoint |
+ chPoints+=ChoicePoint |
+ transitions+=Transition
+ )+
+ '}';
+
+// entry and exit code have multiplicity many: in BaseState to be able to add derived class codes here,
+// in RefinedState to still have both features in the common base class State
+BaseState:
+ 'State' name=ID '{'
+ ('entry' entryCode=DetailCode)?
+ ('exit' exitCode=DetailCode)?
+ ('subgraph' subgraph=StateGraph)?
+ '}';
+
+RefinedState:
+ 'RefinedState' base=[BaseState|FQN] '{'
+ ('entry' entryCode=DetailCode)?
+ ('exit' exitCode=DetailCode)?
+ ('subgraph' subgraph=StateGraph)?
+ '}';
+
+// TODOHRR: provide a means to call super class code (cf. ROOM p. 310f)
+// super() keyword or flag like in Trice
+DetailCode:
+ '{'
+ commands+=STRING+
+ '}';
+
+TrPoint: TransitionPoint | EntryPoint | ExitPoint;
+
+TransitionPoint:
+ (handler?='handler')? 'TransitionPoint' name=ID;
+
+EntryPoint:
+ 'EntryPoint' name=ID;
+
+ExitPoint:
+ 'ExitPoint' name=ID;
+
+ChoicePoint:
+ 'ChoicePoint' name=ID;
+
+Transition: InitialTransition | NonInitialTransition;
+NonInitialTransition: TriggeredTransition | ContinuationTransition | CPBranchTransition;
+
+InitialTransition:
+ 'Transition' (name=ID)? ':' 'initial' '->' to=TransitionTerminal '{'
+ ('action' action=DetailCode)?
+ '}';
+
+ContinuationTransition:
+ 'Transition' (name=ID)? ':' from=TransitionTerminal '->' to=TransitionTerminal '{'
+ ('action' action=DetailCode)?
+ '}';
+
+TriggeredTransition:
+ 'Transition' (name=ID)? ':' from=TransitionTerminal '->' to=TransitionTerminal '{'
+ 'triggers' '{'
+ triggers+=Trigger ('or' triggers+=Trigger)*
+ '}'
+ ('action' action=DetailCode)?
+ '}';
+
+CPBranchTransition:
+ 'Transition' (name=ID)? ':' from=TransitionTerminal '->' to=TransitionTerminal '{'
+ 'cond' condition=DetailCode
+ ('action' action=DetailCode)?
+ '}';
+
+TransitionTerminal: StateTerminal | TrPointTerminal | SubStateTrPointTerminal | ChoicepointTerminal;
+
+StateTerminal:
+ state=[BaseState|ID];
+TrPointTerminal:
+ 'my' trPoint=[TrPoint|ID];
+SubStateTrPointTerminal:
+ trPoint=[TrPoint|ID] 'of' state=[BaseState|ID];
+ChoicepointTerminal:
+ 'cp' cp=[ChoicePoint|ID];
+
+//TransitionSource: TransitionTerminal|ChoicePointCaseRef|ChoicePointDefaultRef;
+//TransitionSource: TransitionTerminal|ChoicePointRef;
+//TransitionDest: TransitionTerminal|ChoicePointRef;
+
+//ChoicePointCaseRef: 'cp' cp=[ChoicePoint|ID] 'case' case=[ChoicePointCase|ID];
+//ChoicePointDefaultRef: 'cp' cp=[ChoicePoint|ID] 'default';
+//ChoicePointRef: 'cp' cp=[ChoicePoint|ID];
+
+Trigger:
+ '<' msgFromIfPairs+=MessageFromIf ('|' msgFromIfPairs+=MessageFromIf)*
+ (guard=Guard)? '>'
+;
+
+MessageFromIf:
+ message=[Message|ID] ':' from=[InterfaceItem|ID]
+;
+
+Guard:
+ 'guard' guard=DetailCode;
+
+// **************************************************************
+// general
+
+Import :
+ 'import' importedNamespace=ImportedFQN;
+
+ImportedFQN:
+ FQN ('.' '*')?;
+
+FQN:
+ ID ('.' ID)*;
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java index d12cc0851..7db4714b7 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java @@ -1,35 +1,35 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core; - -import org.eclipse.etrice.core.naming.RoomFragmentProvider; -import org.eclipse.etrice.core.naming.RoomQualifiedNameProvider; -import org.eclipse.xtext.naming.IQualifiedNameProvider; -import org.eclipse.xtext.resource.IFragmentProvider; - - -/** - * Use this class to register components to be used within the IDE. - */ -public class RoomRuntimeModule extends org.eclipse.etrice.core.AbstractRoomRuntimeModule { - - @Override - public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() { - return RoomQualifiedNameProvider.class; - } - - @Override - public Class<? extends IFragmentProvider> bindIFragmentProvider() { - return RoomFragmentProvider.class; - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core;
+
+import org.eclipse.etrice.core.naming.RoomFragmentProvider;
+import org.eclipse.etrice.core.naming.RoomQualifiedNameProvider;
+import org.eclipse.xtext.naming.IQualifiedNameProvider;
+import org.eclipse.xtext.resource.IFragmentProvider;
+
+
+/**
+ * Use this class to register components to be used within the IDE.
+ */
+public class RoomRuntimeModule extends org.eclipse.etrice.core.AbstractRoomRuntimeModule {
+
+ @Override
+ public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
+ return RoomQualifiedNameProvider.class;
+ }
+
+ @Override
+ public Class<? extends IFragmentProvider> bindIFragmentProvider() {
+ return RoomFragmentProvider.class;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomStandaloneSetup.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomStandaloneSetup.java index 4e5490356..7233be345 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomStandaloneSetup.java +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomStandaloneSetup.java @@ -1,29 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - - - -package org.eclipse.etrice.core; - -import org.eclipse.etrice.core.RoomStandaloneSetupGenerated; - -/** - * Initialization support for running Xtext languages - * without equinox extension registry - */ -public class RoomStandaloneSetup extends RoomStandaloneSetupGenerated{ - - public static void doSetup() { - new RoomStandaloneSetup().createInjectorAndDoEMFRegistration(); - } -} - +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+
+
+package org.eclipse.etrice.core;
+
+import org.eclipse.etrice.core.RoomStandaloneSetupGenerated;
+
+/**
+ * Initialization support for running Xtext languages
+ * without equinox extension registry
+ */
+public class RoomStandaloneSetup extends RoomStandaloneSetupGenerated{
+
+ public static void doSetup() {
+ new RoomStandaloneSetup().createInjectorAndDoEMFRegistration();
+ }
+}
+
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting/RoomFormatter.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting/RoomFormatter.java index bfbb4edc5..79c5515a2 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting/RoomFormatter.java +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/formatting/RoomFormatter.java @@ -1,34 +1,34 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.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 RoomFormatter extends AbstractDeclarativeFormatter { - - @Override - protected void configureFormatting(FormattingConfig c) { - //org.eclipse.etrice.core.services.RoomGrammarAccess f = (org.eclipse.etrice.core.services.RoomGrammarAccess) getGrammarAccess(); - - //... - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.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 RoomFormatter extends AbstractDeclarativeFormatter {
+
+ @Override
+ protected void configureFormatting(FormattingConfig c) {
+ //org.eclipse.etrice.core.services.RoomGrammarAccess f = (org.eclipse.etrice.core.services.RoomGrammarAccess) getGrammarAccess();
+
+ //...
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/FilteringScope.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/FilteringScope.java index c9b7109c7..3549345b7 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/FilteringScope.java +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/FilteringScope.java @@ -1,66 +1,66 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.scoping; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.xtext.resource.IEObjectDescription; -import org.eclipse.xtext.scoping.IScope; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -public class FilteringScope implements IScope { - - private IScope delegate; - private Predicate<IEObjectDescription> filter; - - public FilteringScope(IScope delegate, Predicate<IEObjectDescription> filter) { - this.delegate = delegate; - this.filter = filter; - } - - public IScope getOuterScope() { - return new FilteringScope(delegate.getOuterScope(), filter); - } - - public Iterable<IEObjectDescription> getContents() { - return filter(delegate.getContents()); - } - - public Iterable<IEObjectDescription> getAllContents() { - return filter(delegate.getAllContents()); - } - - public IEObjectDescription getContentByName(String name) { - return filter(delegate.getContentByName(name)); - } - - public IEObjectDescription getContentByEObject(EObject object) { - return filter(delegate.getContentByEObject(object)); - } - - public Iterable<IEObjectDescription> getAllContentsByEObject(EObject object) { - return filter(delegate.getAllContentsByEObject(object)); - } - - protected Iterable<IEObjectDescription> filter( - Iterable<IEObjectDescription> unfiltered) { - return Iterables.filter(unfiltered, filter); - } - - protected IEObjectDescription filter(IEObjectDescription contentByEObject) { - if (!filter.apply(contentByEObject)) - return null; - return contentByEObject; - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.scoping;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.scoping.IScope;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+public class FilteringScope implements IScope {
+
+ private IScope delegate;
+ private Predicate<IEObjectDescription> filter;
+
+ public FilteringScope(IScope delegate, Predicate<IEObjectDescription> filter) {
+ this.delegate = delegate;
+ this.filter = filter;
+ }
+
+ public IScope getOuterScope() {
+ return new FilteringScope(delegate.getOuterScope(), filter);
+ }
+
+ public Iterable<IEObjectDescription> getContents() {
+ return filter(delegate.getContents());
+ }
+
+ public Iterable<IEObjectDescription> getAllContents() {
+ return filter(delegate.getAllContents());
+ }
+
+ public IEObjectDescription getContentByName(String name) {
+ return filter(delegate.getContentByName(name));
+ }
+
+ public IEObjectDescription getContentByEObject(EObject object) {
+ return filter(delegate.getContentByEObject(object));
+ }
+
+ public Iterable<IEObjectDescription> getAllContentsByEObject(EObject object) {
+ return filter(delegate.getAllContentsByEObject(object));
+ }
+
+ protected Iterable<IEObjectDescription> filter(
+ Iterable<IEObjectDescription> unfiltered) {
+ return Iterables.filter(unfiltered, filter);
+ }
+
+ protected IEObjectDescription filter(IEObjectDescription contentByEObject) {
+ if (!filter.apply(contentByEObject))
+ return null;
+ return contentByEObject;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java index 048f418f4..02a3085eb 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java @@ -1,803 +1,803 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.core.scoping; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.ActorContainerClass; -import org.eclipse.etrice.core.room.ActorRef; -import org.eclipse.etrice.core.room.BaseState; -import org.eclipse.etrice.core.room.BindingEndPoint; -import org.eclipse.etrice.core.room.ChoicePoint; -import org.eclipse.etrice.core.room.ChoicepointTerminal; -import org.eclipse.etrice.core.room.ExternalPort; -import org.eclipse.etrice.core.room.InterfaceItem; -import org.eclipse.etrice.core.room.Message; -import org.eclipse.etrice.core.room.MessageFromIf; -import org.eclipse.etrice.core.room.MessageHandler; -import org.eclipse.etrice.core.room.Port; -import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RefSAPoint; -import org.eclipse.etrice.core.room.RefinedState; -import org.eclipse.etrice.core.room.RelaySAPoint; -import org.eclipse.etrice.core.room.SAPRef; -import org.eclipse.etrice.core.room.SPPRef; -import org.eclipse.etrice.core.room.SPPoint; -import org.eclipse.etrice.core.room.SemanticsInRule; -import org.eclipse.etrice.core.room.SemanticsOutRule; -import org.eclipse.etrice.core.room.ServiceImplementation; -import org.eclipse.etrice.core.room.State; -import org.eclipse.etrice.core.room.StateGraph; -import org.eclipse.etrice.core.room.StateTerminal; -import org.eclipse.etrice.core.room.SubStateTrPointTerminal; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.core.room.SubSystemRef; -import org.eclipse.etrice.core.room.TrPoint; -import org.eclipse.etrice.core.room.TrPointTerminal; -import org.eclipse.xtext.resource.EObjectDescription; -import org.eclipse.xtext.resource.IEObjectDescription; -import org.eclipse.xtext.scoping.IScope; -import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; -import org.eclipse.xtext.scoping.impl.SimpleScope; - - -/** - * 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 RoomScopeProvider extends AbstractDeclarativeScopeProvider { - - public static final String STATE_PATH_DELIMITER = "."; - - /** - * first container of type {@link StateGraph} ({@link State}, {@link StateMachine}) - * @param obj - * @return StateGraph Container - */ - private StateGraph getStateGraph(EObject obj) { - EObject ctx = obj.eContainer(); - while (!(ctx instanceof StateGraph) && ctx.eContainer()!=null) - ctx = ctx.eContainer(); - if (ctx instanceof StateGraph) - return (StateGraph) ctx; - - return null; - } - - /** - * first container of type {@link ActorClass} - * @param obj - * @return ActorClass container - */ - private ActorClass getActorClass(EObject obj) { - EObject ctx = obj.eContainer(); - while (!(ctx instanceof ActorClass) && ctx.eContainer()!=null) - ctx = ctx.eContainer(); - if (ctx instanceof ActorClass) - return (ActorClass) ctx; - - return null; - } - - /** - * first container of type {@link ActorClass} - * @param obj - * @return ActorClass container - */ - private ActorContainerClass getActorContainerClass(EObject obj) { - EObject ctx = obj.eContainer(); - while (!(ctx instanceof ActorContainerClass) && ctx.eContainer()!=null) - ctx = ctx.eContainer(); - if (ctx instanceof ActorContainerClass) - return (ActorContainerClass) ctx; - - return null; - } - - /** - * first container of type {@link ProtocolClass} - * @param obj - * @return ActorClass container - */ - private ProtocolClass getProtocolClass(EObject obj) { - EObject ctx = obj.eContainer(); - while (!(ctx instanceof ProtocolClass) && ctx.eContainer()!=null) - ctx = ctx.eContainer(); - if (ctx instanceof ProtocolClass) - return (ProtocolClass) ctx; - - return null; - } - - /** - * check whether port is referenced by external port - * @param p - port to be checked - * @param ports - list of external ports - * @return true if contained - */ - private boolean isContained(Port p, EList<ExternalPort> ports) { - for (ExternalPort port : ports) { - if (port.getIfport()==p) - return true; - } - return false; - } - - /** - * recursively collect all {@link BaseState}s of an actor class in a list - * @param ac - * @param states - */ - private void collectAllStates(ActorClass ac, - LinkedList<BaseState> states) { - while (ac!=null) { - collectStates(ac.getStateMachine(), states); - ac = ac.getBase(); - } - } - - private void collectStates(StateGraph sg, - LinkedList<BaseState> states) { - - if (sg==null) - return; - - for (State s : sg.getStates()) { - if (s instanceof BaseState) - states.add((BaseState) s); - } - for (State s : sg.getStates()) { - collectStates(s.getSubgraph(), states); - } - } - - /** - * compute the path of a {@link BaseState} - * @param bs - * @return the path - */ - private String getStatePath(BaseState bs) { - EObject parent = bs.eContainer().eContainer(); - if (parent instanceof BaseState) - return getStatePath((BaseState) parent)+STATE_PATH_DELIMITER+bs.getName(); - else if (parent instanceof RefinedState) { - BaseState base = ((RefinedState) parent).getBase(); - if (base!=null) - return getStatePath(base)+STATE_PATH_DELIMITER+bs.getName(); - } - return bs.getName(); - } - - /** - * return a list of base classes of an {@link ActorClass}, parent classes first. - * The list includes the class itself - * @param ac - * @return - */ - private LinkedList<ActorClass> getBaseClasses(ActorClass ac) { - LinkedList<ActorClass> classes = new LinkedList<ActorClass>(); - if (ac!=null) { - classes.addFirst(ac); - while (ac.getBase()!=null) { - ac = ac.getBase(); - classes.addFirst(ac); - } - } - return classes; - } - - /** - * return a list of base classes of an {@link ProtocolClass}, parent classes first. - * The list includes the class itself - * @param pc - * @return - */ - private LinkedList<ProtocolClass> getBaseClasses(ProtocolClass pc) { - LinkedList<ProtocolClass> classes = new LinkedList<ProtocolClass>(); - classes.addFirst(pc); - while (pc.getBase()!=null) { - pc = pc.getBase(); - classes.addFirst(pc); - } - return classes; - } - - /** - * return the {@link BaseState} of a {@link State} - * @param s - * @return the state itself if a BaseState or the BaseState for a {@link RefinedState} - */ - private BaseState getBaseState(State s) { - if (s instanceof BaseState) - return (BaseState) s; - else if (s instanceof RefinedState) - return ((RefinedState) s).getBase(); - else - return null; - } - - private IScope getStateScopes(EObject obj) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - // first state in container hierarchy - StateGraph parent = getStateGraph(obj); - - // collect states of my parent - if (parent!=null) { - for (State s : parent.getStates()) { - BaseState bs = getBaseState(s); - scopes.add(EObjectDescription.create(bs.getName(), bs)); - } - - // if my parent is a refined state we also add its base state contents - if (parent.eContainer() instanceof RefinedState) { - parent = ((RefinedState) parent.eContainer()).getBase().getSubgraph(); - if (parent!=null) - for (State s : parent.getStates()) { - BaseState bs = getBaseState(s); - scopes.add(EObjectDescription.create(bs.getName(), bs)); - } - } - else if (parent.eContainer() instanceof ActorClass) { - ActorClass ac = (ActorClass) parent.eContainer(); - if (ac.getBase()!=null) { - for (State s : ac.getBase().getStateMachine().getStates()) { - BaseState bs = getBaseState(s); - scopes.add(EObjectDescription.create(bs.getName(), bs)); - } - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of State scopes for a {@link StateTerminal} - * @param st - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_StateTerminal_state(StateTerminal st, EReference ref) { - return getStateScopes(st); - } - - /** - * returns a flat list of TransitionPoint scopes for a {@link TrPointTerminal} - * @param ep - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_TrPointTerminal_trPoint(TrPointTerminal ep, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - StateGraph parent = getStateGraph(ep); - StateGraph targetStateGraph = parent; - - getTrPointScopes(scopes, targetStateGraph); - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of TransitionPoint scopes for a {@link SubStateTrPointTerminal} - * @param ep - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SubStateTrPointTerminal_trPoint(SubStateTrPointTerminal ep, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - StateGraph parent = getStateGraph(ep); - StateGraph targetStateGraph = parent; - if (ep.getState()!=null) { - targetStateGraph = ep.getState().getSubgraph(); // always a BaseState - - // if one of our siblings is a RefinedState of our target we take that as target - for (State sibling : parent.getStates()) { - if (sibling instanceof RefinedState) { - if (((RefinedState)sibling).getBase()==ep.getState()) - targetStateGraph = sibling.getSubgraph(); - } - } - } - - getTrPointScopes(scopes, targetStateGraph); - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - private void getTrPointScopes(final List<IEObjectDescription> scopes, - StateGraph sg) { - - // collect transition points of this state - for (TrPoint tp : sg.getTrPoints()) { - scopes.add(EObjectDescription.create(tp.getName(), tp)); - } - - // if this state is a refined state we also add its base state transition points - if (sg.eContainer() instanceof RefinedState) { - sg = ((RefinedState) sg.eContainer()).getBase().getSubgraph(); - if (sg!=null) - for (TrPoint tp : sg.getTrPoints()) { - scopes.add(EObjectDescription.create(tp.getName(), tp)); - } - } - } - - /** - * returns a flat list of State scopes for a {@link SubStateTrPointTerminal} - * @param st - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SubStateTrPointTerminal_state(SubStateTrPointTerminal st, EReference ref) { - return getStateScopes(st); - } - - /** - * returns a flat list of Choicepoint scopes for a {@link SubStateTrPointTerminal} - * @param ct - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_ChoicepointTerminal_cp(ChoicepointTerminal ct, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - // first state in container hierarchy - StateGraph parent = getStateGraph(ct); - - // collect choicepoints of my parent - if (parent!=null) - for (ChoicePoint cp : parent.getChPoints()) { - scopes.add(EObjectDescription.create(cp.getName(), cp)); - } - - // if my parent is a refined state we also add its base state contents - if (parent.eContainer() instanceof RefinedState) { - parent = ((RefinedState) parent.eContainer()).getBase().getSubgraph(); - if (parent!=null) - for (ChoicePoint cp : parent.getChPoints()) { - scopes.add(EObjectDescription.create(cp.getName(), cp)); - } - } - else if (parent.eContainer() instanceof ActorClass) { - ActorClass ac = (ActorClass) parent.eContainer(); - if (ac.getBase()!=null) { - for (ChoicePoint cp : ac.getBase().getStateMachine().getChPoints()) { - scopes.add(EObjectDescription.create(cp.getName(), cp)); - } - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Message scopes for a {@link MessageFromIf} - * @param mfi - the message from interface - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_MessageFromIf_message(MessageFromIf mfi, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - InterfaceItem item = mfi.getFrom(); - if (item!=null) { - ProtocolClass protocol = item.getProtocol(); - boolean conjugated = false; - if (item instanceof Port) - conjugated = ((Port)item).isConjugated(); - else if (item instanceof SAPRef) - conjugated = true; - for (Message msg : conjugated?protocol.getOutgoingMessages():protocol.getIncomingMessages()) { - scopes.add(EObjectDescription.create(msg.getName(), msg)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Port scopes for a {@link MessageFromIf} - * @param mfi - the message from interface - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_MessageFromIf_port(MessageFromIf mfi, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorClass ac = getActorClass(mfi); - for (Port p : ac.getIntPorts()) { - scopes.add(EObjectDescription.create(p.getName(), p)); - } - for (ExternalPort p : ac.getExtPorts()) { - scopes.add(EObjectDescription.create(p.getIfport().getName(), p.getIfport())); - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of InterfaceItem scopes for a {@link MessageFromIf} - * @param mfi - the message from interface - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_MessageFromIf_from(MessageFromIf mfi, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorClass ac = getActorClass(mfi); - LinkedList<ActorClass> classes = getBaseClasses(ac); - LinkedList<InterfaceItem> items = new LinkedList<InterfaceItem>(); - - // for all base classes - for (ActorClass a : classes) { - // add internal ports - items.addAll(a.getIntPorts()); - - // add service implementations and saps - for (ServiceImplementation ispp : a.getServiceImplementations()) { - items.add(ispp.getSpp()); - } - items.addAll(a.getStrSAPs()); - - // add external end ports - for (ExternalPort p : a.getExtPorts()) { - items.add(p.getIfport()); - } - } - - for (InterfaceItem item : items) { - scopes.add(EObjectDescription.create(item.getName(), item)); - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of ActorRef scopes for a {@link BindingEndPoint} - * @param ep - the endpoint - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_BindingEndPoint_actorRef(BindingEndPoint ep, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorContainerClass sc = getActorContainerClass(ep); - if (sc instanceof ActorClass) { - LinkedList<ActorClass> classes = getBaseClasses((ActorClass)sc); - for (ActorClass a : classes) { - for (ActorRef ar : a.getActorRefs()) { - scopes.add(EObjectDescription.create(ar.getName(), ar)); - } - } - } - else { - for (ActorRef ar : sc.getActorRefs()) { - scopes.add(EObjectDescription.create(ar.getName(), ar)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Port scopes for a {@link BindingEndPoint} - * @param ep - the endpoint - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_BindingEndPoint_port(BindingEndPoint ep, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorContainerClass acc = getActorContainerClass(ep); - - if (ep.getActorRef() == null){ - if (acc instanceof ActorClass) { - ActorClass ac = (ActorClass) acc; - // for all super classes (including this class) - LinkedList<ActorClass> classes = getBaseClasses(ac); - for (ActorClass a : classes) { - // collect internal and relay ports, i.e. - // structure ports not in interface (internal) - for (Port p : a.getIntPorts()) { - scopes.add(EObjectDescription.create(p.getName(), p)); - } - // interface ports not in structure (relay) - for (Port p : a.getIfPorts()) { - if (!isContained(p, a.getExtPorts())) - scopes.add(EObjectDescription.create(p.getName(), p)); - } - } - } - else { - // SubSystemClass has no internal end ports - } - } - else { - // all ports in the sub actor's interface - if (ep.getActorRef() instanceof ActorRef) { - ActorClass ac = ((ActorRef)ep.getActorRef()).getType(); - LinkedList<ActorClass> classes = getBaseClasses(ac); - for (ActorClass a : classes) { - for (Port p : a.getIfPorts()) { - scopes.add(EObjectDescription.create(p.getName(), p)); - } - } - } - else { - SubSystemClass ssc = ((SubSystemRef)ep.getActorRef()).getType(); - for (Port p : ssc.getRelayPorts()) { - scopes.add(EObjectDescription.create(p.getName(), p)); - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of BaseState scopes for a {@link RefinedState} - * @param rs - the refined state - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_RefinedState_base(RefinedState rs, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorClass ac = getActorClass(rs); - LinkedList<BaseState> states = new LinkedList<BaseState>(); - collectAllStates(ac.getBase(), states); - for (BaseState bs : states) { - scopes.add(EObjectDescription.create(getStatePath(bs), bs)); - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Message scopes for a {@link SemanticsInRule} - * @param sr - the semantics rule for incoming messages - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SemanticsInRule_msg(SemanticsInRule sr, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ProtocolClass pc = getProtocolClass(sr); - LinkedList<ProtocolClass> classes = getBaseClasses(pc); - for (ProtocolClass bpc : classes) { - for (Message m : bpc.getIncomingMessages()) { - scopes.add(EObjectDescription.create(m.getName(), m)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Message scopes for a {@link SemanticsInRule} - * @param sr - the semantics rule for incoming messages - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SemanticsOutRule_msg(SemanticsOutRule sr, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ProtocolClass pc = getProtocolClass(sr); - LinkedList<ProtocolClass> classes = getBaseClasses(pc); - for (ProtocolClass bpc : classes) { - for (Message m : bpc.getOutgoingMessages()) { - scopes.add(EObjectDescription.create(m.getName(), m)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of ActorRef scopes for a {@link SubActorSAPoint} - * @param pt - * @param ref - * @return a list of scopes - */ - public IScope scope_RefSAPoint_ref(RefSAPoint pt, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorContainerClass acc = getActorContainerClass(pt); - if (acc instanceof ActorClass) { - LinkedList<ActorClass> classes = getBaseClasses((ActorClass) acc); - for (ActorClass a : classes) { - for (ActorRef ar : a.getActorRefs()) { - scopes.add(EObjectDescription.create(ar.getName(), ar)); - } - } - } - else { - for (ActorRef ar : acc.getActorRefs()) { - scopes.add(EObjectDescription.create(ar.getName(), ar)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of SPPRef scopes for a {@link RelaySAPoint} - * @param pt - * @param ref - * @return a list of scopes - */ - public IScope scope_RelaySAPoint_relay(RelaySAPoint pt, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorClass ac = getActorClass(pt); - LinkedList<ActorClass> classes = getBaseClasses(ac); - for (ActorClass a : classes) { - for (SPPRef spp : a.getIfSPPs()) { - scopes.add(EObjectDescription.create(spp.getName(), spp)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of ActorRef scopes for a {@link SPPoint} - * @param pt - * @param ref - * @return a list of scopes - */ - public IScope scope_SPPoint_actorRef(SPPoint pt, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorContainerClass acc = getActorContainerClass(pt); - if (acc instanceof ActorClass) { - LinkedList<ActorClass> classes = getBaseClasses((ActorClass)acc); - for (ActorClass a : classes) { - for (ActorRef ar : a.getActorRefs()) { - scopes.add(EObjectDescription.create(ar.getName(), ar)); - } - } - } - else { - for (ActorRef ar : acc.getActorRefs()) { - scopes.add(EObjectDescription.create(ar.getName(), ar)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of SPPRef scopes for a {@link SPPoint} - * @param pt - * @param ref - * @return a list of scopes - */ - public IScope scope_SPPoint_service(SPPoint pt, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - if (pt.getRef()!=null) { - if (pt.getRef() instanceof ActorRef) { - ActorClass ac = ((ActorRef)pt.getRef()).getType(); - LinkedList<ActorClass> classes = getBaseClasses(ac); - for (ActorClass a : classes) { - for (SPPRef spp : a.getIfSPPs()) { - scopes.add(EObjectDescription.create(spp.getName(), spp)); - } - } - } - else if (pt.getRef() instanceof SubSystemRef) { - SubSystemClass ssc = ((SubSystemRef)pt.getRef()).getType(); - for (SPPRef spp : ssc.getIfSPPs()) { - scopes.add(EObjectDescription.create(spp.getName(), spp)); - } - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - public IScope scope_MessageHandler_msg(MessageHandler handler, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ProtocolClass pc = getProtocolClass(handler); - if (pc!=null) { - for (Message m : pc.getIncomingMessages()) { - scopes.add(EObjectDescription.create(m.getName(), m)); - } - for (Message m : pc.getOutgoingMessages()) { - scopes.add(EObjectDescription.create(m.getName(), m)); - } - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /* - * we prefer loose scoping here and rely on validation for meaningful error messages - * - * returns a flat list of ActorClass scopes for a {@link ActorRef} - * @param ar - the actor reference - * @param ref - not used - * @return a list of scopes - */ -// public IScope scope_ActorRef_type(ActorRef ar, EReference ref) { -// ActorClass ac = getActorClass(ar); -// IScope scope = delegateGetScope(ar, ref); -// return new FilteringScope(scope, new ActorRefFilter(ac)); -// } - - /** - * returns a flat list of Port scopes for a {@link ExternalPort} - * @param ar - the external port - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_ExternalPort_ifport(ExternalPort ep, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - ActorClass ac = getActorClass(ep); - for (Port ip : ac.getIfPorts()) { - scopes.add(EObjectDescription.create(ip.getName(), ip)); - } - - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - /** - * returns a flat list of Port scopes for a {@link ExternalPort} - * @param ar - the external port - * @param ref - not used - * @return a list of scopes - */ -// public IScope scope_ActorInstance_segments(ActorInstance ai, EReference ref) { -// final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); -// -// if (ai.getSegments().isEmpty()) { -// // context is my ActorContainerClass -// ActorContainerClass acc = getActorContainerClass(ai); -// for (ActorRef ar : acc.getActorRefs()) { -// scopes.add(EObjectDescription.create(ar.getName(), ar)); -// } -// } -// else { -// // context is actor class of last segment -// ActorClass ac = ai.getSegments().get(ai.getSegments().size()-1).getType(); -// for (ActorRef ar : ac.getActorRefs()) { -// scopes.add(EObjectDescription.create(ar.getName(), ar)); -// } -// } -// -// return new SimpleScope(IScope.NULLSCOPE, scopes); -// } - - /* - public IScope scope_ChoicePointCaseRef_case(ChoicePointCaseRef cr, EReference ref) { - final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>(); - - if (cr.getCp()!=null) { - for (ChoicePointCase cas : cr.getCp().getCases()) { - scopes.add(EObjectDescription.create(cas.getName(), cas)); - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - }*/ -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.scoping;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorContainerClass;
+import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.etrice.core.room.BaseState;
+import org.eclipse.etrice.core.room.BindingEndPoint;
+import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.ChoicepointTerminal;
+import org.eclipse.etrice.core.room.ExternalPort;
+import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.Message;
+import org.eclipse.etrice.core.room.MessageFromIf;
+import org.eclipse.etrice.core.room.MessageHandler;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.core.room.RefSAPoint;
+import org.eclipse.etrice.core.room.RefinedState;
+import org.eclipse.etrice.core.room.RelaySAPoint;
+import org.eclipse.etrice.core.room.SAPRef;
+import org.eclipse.etrice.core.room.SPPRef;
+import org.eclipse.etrice.core.room.SPPoint;
+import org.eclipse.etrice.core.room.SemanticsInRule;
+import org.eclipse.etrice.core.room.SemanticsOutRule;
+import org.eclipse.etrice.core.room.ServiceImplementation;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.core.room.StateTerminal;
+import org.eclipse.etrice.core.room.SubStateTrPointTerminal;
+import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.room.SubSystemRef;
+import org.eclipse.etrice.core.room.TrPoint;
+import org.eclipse.etrice.core.room.TrPointTerminal;
+import org.eclipse.xtext.resource.EObjectDescription;
+import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.scoping.IScope;
+import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
+import org.eclipse.xtext.scoping.impl.SimpleScope;
+
+
+/**
+ * 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 RoomScopeProvider extends AbstractDeclarativeScopeProvider {
+
+ public static final String STATE_PATH_DELIMITER = ".";
+
+ /**
+ * first container of type {@link StateGraph} ({@link State}, {@link StateMachine})
+ * @param obj
+ * @return StateGraph Container
+ */
+ private StateGraph getStateGraph(EObject obj) {
+ EObject ctx = obj.eContainer();
+ while (!(ctx instanceof StateGraph) && ctx.eContainer()!=null)
+ ctx = ctx.eContainer();
+ if (ctx instanceof StateGraph)
+ return (StateGraph) ctx;
+
+ return null;
+ }
+
+ /**
+ * first container of type {@link ActorClass}
+ * @param obj
+ * @return ActorClass container
+ */
+ private ActorClass getActorClass(EObject obj) {
+ EObject ctx = obj.eContainer();
+ while (!(ctx instanceof ActorClass) && ctx.eContainer()!=null)
+ ctx = ctx.eContainer();
+ if (ctx instanceof ActorClass)
+ return (ActorClass) ctx;
+
+ return null;
+ }
+
+ /**
+ * first container of type {@link ActorClass}
+ * @param obj
+ * @return ActorClass container
+ */
+ private ActorContainerClass getActorContainerClass(EObject obj) {
+ EObject ctx = obj.eContainer();
+ while (!(ctx instanceof ActorContainerClass) && ctx.eContainer()!=null)
+ ctx = ctx.eContainer();
+ if (ctx instanceof ActorContainerClass)
+ return (ActorContainerClass) ctx;
+
+ return null;
+ }
+
+ /**
+ * first container of type {@link ProtocolClass}
+ * @param obj
+ * @return ActorClass container
+ */
+ private ProtocolClass getProtocolClass(EObject obj) {
+ EObject ctx = obj.eContainer();
+ while (!(ctx instanceof ProtocolClass) && ctx.eContainer()!=null)
+ ctx = ctx.eContainer();
+ if (ctx instanceof ProtocolClass)
+ return (ProtocolClass) ctx;
+
+ return null;
+ }
+
+ /**
+ * check whether port is referenced by external port
+ * @param p - port to be checked
+ * @param ports - list of external ports
+ * @return true if contained
+ */
+ private boolean isContained(Port p, EList<ExternalPort> ports) {
+ for (ExternalPort port : ports) {
+ if (port.getIfport()==p)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * recursively collect all {@link BaseState}s of an actor class in a list
+ * @param ac
+ * @param states
+ */
+ private void collectAllStates(ActorClass ac,
+ LinkedList<BaseState> states) {
+ while (ac!=null) {
+ collectStates(ac.getStateMachine(), states);
+ ac = ac.getBase();
+ }
+ }
+
+ private void collectStates(StateGraph sg,
+ LinkedList<BaseState> states) {
+
+ if (sg==null)
+ return;
+
+ for (State s : sg.getStates()) {
+ if (s instanceof BaseState)
+ states.add((BaseState) s);
+ }
+ for (State s : sg.getStates()) {
+ collectStates(s.getSubgraph(), states);
+ }
+ }
+
+ /**
+ * compute the path of a {@link BaseState}
+ * @param bs
+ * @return the path
+ */
+ private String getStatePath(BaseState bs) {
+ EObject parent = bs.eContainer().eContainer();
+ if (parent instanceof BaseState)
+ return getStatePath((BaseState) parent)+STATE_PATH_DELIMITER+bs.getName();
+ else if (parent instanceof RefinedState) {
+ BaseState base = ((RefinedState) parent).getBase();
+ if (base!=null)
+ return getStatePath(base)+STATE_PATH_DELIMITER+bs.getName();
+ }
+ return bs.getName();
+ }
+
+ /**
+ * return a list of base classes of an {@link ActorClass}, parent classes first.
+ * The list includes the class itself
+ * @param ac
+ * @return
+ */
+ private LinkedList<ActorClass> getBaseClasses(ActorClass ac) {
+ LinkedList<ActorClass> classes = new LinkedList<ActorClass>();
+ if (ac!=null) {
+ classes.addFirst(ac);
+ while (ac.getBase()!=null) {
+ ac = ac.getBase();
+ classes.addFirst(ac);
+ }
+ }
+ return classes;
+ }
+
+ /**
+ * return a list of base classes of an {@link ProtocolClass}, parent classes first.
+ * The list includes the class itself
+ * @param pc
+ * @return
+ */
+ private LinkedList<ProtocolClass> getBaseClasses(ProtocolClass pc) {
+ LinkedList<ProtocolClass> classes = new LinkedList<ProtocolClass>();
+ classes.addFirst(pc);
+ while (pc.getBase()!=null) {
+ pc = pc.getBase();
+ classes.addFirst(pc);
+ }
+ return classes;
+ }
+
+ /**
+ * return the {@link BaseState} of a {@link State}
+ * @param s
+ * @return the state itself if a BaseState or the BaseState for a {@link RefinedState}
+ */
+ private BaseState getBaseState(State s) {
+ if (s instanceof BaseState)
+ return (BaseState) s;
+ else if (s instanceof RefinedState)
+ return ((RefinedState) s).getBase();
+ else
+ return null;
+ }
+
+ private IScope getStateScopes(EObject obj) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ // first state in container hierarchy
+ StateGraph parent = getStateGraph(obj);
+
+ // collect states of my parent
+ if (parent!=null) {
+ for (State s : parent.getStates()) {
+ BaseState bs = getBaseState(s);
+ scopes.add(EObjectDescription.create(bs.getName(), bs));
+ }
+
+ // if my parent is a refined state we also add its base state contents
+ if (parent.eContainer() instanceof RefinedState) {
+ parent = ((RefinedState) parent.eContainer()).getBase().getSubgraph();
+ if (parent!=null)
+ for (State s : parent.getStates()) {
+ BaseState bs = getBaseState(s);
+ scopes.add(EObjectDescription.create(bs.getName(), bs));
+ }
+ }
+ else if (parent.eContainer() instanceof ActorClass) {
+ ActorClass ac = (ActorClass) parent.eContainer();
+ if (ac.getBase()!=null) {
+ for (State s : ac.getBase().getStateMachine().getStates()) {
+ BaseState bs = getBaseState(s);
+ scopes.add(EObjectDescription.create(bs.getName(), bs));
+ }
+ }
+ }
+ }
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of State scopes for a {@link StateTerminal}
+ * @param st - the transition endpoint or terminal
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_StateTerminal_state(StateTerminal st, EReference ref) {
+ return getStateScopes(st);
+ }
+
+ /**
+ * returns a flat list of TransitionPoint scopes for a {@link TrPointTerminal}
+ * @param ep - the transition endpoint or terminal
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_TrPointTerminal_trPoint(TrPointTerminal ep, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ StateGraph parent = getStateGraph(ep);
+ StateGraph targetStateGraph = parent;
+
+ getTrPointScopes(scopes, targetStateGraph);
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of TransitionPoint scopes for a {@link SubStateTrPointTerminal}
+ * @param ep - the transition endpoint or terminal
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_SubStateTrPointTerminal_trPoint(SubStateTrPointTerminal ep, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ StateGraph parent = getStateGraph(ep);
+ StateGraph targetStateGraph = parent;
+ if (ep.getState()!=null) {
+ targetStateGraph = ep.getState().getSubgraph(); // always a BaseState
+
+ // if one of our siblings is a RefinedState of our target we take that as target
+ for (State sibling : parent.getStates()) {
+ if (sibling instanceof RefinedState) {
+ if (((RefinedState)sibling).getBase()==ep.getState())
+ targetStateGraph = sibling.getSubgraph();
+ }
+ }
+ }
+
+ getTrPointScopes(scopes, targetStateGraph);
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ private void getTrPointScopes(final List<IEObjectDescription> scopes,
+ StateGraph sg) {
+
+ // collect transition points of this state
+ for (TrPoint tp : sg.getTrPoints()) {
+ scopes.add(EObjectDescription.create(tp.getName(), tp));
+ }
+
+ // if this state is a refined state we also add its base state transition points
+ if (sg.eContainer() instanceof RefinedState) {
+ sg = ((RefinedState) sg.eContainer()).getBase().getSubgraph();
+ if (sg!=null)
+ for (TrPoint tp : sg.getTrPoints()) {
+ scopes.add(EObjectDescription.create(tp.getName(), tp));
+ }
+ }
+ }
+
+ /**
+ * returns a flat list of State scopes for a {@link SubStateTrPointTerminal}
+ * @param st - the transition endpoint or terminal
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_SubStateTrPointTerminal_state(SubStateTrPointTerminal st, EReference ref) {
+ return getStateScopes(st);
+ }
+
+ /**
+ * returns a flat list of Choicepoint scopes for a {@link SubStateTrPointTerminal}
+ * @param ct - the transition endpoint or terminal
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_ChoicepointTerminal_cp(ChoicepointTerminal ct, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ // first state in container hierarchy
+ StateGraph parent = getStateGraph(ct);
+
+ // collect choicepoints of my parent
+ if (parent!=null)
+ for (ChoicePoint cp : parent.getChPoints()) {
+ scopes.add(EObjectDescription.create(cp.getName(), cp));
+ }
+
+ // if my parent is a refined state we also add its base state contents
+ if (parent.eContainer() instanceof RefinedState) {
+ parent = ((RefinedState) parent.eContainer()).getBase().getSubgraph();
+ if (parent!=null)
+ for (ChoicePoint cp : parent.getChPoints()) {
+ scopes.add(EObjectDescription.create(cp.getName(), cp));
+ }
+ }
+ else if (parent.eContainer() instanceof ActorClass) {
+ ActorClass ac = (ActorClass) parent.eContainer();
+ if (ac.getBase()!=null) {
+ for (ChoicePoint cp : ac.getBase().getStateMachine().getChPoints()) {
+ scopes.add(EObjectDescription.create(cp.getName(), cp));
+ }
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of Message scopes for a {@link MessageFromIf}
+ * @param mfi - the message from interface
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_MessageFromIf_message(MessageFromIf mfi, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ InterfaceItem item = mfi.getFrom();
+ if (item!=null) {
+ ProtocolClass protocol = item.getProtocol();
+ boolean conjugated = false;
+ if (item instanceof Port)
+ conjugated = ((Port)item).isConjugated();
+ else if (item instanceof SAPRef)
+ conjugated = true;
+ for (Message msg : conjugated?protocol.getOutgoingMessages():protocol.getIncomingMessages()) {
+ scopes.add(EObjectDescription.create(msg.getName(), msg));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of Port scopes for a {@link MessageFromIf}
+ * @param mfi - the message from interface
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_MessageFromIf_port(MessageFromIf mfi, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorClass ac = getActorClass(mfi);
+ for (Port p : ac.getIntPorts()) {
+ scopes.add(EObjectDescription.create(p.getName(), p));
+ }
+ for (ExternalPort p : ac.getExtPorts()) {
+ scopes.add(EObjectDescription.create(p.getIfport().getName(), p.getIfport()));
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of InterfaceItem scopes for a {@link MessageFromIf}
+ * @param mfi - the message from interface
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_MessageFromIf_from(MessageFromIf mfi, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorClass ac = getActorClass(mfi);
+ LinkedList<ActorClass> classes = getBaseClasses(ac);
+ LinkedList<InterfaceItem> items = new LinkedList<InterfaceItem>();
+
+ // for all base classes
+ for (ActorClass a : classes) {
+ // add internal ports
+ items.addAll(a.getIntPorts());
+
+ // add service implementations and saps
+ for (ServiceImplementation ispp : a.getServiceImplementations()) {
+ items.add(ispp.getSpp());
+ }
+ items.addAll(a.getStrSAPs());
+
+ // add external end ports
+ for (ExternalPort p : a.getExtPorts()) {
+ items.add(p.getIfport());
+ }
+ }
+
+ for (InterfaceItem item : items) {
+ scopes.add(EObjectDescription.create(item.getName(), item));
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of ActorRef scopes for a {@link BindingEndPoint}
+ * @param ep - the endpoint
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_BindingEndPoint_actorRef(BindingEndPoint ep, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorContainerClass sc = getActorContainerClass(ep);
+ if (sc instanceof ActorClass) {
+ LinkedList<ActorClass> classes = getBaseClasses((ActorClass)sc);
+ for (ActorClass a : classes) {
+ for (ActorRef ar : a.getActorRefs()) {
+ scopes.add(EObjectDescription.create(ar.getName(), ar));
+ }
+ }
+ }
+ else {
+ for (ActorRef ar : sc.getActorRefs()) {
+ scopes.add(EObjectDescription.create(ar.getName(), ar));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of Port scopes for a {@link BindingEndPoint}
+ * @param ep - the endpoint
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_BindingEndPoint_port(BindingEndPoint ep, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorContainerClass acc = getActorContainerClass(ep);
+
+ if (ep.getActorRef() == null){
+ if (acc instanceof ActorClass) {
+ ActorClass ac = (ActorClass) acc;
+ // for all super classes (including this class)
+ LinkedList<ActorClass> classes = getBaseClasses(ac);
+ for (ActorClass a : classes) {
+ // collect internal and relay ports, i.e.
+ // structure ports not in interface (internal)
+ for (Port p : a.getIntPorts()) {
+ scopes.add(EObjectDescription.create(p.getName(), p));
+ }
+ // interface ports not in structure (relay)
+ for (Port p : a.getIfPorts()) {
+ if (!isContained(p, a.getExtPorts()))
+ scopes.add(EObjectDescription.create(p.getName(), p));
+ }
+ }
+ }
+ else {
+ // SubSystemClass has no internal end ports
+ }
+ }
+ else {
+ // all ports in the sub actor's interface
+ if (ep.getActorRef() instanceof ActorRef) {
+ ActorClass ac = ((ActorRef)ep.getActorRef()).getType();
+ LinkedList<ActorClass> classes = getBaseClasses(ac);
+ for (ActorClass a : classes) {
+ for (Port p : a.getIfPorts()) {
+ scopes.add(EObjectDescription.create(p.getName(), p));
+ }
+ }
+ }
+ else {
+ SubSystemClass ssc = ((SubSystemRef)ep.getActorRef()).getType();
+ for (Port p : ssc.getRelayPorts()) {
+ scopes.add(EObjectDescription.create(p.getName(), p));
+ }
+ }
+ }
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of BaseState scopes for a {@link RefinedState}
+ * @param rs - the refined state
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_RefinedState_base(RefinedState rs, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorClass ac = getActorClass(rs);
+ LinkedList<BaseState> states = new LinkedList<BaseState>();
+ collectAllStates(ac.getBase(), states);
+ for (BaseState bs : states) {
+ scopes.add(EObjectDescription.create(getStatePath(bs), bs));
+ }
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of Message scopes for a {@link SemanticsInRule}
+ * @param sr - the semantics rule for incoming messages
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_SemanticsInRule_msg(SemanticsInRule sr, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ProtocolClass pc = getProtocolClass(sr);
+ LinkedList<ProtocolClass> classes = getBaseClasses(pc);
+ for (ProtocolClass bpc : classes) {
+ for (Message m : bpc.getIncomingMessages()) {
+ scopes.add(EObjectDescription.create(m.getName(), m));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of Message scopes for a {@link SemanticsInRule}
+ * @param sr - the semantics rule for incoming messages
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_SemanticsOutRule_msg(SemanticsOutRule sr, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ProtocolClass pc = getProtocolClass(sr);
+ LinkedList<ProtocolClass> classes = getBaseClasses(pc);
+ for (ProtocolClass bpc : classes) {
+ for (Message m : bpc.getOutgoingMessages()) {
+ scopes.add(EObjectDescription.create(m.getName(), m));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of ActorRef scopes for a {@link SubActorSAPoint}
+ * @param pt
+ * @param ref
+ * @return a list of scopes
+ */
+ public IScope scope_RefSAPoint_ref(RefSAPoint pt, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorContainerClass acc = getActorContainerClass(pt);
+ if (acc instanceof ActorClass) {
+ LinkedList<ActorClass> classes = getBaseClasses((ActorClass) acc);
+ for (ActorClass a : classes) {
+ for (ActorRef ar : a.getActorRefs()) {
+ scopes.add(EObjectDescription.create(ar.getName(), ar));
+ }
+ }
+ }
+ else {
+ for (ActorRef ar : acc.getActorRefs()) {
+ scopes.add(EObjectDescription.create(ar.getName(), ar));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of SPPRef scopes for a {@link RelaySAPoint}
+ * @param pt
+ * @param ref
+ * @return a list of scopes
+ */
+ public IScope scope_RelaySAPoint_relay(RelaySAPoint pt, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorClass ac = getActorClass(pt);
+ LinkedList<ActorClass> classes = getBaseClasses(ac);
+ for (ActorClass a : classes) {
+ for (SPPRef spp : a.getIfSPPs()) {
+ scopes.add(EObjectDescription.create(spp.getName(), spp));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of ActorRef scopes for a {@link SPPoint}
+ * @param pt
+ * @param ref
+ * @return a list of scopes
+ */
+ public IScope scope_SPPoint_actorRef(SPPoint pt, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorContainerClass acc = getActorContainerClass(pt);
+ if (acc instanceof ActorClass) {
+ LinkedList<ActorClass> classes = getBaseClasses((ActorClass)acc);
+ for (ActorClass a : classes) {
+ for (ActorRef ar : a.getActorRefs()) {
+ scopes.add(EObjectDescription.create(ar.getName(), ar));
+ }
+ }
+ }
+ else {
+ for (ActorRef ar : acc.getActorRefs()) {
+ scopes.add(EObjectDescription.create(ar.getName(), ar));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /**
+ * returns a flat list of SPPRef scopes for a {@link SPPoint}
+ * @param pt
+ * @param ref
+ * @return a list of scopes
+ */
+ public IScope scope_SPPoint_service(SPPoint pt, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ if (pt.getRef()!=null) {
+ if (pt.getRef() instanceof ActorRef) {
+ ActorClass ac = ((ActorRef)pt.getRef()).getType();
+ LinkedList<ActorClass> classes = getBaseClasses(ac);
+ for (ActorClass a : classes) {
+ for (SPPRef spp : a.getIfSPPs()) {
+ scopes.add(EObjectDescription.create(spp.getName(), spp));
+ }
+ }
+ }
+ else if (pt.getRef() instanceof SubSystemRef) {
+ SubSystemClass ssc = ((SubSystemRef)pt.getRef()).getType();
+ for (SPPRef spp : ssc.getIfSPPs()) {
+ scopes.add(EObjectDescription.create(spp.getName(), spp));
+ }
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ public IScope scope_MessageHandler_msg(MessageHandler handler, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ProtocolClass pc = getProtocolClass(handler);
+ if (pc!=null) {
+ for (Message m : pc.getIncomingMessages()) {
+ scopes.add(EObjectDescription.create(m.getName(), m));
+ }
+ for (Message m : pc.getOutgoingMessages()) {
+ scopes.add(EObjectDescription.create(m.getName(), m));
+ }
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ /*
+ * we prefer loose scoping here and rely on validation for meaningful error messages
+ *
+ * returns a flat list of ActorClass scopes for a {@link ActorRef}
+ * @param ar - the actor reference
+ * @param ref - not used
+ * @return a list of scopes
+ */
+// public IScope scope_ActorRef_type(ActorRef ar, EReference ref) {
+// ActorClass ac = getActorClass(ar);
+// IScope scope = delegateGetScope(ar, ref);
+// return new FilteringScope(scope, new ActorRefFilter(ac));
+// }
+
+ /**
+ * returns a flat list of Port scopes for a {@link ExternalPort}
+ * @param ar - the external port
+ * @param ref - not used
+ * @return a list of scopes
+ */
+ public IScope scope_ExternalPort_ifport(ExternalPort ep, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorClass ac = getActorClass(ep);
+ for (Port ip : ac.getIfPorts()) {
+ scopes.add(EObjectDescription.create(ip.getName(), ip));
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+ /**
+ * returns a flat list of Port scopes for a {@link ExternalPort}
+ * @param ar - the external port
+ * @param ref - not used
+ * @return a list of scopes
+ */
+// public IScope scope_ActorInstance_segments(ActorInstance ai, EReference ref) {
+// final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+//
+// if (ai.getSegments().isEmpty()) {
+// // context is my ActorContainerClass
+// ActorContainerClass acc = getActorContainerClass(ai);
+// for (ActorRef ar : acc.getActorRefs()) {
+// scopes.add(EObjectDescription.create(ar.getName(), ar));
+// }
+// }
+// else {
+// // context is actor class of last segment
+// ActorClass ac = ai.getSegments().get(ai.getSegments().size()-1).getType();
+// for (ActorRef ar : ac.getActorRefs()) {
+// scopes.add(EObjectDescription.create(ar.getName(), ar));
+// }
+// }
+//
+// return new SimpleScope(IScope.NULLSCOPE, scopes);
+// }
+
+ /*
+ public IScope scope_ChoicePointCaseRef_case(ChoicePointCaseRef cr, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ if (cr.getCp()!=null) {
+ for (ChoicePointCase cas : cr.getCp().getCases()) {
+ scopes.add(EObjectDescription.create(cas.getName(), cas));
+ }
+ }
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }*/
+}
diff --git a/plugins/org.eclipse.etrice.generator.java/.gitignore b/plugins/org.eclipse.etrice.generator.java/.gitignore index ba077a403..092357e47 100644 --- a/plugins/org.eclipse.etrice.generator.java/.gitignore +++ b/plugins/org.eclipse.etrice.generator.java/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF index 2f18570af..a3bf59bf7 100644 --- a/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF @@ -1,21 +1,21 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: eTrice Java Generator -Bundle-Vendor: eTrice (Incubation) -Bundle-Version: 0.1.0 -Bundle-SymbolicName: org.eclipse.etrice.generator.java; singleton:=true -Bundle-ActivationPolicy: lazy -Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.1.0";visibility:=reexport, - org.eclipse.etrice.generator;bundle-version="0.1.0", - org.eclipse.xpand;bundle-version="1.0.1";visibility:=reexport, - org.eclipse.xtend;bundle-version="1.0.1";visibility:=reexport, - org.eclipse.xtext;bundle-version="1.0.1";visibility:=reexport, - org.eclipse.emf.mwe2.launch;bundle-version="1.0.1";resolution:=optional, - org.eclipse.emf.mwe.utils;bundle-version="1.0.0";visibility:=reexport, - org.eclipse.xtend.typesystem.emf;bundle-version="1.0.1";visibility:=reexport, - org.eclipse.xtend.util.stdlib;bundle-version="1.0.1", - org.eclipse.jdt.core;bundle-version="3.6.0", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0" -Import-Package: org.apache.log4j -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eTrice Java Generator
+Bundle-Vendor: eTrice (Incubation)
+Bundle-Version: 0.1.0
+Bundle-SymbolicName: org.eclipse.etrice.generator.java; singleton:=true
+Bundle-ActivationPolicy: lazy
+Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.1.0";visibility:=reexport,
+ org.eclipse.etrice.generator;bundle-version="0.1.0",
+ org.eclipse.xpand;bundle-version="1.0.1";visibility:=reexport,
+ org.eclipse.xtend;bundle-version="1.0.1";visibility:=reexport,
+ org.eclipse.xtext;bundle-version="1.0.1";visibility:=reexport,
+ org.eclipse.emf.mwe2.launch;bundle-version="1.0.1";resolution:=optional,
+ org.eclipse.emf.mwe.utils;bundle-version="1.0.0";visibility:=reexport,
+ org.eclipse.xtend.typesystem.emf;bundle-version="1.0.1";visibility:=reexport,
+ org.eclipse.xtend.util.stdlib;bundle-version="1.0.1",
+ org.eclipse.jdt.core;bundle-version="3.6.0",
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ org.eclipse.core.runtime;bundle-version="3.6.0"
+Import-Package: org.apache.log4j
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/org.eclipse.etrice.generator.java/build.properties b/plugins/org.eclipse.etrice.generator.java/build.properties index 81aa74d8a..f71c22ce7 100644 --- a/plugins/org.eclipse.etrice.generator.java/build.properties +++ b/plugins/org.eclipse.etrice.generator.java/build.properties @@ -1,4 +1,4 @@ -source.. = src/ -bin.includes = META-INF/,\ - . -jre.compilation.profile = JavaSE-1.6 +source.. = src/
+bin.includes = META-INF/,\
+ .
+jre.compilation.profile = JavaSE-1.6
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates/Main.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates/Main.xpt index 185e57081..a39935a27 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/templates/Main.xpt +++ b/plugins/org.eclipse.etrice.generator.java/src/templates/Main.xpt @@ -1,23 +1,23 @@ -«REM» -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ -«ENDREM» -«IMPORT room»; -«IMPORT etricegen» - -«DEFINE main FOR Root-» - «EXPAND DataClass::dataClass FOR this» - «EXPAND ProtocolClass::protocolClass FOR this» - «EXPAND ActorClass::actorClass FOR this» - «EXPAND SubSystemClass::subSystemClass FOR this» - «EXPAND SubSystemRunner::subSystemRunner FOR this» -«ENDDEFINE» +«REM»
+/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+«ENDREM»
+«IMPORT room»;
+«IMPORT etricegen»
+
+«DEFINE main FOR Root-»
+ «EXPAND DataClass::dataClass FOR this»
+ «EXPAND ProtocolClass::protocolClass FOR this»
+ «EXPAND ActorClass::actorClass FOR this»
+ «EXPAND SubSystemClass::subSystemClass FOR this»
+ «EXPAND SubSystemRunner::subSystemRunner FOR this»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/workflow/RoomGenerator.mwe2 b/plugins/org.eclipse.etrice.generator.java/src/workflow/RoomGenerator.mwe2 index 2f5957f50..d89ead5b5 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/workflow/RoomGenerator.mwe2 +++ b/plugins/org.eclipse.etrice.generator.java/src/workflow/RoomGenerator.mwe2 @@ -1,62 +1,62 @@ -/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -module workflow.RoomGenerator - -import org.eclipse.emf.mwe.utils.* - -var sourceDir = "" -var targetDir = "" -var fileEncoding = "Cp1252" - -Workflow { - - component = org.eclipse.xtext.mwe.Reader { - // lookup all resources on the classpath - // useJavaClassPath = true - - // or define search scope explicitly - path = sourceDir - useJavaClassPath=true - - // this class will be generated by the xtext generator - register = org.eclipse.etrice.core.RoomStandaloneSetup {} - load = { - slot = "model" - - // HOWTO: feed top level object into generator - // Sven Efftinge in news://news.eclipse.org:119/hlh0ju$if8$1@build.eclipse.org: - // "The new reader is based on EObjectDescriptions, which are by default only available and created for elements, which have a name." - // ==> Therefore we introduced a name for the model in Room.xtext - type = "RoomModel" - } - } - - // HOWTO: call a custom workflow component - component = org.eclipse.etrice.generator.workflow.InstanceModelCreator { - inSlot = "model" - outSlot = "instance_model" - debug = true // debug flag for verbose output - save = true // save intermediate model for debugging purposes - uri = "src-gen/tmp.rim" // name of intermediate model file - } - - component = org.eclipse.xpand2.Generator { - metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {} - expand = "templates::Main::main FOREACH instance_model" - outlet = { - path = targetDir - postprocessor = org.eclipse.xpand2.output.JavaBeautifier {} - } - fileEncoding = fileEncoding - } -} +/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+module workflow.RoomGenerator
+
+import org.eclipse.emf.mwe.utils.*
+
+var sourceDir = ""
+var targetDir = ""
+var fileEncoding = "Cp1252"
+
+Workflow {
+
+ component = org.eclipse.xtext.mwe.Reader {
+ // lookup all resources on the classpath
+ // useJavaClassPath = true
+
+ // or define search scope explicitly
+ path = sourceDir
+ useJavaClassPath=true
+
+ // this class will be generated by the xtext generator
+ register = org.eclipse.etrice.core.RoomStandaloneSetup {}
+ load = {
+ slot = "model"
+
+ // HOWTO: feed top level object into generator
+ // Sven Efftinge in news://news.eclipse.org:119/hlh0ju$if8$1@build.eclipse.org:
+ // "The new reader is based on EObjectDescriptions, which are by default only available and created for elements, which have a name."
+ // ==> Therefore we introduced a name for the model in Room.xtext
+ type = "RoomModel"
+ }
+ }
+
+ // HOWTO: call a custom workflow component
+ component = org.eclipse.etrice.generator.workflow.InstanceModelCreator {
+ inSlot = "model"
+ outSlot = "instance_model"
+ debug = true // debug flag for verbose output
+ save = true // save intermediate model for debugging purposes
+ uri = "src-gen/tmp.rim" // name of intermediate model file
+ }
+
+ component = org.eclipse.xpand2.Generator {
+ metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {}
+ expand = "templates::Main::main FOREACH instance_model"
+ outlet = {
+ path = targetDir
+ postprocessor = org.eclipse.xpand2.output.JavaBeautifier {}
+ }
+ fileEncoding = fileEncoding
+ }
+}
diff --git a/plugins/org.eclipse.etrice.generator/.gitignore b/plugins/org.eclipse.etrice.generator/.gitignore index ba077a403..092357e47 100644 --- a/plugins/org.eclipse.etrice.generator/.gitignore +++ b/plugins/org.eclipse.etrice.generator/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/plugins/org.eclipse.etrice.ui.behavior/.classpath b/plugins/org.eclipse.etrice.ui.behavior/.classpath index ad32c83a7..8a8f1668c 100644 --- a/plugins/org.eclipse.etrice.ui.behavior/.classpath +++ b/plugins/org.eclipse.etrice.ui.behavior/.classpath @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.etrice.ui.behavior/.project b/plugins/org.eclipse.etrice.ui.behavior/.project index de09fb560..ee8bca729 100644 --- a/plugins/org.eclipse.etrice.ui.behavior/.project +++ b/plugins/org.eclipse.etrice.ui.behavior/.project @@ -1,28 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.etrice.ui.behavior</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.ui.behavior</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.etrice.ui.common/.classpath b/plugins/org.eclipse.etrice.ui.common/.classpath index ad32c83a7..8a8f1668c 100644 --- a/plugins/org.eclipse.etrice.ui.common/.classpath +++ b/plugins/org.eclipse.etrice.ui.common/.classpath @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.etrice.ui.common/.project b/plugins/org.eclipse.etrice.ui.common/.project index a0274dc33..63e3c3a0b 100644 --- a/plugins/org.eclipse.etrice.ui.common/.project +++ b/plugins/org.eclipse.etrice.ui.common/.project @@ -1,28 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.etrice.ui.common</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.ui.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.etrice.ui.structure/.gitignore b/plugins/org.eclipse.etrice.ui.structure/.gitignore index ba077a403..092357e47 100644 --- a/plugins/org.eclipse.etrice.ui.structure/.gitignore +++ b/plugins/org.eclipse.etrice.ui.structure/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramAccess.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramAccess.java index e44e30b56..cc710c56a 100644 --- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramAccess.java +++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramAccess.java @@ -68,6 +68,7 @@ public class DiagramAccess { exists = diagramFile.exists();
}
else {
+ uri = uri.trimSegments(1);
File diagramFile = new File(uri.toFileString());
diagramFile = new File(diagramFile.getParent()
+File.separator+DIAGRAMS_FOLDER_NAME
diff --git a/runtime/org.eclipse.etrice.runtime.java/.gitignore b/runtime/org.eclipse.etrice.runtime.java/.gitignore index ba077a403..092357e47 100644 --- a/runtime/org.eclipse.etrice.runtime.java/.gitignore +++ b/runtime/org.eclipse.etrice.runtime.java/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/team/code_style.epf b/team/code_style.epf index 2e6dfebe5..7840ae48c 100644 --- a/team/code_style.epf +++ b/team/code_style.epf @@ -1,24 +1,24 @@ -#Fri Jan 28 07:47:05 CET 2011 -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.overrideannotation=true -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.formatterprofiles.version=11 -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.fieldSuffixes= -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2010 protos software gmbh (http\://www.protos.de).\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * CONTRIBUTORS\:\r\n * \t\tThomas Schuetz and Henrik Rentz-Reichert (initial contribution)\r\n * \r\n *******************************************************************************/\r\n</template></templates> -\!/= -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.ignorelowercasenames=true -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.localSuffixes= -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.fieldPrefixes= -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.localPrefixes= -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.argumentSuffixes= -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.argumentPrefixes= -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.ondemandthreshold=99 -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.gettersetter.use.is=true -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.exception.name=e -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.importorder=java;javax;org;com; -@org.eclipse.jdt.ui=3.6.0.v20100602-1600 -/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -file_export_version=3.0 -@org.eclipse.jdt.core=3.6.0.v_A58 -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.staticondemandthreshold=99 +#Fri Jan 28 07:47:05 CET 2011
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.overrideannotation=true
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.formatterprofiles.version=11
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2010 protos software gmbh (http\://www.protos.de).\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * CONTRIBUTORS\:\r\n * \t\tThomas Schuetz and Henrik Rentz-Reichert (initial contribution)\r\n * \r\n *******************************************************************************/\r\n</template></templates>
+\!/=
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.ignorelowercasenames=true
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.localSuffixes=
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.localPrefixes=
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.ondemandthreshold=99
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.gettersetter.use.is=true
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.exception.name=e
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.importorder=java;javax;org;com;
+@org.eclipse.jdt.ui=3.6.0.v20100602-1600
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+file_export_version=3.0
+@org.eclipse.jdt.core=3.6.0.v_A58
+/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.staticondemandthreshold=99
diff --git a/team/codetemplates.xml b/team/codetemplates.xml index a05a467e8..c31da858b 100644 --- a/team/codetemplates.xml +++ b/team/codetemplates.xml @@ -1,31 +1,31 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/** - * ${tags} - * ${see_to_target} - */</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc) - * ${see_to_overridden} - */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/** - * @param ${param} the ${bare_field_name} to set - */</template><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/******************************************************************************* - * Copyright (c) 2010 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ -</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/** - * - */</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/** - * @return the ${bare_field_name} - */</template><template autoinsert="true" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/** - * @author ${user} - * - * ${tags} - */</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/** - * ${tags} - */</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/** - * ${tags} +<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
+ * ${tags}
+ * ${see_to_target}
+ */</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc)
+ * ${see_to_overridden}
+ */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
+ * @param ${param} the ${bare_field_name} to set
+ */</template><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**
+ *
+ */</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
+ * @return the ${bare_field_name}
+ */</template><template autoinsert="true" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
+ * @author ${user}
+ *
+ * ${tags}
+ */</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
+ * ${tags}
+ */</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
+ * ${tags}
*/</template></templates>
\ No newline at end of file diff --git a/team/etrice_project_website.epf b/team/etrice_project_website.epf index e02d3acfb..f3c2f8818 100644 --- a/team/etrice_project_website.epf +++ b/team/etrice_project_website.epf @@ -1,5 +1,5 @@ -#Fri Jan 28 09:39:16 CET 2011 -file_export_version=3.0 -@org.eclipse.team.cvs.core=3.3.300.I20100526-0800 -\!/= -/instance/org.eclipse.team.cvs.core/repositories/%extssh%__COMMITTER_NAME__@dev.eclipse.org%%cvsroot%org.eclipse/location=\:extssh\:__COMMITTER_NAME__@dev.eclipse.org\:/cvsroot/org.eclipse +#Fri Jan 28 09:39:16 CET 2011
+file_export_version=3.0
+@org.eclipse.team.cvs.core=3.3.300.I20100526-0800
+\!/=
+/instance/org.eclipse.team.cvs.core/repositories/%extssh%__COMMITTER_NAME__@dev.eclipse.org%%cvsroot%org.eclipse/location=\:extssh\:__COMMITTER_NAME__@dev.eclipse.org\:/cvsroot/org.eclipse
diff --git a/tests/org.eclipse.etrice.generator.tests/.gitignore b/tests/org.eclipse.etrice.generator.tests/.gitignore index ba077a403..092357e47 100644 --- a/tests/org.eclipse.etrice.generator.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.tests/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/tests/org.eclipse.etrice.generator.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.generator.tests/META-INF/MANIFEST.MF index 55ee4f0cf..89d867dd8 100644 --- a/tests/org.eclipse.etrice.generator.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.etrice.generator.tests/META-INF/MANIFEST.MF @@ -1,15 +1,15 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: eTrice Generator Model Tests -Bundle-SymbolicName: org.eclipse.etrice.generator.tests -Bundle-Version: 0.1.0 -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-Vendor: eTrice (Incubation) -Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.1.0", - org.eclipse.etrice.generator;bundle-version="0.1.0", - org.junit;bundle-version="4.8.1", - org.eclipse.osgi;bundle-version="3.6.0", - org.eclipse.xtext;bundle-version="1.0.0", - org.eclipse.core.runtime;bundle-version="3.6.0" -Bundle-Activator: org.eclipse.etrice.generator.InstanceTestsActivator -Bundle-ActivationPolicy: lazy +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eTrice Generator Model Tests
+Bundle-SymbolicName: org.eclipse.etrice.generator.tests
+Bundle-Version: 0.1.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: eTrice (Incubation)
+Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.1.0",
+ org.eclipse.etrice.generator;bundle-version="0.1.0",
+ org.junit;bundle-version="4.8.1",
+ org.eclipse.osgi;bundle-version="3.6.0",
+ org.eclipse.xtext;bundle-version="1.0.0",
+ org.eclipse.core.runtime;bundle-version="3.6.0"
+Bundle-Activator: org.eclipse.etrice.generator.InstanceTestsActivator
+Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.runtime.java.tests/.gitignore b/tests/org.eclipse.etrice.runtime.java.tests/.gitignore index ba077a403..092357e47 100644 --- a/tests/org.eclipse.etrice.runtime.java.tests/.gitignore +++ b/tests/org.eclipse.etrice.runtime.java.tests/.gitignore @@ -1 +1 @@ -bin +bin
diff --git a/tests/org.eclipse.etrice.ui.structure.tests/.classpath b/tests/org.eclipse.etrice.ui.structure.tests/.classpath index ad32c83a7..8a8f1668c 100644 --- a/tests/org.eclipse.etrice.ui.structure.tests/.classpath +++ b/tests/org.eclipse.etrice.ui.structure.tests/.classpath @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.etrice.ui.structure.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.etrice.ui.structure.tests/.settings/org.eclipse.jdt.core.prefs index b5619aabb..7f8e6f7b4 100644 --- a/tests/org.eclipse.etrice.ui.structure.tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.etrice.ui.structure.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ -#Fri Jan 28 15:16:58 CET 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 +#Fri Jan 28 15:16:58 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/tests/org.eclipse.etrice.ui.structure.tests/build.properties b/tests/org.eclipse.etrice.ui.structure.tests/build.properties index 34d2e4d2d..41eb6ade2 100644 --- a/tests/org.eclipse.etrice.ui.structure.tests/build.properties +++ b/tests/org.eclipse.etrice.ui.structure.tests/build.properties @@ -1,4 +1,4 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/org.eclipse.etrice.ui.structure.tests/src/org/eclipse/etrice/ui/structure/StructureTestActivator.java b/tests/org.eclipse.etrice.ui.structure.tests/src/org/eclipse/etrice/ui/structure/StructureTestActivator.java index 3eb3852eb..a9f5b1037 100644 --- a/tests/org.eclipse.etrice.ui.structure.tests/src/org/eclipse/etrice/ui/structure/StructureTestActivator.java +++ b/tests/org.eclipse.etrice.ui.structure.tests/src/org/eclipse/etrice/ui/structure/StructureTestActivator.java @@ -1,22 +1,22 @@ -package org.eclipse.etrice.ui.structure; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class StructureTestActivator extends Plugin implements BundleActivator { - - private static StructureTestActivator instance = null; - - public static StructureTestActivator getInstance() { - return instance; - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - - instance = this; - } - -} +package org.eclipse.etrice.ui.structure;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class StructureTestActivator extends Plugin implements BundleActivator {
+
+ private static StructureTestActivator instance = null;
+
+ public static StructureTestActivator getInstance() {
+ return instance;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ instance = this;
+ }
+
+}
|