org.eclipse.contribution.visualiser.simpleImpl
Class SimpleMarkupProvider

java.lang.Object
  extended byorg.eclipse.contribution.visualiser.simpleImpl.SimpleMarkupProvider
All Implemented Interfaces:
IMarkupProvider
Direct Known Subclasses:
FileMarkupProvider, JDTSearchResultsMarkupProvider, MarkerMarkupProvider

public class SimpleMarkupProvider
extends java.lang.Object
implements IMarkupProvider

Example implementation of a markup provider. Loads its information about the markups from a file. Manages the list of markups in a hashtable - the hashtable maps the member ID to a list of 'Stripe instances' (markups).


Constructor Summary
SimpleMarkupProvider()
           
 
Method Summary
 void activate()
          Activate the provider
 void addMarkup(java.lang.String membername, Stripe s)
          Add a Stripe to the member with the given name.
 void addMarkupKind(IMarkupKind kind)
          Add a markup kind
 void deactivate()
          Deactivate the provider
 java.util.SortedSet getAllMarkupKinds()
          Get all the markup kinds.
 org.eclipse.swt.graphics.Color getColorFor(IMarkupKind kind)
          Get the colour for a given kind
 java.util.List getGroupMarkups(IGroup group)
          Get the markups for a group.
 java.util.List getMemberMarkups(IMember member)
          Get a List of Stripes for the given member, which are its markups.
protected  org.eclipse.swt.graphics.Color getNextColourFor(java.lang.String p)
          Get the next assignable colour and assign it to the String argument.
 void initialise()
          Initialise the markup provider.
 void processMarkups()
          Process all the Stripes that have been added to deal with the overlapping cases
 boolean processMouseclick(IMember member, Stripe stripe, int buttonClicked)
          Process a mouse click on a stripe.
 void resetColours()
          Reset the color memory
 void resetMarkupsAndKinds()
          Empty the data structures that contain the stripe and kind information
 void setColorFor(IMarkupKind kind, org.eclipse.swt.graphics.Color color)
          Set the color for a kind.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMarkupProvider

public SimpleMarkupProvider()
Method Detail

initialise

public void initialise()
Initialise the markup provider. This simple implementation does nothing here.

Specified by:
initialise in interface IMarkupProvider

getMemberMarkups

public java.util.List getMemberMarkups(IMember member)
Get a List of Stripes for the given member, which are its markups.

Specified by:
getMemberMarkups in interface IMarkupProvider

addMarkup

public void addMarkup(java.lang.String membername,
                      Stripe s)
Add a Stripe to the member with the given name.

Parameters:
membername -
s -

addMarkupKind

public void addMarkupKind(IMarkupKind kind)
Add a markup kind

Parameters:
kind -

processMarkups

public void processMarkups()
Process all the Stripes that have been added to deal with the overlapping cases


getGroupMarkups

public java.util.List getGroupMarkups(IGroup group)
Get the markups for a group. Group markups are a stacked set of member markups.

Specified by:
getGroupMarkups in interface IMarkupProvider

getAllMarkupKinds

public java.util.SortedSet getAllMarkupKinds()
Get all the markup kinds.

Specified by:
getAllMarkupKinds in interface IMarkupProvider
Returns:
a Set of IMarkupKinds

getColorFor

public org.eclipse.swt.graphics.Color getColorFor(IMarkupKind kind)
Get the colour for a given kind

Specified by:
getColorFor in interface IMarkupProvider
Parameters:
kind - - the kind
Returns:
the Color for that kind

setColorFor

public void setColorFor(IMarkupKind kind,
                        org.eclipse.swt.graphics.Color color)
Set the color for a kind.

Specified by:
setColorFor in interface IMarkupProvider
Parameters:
kind - - the kind
color - - the Color

getNextColourFor

protected org.eclipse.swt.graphics.Color getNextColourFor(java.lang.String p)
Get the next assignable colour and assign it to the String argument.

Parameters:
p - - the kind
Returns:
new Color

resetMarkupsAndKinds

public void resetMarkupsAndKinds()
Empty the data structures that contain the stripe and kind information


resetColours

public void resetColours()
Reset the color memory


processMouseclick

public boolean processMouseclick(IMember member,
                                 Stripe stripe,
                                 int buttonClicked)
Process a mouse click on a stripe. This implementation does nothing and returns true to allow the visualiser to perform the default operations.

Specified by:
processMouseclick in interface IMarkupProvider
See Also:
IMarkupProvider.processMouseclick(IMember, Stripe, int)

activate

public void activate()
Activate the provider

Specified by:
activate in interface IMarkupProvider

deactivate

public void deactivate()
Deactivate the provider

Specified by:
deactivate in interface IMarkupProvider