Package org.eclipse.equinox.p2.ui
Class Policy
- java.lang.Object
-
- org.eclipse.equinox.p2.ui.Policy
-
public class Policy extends Object
The Policy class is used to specify application specific policies that should be used in the standard p2 UI class libraries. The default policy is acquired using the OSGi service model. Policy allows clients to specify things such as how repositories are manipulated in the standard wizards and dialogs, and how the repositories or the installation itself should be traversed when displaying content. In some cases, the Policy is used only to define a default value that can be overridden by user choice and subsequently stored in dialog settings. Client applications should ensure that their Policy is registered before any of the p2 UI objects access the default Policy.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static intRESTART_POLICY_FORCEA constant indicating that restart should be forced (without confirmation) immediately after completion of a provisioning operation.static intRESTART_POLICY_FORCE_APPLYA constant indicating that the changes should be applied dynamically to the profile (without confirmation) immediately after completion of a provisioning operation.static intRESTART_POLICY_PROMPTA constant indicating that the user should be prompted to restart after completion of a provisioning operation.static intRESTART_POLICY_PROMPT_RESTART_OR_APPLYA constant indicating that, where possible, the user should be given the option to restart or dynamically apply the changes after completion of a provisioning operation.static intUPDATE_STYLE_MULTIPLE_IUSA constant indicating that the user should be presented with an update wizard that shows a list of IUs that can be updated.static intUPDATE_STYLE_SINGLE_IUSA constant indicating that the user should be presented with an update wizard that shows detail about a single IU that can be updated.
-
Constructor Summary
Constructors Constructor Description Policy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontinueWorkingWithOperation(ProfileChangeOperation operation, Shell shell)Answer a boolean indicating whether the caller should continue to work with the specified operation.booleangetCheckAgainstCurrentExecutionEnvironment()Get a boolean value indicating whether the provisioning operation should check compatibility with current execution environmentbooleangetContactAllSites()Get a boolean value indicating whether to contact all sites.booleangetFilterOnEnv()Return a boolean value indicating whether or not the list of available software should be filtered based on the environment settings of the profile.booleangetGroupByCategory()Return a boolean indicating whether available software should be grouped by category.booleangetHideAlreadyInstalled()Get a boolean value indicating whether to hide already installed units.IStatusgetNoProfileChosenStatus()Return a status that can be used to describe the failure to retrieve a profile.booleangetRepositoriesVisible()Return a boolean indicating whether the repositories should be visible to the user, such that the user can add, remove, and otherwise manipulate the software site list.StringgetRepositoryPreferencePageId()Get the id of the preference page that should be used to link to the software sites page.StringgetRepositoryPreferencePageName()Get the localized name of the preference page that should be displayed in links to the software sites page.intgetRestartPolicy()Get the restart policy that should be used when the provisioning UI determines that a restart is required.booleangetShowDrilldownRequirements()Return a boolean indicating whether the user should be allowed drill down from a visible update or installed item into the requirements.booleangetShowLatestVersionsOnly()Return a boolean indicating whether only the latest versions of updates and available software should be shown to the user.PointgetUpdateDetailsPreferredSize()Get a point describing the preferred size of the details area shown in single IU update wizards.intgetUpdateWizardStyle()Get the update wizard style that should be used to determine what to show the user when updates are available.IQuery<IInstallableUnit>getVisibleAvailableIUQuery()Return a query that can be used to obtain the IInstallableUnits that should be presented to the user from the software repositories.IQuery<IInstallableUnit>getVisibleInstalledIUQuery()Return a query that can be used to obtain the IInstallableUnits in the profile that should be presented to the user.voidsetCheckAgainstCurrentExecutionEnvironment(boolean check)Set a boolean indicating whether the provisioning operation should check compatibility with current execution environment.voidsetContactAllSites(boolean contactAll)Set a boolean indicating whether all sites need to be contacted.voidsetFilterOnEnv(boolean filterOnEnv)Set a boolean value indicating whether or not the list of available software should be filtered based on the environment settings of the profile.voidsetGroupByCategory(boolean group)Set a boolean indicating whether available software should be grouped by category.voidsetHideAlreadyInstalled(boolean hide)Set a boolean indicating whether to hide already installed units.voidsetRepositoriesVisible(boolean visible)Set a boolean indicating whether the repositories should be visible to the user, such that the user can add, remove, and otherwise manipulate the software site list.voidsetRepositoryPreferencePageId(String id)Set the id of the preference page that should be used to link to the software sites page.voidsetRepositoryPreferencePageName(String name)Set the localized name of the preference page that should be displayed in links to the software sites page.voidsetRestartPolicy(int restartPolicy)Set the restart policy that should be used when the provisioning UI determines that a restart is required.voidsetShowDrilldownRequirements(boolean drilldown)Set a boolean indicating whether the user should be allowed drill down from a visible update or installed item into the requirements.voidsetShowLatestVersionsOnly(boolean showLatest)Set a boolean indicating whether only the latest versions of updates and available software should be shown to the user.voidsetUpdateDetailsPreferredSize(Point preferredSize)Set the preferred size of the details area shown in update wizards which notify the user of a single update.voidsetUpdateWizardStyle(int updateWizardStyle)Get the update wizard style that should be used to determine what to show the user when updates are available.voidsetVisibleAvailableIUQuery(IQuery<IInstallableUnit> query)Set the query that can be used to obtain the IInstallableUnits that should be presented to the user.voidsetVisibleInstalledIUQuery(IQuery<IInstallableUnit> query)Set the query that can be used to obtain the IInstallableUnits in the profile that should be presented to the user.
-
-
-
Field Detail
-
RESTART_POLICY_FORCE
public static final int RESTART_POLICY_FORCE
A constant indicating that restart should be forced (without confirmation) immediately after completion of a provisioning operation.- See Also:
- Constant Field Values
-
RESTART_POLICY_FORCE_APPLY
public static final int RESTART_POLICY_FORCE_APPLY
A constant indicating that the changes should be applied dynamically to the profile (without confirmation) immediately after completion of a provisioning operation.- See Also:
- Constant Field Values
-
RESTART_POLICY_PROMPT
public static final int RESTART_POLICY_PROMPT
A constant indicating that the user should be prompted to restart after completion of a provisioning operation.- See Also:
- Constant Field Values
-
RESTART_POLICY_PROMPT_RESTART_OR_APPLY
public static final int RESTART_POLICY_PROMPT_RESTART_OR_APPLY
A constant indicating that, where possible, the user should be given the option to restart or dynamically apply the changes after completion of a provisioning operation.- See Also:
- Constant Field Values
-
UPDATE_STYLE_MULTIPLE_IUS
public static final int UPDATE_STYLE_MULTIPLE_IUS
A constant indicating that the user should be presented with an update wizard that shows a list of IUs that can be updated. Even when only one update is available, a list showing the single update will be used. This option is recommended when the user's view of the system is a set of component updates and the user is expected to have knowledge of the composition of the system.- Since:
- 2.1
- See Also:
- Constant Field Values
-
UPDATE_STYLE_SINGLE_IUS
public static final int UPDATE_STYLE_SINGLE_IUS
A constant indicating that the user should be presented with an update wizard that shows detail about a single IU that can be updated. If more than one IU can be updated, the user will be shown a list; however, this option is recommended to be used only when the user's view of the system is a single application that can be updated, and only one IU is expected to be available for update.- Since:
- 2.1
- See Also:
- Constant Field Values
-
-
Method Detail
-
continueWorkingWithOperation
public boolean continueWorkingWithOperation(ProfileChangeOperation operation, Shell shell)
Answer a boolean indicating whether the caller should continue to work with the specified operation. This method is used when an operation has been resolved, but the UI may have further restrictions on continuing with it.- Parameters:
operation- the operation in question. It must already be resolved.shell- the shell to use for any interaction with the user- Returns:
trueif processing of the operation should continue,falseif not. It is up to the implementor to report any errors to the user when answeringfalse.
-
getNoProfileChosenStatus
public IStatus getNoProfileChosenStatus()
Return a status that can be used to describe the failure to retrieve a profile.- Returns:
- a status describing a failure to retrieve a profile, or
nullif there is no such status.
-
getVisibleAvailableIUQuery
public IQuery<IInstallableUnit> getVisibleAvailableIUQuery()
Return a query that can be used to obtain the IInstallableUnits that should be presented to the user from the software repositories.- Returns:
- the query used to retrieve user visible available IUs
-
setVisibleAvailableIUQuery
public void setVisibleAvailableIUQuery(IQuery<IInstallableUnit> query)
Set the query that can be used to obtain the IInstallableUnits that should be presented to the user.- Parameters:
query- the query used to retrieve user visible available IUs
-
getVisibleInstalledIUQuery
public IQuery<IInstallableUnit> getVisibleInstalledIUQuery()
Return a query that can be used to obtain the IInstallableUnits in the profile that should be presented to the user.- Returns:
- the query used to retrieve user visible installed IUs
-
setVisibleInstalledIUQuery
public void setVisibleInstalledIUQuery(IQuery<IInstallableUnit> query)
Set the query that can be used to obtain the IInstallableUnits in the profile that should be presented to the user.- Parameters:
query- the query used to retrieve user visible installed IUs
-
getRestartPolicy
public int getRestartPolicy()
Get the restart policy that should be used when the provisioning UI determines that a restart is required.- Returns:
- an integer constant describing the restart policy
- See Also:
RESTART_POLICY_FORCE,RESTART_POLICY_FORCE_APPLY,RESTART_POLICY_PROMPT,RESTART_POLICY_PROMPT_RESTART_OR_APPLY
-
setRestartPolicy
public void setRestartPolicy(int restartPolicy)
Set the restart policy that should be used when the provisioning UI determines that a restart is required.- Parameters:
restartPolicy- an integer constant describing the restart policy- See Also:
RESTART_POLICY_FORCE,RESTART_POLICY_FORCE_APPLY,RESTART_POLICY_PROMPT,RESTART_POLICY_PROMPT_RESTART_OR_APPLY
-
getRepositoriesVisible
public boolean getRepositoriesVisible()
Return a boolean indicating whether the repositories should be visible to the user, such that the user can add, remove, and otherwise manipulate the software site list.- Returns:
trueif repositories are visible to the end user,falseif they are not.
-
setRepositoriesVisible
public void setRepositoriesVisible(boolean visible)
Set a boolean indicating whether the repositories should be visible to the user, such that the user can add, remove, and otherwise manipulate the software site list.- Parameters:
visible-trueif repositories are visible to the end user,falseif they are not.
-
getShowLatestVersionsOnly
public boolean getShowLatestVersionsOnly()
Return a boolean indicating whether only the latest versions of updates and available software should be shown to the user.- Returns:
trueif only the latest versions are shown,falseif all versions should be shown.
-
setShowLatestVersionsOnly
public void setShowLatestVersionsOnly(boolean showLatest)
Set a boolean indicating whether only the latest versions of updates and available software should be shown to the user.- Parameters:
showLatest-trueif only the latest versions are shown,falseif all versions should be shown.
-
getShowDrilldownRequirements
public boolean getShowDrilldownRequirements()
Return a boolean indicating whether the user should be allowed drill down from a visible update or installed item into the requirements.- Returns:
trueif drilldown is allowed,falseif it is not.
-
setShowDrilldownRequirements
public void setShowDrilldownRequirements(boolean drilldown)
Set a boolean indicating whether the user should be allowed drill down from a visible update or installed item into the requirements.- Parameters:
drilldown-trueif drilldown is allowed,falseif it is not.
-
getFilterOnEnv
public boolean getFilterOnEnv()
Return a boolean value indicating whether or not the list of available software should be filtered based on the environment settings of the profile.- Returns:
trueif the results should be filtered andfalseotherwise.- Since:
- 2.1
-
setFilterOnEnv
public void setFilterOnEnv(boolean filterOnEnv)
Set a boolean value indicating whether or not the list of available software should be filtered based on the environment settings of the profile.- Parameters:
filterOnEnv-trueif the results should be filtered andfalseotherwise.- Since:
- 2.1
-
getGroupByCategory
public boolean getGroupByCategory()
Return a boolean indicating whether available software should be grouped by category.- Returns:
trueif items should be grouped by category,falseif categories should not be shown.
-
setGroupByCategory
public void setGroupByCategory(boolean group)
Set a boolean indicating whether available software should be grouped by category.- Parameters:
group-trueif items should be grouped by category,falseif categories should not be shown.
-
getRepositoryPreferencePageId
public String getRepositoryPreferencePageId()
Get the id of the preference page that should be used to link to the software sites page.- Returns:
- the preference page id, or
nullif there is no preference page id showing the software sites.
-
setRepositoryPreferencePageId
public void setRepositoryPreferencePageId(String id)
Set the id of the preference page that should be used to link to the software sites page.- Parameters:
id- the preference page id, ornullif there is no preference page id showing the software sites.
-
getRepositoryPreferencePageName
public String getRepositoryPreferencePageName()
Get the localized name of the preference page that should be displayed in links to the software sites page.- Returns:
- the preference page name, or
nullif there is no preference page.
-
setRepositoryPreferencePageName
public void setRepositoryPreferencePageName(String name)
Set the localized name of the preference page that should be displayed in links to the software sites page. This name is ignored if no id is specified for the preference page.- Parameters:
name- the preference page name, ornullif there is no preference page.- See Also:
setRepositoryPreferencePageId(String)
-
getUpdateWizardStyle
public int getUpdateWizardStyle()
Get the update wizard style that should be used to determine what to show the user when updates are available.- Returns:
- an integer constant describing the update wizard style
- Since:
- 2.1
- See Also:
UPDATE_STYLE_SINGLE_IUS,UPDATE_STYLE_MULTIPLE_IUS
-
setUpdateWizardStyle
public void setUpdateWizardStyle(int updateWizardStyle)
Get the update wizard style that should be used to determine what to show the user when updates are available.- Parameters:
updateWizardStyle- an integer constant describing the update wizard style- Since:
- 2.1
- See Also:
UPDATE_STYLE_SINGLE_IUS,UPDATE_STYLE_MULTIPLE_IUS
-
getUpdateDetailsPreferredSize
public Point getUpdateDetailsPreferredSize()
Get a point describing the preferred size of the details area shown in single IU update wizards. This value may be null, in which case the wizard may compute a default size.- Returns:
- a Point describing the preferred size of the update wizard details area.
- Since:
- 2.1
- See Also:
UPDATE_STYLE_SINGLE_IUS
-
setUpdateDetailsPreferredSize
public void setUpdateDetailsPreferredSize(Point preferredSize)
Set the preferred size of the details area shown in update wizards which notify the user of a single update. Clients can use this value to ensure that their product's branded update notifier is sized to fit the expected content.- Parameters:
preferredSize- a Point describing the preferred size- Since:
- 2.1
- See Also:
UPDATE_STYLE_SINGLE_IUS
-
getContactAllSites
public boolean getContactAllSites()
Get a boolean value indicating whether to contact all sites.- Returns:
truetrue if all sites need to be contacted,falseotherwise.- Since:
- 2.3
-
setContactAllSites
public void setContactAllSites(boolean contactAll)
Set a boolean indicating whether all sites need to be contacted.- Parameters:
contactAll-trueif all sites need to be contacted,falseotherwise.- Since:
- 2.3
-
getHideAlreadyInstalled
public boolean getHideAlreadyInstalled()
Get a boolean value indicating whether to hide already installed units.- Returns:
trueif already installed units are to be hidden,falseotherwise.- Since:
- 2.3
-
setHideAlreadyInstalled
public void setHideAlreadyInstalled(boolean hide)
Set a boolean indicating whether to hide already installed units.- Parameters:
hide-trueif already installed units need to be hidden,falseotherwise.- Since:
- 2.3
-
getCheckAgainstCurrentExecutionEnvironment
public boolean getCheckAgainstCurrentExecutionEnvironment()
Get a boolean value indicating whether the provisioning operation should check compatibility with current execution environment- Returns:
trueif operation should check compatibility with current execution environment,falseotherwise.- Since:
- 2.6
-
setCheckAgainstCurrentExecutionEnvironment
public void setCheckAgainstCurrentExecutionEnvironment(boolean check)
Set a boolean indicating whether the provisioning operation should check compatibility with current execution environment.- Parameters:
check-trueif operation should check compatibility with current execution environment,falseotherwise.- Since:
- 2.6
-
-