Bug 575453 - Go to Resource disabled for markers without path
Summary: Go to Resource disabled for markers without path
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.21   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 4.22 M3   Edit
Assignee: Jörg Kubitz CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy, usability
Depends on:
Blocks: 575807
  Show dependency tree
 
Reported: 2021-08-17 07:13 EDT by Jörg Kubitz CLA
Modified: 2021-11-16 09:12 EST (History)
5 users (show)

See Also:


Attachments
Screenshot Problems View Context Menu.png (67.96 KB, image/png)
2021-08-17 07:14 EDT, Jörg Kubitz CLA
no flags Details
Initial state in pde perspective (221.19 KB, image/png)
2021-09-15 06:59 EDT, Lars Vogel CLA
no flags Details
After double-click (200.61 KB, image/png)
2021-09-15 06:59 EDT, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Kubitz CLA 2021-08-17 07:13:19 EDT
There are a lot JDT markers in the Problems View where the context menu action "Go to Resource" is not available. (see screenshot)

As far as i observed thats the case if and only if the "Path" field is empty (i.e. if the underlying resource has only 1 segment). Nevertheless there is a resource (the project) the action could jump to.

Can someone please fix that. It is so annoying to search for the project manual.
Comment 1 Jörg Kubitz CLA 2021-08-17 07:14:10 EDT
Created attachment 286958 [details]
Screenshot Problems View Context Menu.png
Comment 2 Andrey Loskutov CLA 2021-08-17 07:19:26 EDT
AFAIK PDE generates the warnings. It should be possible to link the warning to MANIFEST.MF.
Comment 3 Jörg Kubitz CLA 2021-08-17 07:31:32 EDT
(In reply to Andrey Loskutov from comment #2)
> AFAIK PDE generates the warnings. It should be possible to link the warning
> to MANIFEST.MF.

there are also errors like 
"Project '...' is missing required Java project:" | Build path | Build Path Problem
"The project cannot be built until build path errors are resolved" | Unknown 
| Java Problem

which are from JDT (JavaBuilder.isWorthBuilding()) directly.
They could link to the ".project" or ".classpath" file. However since those files are hidden by default i would prefer a jump to the Project in the Package Explorer if possible.
Comment 4 Andrey Loskutov CLA 2021-08-17 07:36:02 EDT
(In reply to Jörg Kubitz from comment #3)
> (In reply to Andrey Loskutov from comment #2)
> > AFAIK PDE generates the warnings. It should be possible to link the warning
> > to MANIFEST.MF.
> 
> there are also errors like 
> "Project '...' is missing required Java project:" | Build path | Build Path
> Problem
> "The project cannot be built until build path errors are resolved" | Unknown 
> | Java Problem
> 
> which are from JDT (JavaBuilder.isWorthBuilding()) directly.
> They could link to the ".project" or ".classpath" file. However since those
> files are hidden by default i would prefer a jump to the Project in the
> Package Explorer if possible.

Hidden files can be opened, that's not a big deal. Jumping to Project is not possible. Please create new bug per problem type that has no resource, it must be done by the marker creator, not by Problems UI after that.
Comment 5 Jörg Kubitz CLA 2021-08-17 07:46:16 EDT
(In reply to Andrey Loskutov from comment #4)
> Hidden files can be opened, that's not a big deal. 

yea, but then i would need a second step to "Show in"/"Project Explorer" or "Show in"/"Package Explorer" to be able to configure the project. But both Actions do not for with hidden files.

> Jumping to Project is not possible. 

That's what i ask to change.

> Please create new bug per problem type that has no resource,

Ok, i will - but there is a resource: the project!
Comment 6 Andrey Loskutov CLA 2021-08-17 08:00:44 EDT
(In reply to Jörg Kubitz from comment #5)
> (In reply to Andrey Loskutov from comment #4)
> > Hidden files can be opened, that's not a big deal. 
> 
> yea, but then i would need a second step to "Show in"/"Project Explorer" or
> "Show in"/"Package Explorer" to be able to configure the project. But both
> Actions do not for with hidden files.
> 
> > Jumping to Project is not possible. 
> 
> That's what i ask to change.
> 
> > Please create new bug per problem type that has no resource,
> 
> Ok, i will - but there is a resource: the project!

You can't "open" a project to fix it, not in the sense of "open resource".
Most issues you mention are pointing either to .manifest or .classpath files.

If you wish to allow any arbitrary action be triggered via "Go to resource", you probably want to change the "Go to resource" to generic "Show me something where I can fix that" and redesign how Problems view works, so it can open preferences dialogs etc.

Right now it requires a path to a *file*.
Comment 7 Jörg Kubitz CLA 2021-08-17 08:07:02 EDT
created Bug 575456
created Bug 575457
created Bug 575458
Comment 8 Jörg Kubitz CLA 2021-08-17 08:57:34 EDT
(In reply to Andrey Loskutov from comment #6)

> You can't "open" a project to fix it, not in the sense of "open resource".
> Most issues you mention are pointing either to .manifest or .classpath files.

I'd like to point them to those file then. 
Just in case someone create a Marker on a non IFile resource (as is), i would like "Go to Resource" to behave like "Show In"/"Package Explorer" or "Show In"/"Project Explorer" (what ever which explorer is open).
[added to org.eclipse.ui.internal.views.markers.ExtendedMarkersView.openMarkerInEditor(IMarker, IWorkbenchPage)]

Otherwise i would like to deprecate Resource.createMarker() and suggest the subclassed IFile.createMarker(). Because the current implementation feels incomplete.
Comment 9 Eclipse Genie CLA 2021-08-25 02:49:19 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/184395
Comment 10 Mickael Istria CLA 2021-08-25 02:55:58 EDT
What about hiding "Go to resource" and instead putting the whole "Show In" menu in case of non-IFile?
Comment 11 Jörg Kubitz CLA 2021-08-25 03:05:43 EDT
(In reply to Mickael Istria from comment #10)
> What about hiding "Go to resource" and instead putting the whole "Show In"
> menu in case of non-IFile?

There is a "Show In" menu. But as it requires to select a Handler it can not handle double click (which i typically use). 
I added the "show in" behaviour of the first handler to the double click.

I do not seed a need to hide "Go to resource" (and i dont know how to).
Comment 12 Mickael Istria CLA 2021-08-25 03:14:31 EDT
(In reply to Jörg Kubitz from comment #11)
> There is a "Show In" menu. But as it requires to select a Handler it can not
> handle double click (which i typically use). 
> I added the "show in" behaviour of the first handler to the double click.
> 
> I do not seed a need to hide "Go to resource" (and i dont know how to).

OK thanks. In any case, the context-menu not really the topic of this bug, so let's not bother with it.
Comment 14 Lars Vogel CLA 2021-09-15 06:59:12 EDT
Created attachment 287132 [details]
Initial state in pde perspective
Comment 15 Lars Vogel CLA 2021-09-15 06:59:36 EDT
Created attachment 287133 [details]
After double-click
Comment 16 Eclipse Genie CLA 2021-10-07 14:17:03 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/186289
Comment 18 Mickael Istria CLA 2021-10-20 11:15:43 EDT
Merged patch resolves the issue for reported.
Further issues should be tracked separately and new tickets be open for them in order to better identify best resolution for them.
Comment 19 Andrey Loskutov CLA 2021-10-20 11:51:23 EDT
(In reply to Mickael Istria from comment #18)
> Merged patch resolves the issue for reported.
> Further issues should be tracked separately and new tickets be open for them
> in order to better identify best resolution for them.

Could one provide a summary how exactly the system behavior is supposed to be now? I've followed discussion on gerrit but I still not sure what is merged without reading the code, which is not what I want to do now.
Comment 20 Mickael Istria CLA 2021-10-20 11:55:21 EDT
(In reply to Andrey Loskutov from comment #19)
> Could one provide a summary how exactly the system behavior is supposed to
> be now? I've followed discussion on gerrit but I still not sure what is
> merged without reading the code, which is not what I want to do now.

In the Java perspective, double-clicking on a marker which has no resource path will bring selection onto the project in the Project Explorer.
Comment 21 Andrey Loskutov CLA 2021-10-20 12:04:03 EDT
(In reply to Mickael Istria from comment #20)
> In the Java perspective, double-clicking on a marker which has no resource
> path will bring selection onto the project in the Project Explorer.

Thanks. It is not a typo: *Project* explorer, not *Package* Explorer? So it will be opened if not there by default, or if it is not opened, nothing happens?
Comment 22 Mickael Istria CLA 2021-10-20 12:06:37 EDT
(In reply to Andrey Loskutov from comment #21)
> Thanks. It is not a typo: *Project* explorer, not *Package* Explorer?

It is a typo, sorry. It's the "Package Explorer" that's targeted here.

> So it
> will be opened if not there by default, or if it is not opened, nothing
> happens?

That's a good question and I'm not sure about the expectation in this case; but the current implementation seems to open the view if it's closed.
This behavior seems good to me; but I don't have a strong opinion about it.
Comment 23 Lars Vogel CLA 2021-10-20 12:33:50 EDT
(In reply to Mickael Istria from comment #20)
> (In reply to Andrey Loskutov from comment #19)
> > Could one provide a summary how exactly the system behavior is supposed to
> > be now? I've followed discussion on gerrit but I still not sure what is
> > merged without reading the code, which is not what I want to do now.
> 
> In the Java perspective, double-clicking on a marker which has no resource
> path will bring selection onto the project in the Project Explorer.

And in the pde perspective it still opens Git repository view, I assume.
Comment 24 Mickael Istria CLA 2021-10-20 12:40:32 EDT
(In reply to Lars Vogel from comment #23)
> And in the pde perspective it still opens Git repository view, I assume.

Yes, but the issue should probably be reported to PDE or EGit as the "Show In" menu shows a symptom of the same root issue.
Comment 25 Lars Vogel CLA 2021-10-21 10:10:05 EDT
I suggest to revert this current fix and go with the additional configuration Jörg suggested.

I just tested this with a client who had Genuitec installed in one of his Eclipse. After downloading the latest SDK and double-clicking on a cycle error it tried to open the view from Genuitec even though it was not installed anymore. It gave an error "Could not initized view" or somethhing like that.

Genuitec is just one example, of course. We also have this weird behavior in the PDE perspective and most likely in other perspectives.

Better to introduce a new configuration option, rather than introduce unexplainable errors and behavior by re-using existing functionality.

WDYT?
Comment 26 Mickael Istria CLA 2021-10-21 10:25:31 EDT
(In reply to Lars Vogel from comment #25)
> I suggest to revert this current fix and go with the additional
> configuration Jörg suggested.
> 
> I just tested this with a client who had Genuitec installed in one of his
> Eclipse. After downloading the latest SDK and double-clicking on a cycle
> error it tried to open the view from Genuitec even though it was not
> installed anymore. It gave an error "Could not initized view" or somethhing
> like that.

Did you report this issue to Genuitec or whatever else is responsible of showing this error (could be Platform) ?

> Better to introduce a new configuration option, rather than introduce
> unexplainable errors and behavior by re-using existing functionality.
> WDYT?

I strongly disagree. What you faced is a bug that is not related to this issue. Most probably, using right-click > Show In > Genuitec view (or whatever the view was) would have resulted in the same error, independently of this patch.
We should fix bugs where they are instead of introducing public configuration APIs to workaround them.
Comment 27 Lars Vogel CLA 2021-10-21 10:40:56 EDT
(In reply to Mickael Istria from comment #26)
> (In reply to Lars Vogel from comment #25)
> > I suggest to revert this current fix and go with the additional
> > configuration Jörg suggested.

> I strongly disagree. What you faced is a bug that is not related to this
> issue. Most probably, using right-click > Show In > Genuitec view (or
> whatever the view was) would have resulted in the same error, independently
> of this patch.

No. The option to Open-with >  Genuitec view  was not available. The platform API did not show the view, as it was not installed. But the new functionality still did use it. So either the new functionality must also ignore that views are not installed anymore or be reverted.
Comment 28 Mickael Istria CLA 2021-10-21 10:42:51 EDT
(In reply to Lars Vogel from comment #27)
> The
> platform API did not show the view, as it was not installed. But the new
> functionality still did use it. So either the new functionality must also
> ignore that views are not installed anymore or be reverted.

OK thanks. I think the current code is missing a guard to verify the referenced view is registered.
@Jorg: can you please take care of this?
Comment 29 Jörg Kubitz CLA 2021-10-21 14:22:46 EDT
(In reply to Mickael Istria from comment #28)
> @Jorg: can you please take care of this?

It was good that you submitted my patch and Lars did try it in a real world usecase. We learned the hard way that the "take first" logic has dynamic behavior due to perspective contributors. That dynamic is not good. The double click action should always take me to the same fixed view per perspective. It needs to be configured per perspective. The only way is to extend the API for that. We should not make a default. 

Even though i am a frequent user of git perspective i do not know which view would best for the Git perspective. Selecting a resource in the git repository view did not help me in the past - the repository view feels like a dead end for solving problems associated with files/projects.
From a user perspective: I am using eclipse for Java and Java only. My wish as a Java user is that any perspective would lead me to the package explorer. I wish the java ide would be shipped with java-centric views only, i.e. having a Java-Git perspective.

Before starting on this bug i did not even know that perspectives have so much associated decisions. I always expected perspectives would only be a preconfigured set and layout of the available views. Now i learned they can totally change the available actions. I don't like that. 
However as long as that is the concept of perspectives the perspective owner should decide what a action is executed on a double-click - and not a perspective contributor as is.
Comment 30 Mickael Istria CLA 2021-10-21 14:53:06 EDT
@Lars: do you have details about how to reproduce the issue?
It seems to me that WorkbenchPage.getShowInPartIds can return invalid ids; and the various consumers in ShowInMenu to verify the existence of a view description for this id before adding it to the menu. So the code here should do the same thing.
Comment 31 Eclipse Genie CLA 2021-10-21 15:10:31 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/186789
Comment 32 Lars Vogel CLA 2021-10-22 03:05:37 EDT
(In reply to Jörg Kubitz from comment #29)
> (In reply to Mickael Istria from comment #28)
> > @Jorg: can you please take care of this?
> 
> It was good that you submitted my patch and Lars did try it in a real world
> usecase. We learned the hard way that the "take first" logic has dynamic
> behavior due to perspective contributors. That dynamic is not good. The
> double click action should always take me to the same fixed view per
> perspective. It needs to be configured per perspective. The only way is to
> extend the API for that. We should not make a default. 
> 
> Even though i am a frequent user of git perspective i do not know which view
> would best for the Git perspective. Selecting a resource in the git
> repository view did not help me in the past - the repository view feels like
> a dead end for solving problems associated with files/projects.
> From a user perspective: I am using eclipse for Java and Java only. My wish
> as a Java user is that any perspective would lead me to the package
> explorer. I wish the java ide would be shipped with java-centric views only,
> i.e. having a Java-Git perspective.
> 
> Before starting on this bug i did not even know that perspectives have so
> much associated decisions. I always expected perspectives would only be a
> preconfigured set and layout of the available views. Now i learned they can
> totally change the available actions. I don't like that. 
> However as long as that is the concept of perspectives the perspective owner
> should decide what a action is executed on a double-click - and not a
> perspective contributor as is.

I agree. Can you please push a Gerrit which adds this additional configuruation? Having one additional configuration option is not as bad as doing strange things  in some perspectives and depending on the installed plug-ins which we cannot control. As Eclipse is a extendable platform we cannot break existing functionality.
Comment 33 Eclipse Genie CLA 2021-10-22 04:21:51 EDT
New Gerrit change created: https://git.eclipse.org/r/c/pde/eclipse.pde.ui/+/186813
Comment 35 Mickael Istria CLA 2021-10-22 09:45:05 EDT
The "showInId" is not a good enough name if it applies only to markers; it should be "showContainerMarkersIn" or similar which clarifies the goal.
Or, if you want to keep this name, it should also applies to the "Show in" menu. Basically, this attribute should be used to prioritize one element over others in WorkbenchPage.getShowInPartIds so it's consistently used everywhere one would expect.
The value of the new flag should be stored and accessible in IPerspectiveDescriptor API like anything else so it becomes safer and more consistent to use it.
It seems to me that with the new patch, if some perspective doesn't define the "showInId", this feature will not work at all. So the benefit is lower for the wider world. If showInId is null, sticking to previous property of opening the first available view still makes sense; particularly for properties that do take care of sorting their extensions correctly.
Comment 36 Jörg Kubitz CLA 2021-10-22 10:05:04 EDT
(In reply to Mickael Istria from comment #35)
> The "showInId" is not a good enough name if it applies only to markers; it

Currently it is only used with markers. It does not prevent future uses in other usecases.

> It seems to me that with the new patch, if some perspective doesn't define
> the "showInId", this feature will not work at all. 

It just does not change anything. And that's good because we can not know if it makes sense in other perspectives: As far as i understand, the perspective owner has no influence how the perspective contributors change order of the showInId actions. Seems to be a pseudorandom order of contributors.
Comment 37 Mickael Istria CLA 2021-10-22 10:19:57 EDT
(In reply to Jörg Kubitz from comment #36)
> (In reply to Mickael Istria from comment #35)
> > The "showInId" is not a good enough name if it applies only to markers; it
> 
> Currently it is only used with markers. It does not prevent future uses in
> other usecases.

Either we already use it for other existing use-cases (show in menu) now, or we define it to be only for markers. As it's an API, we cannot just leave things in between and expect consumers will feel comfortable with it.

> It just does not change anything. And that's good because we can not know if
> it makes sense in other perspectives

OK

> As far as i understand, the
> perspective owner has no influence how the perspective contributors change
> order of the showInId actions. Seems to be a pseudorandom order of
> contributors.

That's really the exact same issue as the order in the show in menu; so we should aim for a unified solution.
Comment 38 Jörg Kubitz CLA 2021-10-22 11:19:11 EDT
(In reply to Mickael Istria from comment #37)

Other use-cases would be to use the automatic show-in action on other places that show references of one or more projects.

But i don't know any view that annoyed me as much as the problems view. I don't even know any other list that lists projects. The other views that i use all have a tree where the doubleclick would expand the project node.

I do not need the show-In Dialog to be sorted. But i am happy that i now do not need to open it anymore for problems.
Comment 40 Lars Vogel CLA 2021-10-25 02:47:20 EDT
Thanks, Jörg.

Please add to N&N.
Comment 41 Mickael Istria CLA 2021-10-25 04:25:33 EDT
As mentioned with more concrete details in other comments, the overall quality of the code and new API is not sufficient to consider it as resolved. I'll clean this up some time later.
Comment 42 Eclipse Genie CLA 2021-10-25 10:17:14 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/186894
Comment 44 Lars Vogel CLA 2021-10-26 03:09:28 EDT
Jörg, can you update the PDE config for latest change?
Comment 45 Eclipse Genie CLA 2021-10-26 03:26:14 EDT
New Gerrit change created: https://git.eclipse.org/r/c/pde/eclipse.pde.ui/+/186957
Comment 48 Lars Vogel CLA 2021-10-26 04:30:10 EDT
(In reply to Lars Vogel from comment #40)
> Thanks, Jörg.
> 
> Please add to N&N.

Jörg, please also create this entry in a way so that after developer knows how to update their perspective.
Comment 49 Eclipse Genie CLA 2021-10-26 04:43:58 EDT
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/186960
Comment 51 Mickael Istria CLA 2021-10-26 17:07:16 EDT
Thanks Jorg!
Comment 52 Vikas Chandra CLA 2021-11-11 05:54:28 EST
The image in N&N is greater than 800px.

As per instruction - "The image should be no more than 800 pixels wide"

Can you upload an image which is less than/ equal to 800px wide?
Comment 53 Eclipse Genie CLA 2021-11-15 02:19:15 EST
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/187726
Comment 55 Jörg Kubitz CLA 2021-11-15 02:32:06 EST
(In reply to Vikas Chandra from comment #52)
> The image in N&N is greater than 800px.

Thanks for the hint. Done. What needs to happen that the webpage shows the updated version?
https://www.eclipse.org/eclipse/news/4.22/platform.php
Comment 56 Eclipse Genie CLA 2021-11-16 09:12:15 EST
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/187784