Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7963533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:37:42+00:00 2026-06-04T05:37:42+00:00

I’m building an Eclipse Feature that has a requirement that amounts to this… The

  • 0

I’m building an Eclipse Feature that has a requirement that amounts to this… The Feature must be able to be uninstalled automatically if the user has his license revoked.

If you want more background information about that, Here is another question that I’ve asked on this topic.

Thanks to the answers on that question, I’ve been trying to learn the Eclipse p2 director api. I’ve found some classes that look useful here

I’ve been trying to instantiate one of these classes in my code, but with no luck yet.
I’ve been reading the help documentation, and I’m getting kind of lost in it all.

I’m stuck because I have a need to supply the OperationFactory with a collection of IInstallableUnit objects.

private void scheduleUninstallOperationJob(
        Collection<? extends IVersionedId> toUninstall) 
{
    OperationFactory oFactory = new OperationFactory();
    Collection<URI> repos = null;
    UninstallOperation op = null;
    try {
        op = oFactory.createUninstallOperation(toUninstall, repos, null);
    } catch (ProvisionException e) {
        e.printStackTrace();
    }
    IStatus result = op.resolveModal(null);
    if (result.isOK()) {
        op.getProvisioningJob(null).schedule();
    }
}

I don’t see any way to easily ask the running instance of Eclipse to give me the collection of currently installed InstallableUnits so that I can easily pass the one I want to uninstall to the OperationFactory.createUninstallOperation() method.

I’ve tried using Eclipse source code as an example, but the code that I have found is the org.eclipse.equinox.p2.ui.ProvisioningUI, and it’s tightly coupled to the UI that is used when manually uninstalling InstallableUnits. This code also uses code that is in the dreaded Eclipse internal packages which I would like to avoid using if possible.

Thank you for your consideration, Trace

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:37:43+00:00Added an answer on June 4, 2026 at 5:37 am

    This code gets the collection of IUs which are managed by the profile of the currently running system:

    /**
     * This Activator informs user about the IUs which are currently installed in
     * the running environment.
     * 
     * This code is intended for demo only and should be much more defensive for
     * production use.
     * 
     * @author Ilya Shinkarenko
     * 
     */
    public class SelfInformerActivator extends Plugin {
    
    @Override
    public void start(final BundleContext ctx) throws Exception {
        super.start(ctx);
    
        ServiceReference<IProvisioningAgentProvider> sr = ctx.getServiceReference(IProvisioningAgentProvider.class);
        IProvisioningAgentProvider agentProvider = ctx.getService(sr);
        URI p2InstanceURI = null; // myself
        final IProvisioningAgent agent = agentProvider.createAgent(p2InstanceURI);
    
        IProfileRegistry regProfile = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
    
        IProfile profileSelf = regProfile.getProfile(IProfileRegistry.SELF);
    
        IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery();
    
        //This is what you need:
        IQueryResult<IInstallableUnit> allIUs = profileSelf.query(query, new NullProgressMonitor());
    
        //Let's output it:
        Iterator<IInstallableUnit> iterator = allIUs.iterator();
        while (iterator.hasNext()) {
            IInstallableUnit iu = iterator.next();
            System.out.println(iu);
        }
    
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.