mirror of
https://github.com/Minres/RDL-Editor.git
synced 2024-12-23 07:28:03 +01:00
Eyck Jentzsch
cc2891cb8c
* changed the grammar to ease code generation * added a code generator and a standalone setup to generate SystemC code using SC-Components lib
47 lines
1.8 KiB
Java
47 lines
1.8 KiB
Java
package com.minres.rdl.ui;
|
|
|
|
import com.minres.rdl.rdl.ComponentDefinition;
|
|
import com.minres.rdl.rdl.ComponentDefinitionType;
|
|
import com.minres.rdl.rdl.ComponentInstance;
|
|
import com.minres.rdl.rdl.Instantiation;
|
|
import org.eclipse.emf.ecore.EObject;
|
|
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider;
|
|
import org.eclipse.xtext.xbase.lib.StringExtensions;
|
|
|
|
@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 Instantiation)) {
|
|
ComponentDefinitionType _xifexpression = null;
|
|
ComponentDefinition _componentRef = ((Instantiation)parent).getComponentRef();
|
|
boolean _tripleNotEquals = (_componentRef != null);
|
|
if (_tripleNotEquals) {
|
|
_xifexpression = ((Instantiation)parent).getComponentRef().getType();
|
|
} else {
|
|
_xifexpression = ((Instantiation)parent).getComponent().getType();
|
|
}
|
|
String _firstUpper = StringExtensions.toFirstUpper(_xifexpression.getLiteral());
|
|
String _plus = (_firstUpper + " ");
|
|
String _name = ((ComponentInstance)o).getName();
|
|
return (_plus + _name);
|
|
}
|
|
}
|
|
}
|
|
return super.getFirstLine(o);
|
|
}
|
|
}
|