From eb1544b8f17bc2f0efbe5685ad801127620a78c3 Mon Sep 17 00:00:00 2001 From: Vladyslav Zhukovskyi Date: Sat, 12 Feb 2022 15:55:30 +0200 Subject: [PATCH] Get rid of patch PRJ-452.patch as far as it moved to plugin Signed-off-by: Vladyslav Zhukovskyi --- patches/projector-client/PRJ-452.patch | 50 ------------------- .../ide/IdeFrameConfigurationService.kt | 29 +++++++++++ .../src/main/resources/META-INF/plugin.xml | 1 + 3 files changed, 30 insertions(+), 50 deletions(-) delete mode 100644 patches/projector-client/PRJ-452.patch create mode 100644 plugins/devfile-plugin/src/main/kotlin/che/incubator/ide/IdeFrameConfigurationService.kt diff --git a/patches/projector-client/PRJ-452.patch b/patches/projector-client/PRJ-452.patch deleted file mode 100644 index 18538dd2..00000000 --- a/patches/projector-client/PRJ-452.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/projector-client-web/src/main/kotlin/org/jetbrains/projector/client/web/window/Window.kt b/projector-client-web/src/main/kotlin/org/jetbrains/projector/client/web/window/Window.kt -index 68bcf44..ccf6a84 100644 ---- a/projector-client-web/src/main/kotlin/org/jetbrains/projector/client/web/window/Window.kt -+++ b/projector-client-web/src/main/kotlin/org/jetbrains/projector/client/web/window/Window.kt -@@ -24,6 +24,7 @@ - package org.jetbrains.projector.client.web.window - - import kotlinx.browser.document -+import kotlinx.browser.window - import kotlinx.dom.addClass - import org.jetbrains.projector.client.common.SingleRenderingSurfaceProcessor - import org.jetbrains.projector.client.common.canvas.DomCanvas -@@ -38,10 +39,12 @@ import org.jetbrains.projector.client.web.state.ClientAction - import org.jetbrains.projector.client.web.state.ClientStateMachine - import org.jetbrains.projector.client.web.state.LafListener - import org.jetbrains.projector.client.web.state.ProjectorUI -+import org.jetbrains.projector.common.protocol.data.CommonIntSize - import org.jetbrains.projector.common.protocol.data.CommonRectangle - import org.jetbrains.projector.common.protocol.data.CursorType - import org.jetbrains.projector.common.protocol.toClient.WindowData - import org.jetbrains.projector.common.protocol.toClient.WindowType -+import org.jetbrains.projector.common.protocol.toServer.ClientResizeEvent - import org.jetbrains.projector.common.protocol.toServer.ClientWindowCloseEvent - import org.jetbrains.projector.common.protocol.toServer.ClientWindowMoveEvent - import org.jetbrains.projector.common.protocol.toServer.ClientWindowResizeEvent -@@ -122,6 +125,7 @@ class Window(windowData: WindowData, private val stateMachine: ClientStateMachin - - if (windowData.windowType == WindowType.IDEA_WINDOW || windowData.windowType == WindowType.POPUP) { - canvas.style.border = "none" -+ setMaximized() - } - else if (windowData.windowType == WindowType.WINDOW) { - if (windowData.undecorated) { -@@ -253,6 +257,16 @@ class Window(windowData: WindowData, private val stateMachine: ClientStateMachin - ) - } - -+ private fun setMaximized() { -+ val userScalingRatio = ParamsProvider.USER_SCALING_RATIO -+ -+ stateMachine.fire(ClientAction.AddEvent(ClientResizeEvent(size = CommonIntSize( -+ width = (window.innerWidth / userScalingRatio).roundToInt(), -+ height = (window.innerHeight / userScalingRatio).roundToInt() -+ )))) -+ stateMachine.fire(ClientAction.WindowResize) -+ } -+ - fun dispose() { - canvas.remove() - border.dispose() diff --git a/plugins/devfile-plugin/src/main/kotlin/che/incubator/ide/IdeFrameConfigurationService.kt b/plugins/devfile-plugin/src/main/kotlin/che/incubator/ide/IdeFrameConfigurationService.kt new file mode 100644 index 00000000..0ee3c315 --- /dev/null +++ b/plugins/devfile-plugin/src/main/kotlin/che/incubator/ide/IdeFrameConfigurationService.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 Red Hat, Inc. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Red Hat, Inc. - initial API and implementation + */ +package che.incubator.ide + +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupActivity +import com.intellij.openapi.wm.IdeFocusManager +import java.awt.Component +import java.awt.Frame +import java.awt.Window +import javax.swing.JFrame +import javax.swing.SwingUtilities + +class IdeFrameConfigurationService : StartupActivity { + override fun runActivity(project: Project) { + val focusOwner: Component = IdeFocusManager.getGlobalInstance().focusOwner + val window: Window = if(focusOwner is JFrame) focusOwner else SwingUtilities.getWindowAncestor(focusOwner) + (window as JFrame).extendedState = Frame.MAXIMIZED_BOTH + } +} diff --git a/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml b/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml index 27831ac8..1d662605 100644 --- a/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml +++ b/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml @@ -16,5 +16,6 @@ +