Skip to content

Changes for Add Liberty starter project link to Project/Package Explorer - #687

Closed
malavikaharikumar23 wants to merge 23 commits into
OpenLiberty:devfrom
malavikaharikumar23:liberty-starter-validation
Closed

malavikaharikumar23 wants to merge 23 commits into
OpenLiberty:devfrom
malavikaharikumar23:liberty-starter-validation

Conversation

@malavikaharikumar23

Copy link
Copy Markdown
Contributor

Description
Adds the Create new Liberty starter project link to the empty Project/Package Explorer (and Package Explorer) so that first-time users can easily create a starter project directly from the view

Problems solved

  1. Link not appearing in existing workspaces after plugin install
    Eclipse restores perspectives from workbench.xmi on restart, which bypasses PerspectiveExtensionReader. The persp.newWizSC:... tag was therefore never injected into an already-running perspective.

Fix: Introduced LibertyPerspectiveProcessor — an E4 model processor registered via the org.eclipse.e4.workbench.model extension point. It runs synchronously on every startup, recursively walks the full model tree (TrimmedWindow → PartSashContainer → PerspectiveStack → Perspective), and adds the missing tag to every perspective without requiring a perspective reset.

  1. Eclipse crash on startup after plugin install
    The DS component triggered early bundle activation before the workbench existed. LibertyDevPlugin.start() called PlatformUI.getWorkbench() and threw IllegalStateException.

Fix: Added an PlatformUI.isWorkbenchRunning() guard in registerListeners() so the call is skipped entirely when the workbench is not yet available.

  1. Processor not finding the perspective
    Perspectives are nested at an arbitrary depth in the model tree, not as direct children of the window. A shallow walk missed them.

Fix: Changed LibertyPerspectiveProcessor to recursively walk MElementContainer children at every level, ensuring all perspectives are found regardless of nesting depth.

@mezarin mezarin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested it myself. Will do that next. Here are a couple of comments.

<newWizardShortcut id="io.openliberty.tools.eclipse.ui.wizard.LibertyStarter"/>
</perspectiveExtension>
<perspectiveExtension targetID="org.eclipse.jdt.ui.JavaBrowsingPerspective">
<perspectiveExtension targetID="*">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit dangerous to target all perspectives as there are some that do not make sense for this: Database *, Planning, XML, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

walkAndTag(application);

// Also cover snippets
for (MUIElement snippet : application.getSnippets()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to cover snippets?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment thread bundles/io.openliberty.tools.eclipse.ui/plugin.xml Outdated
@malavikaharikumar23 malavikaharikumar23 self-assigned this Sep 9, 2026
@mezarin

mezarin commented Sep 11, 2026

Copy link
Copy Markdown
Member

closing this PR because the code was shipped as part of PR #695

@mezarin mezarin closed this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants