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

[WIP] Merge KEITH features #49

Merged
merged 377 commits into from
Sep 18, 2020
Merged

[WIP] Merge KEITH features #49

merged 377 commits into from
Sep 18, 2020

Conversation

soerendomroes
Copy link
Member

@soerendomroes soerendomroes commented Jul 9, 2020

Can only be merged after an ELK release and should use ELK 0.7.0, Xtext 2.20 and at least eclipse 2019-12.

ConnorObrian and others added 30 commits June 12, 2019 14:40
Empty stub for setStaticConstraint was added to the LanguageServerExtension.
refreshLayout was added to the LanguageServerExtension and implemented. It is called in order that nodes snap back if no constraint was set.
Additionally, methods were added to shorten the retrieval and setting of constraints.
The last commit did not work without the StaticConstraint class that I forgot to commit
NiklasRentzCAU and others added 14 commits August 18, 2020 10:19
This extension point allows any projects wanting to extend any KLighD
behavior for different run configurations to only need to register this
extension once via Eclipse extension and via Java ServiceLoader in
META-INF/services and programatically register everything needed in the
implementation of this extension with the KLighD API for registering
extensions programmatically.
Instead of throwing exceptions, a message model displaying that no model
is in the editor is shown.
Merge remote-tracking branch 'origin/keith' into mainThreadQueue

Conflicts:
	plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend
klighd.lsp: Added main thread queue for SWT and AWT calls.
Moved the initialization and loading of all extensions into the static
part after creating the instance, so that the startupHook extension may
use the instance and modify it directly.
Copy link
Member

@sailingKieler sailingKieler left a comment

Choose a reason for hiding this comment

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

I found a few things, none of them are major things, of course, but please have a look and fix esp. the out-dated javadocs.

if (injector == null) {
injector = new KGraphStandaloneSetup().createInjectorAndDoEMFRegistration();
}
return injector;
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK keeping the injector in a field is not required, as it's kept in KGraphStandaloneSetupGenerated.
Just remove the return type void and everything behaves as expected ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

We keep the injector in a field to avoid that the KGraphIdeModule, which is registered in the KGraphIdeSetup is removed from the injector by someone who calls doSetup without ide modules in mind. I suggest to leave it this way to avoid future complications.

@@ -13,6 +13,7 @@ Require-Bundle: org.eclipse.emf.ecore.xmi,
de.cau.cs.kieler.klighd.piccolo,
org.eclipse.elk.alg.common;resolution:=optional,
org.eclipse.elk.alg.force;resolution:=optional,
org.eclipse.elk.alg.graphviz.dot,
Copy link
Member

Choose a reason for hiding this comment

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

Is it really necessary that this dependency is non-optional?
Why is it required at all?

Copy link
Member

Choose a reason for hiding this comment

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

I will change it to being optional, I did not see that the others were optional as well when adding this dependency. It is required, as the LayoutMetaDataService called by the KlighdStandaloneSetup will load all ILayoutMetaDataProvider via ServiceLoader and will not be able to instanciate the GraphvizMetaDataProvider, as it has a dependency to graphviz.dot which will otherwise not be included.

@@ -68,8 +68,6 @@ public void doInitialize() {
);

KlighdDataManager.getInstance()
.registerUpdateStrategy(SimpleUpdateStrategy.ID, new SimpleUpdateStrategy())
.registerViewer(PiccoloViewer.ID, new PiccoloViewer.Provider())
Copy link
Member

Choose a reason for hiding this comment

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

Is there any replacement for this deletion? AFAIR it is required for running unit tests in non-Eclipse mode.

Copy link
Member

Choose a reason for hiding this comment

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

Now that all update strategies and viewers can be registered via service loader and via extension point, registering these manually is not needed anymore. The simple update strategy is registered via extension point and service loader and will therefore be registered by the KlighdDataManager by default. The PiccoloViewer should not be registered here, as not all projects using the standalone setup (i.e., the KLighD Language Server) use it, it should not be registered therefore. I guess it should also be registered via extension point/service loader in the Piccolo Plugin therefore, however I don't see that happening there yet. I will look into that.

Copy link
Member

Choose a reason for hiding this comment

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

I'm with the changed registration of the SimpleUpdateStrategy, but I would advocate a registration of the (non-UI) PiccoloViewer.Provider in the klighd.piccolo.test project. Do you agree?

Copy link
Member

Choose a reason for hiding this comment

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

Currently, that Provider is registered in

<viewer
class="de.cau.cs.kieler.klighd.piccolo.viewer.PiccoloViewer$Provider"
id="de.cau.cs.kieler.klighd.piccolo.viewer.PiccoloViewer">
</viewer>
, too, so having a corresponding service loader-based registration would be good.

Copy link
Member

Choose a reason for hiding this comment

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

Seems good to have it registered in the test plugins where it is needed instead of in the standalone setup. I will implement that tomorrow.

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

Done. The PiccoloViewer$Provider is now registered via Extension Point and via Service Loader in the klighd.test and klighd.piccolo.test plugins.

@@ -3,6 +3,7 @@
<plugin>
<extension-point id="extensions" name="Compound extension point for all kinds of extensions" schema="schema/extensions.exsd"/>
<extension-point id="diagramSyntheses" name="Diagram syntheses registering point" schema="schema/diagramSyntheses.exsd"/>
<extension-point id="klighdStartupHook" name="Startup Hook for KLighD" schema="schema/klighdStartupHook.exsd"/>
Copy link
Member

Choose a reason for hiding this comment

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

We agreed on having the startupHooks as an extension type within the extensions point declared above, right?

Copy link
Member

Choose a reason for hiding this comment

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

Yes we did, and it is implemented as such. I guess I overlooked this reference when removing it again. Will remove.

@@ -201,7 +201,7 @@ private DiagramLayoutOptions() {
/**
* @see CoreOptions#PORT_LABEL_PLACEMENT
*/
public static final IProperty<PortLabelPlacement> PORT_LABEL_PLACEMENT =
public static final IProperty<EnumSet<PortLabelPlacement>> PORT_LABEL_PLACEMENT =
Copy link
Member

Choose a reason for hiding this comment

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

That's an API breaking change, right? Did that change happen in ELK, too?

Copy link
Member

Choose a reason for hiding this comment

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

Has the corresponding change in ELK been released?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this was released in ELK 0.7.0

@sailingKieler
Copy link
Member

I don't have time for a detailed review this week, but I guess you guys did the changes carefully.

@@ -16,7 +16,7 @@
<dependencies>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.core.service</artifactId>
<artifactId>org.eclipse.elk.core</artifactId>
Copy link
Member Author

Choose a reason for hiding this comment

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

Why do you remove elk.core.service here? Is it not needed?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the dependencies in the manifest, this dependency was wrong in the first place (the .service part is not required there, but the elk.core bundle directly). Furthermore, the only class in the package has only dependencies to elk.core and not elk.core.service, so this is correct like this.
Looking at the last build with this here also shows some issue in the maven build with this dependency, which is resolved with this change.

Copy link
Member

Choose a reason for hiding this comment

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

This change is wrong, as the class LightDiagramServices requires DiagramLayoutEngine from elk.service, see

final DiagramLayoutEngine engine = new KlighdLayoutSetup().getDiagramLayoutEngine();
final IStatus status;
if (Klighd.IS_PLATFORM_RUNNING) {
final IElkCancelIndicator cancelationIndicator =
thePart != null ? new DispositionAwareCancelationHandle(thePart) : null;
status = engine.layout(thePart, diagramPart, cancelationIndicator, layoutParameters)
.getProperty(DiagramLayoutEngine.MAPPING_STATUS);
} else {
final IElkProgressMonitor progressMonitor = new NullElkProgressMonitor();
status = engine.layout(thePart, diagramPart, progressMonitor, layoutParameters)
.getProperty(DiagramLayoutEngine.MAPPING_STATUS);
}

For compiling elk.service is include via a Manifest dependency.
For this reason, elk.service is been published to maven central, see eclipse/elk#511
This, please re-add the dependency to elk.service, otherwise Klighd won't work in standalone mode "out-of-the-box".

Copy link
Member

@sailingKieler sailingKieler Sep 21, 2020

Choose a reason for hiding this comment

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

Wrt.

Furthermore, the only class in the package has only dependencies to elk.core and not elk.core.service, so this is correct like this.

This project with its dependencies serves as a so-called Bill-Of-Materials (BOM), see https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms

The aim is that only a dependency to this project is required in order to bring Klighd to work.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, I did not know abot the BOM behavior of the project, so this makes sense as it was before. The initial reason why I changed this though is because the build suddenly broke as mentioned before and seen here and this at least fixed the Maven build again.
The issue in the build is summarized in the logs:

No versions are present in the repository for the artifact with a range [4.5.1,6.0.0)
  com.sun.jna:com.sun.jna:jar:null

from the specified remote repositories:
  klighd (http://kieler.github.io/KLighD/repo, releases=true, snapshots=true),
  central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
Path to dependency: 
	1) de.cau.cs.kieler.klighd:de.cau.cs.kieler.klighd.standalone:pom:2.0.0.v20200918
	2) org.eclipse.elk:org.eclipse.elk.core.service:jar:0.7.0
	3) org.eclipse.platform:org.eclipse.ui.workbench:jar:3.110.0
	4) org.eclipse.platform:org.eclipse.e4.ui.workbench.addons.swt:jar:1.3.1100
	5) org.eclipse.platform:org.eclipse.e4.ui.workbench.renderers.swt:jar:0.14.1300
	6) org.eclipse.platform:org.eclipse.e4.ui.workbench.swt:jar:0.14.1100
	7) org.eclipse.platform:org.eclipse.urischeme:jar:1.1.100

As I now tracked this down, the Issue is only has nothing to do with the merge of keith and would have occured otherwise as well because of the org.eclipse.urischeme transitive dependency of elk.core.service, which had a new release 1.1.100 on Sept. 16th and introduced a new dependency to com.sun.jna version [4.5.1,6.0.0), which is not available on Maven Central. Only a previous version 3.0.5 is available there with a note to use net.java.dev.jna instead (see here).
As this new dependency is automatically resolved by maven, the build currently fails when re-adding the dependency to elk.core.service again.

I don't quite know enough about maven's own dependency management, as we otherwise only use the depenendy mechanism of tycho, so have not found a solution to this problem yet. Do you know how to resolve this now-broken transitive dependency? Sadly, this seems to be blocking the next KLighD release.

Copy link
Member

Choose a reason for hiding this comment

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

As this problem also affects the ELK nightly build, I submitted an Issue on the Eclipse bug tracker:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=567244

Copy link
Member

Choose a reason for hiding this comment

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

Do you know how to resolve this now-broken transitive dependency? Sadly, this seems to be blocking the next KLighD release.

Can we have a call on that today (Sept 23rd) afternoon?

@NiklasRentzCAU NiklasRentzCAU merged commit cc19356 into master Sep 18, 2020
@NiklasRentzCAU NiklasRentzCAU deleted the keith branch August 7, 2024 13:35
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.

5 participants