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 8550207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:53:56+00:00 2026-06-11T13:53:56+00:00

I am trying to implement an ISelectionListener in my eclipse plugin, which will track

  • 0

I am trying to implement an ISelectionListener in my eclipse plugin, which will track the selections in my project explorer and tell me which projects are selected. So its the same way that the build toolbar button finds out which projects are selected to be build each time. I implement that listener but I can get the projects selected only if the user clicks on the actual project and not in any other items under the project(like source codes, folders, packages…) my code is :

    @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    Object[] allselections= null;
    selectedProjects.clear();
    // TODO Auto-generated method stub

    if(selection instanceof IStructuredSelection) {
        //Object element = ((IStructuredSelection)selection).getFirstElement();
        allselections = ((IStructuredSelection)selection).toArray();
        for(Object element: allselections){

            if (element instanceof IResource) {
                selectedProjects.add(((IResource)element).getProject());

        }
    }
};

When the element is not an instanceof IResource and is either a CModelManager, cSource/cxxSource from CDT…and anything else that can be part of a project, is there a generic way to get the project that it belongs to?

For an IResourceChangeListener you can use the IResourceDeltaVisitor and then you can get everything as an IResource instance using: IResource resource = delta.getResource() in the visit(IResourceDelta delta) function. Is there something similar for the ISelectionListener?

  • 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-11T13:53:57+00:00Added an answer on June 11, 2026 at 1:53 pm

    http://www.eclipsezone.com/articles/what-is-iadaptable/

    http://wiki.eclipse.org/FAQ_How_do_I_use_IAdaptable_and_IAdapterFactory%3F

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

Sidebar

Related Questions

I'm trying implement A* Start path finding in my games(which are written with JavaScript,
Trying to implement LoaderManager + CursorLoader. In onFinish method adapter should swap its cursor
Trying to implement 3-layer (not: tier, I just want to separate my project logically,
Trying to implement a function that will return a list of ints the represent
Trying to implement a shell, mainly piping. I've written this test case which I
Trying to implement the new FP 10.1 Global error handler into my projects but
im trying to implement a search for a project I'm currently working on. problem
I'm trying implement my project in Apache Struts 2 but I'm not very familiar
am trying to implement fluent nhibernate in MVC project...there were no build errors... but
Trying to implement a function in my linkedlist class that will return total amount

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.