Disable intentions/Blockstatement question

Q1:

I have a concept where I use BinaryOperation as a child. This has some intentions with it, but I don't want to have for instance the FlipBinaryOperation. Is there a way to disable specific intentions from a concept?

Q2:

I have several statements I want to print in a java method.

E.g.

Float setup = new Float(1)
setup.compareTo(1)

Where I LOOP over both, and COPY_SRCL all setup and COPY_SRCL all methods (compareTo) from concepts I created. To LOOP I use a BlockStatement, but if I look at the output the method looks like this

public void test(){
{
   Float setup = new Float(1)
   setup.compareTo(1)
}
}

If I look at the example in this case the calculator example, it is used quite similiar, but without the braces in the code output.

$LOOP${
  ->$inputField.getDocument().addDocumentListener(this.listener);
  add(new JLabel("$Title"));
  add(->$inputField);
}

I solved it in another way, with a Template Switch, where I have for the

"Float setup = new Float(1)" part a template fragment and also for the
"setup.compareTo(1)" part a template fragment and I then Loop over the switch. It works this way, but I would prefer the block statement method, but it doesn't work.

Thanks in advance for any help.
4 comments
Hi,

About your Q1, the easiest way I know to disable an intention is through: File->Settings->Intentions.

There you have a list of intentions per language and you can disable the ones you want.

Regards,
0
OK, I thought about the thing that is disallowed for everyone, not just only in my editor. Like with constrains, child y from parent x where child y's intention is disallowed, but only with parent x. Don't know if this is even possible..
0
Q1: I do not know of a way to disable intentions on sub-concepts, unless the original intentions provide such a capability, perhaps through a behaviour method.

Q2: BlockStatement's TextGen flattens BlockStatements, which are nested inside StatementLists and which do not contain variable declarations. (Granted, the detection could be made more sophisticated)
Your BlockStatements contain variable declarations, thus will not be flattened automatically.
0

Please sign in to leave a comment.