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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:05:21+00:00 2026-05-30T21:05:21+00:00

I want to make a dynamic application and I want to add TreeItem ‘s

  • 0

I want to make a dynamic application and I want to add TreeItem‘s in a Tree when another plugin is loaded.

For example:

  1. I have plugin: com.project.startup and this plugin has a View with a Tree inside it. This
  2. I have plugin: com.project.populator. I want to populate the Tree from com.project.startup when com.project.populator is starting

I know how to add items but I don’t know when and where I have to write my code.

So far I did this using org.eclipse.ui.IStartup but I get this error:

!MESSAGE Unable to execute early startup code for an extension
!STACK 0
java.lang.NullPointerException
    at ro.project.populator.TreePopulator.earlyStartup(TreePopulator.java:18)

My code looks like this:

public class TreePopulator implements IStartup
{

    @Override
    public void earlyStartup()
    {
        ViewMenuOffers viewMenuOffers = (ViewMenuOffers) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ViewMenuOffers.ID);
        TreeViewer treeViewer = viewMenuOffers.getTreeViewer();
        Tree tree = treeViewer.getTree();
        TreeItem trtmItem = new TreeItem(tree, SWT.NONE);
        trtmItem.setText("Item 1");
    }
}

I think the TreeViewer is not initialized.. but it is in createPartControl of ViewMenuOffers.

How can I make this work? How can I add something to a View from another plugin onStartup?

  • 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-30T21:05:22+00:00Added an answer on May 30, 2026 at 9:05 pm

    I found an answer. It can be done like this:

    public class TreePopulator implements IStartup
    {
    
        @Override
        public void earlyStartup()
        {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
    
                @Override
                public void run()
                {
                    ViewMenuOffers viewMenuOffers = (ViewMenuOffers) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ViewMenuOffers.ID);
                    TreeViewer treeViewer = viewMenuOffers.getTreeViewer();
                    Tree tree = treeViewer.getTree();
    
                    TreeItem trtmS = new TreeItem(tree, SWT.NONE);
                    trtmS.setText("Test");
    
                }
    
            });
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make Dynamic UI for a desktop application. I am planning to
So, I'm trying to make a dynamic UI, and i want to add a
i want to make an application which includes dynamic screensaver. User can select multiple
I want to make a Web application in Haskell (for example, it could be
I have developed a Cocoa application for Mac OS X. I want to make
I want to make a dynamic photo gallery in my iPhone application.All images in
I want to create a dynamic datadriven application for practice purposes. If I have
i want to make a dynamic list with buttons on it. My button in
If I want to make a rule dynamic so i can use assert after
I want to make a website where the (dynamic in height) header and footer

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.