Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 136909 - CompositeRuler could use a getDecoratorsCount() method
Summary: CompositeRuler could use a getDecoratorsCount() method
Status: RESOLVED DUPLICATE of bug 25793
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-15 10:23 EDT by David Coppit CLA
Modified: 2007-07-29 09:19 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Coppit CLA 2006-04-15 10:23:00 EDT
Editor implementors who wish to put a decorator on the right side of a composite ruler must manually count how many decorators were added by the superclass:

  protected CompositeRuler createCompositeRuler() {
    CompositeRuler ruler = super.createCompositeRuler();

    int numberOfDecorators = 0;
		
    for (Iterator it = ruler.getDecoratorIterator(); it.hasNext(); it.next())
      numberOfDecorators++;
		
    ruler.addDecorator(numberOfDecorators, createConcernRulerColumn());

    return ruler;
  }

Things would be easier if the CompositeRuler provided a getDecoratorsCount() method:

  public int getDecoratorsCount() {
    return fDecorators.size();
  }

so that the implementation could rather be:

  protected CompositeRuler createCompositeRuler() {
    CompositeRuler ruler = super.createCompositeRuler();
    ruler.addDecorator(ruler.getDecoratorsCount(), createConcernRulerColumn());

    return ruler;
  }

Note: This may be related to bug 25793.
Comment 1 Dani Megert CLA 2006-04-18 04:21:09 EDT
Fixing bug 25793 would be the right thing here to do.

*** This bug has been marked as a duplicate of 25793 ***
Comment 2 Eclipse Webmaster CLA 2007-07-29 09:19:31 EDT
Changing OS from Mac OS to Mac OS X as per bug 185991