Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » DefaultMarkerBehavior woes
DefaultMarkerBehavior woes [message #1384000] Tue, 27 May 2014 19:03 Go to next message
Hernan Gonzalez is currently offline Hernan Gonzalez
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
It took me some time to troubleshoot why my Eclipse editor removed all my problem markers on opening. Then I found that the DiagramBehaviour has a DefaultMarkerBehavior that has this code:

  void updateProblemIndication() {
     ...
     if (markerHelper.hasMarkers(resourceSet)) {
      markerHelper.deleteMarkers(resourceSet);
     }
     if (diagnostic.getSeverity() != Diagnostic.OK) {
        markerHelper.createMarkers(diagnostic);
     ...
     }
   }
  }


This looks objectionable in that:

- Isn't there a more cooperative way of adding its own problem markers, without deleting all (including perhaps problems from other participants)?
I'm not sure about the (non Graphiti) markerHelper.hasMarkers() doc: "Returns whether the a maker with id equals to the return of getMarkerID() " (and that method is private!), I'm not sure who sets that id, and if all "Problem" markers must share it or not.

- If I want to disable that behaviour (assuming I'm not interested in marking those EMF problems), I guess the way is to override MyDiagramBehaviour.createMarkerBehavior() . Sadly, that is less extensible than in looks, because it (as all DiagramBehaviour.create***Behaviour()) returns a concrete class instead of an interface, so I'm forced to extend DefaultMarkerBehavior instead of providing a dummy "no op" implementation.
I'm not a fan of Java interfaces explosion, but I think that they have a point here.

(Even worse, DefaultMarkerBehavior.updateProblemIndication() is package private!)

(Even worse 2: DefaultMarkerBehavior instantiates a private EContentAdapter problemIndicationAdapter field, and that cannot be prevented by a descendant class! the only thing I can do, I guess, is to override initialize() to not registering that adapter ; all very unclean and frafile).


Of corse, in theory I could also provide my own MyDiagramBehaviour that does not extend Graphiti's DiagramBehaviour , but that is not practical either, as DiagramBehaviour is a pretty fat class.

[Updated on: Tue, 27 May 2014 19:09]

Report message to a moderator

Re: DefaultMarkerBehavior woes [message #1384274 is a reply to message #1384000] Wed, 28 May 2014 15:24 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1621
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hernan,

please see below.

Michael

"Hernan Gonzalez" wrote in message news:lm2nh8$1td$1@xxxxxxxxe.org...

....

This looks objectionable in that:

- Isn't there a more cooperative way of adding its own problem markers,
without deleting all (including perhaps problems from other participants)?
I'm not sure about the (non Graphiti) markerHelper.hasMarkers() doc:
"Returns whether the a maker with id equals to the return of getMarkerID() "
(and that method is private!), I'm not sure who sets that id, and if all
"Problem" markers must share it or not.

Michael: yes, good point. Not sure what we can do here, but that should be
tracked. Would you file a bug for that, please?

- If I want to disable that behaviour (assuming I'm not interested in
marking those EMF problems), I guess the way is to override
MyDiagramBehaviour.createMarkerBehavior() . Sadly, that is less extensible
than in looks, because it (as all DiagramBehaviour.create***Behaviour())
returns a concrete class instead of an interface, so I'm forced to extend
DefaultMarkerBehavior instead of providing a dummy "no op" implementation.
I'm not a fan of Java interfaces explosion, but I think that they have a
point here.

Michael: Yes, should be, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=428096


....
Re: DefaultMarkerBehavior woes [message #1384730 is a reply to message #1384274] Fri, 30 May 2014 20:47 Go to previous message
Hernan Gonzalez is currently offline Hernan Gonzalez
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
Michael Wenz wrote on Wed, 28 May 2014 12:24



Michael: yes, good point. Not sure what we can do here, but that should be
tracked. Would you file a bug for that, please?



Sure, done:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=436262
Previous Topic:How to set Icon for Features (other than custom features) on the diagram context menu
Next Topic:MoveAnchorFeature - only vertically/horizontally
Goto Forum:
  


Current Time: Thu Oct 30 17:48:54 GMT 2014

Powered by FUDForum. Page generated in 0.01992 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software