2017-09-12 12:48:21 +02:00
|
|
|
package com.minres.rdl.ui
|
|
|
|
|
|
|
|
import org.eclipse.emf.ecore.EObject
|
|
|
|
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider
|
|
|
|
import com.minres.rdl.rdl.ComponentDefinition
|
|
|
|
import com.minres.rdl.rdl.ComponentInstance
|
2017-09-19 18:08:17 +02:00
|
|
|
import com.minres.rdl.rdl.Instantiation
|
2017-09-12 12:48:21 +02:00
|
|
|
|
|
|
|
class RDLEObjectHoverProvider extends DefaultEObjectHoverProvider {
|
2017-09-19 18:08:17 +02:00
|
|
|
override protected String getFirstLine(EObject o) {
|
|
|
|
switch(o){
|
|
|
|
ComponentDefinition: return 'Component '+o.name+' of type '+o.type.literal
|
|
|
|
ComponentInstance: {
|
|
|
|
val parent = o.eContainer
|
|
|
|
if (parent instanceof Instantiation) {
|
|
|
|
return (if(parent.componentRef !== null) parent.componentRef.type else parent.component.type).literal.toFirstUpper+' '+o.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return super.getFirstLine(o)
|
|
|
|
}
|
2017-09-12 12:48:21 +02:00
|
|
|
}
|