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

  • Home
  • SEARCH
  • 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 7667293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:03:57+00:00 2026-05-31T15:03:57+00:00

I have a view part and in my createPartControl function I have this: viewer

  • 0

I have a view part and in my createPartControl function I have this:

viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);

getSite().setSelectionProvider(viewer);
getSite().getWorkbenchWindow().getSelectionService()
            .addSelectionListener(this);

I’m registering the viewpart as a selection listener, but I only really want to listen to selections provided by the treeviewer in this viewpart. This is because i’m trying to make a context sensitive popup menu so I want to know which node is selected ready for when the menu popup happens (I’m hoping that selection listener code is executed before the menulistener stuff) and the documentation for this framework is unhelpful at best.

I know that the addSelectionListener(String ID, ISelectionListener listener) method, but I cannot work out how on earth I am supposed to know the ID of the viewer I want to listen to, can anyone please help me to work this out?

  • 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-05-31T15:03:58+00:00Added an answer on May 31, 2026 at 3:03 pm

    I only really want to listen to selections provided by the treeviewer in this viewpart

    Why not add selection listener directly to viewer?

    how on earth I am supposed to know the ID of the viewer

    It’s the ID of your view (part) not (tree)viewer.

    You can also call viewer.getSelection() directly without having any listeners.

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

Sidebar

Related Questions

I have a view which is a part of a tabBarController. In this view
I have a view in Eclipse (implemented by a class which extends org.eclipse.ui.part.ViewPart )
Currently I have this url to view an image from the db (codeigniter) domain.com/view/id
I have a View-derived class where I draw a 790x500 (yes, this is odd
I have a view file like this : <html> <head> <meta name=layout content=main />
I have the following link: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' => 'portfolio', 'action' => 'view',
Imagine that I have a view, and as part of a view it render
I have a View with url like /Home/SetResults?patientId=[somePatientId] , part of it gets conditionaly
i have built view controller with xib file and navigation bar in it,this view
We have created a new List View Style that shows thumbnails from a picture

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.