Iniital checkin

This commit is contained in:
2017-09-12 12:48:21 +02:00
commit fd1e04fb62
270 changed files with 87560 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package com.minres.rdl.ui;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
@SuppressWarnings("all")
public class RDLEObjectDocumentationProvider implements IEObjectDocumentationProvider {
@Override
public String getDocumentation(final EObject o) {
return null;
}
}

View File

@ -0,0 +1,46 @@
package com.minres.rdl.ui;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.ComponentInstance;
import com.minres.rdl.rdl.ImmediateInstantiation;
import com.minres.rdl.rdl.NamedInstantiation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider;
@SuppressWarnings("all")
public class RDLEObjectHoverProvider extends DefaultEObjectHoverProvider {
@Override
protected String getFirstLine(final EObject o) {
boolean _matched = false;
if (o instanceof ComponentDefinition) {
_matched=true;
String _name = ((ComponentDefinition)o).getName();
String _plus = ("Component " + _name);
String _plus_1 = (_plus + " of type ");
String _literal = ((ComponentDefinition)o).getType().getLiteral();
return (_plus_1 + _literal);
}
if (!_matched) {
if (o instanceof ComponentInstance) {
_matched=true;
final EObject parent = ((ComponentInstance)o).eContainer();
if ((parent instanceof ImmediateInstantiation)) {
EObject _eContainer = ((ImmediateInstantiation)parent).eContainer();
final ComponentDefinition compDef = ((ComponentDefinition) _eContainer);
String _literal = compDef.getType().getLiteral();
String _plus = (_literal + " ");
String _name = ((ComponentInstance)o).getName();
return (_plus + _name);
} else {
if ((parent instanceof NamedInstantiation)) {
String _literal_1 = ((NamedInstantiation)parent).getComponent().getType().getLiteral();
String _plus_1 = (_literal_1 + " ");
String _name_1 = ((ComponentInstance)o).getName();
return (_plus_1 + _name_1);
}
}
}
}
return super.getFirstLine(o);
}
}

View File

@ -0,0 +1,31 @@
/**
* generated by Xtext 2.12.0
*/
package com.minres.rdl.ui;
import com.minres.rdl.ui.AbstractRDLUiModule;
import com.minres.rdl.ui.RDLEObjectDocumentationProvider;
import com.minres.rdl.ui.RDLEObjectHoverProvider;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider;
/**
* Use this class to register components to be used within the Eclipse IDE.
*/
@FinalFieldsConstructor
@SuppressWarnings("all")
public class RDLUiModule extends AbstractRDLUiModule {
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
return RDLEObjectHoverProvider.class;
}
public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProviderr() {
return RDLEObjectDocumentationProvider.class;
}
public RDLUiModule(final AbstractUIPlugin plugin) {
super(plugin);
}
}

View File

@ -0,0 +1,14 @@
/**
* generated by Xtext 2.12.0
*/
package com.minres.rdl.ui.contentassist;
import com.minres.rdl.ui.contentassist.AbstractRDLProposalProvider;
/**
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist
* on how to customize the content assistant.
*/
@SuppressWarnings("all")
public class RDLProposalProvider extends AbstractRDLProposalProvider {
}

View File

@ -0,0 +1,15 @@
/**
* generated by Xtext 2.12.0
*/
package com.minres.rdl.ui.labeling;
import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for IEObjectDescriptions and IResourceDescriptions.
*
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider
*/
@SuppressWarnings("all")
public class RDLDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
}

View File

@ -0,0 +1,415 @@
/**
* generated by Xtext 2.12.0
*/
package com.minres.rdl.ui.labeling;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import com.minres.rdl.IntegerWithRadix;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.ComponentDefinitionType;
import com.minres.rdl.rdl.ComponentInstance;
import com.minres.rdl.rdl.EnumDefinition;
import com.minres.rdl.rdl.EnumEntry;
import com.minres.rdl.rdl.EnumProperty;
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
import com.minres.rdl.rdl.ImmediateInstantiation;
import com.minres.rdl.rdl.InstancePropertyRef;
import com.minres.rdl.rdl.InstanceRef;
import com.minres.rdl.rdl.NamedInstantiation;
import com.minres.rdl.rdl.PostPropertyAssignment;
import com.minres.rdl.rdl.PropertyAssignment;
import com.minres.rdl.rdl.PropertyAssignmentRhs;
import com.minres.rdl.rdl.PropertyDefinition;
import com.minres.rdl.rdl.PropertyEnum;
import com.minres.rdl.rdl.PropertyModifier;
import com.minres.rdl.rdl.RValue;
import com.minres.rdl.rdl.RValueConstant;
import com.minres.rdl.rdl.Range;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ListExtensions;
/**
* Provides labels for EObjects.
*
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider
*/
@SuppressWarnings("all")
public class RDLLabelProvider extends DefaultEObjectLabelProvider {
@Inject
public RDLLabelProvider(final AdapterFactoryLabelProvider delegate) {
super(delegate);
}
public String text(final ComponentDefinition e) {
String _xifexpression = null;
ImmediateInstantiation _immediateInstantiation = e.getImmediateInstantiation();
boolean _tripleNotEquals = (_immediateInstantiation != null);
if (_tripleNotEquals) {
String _xifexpression_1 = null;
String _name = e.getName();
boolean _tripleNotEquals_1 = (_name != null);
if (_tripleNotEquals_1) {
String _text = this.text(e.getImmediateInstantiation());
String _plus = (_text + " (");
String _name_1 = e.getName();
String _plus_1 = (_plus + _name_1);
_xifexpression_1 = (_plus_1 + ")");
} else {
_xifexpression_1 = this.text(e.getImmediateInstantiation());
}
_xifexpression = _xifexpression_1;
} else {
String _xifexpression_2 = null;
String _name_2 = e.getName();
boolean _tripleNotEquals_2 = (_name_2 != null);
if (_tripleNotEquals_2) {
String _literal = e.getType().getLiteral();
String _plus_2 = (_literal + " ");
String _name_3 = e.getName();
_xifexpression_2 = (_plus_2 + _name_3);
} else {
String _xblockexpression = null;
{
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.NAME)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(e.getPropertyAssignments(), _function);
String _literal_1 = e.getType().getLiteral();
String _plus_3 = (_literal_1 + " ");
Object _text_1 = this.text(((ExplicitPropertyAssignment) pa).getRhs());
_xblockexpression = (_plus_3 + _text_1);
}
_xifexpression_2 = _xblockexpression;
}
_xifexpression = _xifexpression_2;
}
return _xifexpression;
}
public String text(final ExplicitPropertyAssignment e) {
String res = "";
PropertyModifier _modifier = e.getModifier();
boolean _notEquals = (!Objects.equal(_modifier, PropertyModifier.UNDEFINED));
if (_notEquals) {
String _res = res;
String _literal = e.getModifier().getLiteral();
String _plus = (_literal + " ");
res = (_res + _plus);
}
String _res_1 = res;
PropertyEnum _name = e.getName();
res = (_res_1 + _name);
PropertyAssignmentRhs _rhs = e.getRhs();
boolean _tripleNotEquals = (_rhs != null);
if (_tripleNotEquals) {
String _res_2 = res;
Object _text = this.text(e.getRhs());
String _plus_1 = (" = " + _text);
res = (_res_2 + _plus_1);
}
return res;
}
public String text(final PostPropertyAssignment e) {
String res = "";
String _res = res;
String _text = this.text(e.getInstance());
res = (_res + _text);
PropertyDefinition _property = e.getProperty();
boolean _tripleNotEquals = (_property != null);
if (_tripleNotEquals) {
String _res_1 = res;
String _name = e.getProperty().getName();
String _plus = ("->" + _name);
res = (_res_1 + _plus);
} else {
PropertyEnum _propertyEnum = e.getPropertyEnum();
boolean _notEquals = (!Objects.equal(_propertyEnum, PropertyEnum.UNSPECIFIED));
if (_notEquals) {
String _res_2 = res;
String _literal = e.getPropertyEnum().getLiteral();
String _plus_1 = ("->" + _literal);
res = (_res_2 + _plus_1);
}
}
return res;
}
public String text(final InstanceRef e) {
String _xifexpression = null;
InstanceRef _tail = e.getTail();
boolean _tripleNotEquals = (_tail != null);
if (_tripleNotEquals) {
String _name = e.getInstance().getName();
String _plus = (_name + ".");
String _text = this.text(e.getTail());
_xifexpression = (_plus + _text);
} else {
_xifexpression = e.getInstance().getName();
}
return _xifexpression;
}
public String text(final ImmediateInstantiation e) {
final Function1<ComponentInstance, String> _function = (ComponentInstance it) -> {
return this.text(it);
};
return IterableExtensions.join(ListExtensions.<ComponentInstance, String>map(e.getComponentInstances(), _function), ", ");
}
public String text(final ComponentInstance e) {
String res = e.getName();
Range _range = e.getRange();
boolean _tripleNotEquals = (_range != null);
if (_tripleNotEquals) {
String _res = res;
String _xifexpression = null;
Object _size = e.getRange().getSize();
boolean _tripleNotEquals_1 = (_size != null);
if (_tripleNotEquals_1) {
_xifexpression = e.getRange().getSize().toString();
} else {
Object _start = e.getRange().getStart();
String _plus = (_start + ":");
Object _end = e.getRange().getEnd();
_xifexpression = (_plus + _end);
}
String _plus_1 = ("[" + _xifexpression);
String _plus_2 = (_plus_1 + "]");
res = (_res + _plus_2);
}
Object _address = e.getAddress();
boolean _tripleNotEquals_2 = (_address != null);
if (_tripleNotEquals_2) {
String _res_1 = res;
Object _address_1 = e.getAddress();
String _plus_3 = (" @" + _address_1);
res = (_res_1 + _plus_3);
}
return res;
}
public Object text(final PropertyAssignmentRhs e) {
Object _xifexpression = null;
RValue _value = e.getValue();
boolean _tripleNotEquals = (_value != null);
if (_tripleNotEquals) {
_xifexpression = this.text(e.getValue());
} else {
Object _xifexpression_1 = null;
InstancePropertyRef _instPropRef = e.getInstPropRef();
boolean _tripleNotEquals_1 = (_instPropRef != null);
if (_tripleNotEquals_1) {
_xifexpression_1 = this.text(e.getInstPropRef());
} else {
Object _xifexpression_2 = null;
EnumDefinition _enumRef = e.getEnumRef();
boolean _tripleNotEquals_2 = (_enumRef != null);
if (_tripleNotEquals_2) {
_xifexpression_2 = this.text(e.getEnumRef());
}
_xifexpression_1 = _xifexpression_2;
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
public String text(final InstancePropertyRef ref) {
String _text = this.text(ref.getInstance());
String _xifexpression = null;
PropertyDefinition _property = ref.getProperty();
boolean _tripleNotEquals = (_property != null);
if (_tripleNotEquals) {
String _name = ref.getProperty().getName();
_xifexpression = ("->" + _name);
} else {
String _xifexpression_1 = null;
PropertyEnum _propertyEnum = ref.getPropertyEnum();
boolean _notEquals = (!Objects.equal(_propertyEnum, PropertyEnum.UNSPECIFIED));
if (_notEquals) {
String _literal = ref.getPropertyEnum().getLiteral();
_xifexpression_1 = ("->" + _literal);
} else {
_xifexpression_1 = "";
}
_xifexpression = _xifexpression_1;
}
return (_text + _xifexpression);
}
public String text(final RValue e) {
String _xifexpression = null;
String _str = e.getStr();
boolean _tripleNotEquals = (_str != null);
if (_tripleNotEquals) {
_xifexpression = this.elipse(e.getStr());
} else {
RValueConstant _val = e.getVal();
boolean _notEquals = (!Objects.equal(_val, RValueConstant.UNDEFINED));
if (_notEquals) {
return e.getVal().getLiteral();
} else {
Object _num = e.getNum();
boolean _tripleNotEquals_1 = (_num != null);
if (_tripleNotEquals_1) {
Object _num_1 = e.getNum();
final IntegerWithRadix num = ((IntegerWithRadix) _num_1);
return num.toString();
}
}
}
return _xifexpression;
}
public String elipse(final String string) {
final int pos = string.indexOf("\n");
if ((pos > 0)) {
String _substring = string.substring(0, (pos - 1));
return (_substring + "...");
} else {
int _length = string.length();
boolean _greaterThan = (_length > 30);
if (_greaterThan) {
String _substring_1 = string.substring(0, 30);
return (_substring_1 + "...");
} else {
return string;
}
}
}
public String text(final NamedInstantiation e) {
final Function1<ComponentInstance, String> _function = (ComponentInstance it) -> {
return this.text(it);
};
String _join = IterableExtensions.join(ListExtensions.<ComponentInstance, String>map(e.getComponentInstances(), _function), ", ");
String _plus = (_join + " (");
String _name = e.getComponent().getName();
String _plus_1 = (_plus + _name);
return (_plus_1 + ")");
}
public String text(final EnumEntry e) {
String _xifexpression = null;
Object _index = e.getIndex();
boolean _tripleNotEquals = (_index != null);
if (_tripleNotEquals) {
String _name = e.getName();
String _plus = (_name + "=");
String _string = e.getIndex().toString();
_xifexpression = (_plus + _string);
} else {
String _name_1 = e.getName();
String _plus_1 = (_name_1 + "=");
final Function1<EnumProperty, String> _function = (EnumProperty it) -> {
return this.text(it);
};
String _join = IterableExtensions.join(ListExtensions.<EnumProperty, String>map(e.getProperties(), _function), ",");
_xifexpression = (_plus_1 + _join);
}
return _xifexpression;
}
public String text(final EnumProperty e) {
String _name = e.getName();
String _plus = (_name + "=");
String _elipse = this.elipse(e.getValue());
return (_plus + _elipse);
}
public String image(final ComponentDefinition e) {
ComponentDefinitionType _type = e.getType();
if (_type != null) {
switch (_type) {
case ADDRMAP:
return "A.png";
case FIELD:
return "F.png";
case REG:
return "R.png";
case REGFILE:
return "R.png";
case SIGNAL:
return "S.png";
default:
break;
}
}
return null;
}
public String image(final PropertyAssignmentRhs e) {
String _xifexpression = null;
RValue _value = e.getValue();
boolean _tripleNotEquals = (_value != null);
if (_tripleNotEquals) {
_xifexpression = "V.png";
} else {
String _xifexpression_1 = null;
InstancePropertyRef _instPropRef = e.getInstPropRef();
boolean _tripleNotEquals_1 = (_instPropRef != null);
if (_tripleNotEquals_1) {
_xifexpression_1 = this.image(e.getInstPropRef());
} else {
String _xifexpression_2 = null;
EnumDefinition _enumRef = e.getEnumRef();
boolean _tripleNotEquals_2 = (_enumRef != null);
if (_tripleNotEquals_2) {
_xifexpression_2 = "E.png";
}
_xifexpression_1 = _xifexpression_2;
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
public String image(final InstancePropertyRef ref) {
String _xifexpression = null;
PropertyDefinition _property = ref.getProperty();
boolean _tripleNotEquals = (_property != null);
if (_tripleNotEquals) {
_xifexpression = "P.png";
} else {
String _xifexpression_1 = null;
PropertyEnum _propertyEnum = ref.getPropertyEnum();
boolean _notEquals = (!Objects.equal(_propertyEnum, PropertyEnum.UNSPECIFIED));
if (_notEquals) {
_xifexpression_1 = "E.png";
} else {
_xifexpression_1 = "I.png";
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
public String image(final EnumDefinition e) {
return "E.png";
}
public String image(final ExplicitPropertyAssignment e) {
return "P.png";
}
public String image(final PostPropertyAssignment e) {
return "P.png";
}
public String image(final NamedInstantiation e) {
return "I.png";
}
public String image(final EnumEntry v) {
return "V.png";
}
public String image(final EnumProperty e) {
return "P.png";
}
}

View File

@ -0,0 +1,97 @@
/**
* generated by Xtext 2.12.0
*/
package com.minres.rdl.ui.outline;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.EnumDefinition;
import com.minres.rdl.rdl.EnumEntry;
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
import com.minres.rdl.rdl.NamedInstantiation;
import com.minres.rdl.rdl.PostPropertyAssignment;
import com.minres.rdl.rdl.PropertyAssignment;
import com.minres.rdl.rdl.PropertyAssignmentRhs;
import com.minres.rdl.rdl.PropertyDefinition;
import com.minres.rdl.rdl.Root;
import java.util.function.Consumer;
import org.eclipse.xtext.ui.editor.outline.IOutlineNode;
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
import org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode;
/**
* Customization of the default outline structure.
*
* See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#outline
*/
@SuppressWarnings("all")
public class RDLOutlineTreeProvider extends DefaultOutlineTreeProvider {
protected void _createChildren(final DocumentRootNode parentNode, final Root domainModel) {
final Consumer<EnumDefinition> _function = (EnumDefinition it) -> {
this.createNode(parentNode, it);
};
domainModel.getEnumDefinitions().forEach(_function);
final Consumer<PropertyDefinition> _function_1 = (PropertyDefinition it) -> {
this.createNode(parentNode, it);
};
domainModel.getPropertyDefinitions().forEach(_function_1);
final Consumer<ComponentDefinition> _function_2 = (ComponentDefinition it) -> {
this.createNode(parentNode, it);
};
domainModel.getComponentDefinitions().forEach(_function_2);
final Consumer<PropertyAssignment> _function_3 = (PropertyAssignment it) -> {
this.createNode(parentNode, it);
};
domainModel.getPropertyAssignments().forEach(_function_3);
final Consumer<NamedInstantiation> _function_4 = (NamedInstantiation it) -> {
this.createNode(parentNode, it);
};
domainModel.getNamedInstantiations().forEach(_function_4);
}
protected void _createChildren(final IOutlineNode parentNode, final ComponentDefinition compDef) {
final Consumer<EnumDefinition> _function = (EnumDefinition it) -> {
this.createNode(parentNode, it);
};
compDef.getEnumDefinitions().forEach(_function);
final Consumer<ComponentDefinition> _function_1 = (ComponentDefinition it) -> {
this.createNode(parentNode, it);
};
compDef.getComponentDefinitions().forEach(_function_1);
final Consumer<PropertyAssignment> _function_2 = (PropertyAssignment it) -> {
this.createNode(parentNode, it);
};
compDef.getPropertyAssignments().forEach(_function_2);
final Consumer<NamedInstantiation> _function_3 = (NamedInstantiation it) -> {
this.createNode(parentNode, it);
};
compDef.getNamedInstantiations().forEach(_function_3);
}
protected void _createChildren(final IOutlineNode parentNode, final EnumDefinition e) {
final Consumer<EnumEntry> _function = (EnumEntry it) -> {
this.createNode(parentNode, it);
};
e.getBody().getEntries().forEach(_function);
}
protected void _createChildren(final IOutlineNode parentNode, final PostPropertyAssignment p) {
this.createNode(parentNode, p.getRhs());
}
protected boolean _isLeaf(final ExplicitPropertyAssignment feature) {
return true;
}
protected boolean _isLeaf(final NamedInstantiation feature) {
return true;
}
protected boolean _isLeaf(final PropertyAssignmentRhs feature) {
return true;
}
protected boolean _isLeaf(final EnumEntry feature) {
int _size = feature.getProperties().size();
return (_size == 0);
}
}

View File

@ -0,0 +1,15 @@
/**
* generated by Xtext 2.12.0
*/
package com.minres.rdl.ui.quickfix;
import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
/**
* Custom quickfixes.
*
* See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#quick-fixes
*/
@SuppressWarnings("all")
public class RDLQuickfixProvider extends DefaultQuickfixProvider {
}