Betafish
Betafish

Reputation: 1262

Project Explorer not showing projects in eclipse rcp application

With help from many members of stackoverflow, I sort of finally completed my first RCP application.

I'm facing some issues with my Project Explorer

  1. Project Explorer seems not be active when I open my RCP application (Sort of wakes up when I right click on my empty project explorer window)
  2. Even when it ON, it doesnt show me the project explore options. I mean it just shows me the name of the project and nothing else (No files inside it are shown)

Pic:

My Perspective.java file looks as shown below

 package kr;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

public class Perspective implements IPerspectiveFactory {

    public void createInitialLayout(IPageLayout layout) {
        String editorArea = layout.getEditorArea();

         // Top left: Project Explorer view and Bookmarks view placeholder
         IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f,
            editorArea);
         topLeft.addView(IPageLayout.ID_PROJECT_EXPLORER);
         topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);

         // Bottom left: Outline view and Property Sheet view
         IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f,
                   "topLeft");
         bottomLeft.addView(IPageLayout.ID_OUTLINE);
         bottomLeft.addView(IPageLayout.ID_PROP_SHEET);

         // Bottom right: Task List view
        // layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, 0.66f, editorArea);
    }
}

I have added o.e.ui.navigator and o.e.ui.navigator.resources to the dependency list

Upvotes: 4

Views: 900

Answers (2)

LemongrabThree
LemongrabThree

Reputation: 129

I had a similar problem: the Project Explorer was not showing any projects, even after I created some.

The "Project References" page in the "New Project" wizard had one unlabeled checkbox for each project, so they were existent in some form, but the Project Explorer did not seem to pick them up. After adding the getDefaultPageInput method as per memery's answer, I was able to create a project and it would appear in the Explorer, but its name was blank, like in the "Project References" page. And the Explorer would go back to "no projects" if I closed and re-opened the app.

After also calling IDE.registerAdapters in ApplicationWorkbenchAdvisor.java, it works fully for me:

@Override
public void preStartup() {
    super.preStartup();
    IDE.registerAdapters();
}

Upvotes: 1

memery
memery

Reputation: 21

For the initial empty view, you need to override the getDefaultPageInput in the WorkbenchAdvisor class of your RCP defining plugin, like this:

@Override
public IAdaptable getDefaultPageInput() {
    return ResourcesPlugin.getWorkspace().getRoot();
}

Upvotes: 2

Related Questions