Eclipse plugin development: Disabling Java Structure Compare when comparing files?

4 java eclipse eclipse-plugin

I used the following code to compare two files:

CompareConfiguration config = new CompareConfiguration();
config.setRightEditable(false);
config.setLeftEditable(false);
config.setLeftLabel("Klasse 1");
config.setRightLabel("Klasse 2");
config.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, Boolean.FALSE);

CompareUI.openCompareEditorOnPage(new EditorInput(config, file1, file2), page);
Run Code Online (Sandbox Code Playgroud)

This works and a compare editor is opened. But unfortunately, the Java Source Compare and the Java Structure Compare is openend. I want to permanently disable Java Structure Compare. How can I do that?

小智 6

Windows -> 首选项 -> 常规 -> 比较/补丁

取消选中“自动打开结构比较”。

应用并关闭。

参考


Fra*_* IV 3

尝试使用 CompareEditorInput(而不是 EditorInput),然后将其 Configuration 属性设置为 CompareConfiguration,您可以使用其构造函数之一设置首选项存储。ComparePreferences 优先进行结构比较(或者推测不进行)。