public interface EPartService
It is expected that any methods that are exposed by this service that takes an MPart
as an argument be a part that is actually being managed by this service.
Modifier and Type | Interface and Description |
---|---|
static class |
EPartService.PartState
Applicable states that a part can be in.
|
Modifier and Type | Field and Description |
---|---|
static String |
ACTIVE_ON_CLOSE_TAG
Used to tag the currently active part in a presentation for subsequent activation on session
startup
|
static String |
REMOVE_ON_HIDE_TAG
A tag on a part to indicate that it should be removed from the model when it is hidden.
|
Modifier and Type | Method and Description |
---|---|
void |
activate(MPart part)
Activates the given part.
|
void |
activate(MPart part,
boolean requiresFocus)
Activates the given part.
|
void |
addPartListener(IPartListener listener)
Adds the given listener for part lifecycle events.
|
void |
bringToTop(MPart part)
Brings this part to the top so that it will become visible to the end user.
|
MPart |
createPart(String id)
Creates a new part of the given id.
|
MPlaceholder |
createSharedPart(String id)
Creates a new placeholder for a part of the given id.
|
MPlaceholder |
createSharedPart(String id,
boolean force)
Creates a new placeholder for a part of the given id.
|
MPart |
findPart(String id)
Finds and returns a part with the given id.
|
MPart |
getActivePart()
Returns the active part.
|
Collection<MPart> |
getDirtyParts()
Returns a collection of all the dirty parts that are being managed by this service.
|
Collection<MInputPart> |
getInputParts(String inputUri)
Returns a collection of all
MInputPart with the inputURI-Attribute set to the given
value |
Collection<MPart> |
getParts()
Returns a collection of all the parts that are being managed by this part service.
|
void |
hidePart(MPart part)
Hides the given part.
|
void |
hidePart(MPart part,
boolean force)
Hides the given part.
|
boolean |
isPartVisible(MPart part)
Returns whether the specified part is currently visible to the end user.
|
void |
removePartListener(IPartListener listener)
Removes the given listener so that it will no longer be notified of part lifecycle events.
|
void |
requestActivation()
Ask the service to assign activation to a valid part in the currently active presentation.
|
boolean |
saveAll(boolean confirm)
Saves the contents of all dirty parts and returns whether the operation completed.
|
boolean |
savePart(MPart part,
boolean confirm)
Saves the contents of the part if it is dirty and returns whether the operation completed.
|
MPart |
showPart(MPart part,
EPartService.PartState partState)
Shows the given part.
|
MPart |
showPart(String id,
EPartService.PartState partState)
Shows a part with the identified by the given id.
|
void |
switchPerspective(MPerspective perspective)
Switch to the specified perspective.
|
static final String ACTIVE_ON_CLOSE_TAG
static final String REMOVE_ON_HIDE_TAG
hidePart(MPart)
,
Constant Field Valuesvoid addPartListener(IPartListener listener)
Note: Listeners should be removed when no longer necessary.
listener
- the listener to attachvoid removePartListener(IPartListener listener)
listener
- the listener to removevoid activate(MPart part)
part
- the part to activate, must not be null
void activate(MPart part, boolean requiresFocus)
requiresFocus
is true, then granted focus.part
- the part to activate, must not be null
requiresFocus
- if true, then also cause the part to acquire focusvoid requestActivation()
void bringToTop(MPart part)
part
- the part to bring to topMPart findPart(String id)
id
- the id of the part to search for, must not be null
null
if no such part could be foundCollection<MPart> getParts()
null
MPart getActivePart()
null
if no part is
currently activeboolean isPartVisible(MPart part)
part
- the part to checktrue
if the part is currently visible, false
otherwiseMPart createPart(String id)
id
- the identifier of the part, must not be null
null
if no part descriptors can be found
that match the specified idMPlaceholder createSharedPart(String id)
id
- the identifier of the part, must not be null
null
if no part descriptors can be found
that match the specified idMPlaceholder createSharedPart(String id, boolean force)
id
- the identifier of the part, must not be null
force
- true
if a new part should be created, false
if the
window should be queried for a shared part firstnull
if no part descriptors can be found
that match the specified idMPart showPart(String id, EPartService.PartState partState)
getParts()
and iterate over
the collection to find the interested part and invoke showPart(MPart, PartState)
on
it. The behavior of this method is dictated by the supplied state.
ACTIVATE
is supplied, then the part is made visible and granted focus.VISIBLE
is supplied, then the part will be made visible and possibly be
granted focus depending on where it is relative to the active part. If it is in the same
stack as the currently active part, then it will be granted focus.CREATE
is supplied, then the part will be instantiated though its
contents may not necessarily be visible to the end user. visible to the end user.id
- the identifier of the part, must not be null
partState
- the desired state of the shown part to be innull
if no parts or part descriptors can be found
that match the specified idMPart showPart(MPart part, EPartService.PartState partState)
The behavior of this method is dictated by the supplied state.
ACTIVATE
is supplied, then the part is made visible and granted focus.VISIBLE
is supplied, then the part will be made visible and possibly be
granted focus depending on where it is relative to the active part. If it is in the same
stack as the currently active part, then it will be granted focus.CREATE
is supplied, then the part will be instantiated though its
contents may not necessarily be visible to the end user. visible to the end user.part
- the part to showpartState
- the desired state of the shown part to be invoid hidePart(MPart part)
If the part has been tagged with the REMOVE_ON_HIDE_TAG
tag, it will be removed from
the model when the service hides it.
To save the part before hiding, use savePart(MPart, boolean)
:
if (partService.savePart(part, true)) { partService.hidePart(part); }
part
- the part to hidesavePart(MPart, boolean)
void hidePart(MPart part, boolean force)
If force
is true
or the part has been tagged with the
REMOVE_ON_HIDE_TAG
tag, it will be removed from the model when the service hides it.
To save the part before hiding, use savePart(MPart, boolean)
:
if (partService.savePart(part, true)) { partService.hidePart(part); }
part
- the part to hideforce
- if the part should be removed from the model regardless of its
REMOVE_ON_HIDE_TAG
tagsavePart(MPart, boolean)
Collection<MPart> getDirtyParts()
null
boolean savePart(MPart part, boolean confirm)
part
- the part to saveconfirm
- true
if the user should be prompted prior to saving the changes, and
false
to save changes without askingtrue
if the operation completed successfully, false
if the
user canceled the operation or if an error occurred while saving the changeshidePart(MPart, boolean)
boolean saveAll(boolean confirm)
confirm
- true
if the user should be prompted prior to saving the changes, and
false
to save changes without askingtrue
if the operation completed successfully, false
if the
user canceled the operation or if an error occurred while saving the changesCollection<MInputPart> getInputParts(String inputUri)
MInputPart
with the inputURI-Attribute set to the given
valueinputUri
- the input uri to search for, must not be null
AssertionFailedException
- if null passed as argumentvoid switchPerspective(MPerspective perspective)
perspective
- the perspective to switch to, must not be null
and it must be a
perspective that's being managed by this service
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.