JbpmEmptyPropertySection is not working? [message #1009164] |
Thu, 14 February 2013 10:15  |
Eclipse User |
|
|
|
Hi.
I'm able to understand the intention behind this:
<propertyTab
id="bpmn2.jbpm.empty.tab"
replaceTab="org.eclipse.bpmn2.modeler.main.tab"
class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.property.JbpmEmptyPropertySection"
label="Empty">
</propertyTab>
Which I think it is to replace the "base" tab with
id = "org.eclipse.bpmn2.modeler.main.tab" for one which is not applicable, this means it removes the tab.
My first doubt comes with the fact I can't find a tab with this id, so nothing to be removed.
My second doubt is because I tried this mecanism to remove process definitions tab in my extension, and it doesn't remove the tab definitions.
I'll analyse the code to check what is happening, or if I'm mistaken.
Thanks in advance
Rui
|
|
|
Re: JbpmEmptyPropertySection is not working? [message #1009202 is a reply to message #1009164] |
Thu, 14 February 2013 11:43   |
Eclipse User |
|
|
|
Hi again.
Supposing JbpmEmptyPropertySection is being used to replace an existing tab,
I believe this could not work because in PropertyTabDescriptor, when replacements are being analysed the replacement only happens when methods appliesTo and doReplaceTab return true, which in the case of "JbpmEmptyPropertySection" only "doReplaceTab" returns true.
for (String id : replacements) {
for (Bpmn2SectionDescriptor s : (List<Bpmn2SectionDescriptor>) d.getSectionDescriptors()) {
if (s.appliesTo(part, selection)) { //false
// ask the section if it wants to replace this tab
if (s.doReplaceTab(id, part, selection)) {
// replace the tab whose ID is specified as "replaceTab" in this tab.
Bpmn2TabDescriptor replacedTab = TargetRuntime.findTabDescriptor(id);
if (replacedTab!=null) {
replaced.add(replacedTab);
int i = desc.indexOf(replacedTab);
if (i>=0) {
desc.set(i, d);
}
}
}
}
This causes that the base tab is not replaced in "desc" by the new "empty one".
On another hand, if it was replaced (setting doReplaceTab=true, appliesTo=true), when execution reaches at the code below, it would set empty to false, and it would be removed, because the tab contains a EmptySection
for (Bpmn2TabDescriptor d : desc) {
boolean empty = true;
for (Bpmn2SectionDescriptor s : (List<Bpmn2SectionDescriptor>) d.getSectionDescriptors()) {
if (s.appliesTo(part, selection)) {
empty = false;
}
if (s.getSectionClass() instanceof AdvancedPropertySection) {
advancedPropertyTab = d;
}
}
So there's here some game around the returns of the methods (appliesTo, doReplaceTab). On one hand if they return false it doesnt enter in the first crucial point, on other hand, if they return true the replacement run but tab is considered not empty.
Should I file a bug?
Thanks
Rui
[Updated on: Thu, 14 February 2013 11:46] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.05368 seconds