Commit fc5aac12 authored by Luca Cristoforetti's avatar Luca Cristoforetti
Browse files

Get icon paths using an overridable method

parent d5e2aedb
......@@ -21,17 +21,20 @@ import eu.fbk.tools.editor.contract.expression.validation.DefineProposalProvider
* on how to customize the content assistant.
*/
class ExpressionProposalProvider extends AbstractExpressionProposalProvider {
val protected INPUT_PATH = "/resources/icons/input_port.png"
val protected OUTPUT_PATH = "/resources/icons/output_port.png"
val protected INOUT_PATH = "/resources/icons/input_output_port.png"
val images = new Hashtable<PortProposalProvider.PortDirection, Image>()
override complete_PortId(EObject model, RuleCall ruleCall,
org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
if (images.empty) {
val inPortImageDescriptor = ExpressionActivator.imageDescriptorFromPlugin(
"eu.fbk.tools.editor.contract.expression.ui", "/resources/icons/input_port.png");
"eu.fbk.tools.editor.contract.expression.ui", getInputPath);
val outPortImageDescriptor = ExpressionActivator.imageDescriptorFromPlugin(
"eu.fbk.tools.editor.contract.expression.ui", "/resources/icons/output_port.png");
"eu.fbk.tools.editor.contract.expression.ui", getOutputPath);
val inoutPortImageDescriptor = ExpressionActivator.imageDescriptorFromPlugin(
"eu.fbk.tools.editor.contract.expression.ui", "/resources/icons/input_output_port.png");
"eu.fbk.tools.editor.contract.expression.ui", getInOutPath);
images.put(PortProposalProvider.PortDirection.IN, inPortImageDescriptor.createImage());
images.put(PortProposalProvider.PortDirection.OUT, outPortImageDescriptor.createImage());
......@@ -75,6 +78,18 @@ class ExpressionProposalProvider extends AbstractExpressionProposalProvider {
super.complete_PortId(model, ruleCall, context, acceptor)
}
def String getInputPath() {
return INPUT_PATH
}
def String getOutputPath() {
return OUTPUT_PATH
}
def String getInOutPath() {
return INOUT_PATH
}
override complete_ParameterId(EObject model, RuleCall ruleCall,
org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val defaultPriority = getPriorityHelper().getDefaultPriority();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment