Skip to content

Problem during restore of ClassFileEditor#2348

Closed
mehmet-karaman wants to merge 1 commit into
eclipse-jdt:masterfrom
mehmet-karaman:master
Closed

Problem during restore of ClassFileEditor#2348
mehmet-karaman wants to merge 1 commit into
eclipse-jdt:masterfrom
mehmet-karaman:master

Conversation

@mehmet-karaman

Copy link
Copy Markdown
Contributor

#2347

  • added delayed restoring of the IEditorInput.
  • added functionality to check if the IClasspathContainers are fully resolved for the given project.
  • added unit tests.

- added delayed restoring of the IEditorInput.
- added functionality to check if the IClasspathContainers are fully
resolved for the given project.
- added unit tests.

See eclipse-jdt#2245

@laeubi laeubi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this PR actually goes in the right direction but it is made to complicated and requires new API that is not necessary.

See the following PR:

if you have this, then all that is needed is here

if (!javaProject.exists() || !javaProject.isOnClasspath(file)) {
				throw new CoreException(JavaUIStatus.createError(
						IJavaModelStatusConstants.INVALID_RESOURCE,
						JavaEditorMessages.ClassFileEditor_error_classfile_not_on_classpath,
						null));
}

If one disables this check (and another one in Openable), then the class editor already is able to show the file (but without sources). If one now registers a listeners that informs the Editor on changes to the project one can refresh the editor document and everything works smooth (regardless of what is the problem that the input is not there).

@laeubi

laeubi commented Jul 17, 2025

Copy link
Copy Markdown
Contributor

@mehmet-karaman I have now created a example here that shows how the case can be handled without any additional public API as described in the previous comment, if one would handle the TODOs properly the Class Editor will work even in the event of early restore from memeto:

@mehmet-karaman

Copy link
Copy Markdown
Contributor Author

Thanks I am going to check that.

@mehmet-karaman

Copy link
Copy Markdown
Contributor Author

This can be also closed now.

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.

2 participants