public class DefaultToolBehaviorProvider extends java.lang.Object implements IToolBehaviorProvider
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LINE_SELECTION_WIDTH
The default selection width (the tolerance area a user can click to still
select) a lathy object (e.g.
|
Constructor and Description |
---|
DefaultToolBehaviorProvider(IDiagramTypeProvider diagramTypeProvider)
Creates a new
DefaultToolBehaviorProvider . |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Dispose.
|
boolean |
equalsBusinessObjects(java.lang.Object o1,
java.lang.Object o2)
Default Implementation.
|
java.lang.Object |
getAdapter(java.lang.Class<?> type)
Returns the adapter for the specified key.
|
GraphicsAlgorithm |
getChopboxAnchorArea(PictogramElement pe)
Provides the graphics algorithm that defines the outline for the given
pictogram element's chopbox Anchor.
|
GraphicsAlgorithm[] |
getClickArea(PictogramElement pe)
The returned graphics algorithm's define the area where the user can
click to select the shape.
|
ICustomFeature |
getCommandFeature(CustomContext context,
java.lang.String hint)
Command features can do anything, but they are tied to an external
command.
|
GraphicsAlgorithm |
getContentArea(ContainerShape cs)
The returned graphics algorithm defines the technical container for
active children.
|
IContextButtonPadData |
getContextButtonPad(IPictogramElementContext context)
Returns the context button pad data for the given pictogram element
context.
|
IContextMenuEntry[] |
getContextMenu(ICustomContext context)
Returns the context menu for the current mouse location.
|
java.lang.String |
getContributorId()
Returns the contributor ID for the tabbed property sheet page.
|
IDecorator[] |
getDecorators(PictogramElement pe)
Returns decorators which will be used at rendering time to decorate the
graphical representation of the given pictogram element.
|
DiagramScrollingBehavior |
getDiagramScrollingBehavior()
Deprecated.
Scroll bar based infinite canvas is a workaround for Bug
195527 and can be harmed by GEF modifications. It will be
removed then
|
java.lang.String |
getDirectEditingInvalidNotificationTitle(IDirectEditingFeature feature,
IDirectEditingContext context)
Returns the title of the popup that appears when a user provides an
invalid input for direct editing.
|
ICustomFeature |
getDoubleClickFeature(IDoubleClickContext context)
Returns a feature which will be executed at at double click.
|
int |
getLineSelectionWidth(Polyline polyline)
Is asked to return the selection width (the tolerance area a user can
click to still select) a lathy object (e.g.
|
ILocationInfo |
getLocationInfo(PictogramElement pe,
ILocationInfo locationInfo)
Returns the location info which will be used for direct editing if the
framework cannot decide this.
|
IPaletteCompartmentEntry[] |
getPalette()
Default implementation: creates a connection and an object compartment.
|
PictogramElement |
getSelection(PictogramElement originalPe,
PictogramElement[] oldSelection)
Override this method if you want to change the default selection on mouse
click.
|
GraphicsAlgorithm |
getSelectionBorder(PictogramElement pe)
The returned graphics algorithm defines the selection border and the
rectangle where the context buttons appear at.
|
IAnchorSelectionInfo |
getSelectionInfoForAnchor(Anchor anchor)
Return the selection info for the given anchor.
|
IConnectionSelectionInfo |
getSelectionInfoForConnection(Connection connection)
Return the selection info for the given connection.
|
IShapeSelectionInfo |
getSelectionInfoForShape(Shape shape)
Return the selection info for the given shape.
|
PictogramElement[] |
getSelections(PictogramElement selection) |
ICustomFeature |
getSingleClickFeature(ISingleClickContext context)
Returns a feature which will be executed at at a single click on an
already selected shape.
|
java.lang.String |
getTitleToolTip()
Returns a tooltip for the workbench titlebar.
|
java.lang.Object |
getToolTip(GraphicsAlgorithm ga)
Returns the tooltip to be attached to the graphical representation of the
given graphics algorithm.
|
double[] |
getZoomLevels()
Gets the zoom levels.
|
boolean |
isConnectionSelectionEnabled()
Indicates if the selection of connections is enabled.
|
boolean |
isDefaultBendPointRenderingActive() |
boolean |
isMultiSelectionEnabled()
Indicates if the selection of multiple elements is enabled.
|
boolean |
isShowFlyoutPalette()
|
boolean |
isShowGuides()
Indicates whether guides will be shown or not.
|
boolean |
isShowMarqueeTool()
|
boolean |
isShowSelectionTool()
|
boolean |
isStayActiveAfterExecution(IConnectionCreationToolEntry connectionCreationToolEntry)
Defines if the tool created for the given
IConnectionCreationToolEntry stays active after a connection has
been created or not. |
void |
postExecute(IExecutionInfo executionInfo)
Called after execution on stack.
|
void |
preExecute(IExecutionInfo executionInfo)
Called before execution on stack.
|
public static final int DEFAULT_LINE_SELECTION_WIDTH
Polyline
or Polygon
for
Shape
s and Connection
s) in the diagram. Is returned in
the default implementation of getLineSelectionWidth(Polyline)
.public DefaultToolBehaviorProvider(IDiagramTypeProvider diagramTypeProvider)
DefaultToolBehaviorProvider
.diagramTypeProvider
- the diagram type providerpublic void dispose()
IToolBehaviorProvider
dispose
in interface IToolBehaviorProvider
public java.lang.Object getAdapter(java.lang.Class<?> type)
IToolBehaviorProvider
getAdapter
in interface IToolBehaviorProvider
type
- the typepublic PictogramElement getSelection(PictogramElement originalPe, PictogramElement[] oldSelection)
IToolBehaviorProvider
getSelection
in interface IToolBehaviorProvider
originalPe
- the original pictogram elementoldSelection
- the old selectionnull
if there should not be a special selection
behavior; if there should not be a selection simply return the
diagrampublic PictogramElement[] getSelections(PictogramElement selection)
getSelections
in interface IToolBehaviorProvider
public IConnectionSelectionInfo getSelectionInfoForConnection(Connection connection)
IToolBehaviorProvider
getSelectionInfoForConnection
in interface IToolBehaviorProvider
connection
- the connectionpublic IContextButtonPadData getContextButtonPad(IPictogramElementContext context)
IToolBehaviorProvider
getContextButtonPad
in interface IToolBehaviorProvider
context
- The pictogram element context, for which to return the context
button pad data.public IContextMenuEntry[] getContextMenu(ICustomContext context)
IToolBehaviorProvider
getContextMenu
in interface IToolBehaviorProvider
context
- the custom context which contains the info about the location
where the context menu appears.public ILocationInfo getLocationInfo(PictogramElement pe, ILocationInfo locationInfo)
IToolBehaviorProvider
getLocationInfo
in interface IToolBehaviorProvider
pe
- the active and selected pictogram elementlocationInfo
- the current location info determined by the frameworkpublic ICustomFeature getDoubleClickFeature(IDoubleClickContext context)
IToolBehaviorProvider
getDoubleClickFeature
in interface IToolBehaviorProvider
context
- contains information where the double click gesture has
happenedpublic ICustomFeature getSingleClickFeature(ISingleClickContext context)
IToolBehaviorProvider
getSingleClickFeature
in interface IToolBehaviorProvider
context
- contains information where the single click gesture has
happenedpublic ICustomFeature getCommandFeature(CustomContext context, java.lang.String hint)
IToolBehaviorProvider
getCommandFeature
in interface IToolBehaviorProvider
context
- the contexthint
- the hint specified in the command bindingpublic IPaletteCompartmentEntry[] getPalette()
getPalette
in interface IToolBehaviorProvider
public IDecorator[] getDecorators(PictogramElement pe)
IToolBehaviorProvider
IImageDecorator
, IColorDecorator
and
IBorderDecorator
are supported for Shape
s; for
Connection
s only IColorDecorator
s are supported and they
can only be used to change the foreground color of the Connection
.getDecorators
in interface IToolBehaviorProvider
pe
- the pictogram elementpublic IShapeSelectionInfo getSelectionInfoForShape(Shape shape)
IToolBehaviorProvider
getSelectionInfoForShape
in interface IToolBehaviorProvider
shape
- the shapepublic IAnchorSelectionInfo getSelectionInfoForAnchor(Anchor anchor)
IToolBehaviorProvider
getSelectionInfoForAnchor
in interface IToolBehaviorProvider
anchor
- the anchorpublic double[] getZoomLevels()
IToolBehaviorProvider
getZoomLevels
in interface IToolBehaviorProvider
@Deprecated public DiagramScrollingBehavior getDiagramScrollingBehavior()
IToolBehaviorProvider
getDiagramScrollingBehavior
in interface IToolBehaviorProvider
getDiagramScrollingBehavior()
public void preExecute(IExecutionInfo executionInfo)
IToolBehaviorProvider
preExecute
in interface IToolBehaviorProvider
executionInfo
- info about content to be executedpublic void postExecute(IExecutionInfo executionInfo)
IToolBehaviorProvider
postExecute
in interface IToolBehaviorProvider
executionInfo
- info about content to be executedpublic java.lang.Object getToolTip(GraphicsAlgorithm ga)
getToolTip
in interface IToolBehaviorProvider
graphicsAlgorithm
- the graphics algorithmpublic GraphicsAlgorithm getSelectionBorder(PictogramElement pe)
IToolBehaviorProvider
getSelectionBorder
in interface IToolBehaviorProvider
pe
- the pictogram elementpublic GraphicsAlgorithm[] getClickArea(PictogramElement pe)
IToolBehaviorProvider
getClickArea
in interface IToolBehaviorProvider
pe
- the pictogram elementpublic GraphicsAlgorithm getChopboxAnchorArea(PictogramElement pe)
IToolBehaviorProvider
getChopboxAnchorArea
in interface IToolBehaviorProvider
pe
- the given pictogram elementpublic java.lang.String getTitleToolTip()
IToolBehaviorProvider
getTitleToolTip
in interface IToolBehaviorProvider
null
to indicate that the default from
the graphics framework will be usedpublic boolean isShowGuides()
IToolBehaviorProvider
isShowGuides
in interface IToolBehaviorProvider
true
, if guides should be shownpublic GraphicsAlgorithm getContentArea(ContainerShape cs)
IToolBehaviorProvider
getContentArea
in interface IToolBehaviorProvider
cs
- the container shapepublic java.lang.String getContributorId()
IToolBehaviorProvider
getContributorId
in interface IToolBehaviorProvider
public boolean isDefaultBendPointRenderingActive()
public boolean isMultiSelectionEnabled()
IToolBehaviorProvider
false
if an editor with single selection
behavior is needed.isMultiSelectionEnabled
in interface IToolBehaviorProvider
false
, if single selection is enforcedpublic boolean isConnectionSelectionEnabled()
IToolBehaviorProvider
isConnectionSelectionEnabled
in interface IToolBehaviorProvider
true
, if selection of connections is enabledpublic boolean equalsBusinessObjects(java.lang.Object o1, java.lang.Object o2)
equalsBusinessObjects
in interface IToolBehaviorProvider
public boolean isShowFlyoutPalette()
IToolBehaviorProvider.isShowFlyoutPalette()
. This default
implementation returns true
and tells the framework to show
the palette.isShowFlyoutPalette
in interface IToolBehaviorProvider
true
public boolean isShowSelectionTool()
IToolBehaviorProvider.isShowSelectionTool()
. This default
implementation returns true
and tells the framework to show
the selection tool entry in the palette.isShowSelectionTool
in interface IToolBehaviorProvider
true
public boolean isShowMarqueeTool()
IToolBehaviorProvider.isShowMarqueeTool()
. This default
implementation returns true
and tells the framework to show
the marquee tool entry in the palette.isShowMarqueeTool
in interface IToolBehaviorProvider
true
public int getLineSelectionWidth(Polyline polyline)
Polyline
or
Polygon
for Shape
s and Connection
s) in the
diagram. The method is called when a new object is drawn for the first
time onto a diagram (on creation of the object or on opening the
diagram).DEFAULT_LINE_SELECTION_WIDTH
with the value 5 for all shapes.getLineSelectionWidth
in interface IToolBehaviorProvider
polyline
- the Polyline
object to get the selection width forpublic boolean isStayActiveAfterExecution(IConnectionCreationToolEntry connectionCreationToolEntry)
IConnectionCreationToolEntry
stays active after a connection has
been created or not. The default behavior in the GEF framework is
true
, which is also the return value of this default
implementation.isStayActiveAfterExecution
in interface IToolBehaviorProvider
true
in case the tool should stay active after
execution, false
otherwise.public java.lang.String getDirectEditingInvalidNotificationTitle(IDirectEditingFeature feature, IDirectEditingContext context)
getDirectEditingInvalidNotificationTitle
in interface IToolBehaviorProvider
feature
- The IDirectEditingFeature
that was invokedcontext
- The IDirectEditingContext
that was used.String
representing the title of the popup to present
to the user.