Closed ingomohr closed 2 years ago
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/1/
It generally looks good. The corresponding nature test is here:
org.eclipse.core.tests.resources.NatureTest
I wonder if the ProjectEncodingPreferenceSeverityProvider is a bit overkill because I don't see a corresponding thing for the Nature checking; I think it's using package protected helper methods.
I'm not sure I understand the problems with deleting the markers. is the behavior you see different from deleting the marker for a missing nature?
Hello @merks . Sorry for the delay, and thank you for the response.
Apparently, you can't remove the "unknown nature" marker, either. Since this (to me) is inconsistant with the standard Eclipse behavior, in which you can remove problem markers (and that will turn up again once you've built the project again), I'll give it another round and see whether I can fix this for the new preference.
Thanks for the hint w/ the NatureTest
, too.
ProjectEncodingPreferenceSeverityProvider
and used static-"package protected"-method approach instead
** (consistency w/ the other impl)The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/4/
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/5/
Note that the tests that are failing all appear to pass on master:
Note that the tests that are failing all appear to pass on master:
Good morning, @merks . I'm on it. Those regression tests still boggle my mind atm, but this should be resolvable. :)
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/6/
ValidateProjectEncoding
.IResourceChangeListener
simply because I cannot register IPreferenceChangeListener
s via OSGi service.What do you think, @merks ?
@ingomohr Good question. I assume you'd need to listen to this one node in particular so the service would need to provide a fair bit of information to get the right preference node:
InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES);
@laeubi is likely to have some insights/thoughts about registering a preference listener as a service.
This area in the code accesses the instance preferences so that's probably the appropriate place to register a listener programmatically:
- Problem is now:
I'm not sure if I fully understand what the problem is, but here is an example registering the listeners via DS:
- Problem is now:
I'm not sure if I fully understand what the problem is, but here is an example registering the listeners via DS:
Hi @laeubi Thanks for the link. The problem is that the service accepts IResourceChangeListener
s. What I want to register, however, is not an IResourceChangeListener
but an IPreferenceChangeListener
.
resourceChanged
method - but that feels quite "hacky". :)So, what we imho need to decide (for the ticket #166 to which this PR refers):
IPreferenceChangeListener
s via service, tooResourcesPlugin
)?My 2 cents... Programmatically register to get this PR to closure. Then, if someone wants to work on being able to register a preference listener as a service, and that's feasible, they could do so and update this code accordingly.
My 2 cents... Programmatically register to get this PR to closure. Then, if someone wants to work on being able to register a preference listener as a service, and that's feasible, they could do so and update this code accordingly.
Thanks @merks, I'll do that.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/8/
Please don't register resourcechange listeners in the activator, this will most likely fail if the workspace is not ready yet. You don't need to implement any service when you create a component so something like:
@Component(service = {})
public class MyPreferenceChangeListener implements IPreferenceChangeListener {
@Reference
private IWorkspace workspace;
@Reference
private ILog log;
@Reference(target = IScopeContext.BUNDLE_SCOPE_FILTER)
IScopeContext bundleScope;
private IEclipsePreferences eclipsePreferences;
@Activate
public void register() {
eclipsePreferences = bundleScope.getNode(""); //$NON-NLS-1$
eclipsePreferences.addPreferenceChangeListener(this);
}
@Deactivate
public void unregister() {
eclipsePreferences.removePreferenceChangeListener(this);
}
}
should work here.
It's being done in the Workspace.open not in the activator... Other things access the INSTANCE scope preferences there already...
It's being done in the Workspace.open not in the activator... Other things access the INSTANCE scope preferences there already...
Yes and too much work is there already done, actually I won't add more things here if not absolutely necessary, registering a resource change listener is not such thing that requires early workspace access...
Thanks for the feedback. It's not a resource change listener, though. It's a prefs change listener. How do you suggest to register it?
Sorry, I missed the snippet above. Will try that approach.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/9/
ProjectEncodingPreferenceChangeListener
that initialized the workspace that was actually already injected.Performed manual integration tests w/ UI fork again. Still worked as expected.
@merks @laeubi : Quick question: From the old Gerrit-workflow I remember that the Eclipse projects were interested in having only one commit per issue. That's why I amended my commit for this PR all the time. Is this still what you want? (Amending commits typically makes re-reviews harder - at least that's my take-away from working w/ Bitbucket Server).
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/10/
@merks @laeubi : Quick question: From the old Gerrit-workflow I remember that the Eclipse projects were interested in having only one commit per issue. That's why I amended my commit for this PR all the time. Is this still what you want? (Amending commits typically makes re-reviews harder - at least that's my take-away from working w/ Bitbucket Server).
Yes, this is typically what people do. You can also do a chain of commits, and then squash and merge at the end:
@iloveeclipse Do you have any outstanding concerns? This looks good to go now...
@iloveeclipse Do you have any outstanding concerns? This looks good to go now...
I haven't tested/reviewed, but it looks like the new test isn't added to the test suite and so it will be not executed.
@ingomohr: it would be easier to validate this change for reviewers if you could push a PR for platform UI with the preference page change, even if it is not ready yet.
@iloveeclipse Do you have any outstanding concerns? This looks good to go now...
I haven't tested/reviewed, but it looks like the new test isn't added to the test suite and so it will be not executed.
@iloveeclipse You mean org.eclipse.core.tests.resources.AllTests
, yes? I would have added the test if I had known the test should be added there.
Just look around where other tests are included and add it. I have no IDE right now, but most of Eclipse tests are referenced by some testsuite.
ProjectEncodingTest
to suite org.eclipse.core.tests.resources.AllTests
.
ValidateProjectEncoding
to update existing markers's severityProjectEncodingPreferenceChangeListener
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/11/
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/11/
Now you see +10 tests: https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/11/testReport/org.eclipse.core.tests.resources/
Fine. Next, please throw away most listener related code as explained before.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/11/
Now you see +10 tests: https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/11/testReport/org.eclipse.core.tests.resources/
Fine. Next, please throw away most listener related code as explained before.
Yup. Seen those test results on Jenkins. DRY violating code is gone.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/12/
@ingomohr: it would be easier to validate this change for reviewers if you could push a PR for platform UI with the preference page change, even if it is not ready yet.
I created PR 220 for this.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/13/
What @iloveeclipse suggested does sound like a simplification. That being said, I do understand that it's starting to seem like each person that is asked for an opinion pushes in a different direction. That doesn't make contributing feel very rewarding but more of a gauntlet. I think we can all recognize that a lot of time has been invested here and if focused feedback had been provided early, the process would have been shorter.
What @iloveeclipse suggested does sound like a simplification. That being said, I do understand that it's starting to seem like each person that is asked for an opinion pushes in a different direction. That doesn't make contributing feel very rewarding but more of a gauntlet. I think we can all recognize that a lot of time has been invested here and if focused feedback had been provided early, the process would have been shorter.
Thank you for the update/feedback, @merks. That matches my feeling, too.
So, I'll drop the pref-change-listener-via-service approach and add that listener to the CharsetManager
. I'll do that tonight.
Please compare https://github.com/eclipse-platform/eclipse.platform.resources/pull/170 with current code. That does exactly same with less code / less complexity.
Please compare #170 with current code. That does exactly same with less code / less complexity.
Thanks for the hint, @iloveeclipse. The only thing I'm not keen on in your PR is the inner class for the preference change listener. I used a lambda implementation instead b/c it's much smaller. If you specifically want that inner class to happen, just let me know.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/14/
@trancexpress : Simeon, as you've originally wrote the code, could you please also look at the PR please? The corresponding part for the UI with new preference is https://github.com/eclipse-platform/eclipse.platform.ui/pull/220.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/15/
I tested the latest changes here and https://github.com/eclipse-platform/eclipse.platform.ui/pull/220/commits/39b6cd3edb7708d23798a2ee76dbcabbcbd5cf59, LGTM.
The plug-in customization line to disable the marker (I assume the only customization of interest):
org.eclipse.core.resources/missingEncodingMarkerSeverity=-1
Please mention this in the commit message.
(plug-in customization is specified with command line argument for Eclipse: -pluginCustomization /.../plugin_customization.ini
)
I tested the latest changes here and eclipse-platform/eclipse.platform.ui@39b6cd3, LGTM.
The plug-in customization line to disable the marker (I assume the only customization of interest):
org.eclipse.core.resources/missingEncodingMarkerSeverity=-1
Please mention this in the commit message.
(plug-in customization is specified with command line argument for Eclipse:
-pluginCustomization /.../plugin_customization.ini
)
I'm not sure I fully understand you here. I never heard of plug-in customization for preferences before. I updated the commit message (I hope) accordingly.
The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-167/17/
Introduces a new preference that enables to specify if and using which severity markers shall be added in case of missing project-specific encoding settings.
This is the PR of the fork for issue #166
Todo
Here's what I did
Change
ValidateProjectEncoding
classManual Integration Test
Thank you in advance for having a look at the PR!
Kind regards Ingo