diff options
author | DJ Houghton | 2010-09-16 19:35:54 +0000 |
---|---|---|
committer | DJ Houghton | 2010-09-16 19:35:54 +0000 |
commit | ab587d08fbf434ba4225f687ec77e0e61ffbef70 (patch) | |
tree | c365f8b40afaf943adf9260463fdd05d9b520770 /bundles/org.eclipse.equinox.p2.director.app/src | |
parent | cedcc578d08ca6c10b2233240939ea4bf065487e (diff) | |
download | rt.equinox.p2-ab587d08fbf434ba4225f687ec77e0e61ffbef70.tar.gz rt.equinox.p2-ab587d08fbf434ba4225f687ec77e0e61ffbef70.tar.xz rt.equinox.p2-ab587d08fbf434ba4225f687ec77e0e61ffbef70.zip |
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.director.app/src')
3 files changed, 23 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java index c7e4be0c8..8e64f1036 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java @@ -25,6 +25,7 @@ import org.eclipse.equinox.internal.p2.core.helpers.*; import org.eclipse.equinox.internal.provisional.p2.director.*; import org.eclipse.equinox.p2.core.*; import org.eclipse.equinox.p2.engine.*; +import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.planner.IPlanner; @@ -112,6 +113,7 @@ public class DirectorApplication implements IApplication { private static final CommandLineOption OPTION_HELP = new CommandLineOption(new String[] {"-help", "-h", "-?"}, null, Messages.Help_Prints_this_command_line_help); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private static final CommandLineOption OPTION_LIST = new CommandLineOption(new String[] {"-list", "-l"}, Messages.Help_lb_lt_comma_separated_list_gt_rb, Messages.Help_List_all_IUs_found_in_repos); //$NON-NLS-1$ //$NON-NLS-2$ + private static final CommandLineOption OPTION_LIST_INSTALLED = new CommandLineOption(new String[] {"-listInstalledRoots", "-lir"}, null, Messages.Help_List_installed_roots); //$NON-NLS-1$ //$NON-NLS-2$ private static final CommandLineOption OPTION_INSTALL_IU = new CommandLineOption(new String[] {"-installIU", "-installIUs", "-i"}, Messages.Help_lt_comma_separated_list_gt, Messages.Help_Installs_the_listed_IUs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private static final CommandLineOption OPTION_UNINSTALL_IU = new CommandLineOption(new String[] {"-uninstallIU", "-uninstallIUs", "-u"}, Messages.Help_lt_comma_separated_list_gt, Messages.Help_Uninstalls_the_listed_IUs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private static final CommandLineOption OPTION_REVERT = new CommandLineOption(new String[] {"-revert"}, Messages.Help_lt_comma_separated_list_gt, Messages.Help_Revert_to_previous_state); //$NON-NLS-1$ @@ -212,6 +214,7 @@ public class DirectorApplication implements IApplication { private String flavor; private boolean printHelpInfo = false; private boolean printIUList = false; + private boolean printRootIUList = false; private long revertToPreviousState = -1; private boolean verifyOnly = false; private boolean roamingProfile = false; @@ -630,6 +633,11 @@ public class DirectorApplication implements IApplication { continue; } + if (OPTION_LIST_INSTALLED.isOption(opt)) { + printRootIUList = true; + continue; + } + if (OPTION_HELP.isOption(opt)) { printHelpInfo = true; continue; @@ -754,7 +762,7 @@ public class DirectorApplication implements IApplication { throw new ProvisionException(NLS.bind(Messages.unknown_option_0, opt)); } - if (!printHelpInfo && !printIUList && !purgeRegistry && rootsToInstall.isEmpty() && rootsToUninstall.isEmpty() && revertToPreviousState == -1) { + if (!printHelpInfo && !printIUList && !printRootIUList && !purgeRegistry && rootsToInstall.isEmpty() && rootsToUninstall.isEmpty() && revertToPreviousState == -1) { printMessage(Messages.Help_Missing_argument); printHelpInfo = true; } @@ -807,6 +815,8 @@ public class DirectorApplication implements IApplication { performProvisioningActions(); if (printIUList) performList(); + if (printRootIUList) + performListInstalledRoots(); if (purgeRegistry) purgeRegistry(); printMessage(NLS.bind(Messages.Operation_complete, new Long(System.currentTimeMillis() - time))); @@ -938,7 +948,7 @@ public class DirectorApplication implements IApplication { } private void performHelpInfo() { - CommandLineOption[] allOptions = new CommandLineOption[] {OPTION_HELP, OPTION_LIST, OPTION_INSTALL_IU, OPTION_UNINSTALL_IU, OPTION_REVERT, OPTION_DESTINATION, OPTION_METADATAREPOS, OPTION_ARTIFACTREPOS, OPTION_REPOSITORIES, OPTION_VERIFY_ONLY, OPTION_PROFILE, OPTION_FLAVOR, OPTION_SHARED, OPTION_BUNDLEPOOL, OPTION_PROFILE_PROPS, OPTION_ROAMING, OPTION_P2_OS, OPTION_P2_WS, OPTION_P2_ARCH, OPTION_P2_NL, OPTION_PURGEHISTORY, OPTION_FOLLOW_REFERENCES}; + CommandLineOption[] allOptions = new CommandLineOption[] {OPTION_HELP, OPTION_LIST, OPTION_LIST_INSTALLED, OPTION_INSTALL_IU, OPTION_UNINSTALL_IU, OPTION_REVERT, OPTION_DESTINATION, OPTION_METADATAREPOS, OPTION_ARTIFACTREPOS, OPTION_REPOSITORIES, OPTION_VERIFY_ONLY, OPTION_PROFILE, OPTION_FLAVOR, OPTION_SHARED, OPTION_BUNDLEPOOL, OPTION_PROFILE_PROPS, OPTION_ROAMING, OPTION_P2_OS, OPTION_P2_WS, OPTION_P2_ARCH, OPTION_P2_NL, OPTION_PURGEHISTORY, OPTION_FOLLOW_REFERENCES}; for (int i = 0; i < allOptions.length; ++i) { allOptions[i].appendHelp(System.out); } @@ -1019,4 +1029,13 @@ public class DirectorApplication implements IApplication { public void setLog(ILog log) { this.log = log; } + + private void performListInstalledRoots() throws CoreException { + IProfile profile = initializeProfile(); + IQueryResult<IInstallableUnit> roots = profile.query(new UserVisibleRootQuery(), null); + Set<IInstallableUnit> sorted = new TreeSet<IInstallableUnit>(roots.toUnmodifiableSet()); + for (IInstallableUnit iu : sorted) + System.out.println(iu.getId() + '/' + iu.getVersion()); + } + }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java index 8f3163b4c..744780f5a 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Messages.java @@ -35,6 +35,7 @@ public class Messages extends NLS { public static String Help_Installs_the_listed_IUs; public static String Help_lb_lt_path_gt_rb; public static String Help_List_all_IUs_found_in_repos; + public static String Help_List_installed_roots; public static String Help_lt_comma_separated_list_gt; public static String Help_lb_lt_comma_separated_list_gt_rb; public static String Help_lt_name_gt; diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties index ab49951b5..176bee5b5 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/messages.properties @@ -40,6 +40,7 @@ Help_Use_a_shared_location_for_the_install=Use a shared location for the install Ignored_repo=The repository {1} will not be considered. Help_lb_lt_path_gt_rb=[ <path> ] Help_List_all_IUs_found_in_repos=Lists all IU's found in the given repositories. IUs can optionally be listed. Each entry in the list is in the form <id> [ '/' <version> ]. +Help_List_installed_roots=Lists all root IU's found in the given profile. Each entry in the list is in the form <id> [ '/' <version> ]. Help_Revert_to_previous_state=Revert the installation to a previous state [ the number representing the previous state of the profile as found in p2/org.eclipse.equinox.p2.engine/<profileId>/ ]. Help_lt_comma_separated_list_gt=<comma separated list> Help_lb_lt_comma_separated_list_gt_rb=[ <comma separated list> ] |