Open amitjoy opened 1 year ago
There's no such feature currently but it would be easy to add - until then the only possibility is to provide your own renderer for MWindow by subclassing "DefWindowRenderer" and "DefWindowRenderer.WWindowImpl" and overloading there "createWidget" (https://github.com/eclipse-efx/efxclipse-rt/blob/3.x/modules/ui/org.eclipse.fx.ui.workbench.renderers.fx/src/main/java/org/eclipse/fx/ui/workbench/renderers/fx/DefWindowRenderer.java#L456).
Of course you could also do all that using eg https://wiki.eclipse.org/Efxclipse/Runtime/e4#ELifecycleService
Maybe you want to provide a PR
@tomsontom Thanks a lot for your quick response! I have tried the following as an easy way to achieve this:
org.eclipse.fx.ui.workbench.services.lifecycle.LifecycleAddon
EFX_LC:bundleclass://com.osgifx.console.application/com.osgifx.console.application.lifecycle.WindowLifecycle
as a tag to the TrimmedWindow
elementpackage com.osgifx.console.application.lifecycle;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.fx.ui.workbench.renderers.base.widget.WWindow;
import org.eclipse.fx.ui.workbench.services.lifecycle.annotation.PreShow;
import javafx.stage.Stage;
public final class WindowLifecycle {
@PreShow
public void disableResizing(final MWindow window) {
final var stage = (Stage) (WWindow<?>) window.getWidget();
stage.setResizable(false);
}
}
and
Somehow, the lifecycle callback is not getting invoked at all whereas I debugged that the addon can successfully create the instance of the lifecycle class.
Do you have any idea why the lifecycle callback is not getting executed?
Eagerly looking forward to your further assistance.
As far as I debugged, for TrimmedWindow
, it requires a method with @InitContext
where MWindow
can not be injected.
Is there any easy way to disable window resizing? for example, using persisted properties, similar to Eclipse e4 with SWT where we can disable the resizing by setting
styleOverride
persisted property to the numeric value ofSWT.CLOSE | SWT.TITLE
.