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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:27:02+00:00 2026-05-28T05:27:02+00:00

My Tree structure looks like this, containing three classes Index,Key,Value Index1 | — Key1

  • 0

My Tree structure looks like this, containing three classes Index,Key,Value

Index1

 |
  -- Key1

 |
   -- Value1

Index2

 |
  -- Key2

 |
   -- Value2

I’m creating a context menu for an index entry which should have three actions(newKeyAction , newValueAction, removeAction)

and by right clicking on the empty space addAction should be popped up.

This is the code responsible:

 protected void fillContextMenu( IMenuManager manager )
 {
    ITreeSelection mySelection = (ITreeSelection) viewer.getSelection();
    if(mySelection.size() == 1)
        {   
        if(mySelection.getFirstElement() instanceof Index)
        {
            manager.add( newKeyAction );

            manager.add( newValueAction );

            manager.add( removeAction );

    }
       }
   else
   {
        manager.add( addAction);

   }

}

Everything works fine, but the addAction is being invoked only once when the treeViewer is empty, and there after by right clicking on the empty space, node last selected in the tree is being selected and its respective actions are displayed.

Please let me know where i’m going wrong .

  • 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-28T05:27:03+00:00Added an answer on May 28, 2026 at 5:27 am

    there after by right clicking on the empty space, node last selected in the tree is being selected and its respective actions are displayed.

    That’s your problem and you can’t do anything about it. It’s just not possible to clear the selection like this. You should find another way to make addAction available.

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

Sidebar

Related Questions

In C# I have an intrusive tree structure that looks like this: public abstract
I've got a tree-like structure. Each element in this structure should be able to
I have a data-structure (in plist) that looks something like this: What i have
I have a structure that looks like this: [ {'id': 4, 'children': None}, {'id':
This is not a homework. Visually it looks like a tree, but all leafs
I need to create MySQL tables that represent a tree structure like this: Root
So, I have an app/assets/stylesheets/ directory structure that looks something like this: |-dialogs |-mixins
I have a tree structure in memory that I would like to render in
Given a pretty basic source tree structure like the following: trunk ------- QA |--------
I'd like to create a tree structure from JSON, but with multiple columns that

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.