问题
We switched to e4 target platform. One editor has became horrible slow with rendering (about 20 seconds to layout). When a modal dialog is opened from the editor-menu, the application flickers like having an epileptical fit.
When we turn off css, by ...
DefaultScope.INSTANCE.getNode("org.eclipse.e4.ui.workbench.renderers.swt")
.put("themeEnabled", "false");
in the plugin, the rendering is very fast (<10ms), like it used to be under the previous target platform.
this is the control that i have embedded into the editor (for evaluation reasons):
package xyz;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
public class BigControl extends Composite {
public BigControl(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(23, false));
for (int i=0; i<100; i++) {
for (int j=0; j<23; j++) {
new Label(this, SWT.NONE).setText("|" + Integer.toString(i) + " " + Integer.toString(j) + "|");;
}
}
}
}
has anybody experience with that problem? Yes, we know that a table would be better for such amount of data, but refactoring that would cost too much at the moment.
The second problem is, when we turn off the theme functionality, eclipse / swt brings up exceptions when switching perspectives, views and so on.
回答1:
OK, we replaced the target platform by a newer one (2019-3). I was not aware about using an older platform.
The flickering stopped, it is still not fast (resizing the window takes about 2 seconds), but it is acceptable for the moment.
Thank you for your help,
Best, Martin
回答2:
... to make things clear, I created a brand new application by the eclipse wizard (... having a view).
I replaced the sample views code by that - as I mentioned, when we turn off css/theming (see code above), everything is fine - otherwise it doesn't stop to shake, it is even hard to get the mouse pointer back to eclipse to stop the app:
package xyz;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.ViewPart;
public class View extends ViewPart {
public static final String ID = "xyz.view";
public class BigControl extends Composite {
public BigControl(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(23, false));
for (int i=0; i<100; i++) {
for (int j=0; j<23; j++) {
new Label(this, SWT.NONE).setText("|" + Integer.toString(i) + " " + Integer.toString(j) + "|");;
}
}
}
}
@Override
public void createPartControl(Composite parent) {
new BigControl(parent, SWT.NONE);
}
@Override
public void setFocus() {
}
}
来源:https://stackoverflow.com/questions/55403749/editors-with-many-widgets-have-horrible-performance