From 2ce6dd9df2095b4c4d72364aef87310863a81c65 Mon Sep 17 00:00:00 2001 From: Kushal Munir < kmunir@ca.ibm.com> Date: Tue, 1 May 2007 19:20:36 +0000 Subject: [PATCH] [170909] [plan] Contribute User Actions and Import/Export from RSE7. Add methods to the user action registry to manage user actions and contexts. --- .../useractions/UserActionRegistry.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/UserActionRegistry.java b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/UserActionRegistry.java index b2f938ee07c..2d39554b097 100644 --- a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/UserActionRegistry.java +++ b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/UserActionRegistry.java @@ -105,6 +105,34 @@ public class UserActionRegistry { return (List)(map.get(configuration)); } + /** + * Returns whether a user action context for the given profile and subsystem configuration exists. + * @param profile the system profile. + * @param configuration the subsystem configuration. + * @param context the user action context. + * @return true if the user action context exists, false otherwise. + */ + public boolean containsUserActionContext(ISystemProfile profile, ISubSystemConfiguration configuration, IUserActionContext context) { + + Map map = getUserActionContextMap(profile); + List list = getUserActionContexts(map, configuration); + return list.contains(context); + } + + /** + * Returns whether a user action for the given profile and subsystem configuration exists. + * @param profile the system profile. + * @param configuration the subsystem configuration. + * @param context the user action. + * @return true if the user action context exists, false otherwise. + */ + public boolean containsUserActionModel(ISystemProfile profile, ISubSystemConfiguration configuration, IUserActionContext context) { + + Map map = getUserActionContextMap(profile); + List list = getUserActionContexts(map, configuration); + return list.contains(context); + } + /** * Adds a user action context for the given profile and subsystem configuration. * @param profile the system profile. @@ -122,6 +150,7 @@ public class UserActionRegistry { * Adds a user action for the given profile and subsystem configuration. * @param profile the system profile. * @param configuration the subsystem configuration. + * @param model the user action model. */ public void addUserActionModel(ISystemProfile profile, ISubSystemConfiguration configuration, IUserActionModel model) { @@ -147,6 +176,7 @@ public class UserActionRegistry { * Adds a user action for the given profile and subsystem configuration. * @param profile the system profile. * @param configuration the subsystem configuration. + * @param model the user action model. */ public void removeUserActionModel(ISystemProfile profile, ISubSystemConfiguration configuration, IUserActionModel model) { @@ -154,4 +184,28 @@ public class UserActionRegistry { List list = getUserActionModels(map, configuration); list.remove(model); } + + /** + * Returns an array of user action contexts for the given profile and subsystem configuration. + * @param profile the system profile. + * @param configuration the subsystem configuration. + * @return the array of user action contexts, or an empty array if none. + */ + public IUserActionContext[] getUserActionContexts(ISystemProfile profile, ISubSystemConfiguration configuration) { + Map map = getUserActionContextMap(profile); + List list = getUserActionContexts(map, configuration); + return (IUserActionContext[])(list.toArray()); + } + + /** + * Returns an array of user actions for the given profile and subsystem configuration. + * @param profile the system profile. + * @param configuration the subsystem configuration. + * @return the array of user action models, or an empty array if none. + */ + public IUserActionModel[] getUserActionModels(ISystemProfile profile, ISubSystemConfiguration configuration) { + Map map = getUserActionModelMap(profile); + List list = getUserActionModels(map, configuration); + return (IUserActionModel[])(list.toArray()); + } } \ No newline at end of file