Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BndEditor build.bnd: Plugin list should detect plugins by prefix #6069

Conversation

chrisrueger
Copy link
Contributor

Currently the Plugin list is empty when plugins are defined like:

-plugin.0.Main....
-plugin.1.Eclipse....
-plugin.9.Baseline....
image

This PR is supposed to change it, so that it becomes:

image

Additionally the MavenBndRepository should be a proper editor like this:

image

and finally shows plugins which are defined like
-plugin.6.Central
-plugin.7.Local

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
now when you click on it you see a dialog with input fields
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
before this change, saving the build.bnd file after changing something in the editor added a single fixed "-plugin" property instead of keeping the existing ones: e.g. -plugin.6.Central, -plugin.7.Local
Now the existing properties are kept / merged

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
removal is a bit more complicated now, since we have a Map<String,List<>>. so we need to iterate over the value lists to find the right entry.

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger chrisrueger marked this pull request as ready for review April 3, 2024 10:28
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Copy link
Member

@pkriens pkriens left a comment

Choose a reason for hiding this comment

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

Quite amazing you got this to work in so little code.

However, I think we need a generic solution in the BndEditModel for merged & inherited properties. Inherited properties should be greyed out but when you add properties it is important to realize they exist and what their value is. (Double clicking could open an editor on their file.)

It seems to screem for a MergedProperty class that handles this generically and can parameterize the type specific interactions? This is a common problem and I think it is a good idea to see how for example -buildpath would look like in this way?

Fantastic work! This has been a sore point forever.

@@ -967,14 +969,67 @@ public void setTestSuites(List<String> suites) {
}

public List<HeaderClause> getPlugins() {
return doGetObject(Constants.PLUGIN, headerClauseListConverter);
// return all plugins
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this works with inheritance of properties & bnd file properties? It is a powerful but nasty problem

 file 1->* 'plugin.*' property 0->* clause 

To make this work I think you need to model this as an object. When you edit a file, you can edit the local ones in the BndEditoModel but I think the inherited ones should be visible greyed out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should have a call about this, so I do not misunderstand. The method getPlugins() and the new getPluginsProperties() I added work only locally.

It looks like I could do

Set<String> propertyKeys = getProperties().getPropertyKeys(true); to also get inherited properties (instead of getAllPropertyNames()).

To me it seems that the BndEditModel is designed for the local physical file you are looking at. If we would like to visualize inherited properties , we should talk about how this should look like. Greyed out in the same TableViewer could be an idea, but maybe it makes it more complicated, since you need to distinguish between local properties and inherited properties.

Maybe an alternative idea would be an additional (collapsible if possible) non-editable TableViewer which only shows inherited stuff? That way we could treat it separately. Or we have a button saying "Show inherited" and then then all inherited plugins appear too, but editing is disabled?

Anyway, maybe I am misunderstanding or thinking too complicated :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have something in mind about your suggestion of MergedProperty class.
Are you basically talking about something like

  • public List<HeaderClause> getPlugins() {..} changing to public List<MergedProperty> getPlugins() {..}

so that all the stuff which I currently do with the Map<String, List<HeaderClause>> happens under the hood + all the inheritance stuff?

where MergedProperty has something like:

  • String .getKey() returns the local property key e.g. -plugin.1.MavenCentral
  • List<HeaderClause> .getHeaders()
  • boolean .isInherited() - returns false if it is only local. true otherwise
  • List<MergedProperty> getParent() - returns the parent which is inherited

Something like this?

Can you also shed some more light in the meaning of the term merged here? I have the feeling I have not a good understanding of that at the moment. e.g. is merging referring to merging of the List<HeaderClause> when they are defined under the same property key?

@@ -871,6 +871,23 @@
description="Disable verification of server's X509 certificate (insecure, for testing only!)" />
</plugin>

<plugin class="aQute.bnd.repository.maven.provider.MavenBndRepository"
Copy link
Member

Choose a reason for hiding this comment

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

I had no idea this existed!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean those sections in the _plugin.xml ?

Yes, that is how I came to this PR? I was trying the +-Button of the Plugins list, because I wanted to see what this is... because I have never seen anything in the Plugins list of my build.bnd. And tadaaa I saw that I could add repositories. Unfortunately I did not see the MavenRepo we are using.

We can later add also support for other repositories if needed. The xml I created from aQute.bnd.repository.maven.provider.Configuration. I guess we can do the same for aQute.bnd.repository.maven.pom.provider.PomConfiguration.

@chrisrueger chrisrueger marked this pull request as draft April 3, 2024 21:39
this is a kinda hacky attempt to achieve using a new MergedHeaderClause object which "knows" if it is from a local file or inherited from an included file. The name MergedHeaderClause does not really fit, but I intent to clean it up later.

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger
Copy link
Contributor Author

chrisrueger commented Apr 3, 2024

@pkriens I have pushed another commit

Inherited properties should be greyed out

image image

The last two plugins are inherited from included foo/bar.bnd. the ones above are from the current build.bnd in the editor.

This is a "hacky" attempt to implement

  • showing inherited plugins,
  • but grey out the ones which are inherited from another .bnd file
  • editing and removing is disabled for such greyed out entries
  • a tooltip is shown for the greyed out entries (see screenshot)

Although I created a class MergedHeaderClause which "knows" if the headerClause is from the local file or inherited I have a strong feeling it is not what you had in mind with

It seems to screem for a MergedProperty class that handles this generically and can parameterize the type specific interactions? This is a common problem and I think it is a good idea to see how for example -buildpath would look like in this way?

But let's discuss based on this and make it better from there.

* @return a map with a property keys and their plugins.
*/
public Map<String, List<MergedHeaderClause>> getPluginsProperties() {
// return all plugins
Copy link
Member

Choose a reason for hiding this comment

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

I think this logic should be moved to Processor, next to mergeProperties so it is easier to track when we make changes in one or the others. Since this is processor, I think we need a call like:

Processor.getMergedParts(String keyStem) : MergedPart(Processor p, String keyStem, String actualKey, String value)

We could even rewrite ( one day) the mergedProperties with this method. In the BndEditModel, you then turn each one into a number of constituent clauses that can be edited if the processor == the BndEditModel's processor. This would be similar to your MergedHeaderClause, but I would make it something like:

 MergedHeaderClause( MergedPart part, HeaderClause), `isLocal()` can check the part if it is the same Processor.

@chrisrueger
Copy link
Contributor Author

@pkriens I merged https://github.com/bndtools/bnd/pull/6073/files into master.

One thing I noticed while trying to adapt the new stuff is this exception.
It happens when I have a build.bnd opened, close the Eclipse debug instance and start it again.

I then see this.
image

2024-04-04 19:19:32,541 [main] ERROR org.eclipse.equinox.logger - Cannot invoke "aQute.bnd.build.Project.getPropertiesFile()" because "this.bndrun" is null
java.lang.NullPointerException: Cannot invoke "aQute.bnd.build.Project.getPropertiesFile()" because "this.bndrun" is null
	at aQute.bnd.build.model.BndEditModel.getOwner(BndEditModel.java:406)
	at aQute.bnd.build.model.BndEditModel.getPluginsProperties(BndEditModel.java:1030)
	at bndtools.editor.workspace.PluginsPart.refresh(PluginsPart.java:218)
	at org.eclipse.ui.forms.ManagedForm.doRefresh(ManagedForm.java:181)
	at org.eclipse.ui.forms.ManagedForm.refresh(ManagedForm.java:171)
	at org.eclipse.ui.forms.editor.FormPage.setActive(FormPage.java:139)
	at org.eclipse.ui.forms.editor.FormEditor.pageChange(FormEditor.java:495)
	at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1030)
	at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:612)
	at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:518)
	at bndtools.editor.BndEditor.showHighestPriorityPage(BndEditor.java:494)
	at bndtools.editor.BndEditor.addPages(BndEditor.java:457)
	at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:143)
	at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:333)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:158)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:96)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:365)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:995)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:960)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:403)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:330)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:995)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1209)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:116)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:677)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$1.run(PartRenderingEngine.java:544)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:528)
	at org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer.createWidget(ElementReferenceRenderer.java:73)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:995)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveRenderer.processContents(PerspectiveRenderer.java:51)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:82)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:116)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:64)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:677)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:658)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1083)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.bndtools.applaunch.BndApplicationLauncher.lambda$0(BndApplicationLauncher.java:34)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at aQute.launcher.Launcher.handleMainCallable(Launcher.java:464)
	at aQute.launcher.Launcher.launch(Launcher.java:437)
	at aQute.launcher.Launcher.run(Launcher.java:185)
	at aQute.launcher.Launcher.main(Launcher.java:161)
	at aQute.launcher.pre.EmbeddedLauncher.executeWithRunPath(EmbeddedLauncher.java:169)
	at aQute.launcher.pre.EmbeddedLauncher.findAndExecute(EmbeddedLauncher.java:134)
	at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:51)
2024-04-04 19:19:32,553 [main] ERROR org.eclipse.equinox.logger - Error in run listener
java.lang.NullPointerException: Cannot invoke "aQute.bnd.build.Run.getPropertiesFile()" because "run" is null
	at bndtools.m2e.MavenRunListenerHelper.getResource(MavenRunListenerHelper.java:42)
	at bndtools.m2e.MavenImplicitProjectRunListener.end(MavenImplicitProjectRunListener.java:28)
	at bndtools.launch.util.LaunchUtils.endRun(LaunchUtils.java:120)
	at bndtools.editor.BndEditor.dispose(BndEditor.java:729)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:165)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:96)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:365)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:995)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:960)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:403)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:330)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:995)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1209)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:116)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:677)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$1.run(PartRenderingEngine.java:544)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:528)
	at org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer.createWidget(ElementReferenceRenderer.java:73)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:995)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveRenderer.processContents(PerspectiveRenderer.java:51)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:82)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:116)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:64)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:677)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:72)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:658)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1083)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.bndtools.applaunch.BndApplicationLauncher.lambda$0(BndApplicationLauncher.java:34)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at aQute.launcher.Launcher.handleMainCallable(Launcher.java:464)
	at aQute.launcher.Launcher.launch(Launcher.java:437)
	at aQute.launcher.Launcher.run(Launcher.java:185)
	at aQute.launcher.Launcher.main(Launcher.java:161)
	at aQute.launcher.pre.EmbeddedLauncher.executeWithRunPath(EmbeddedLauncher.java:169)
	at aQute.launcher.pre.EmbeddedLauncher.findAndExecute(EmbeddedLauncher.java:134)
	at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:51)
2024-04-04 19:19:33,852 [Bnd-Executor,pool-3-thread-7] ERROR bndtools.central.Central - onAnyWorkspaceAsync callback failed
java.lang.IllegalStateException: FormToolkit has been disposed
	at org.eclipse.ui.forms.widgets.FormToolkit.checkDisposed(FormToolkit.java:1014)
	at org.eclipse.ui.forms.widgets.FormToolkit.createImageHyperlink(FormToolkit.java:419)
	at bndtools.editor.workspace.WorkspaceMainPart.lambda$0(WorkspaceMainPart.java:152)
	at bndtools.central.Central.lambda$9(Central.java:383)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4318)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3941)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.bndtools.applaunch.BndApplicationLauncher.lambda$0(BndApplicationLauncher.java:34)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at aQute.launcher.Launcher.handleMainCallable(Launcher.java:464)
	at aQute.launcher.Launcher.launch(Launcher.java:437)
	at aQute.launcher.Launcher.run(Launcher.java:185)
	at aQute.launcher.Launcher.main(Launcher.java:161)
	at aQute.launcher.pre.EmbeddedLauncher.executeWithRunPath(EmbeddedLauncher.java:169)
	at aQute.launcher.pre.EmbeddedLauncher.findAndExecute(EmbeddedLauncher.java:134)
	at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:51)
2024-04-04 19:19:33,940 [Worker-2: Load repositories] INFO  a.b.d.repository.ReporterLogService - Local not saving because files are identical except increment

I can the close the build.bnd and reopen it again, and then everything is fine.

@chrisrueger
Copy link
Contributor Author

chrisrueger commented Apr 4, 2024

@pkriens I experimented a bit with the Processor.getPropertyKeys(Predicate) and Processor.getMergePropertyKeys(stem)

Here is what I did in BndEditModel:

Processor owner = getOwner();
List<PropertyKey> propertyKeysO = owner.getPropertyKeys(key -> key.startsWith(Constants.PLUGIN));

in getPropertyKeys() I added some debug output inside the while loop to see whats going on:

System.out.println(
				"level: " + localLevel + " propFile: " + localRover.getPropertiesFile() + " localRover: " + "id=("
					+ System.identityHashCode(localRover) + " " + localRover + " keys:" + list);
image
Processor owner = getMergePropertyKeys id:1334679764
level: 0 propFile: /cnf/build.bnd localRover: id=(1334679764 build.bnd keys:[-plugin.4.Test, -plugin.6.Central, -plugin.foo, -plugin.7.Local]
level: 1 propFile: null localRover: id=(546604699 Workspace [bndtools.core] keys:[-plugin.6.Central, -plugin.foo, -plugin.4.Test, -plugin.7.Local]
level: 2 propFile: null localRover: id=(1039960084  keys:[]
level: 3 propFile: null localRover: id=(1192082665  keys:[]
  • You see it traverses a chain of 4 levels
  • level 0 and level 1 contain the same keys (but different order) - odd?
  • level 1 Processor (the parent) is "Workspace" ... the other processes don't print a name in toString and it has all the properties again. (is this expected?)

Important:

  • key=-plugin.foo`` is coming from an -include:foo/bar.bnd. So it is not physically written in `build.bnd`

It seems that rover.stream(false) // local only is not only pulling local stuff, but also included stuff.
ok I can understand that an -include might be local for a Processor but in terms of "what is inside the actual build.bnd file, it is not local.

Why is this a problem?

PropertyKey.isLocalTo(processor) seems to have a different meaning of local than my previous approach:

boolean isLocal = doGetObject(pk.key(), headerClauseListConverter) != null;

The latter gives me "true" for everything physically in the build.bnd file.
key=-plugin.foo`` is not physically in the build.bnd file (it is in `-include:foo/bar.bnd`). So it is not local for the purpose of the editor.

That means, the new stuff does not give me an advantage over my previous approach. I was hoping the the new PropertyKey.isLocalTo() is the same as boolean isLocal = doGetObject(pk.key(), headerClauseListConverter) != null;

What's next

Just wanted to write this down. It helps me to think this more through.
Let's discuss my findings during the next days/

  • Maybe I am just using it wrong.
  • or we are using the wrong words (locally in the physical file build.bnd vs locally for the current processor, which also reads -includes)
  • or my expectations are wrong

@chrisrueger
Copy link
Contributor Author

Thinking out loud.... Adding to the above:
It seems the BndEditModel.properties is special. Because it is the only properties object I found in all the above which is purely loaded un-process(or)ed from the build.bnd

properties.load(inputStream);

image

... so it contains the pure content of that file...without any inheritance or include loading.

Maybe the Processor or PropertyKey also needs something like those unprocessed properties.

@pkriens
Copy link
Member

pkriens commented Apr 5, 2024

I had the nagging feeling this would happen. The same is also true for the ext directory, they are 'included' in the build.bnd.

The only way to detect, as we had discussed, is to look in the edit model. It actually reflects the contents in the editor. So you cannot use isLocal in your case, the original method you had was better.

I'll fix the NPE and see why it is null.

@pkriens
Copy link
Member

pkriens commented Apr 5, 2024

I prefer not to add the information if a property is from the file or not. This would involve a lot of work and somehow it makes intuitive sense to use the BndEditModel for this since it is really on the file. Trying to track the pedigree of properties feels like a rats nest.

@chrisrueger
Copy link
Contributor Author

chrisrueger commented Apr 5, 2024

I prefer not to add the information if a property is from the file or not. This would involve a lot of work and somehow it makes intuitive sense to use the BndEditModel for this since it is really on the file. Trying to track the pedigree of properties feels like a rats nest.

Understandable and totally fine for me.

But, the only thing I am wondering now:

  • for my specific problem I do not get much value from the new PropertyKey. In fact also the duplicates in the list cause more problems. the "old" Set<String> processor.getPropertyKeys(true) removed the duplicates. At least in my case this is what I needed. I could then filter out the local ones.

Do you see use-cases where the new List<PropertyKeys> (which contains duplicates... from different processors) has a value? Maybe you already have something in mind where you need exactly this behavior.

BndEditModel for this since it is really on the file

Given this statement, I wonder if we should reevaluate the requirement to show greyed out (non-in-the-file) plugins in the plugin list.

Although I can understand the wish to see them, I don't know if it somehow blurs the line between being

  • a) "local on the file"
    vs.
  • b) showing an effective combined list of plugins where only a subset is local to the file.

b) adds a certain complexity and derives from the current "what you see is what you get" behavior of the BndEditor.
Maybe this is a bit philosophical, but maybe it is ok for an "editor" to only show the local list for the file you have opened. Maybe the effective list is something which is interesting to see "somewhere", but maybe not in an "editor"?

I don't want to discuss away what we have. I already have the 'greyed out' stuff implemented. I just see that it is more complex than the initial approach (only local stuff).

- PropertyKey.filterVisible(List<PK> )
- show name + propertyKey.key in plugin list
- hide plugin properties and show as tooltip instead

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger
Copy link
Contributor Author

@pkriens see cd6147f with my additions of stuff we talked about earlier.

image

adding new plugins was broken
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger chrisrueger marked this pull request as ready for review April 5, 2024 14:34
@chrisrueger chrisrueger requested a review from pkriens April 5, 2024 14:34
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
we can now add a "helpUrl" attribute to the plugin in _plugin.xml which opens a browser with the website. so we allow to learn more about a plugin

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
let's at least show some helpful page in case a plugin author did not include a custom url

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
- so that it appears in the UI
- improve some default values
- sort MavenBndRepo as first

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger
Copy link
Contributor Author

I did the following additions:

  • added more repository plugins to the list: POMRepository and P2Repository and moved MavenBndRepo to the top (since this is mentioned in most tutorials, it may be the first / default? )
image
  • make the Help Button work and open the Manual page in the browser. For that I introduced a helpUrl parameter in _plugin.xml where the repositories are defined
image

I thinks this is ready for review / merge now. @pkriens

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger
Copy link
Contributor Author

Hi @pkriens , how do we want to proceed here?

@pkriens
Copy link
Member

pkriens commented Apr 9, 2024

Hi, I haven't forgotten you. However, I spent a lot of time making the BndEditModel clean. I have a test case in the resolver where I can't figure out why I get 4 bundles in the old case and only 2 in the new case. The Processor is identical and the debug trace is identical :-( Drives me crazy.

Then there was an issue with project creation which I urgently needed to fix.

I am ok to merge this. I will then take this and integrate the new BndEditModel and then we can see where we are. Ok?

@chrisrueger
Copy link
Contributor Author

@pkriens no problem. Merging is totally fine if you don't see any obvious things. Thanks.

@pkriens pkriens merged commit 5d721aa into bndtools:master Apr 9, 2024
9 checks passed
@chrisrueger
Copy link
Contributor Author

Thanks Peter.

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.

None yet

2 participants