Skip to content

fix: initialize images in a UI job if workbench is running#1011

Open
trancexpress wants to merge 1 commit into
eclipse-tm4e:mainfrom
trancexpress:gh1010
Open

fix: initialize images in a UI job if workbench is running#1011
trancexpress wants to merge 1 commit into
eclipse-tm4e:mainfrom
trancexpress:gh1010

Conversation

@trancexpress

Copy link
Copy Markdown

This change adjusts TMUIPlugin.start() to trigger a UI job for image initalization, to avoid start-up exceptions when TMUIPlugin.start() is not called from a UI thread.

Fixes: #1010

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates TMUIPlugin.start() to avoid SWTError: Invalid thread access by deferring image-registry initialization to the UI thread when the Eclipse workbench is running (addressing issue #1010 seen in headless/LSP test scenarios).

Changes:

  • Replace direct image initialization in TMUIPlugin.start() with a dedicated initializeImages() helper.
  • Schedule TMImages initialization via an Eclipse UIJob when PlatformUI.isWorkbenchRunning() is true.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread org.eclipse.tm4e.ui/src/main/java/org/eclipse/tm4e/ui/TMUIPlugin.java Outdated
@sebthom

sebthom commented Jun 12, 2026

Copy link
Copy Markdown
Member

@akurtakov do you think a more idomatic solution would be to not initialize the image registry in the start method or async via UIJob but lazy like this?

 @Override
 protected void initializeImageRegistry(final ImageRegistry registry) {
      TMImages.initalize(registry);
  }

This change adjusts TMUIPlugin.start() to trigger a UI job for image initalization,
to avoid start-up exceptions when TMUIPlugin.start() is not called from a UI thread.

Fixes: eclipse-tm4e#1010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TMUIPlugin.start() throws SWTError when not called from UI thread

4 participants