From 4b4477794a65cb10ebea2f1f68eb7786fc26b46d Mon Sep 17 00:00:00 2001 From: dinglili Date: Wed, 31 Jul 2024 15:38:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E6=96=B0=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E7=AA=97=E5=8F=A3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product.json | 2 +- src/vs/code/electron-main/app.ts | 2 +- .../deploy/deployWindowMain.ts | 13 +++++-- .../issue/electron-main/deployMainService.ts | 35 +++++++++++++++++-- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/product.json b/product.json index 23be67e3..f8f83ee9 100644 --- a/product.json +++ b/product.json @@ -532,7 +532,7 @@ ], "helpDocUrl":"https://gitee.com/openkylin/extensions-repo/blob/master/user-guide/%E7%9B%AE%E5%BD%95.md", "updateCheckUrl":"https://kylinhorn.cn/updateCheck/kylinide", - "gIndexUrl":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/config/g_index.json", + "gIndexUrl":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/0.4.0/g_index.json", "deployFunc":true, "feedbackUrl":"https://gitee.com/openkylin/kylin-code/issues", "extensionsControlManifest":{ diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index b071711b..f55132b2 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -1490,7 +1490,7 @@ export class CodeApplication extends Disposable { if (fs.existsSync(flagFilePath)) { res = false; // 标记文件存在,不是首次启动 } else { - fs.writeFileSync(flagFilePath, ''); // 创建标记文件 + fs.writeFileSync(flagFilePath, '1'); // 创建标记文件 res = true; // 标记文件不存在,是首次启动 } return res; diff --git a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts index 5c33f9c0..99deddf6 100644 --- a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts +++ b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts @@ -35,6 +35,7 @@ class deployWindow { gSoftInstNum = 0; gExtInst = 0; extAddressPath = ''; + reloadWindowFlag = 0; extInstallState = new Map(); extMap = {}; @@ -271,10 +272,10 @@ class deployWindow { if (writeKeyJson.length > 0) { ipcRenderer.send("kylinide.installWizard.init", { type: "writeKey", keys: writeKeyJson }); } - showContext += "点击结束按钮退出开发环境快速部署\n" + showContext += "点击结束按钮退出开发环境快速部署\n"; let allSuccess = this.checkAllInstalledSucc(this.extInstallState); this.goFinish(showContext, false, allSuccess); - console.log("安装结束:成功"); + console.log("安装结束"); } } // preElement.scrollTop = preElement.scrollHeight; @@ -338,6 +339,7 @@ class deployWindow { this.showTab(this.currentTab); this.removeAllListeners(); this.registerEventListener(); + this.reloadWindowFlag = 0; } // setHeader() { @@ -580,6 +582,9 @@ class deployWindow { this.removeAllListeners(); ipcRenderer.send('kylinide.installWizard.closeWizard', { type: "close" }); console.log("renderer send kylinide.installWizard.closeWizard", 'close'); + if (this.reloadWindowFlag) { + ipcRenderer.send('kylinide.installWizard.reloadwindow'); + } this.custom_print("nextPrev onlineInstallTab4"); return; } @@ -749,6 +754,9 @@ class deployWindow { else { ipcRenderer.send('kylinide.installWizard.closeWizard', { type: "close" }); this.removeAllListeners(); + if (this.reloadWindowFlag) { + ipcRenderer.send('kylinide.installWizard.reloadwindow'); + } } }); /** @@ -1172,6 +1180,7 @@ class deployWindow { if (flagjson > 0) { return false; } else { + this.reloadWindowFlag = 1; return true; } } diff --git a/src/vs/platform/issue/electron-main/deployMainService.ts b/src/vs/platform/issue/electron-main/deployMainService.ts index 2dabf036..86391c10 100644 --- a/src/vs/platform/issue/electron-main/deployMainService.ts +++ b/src/vs/platform/issue/electron-main/deployMainService.ts @@ -17,7 +17,7 @@ import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/e import { IDeployMainService, DeployWindowConfiguration, DeployData } from 'vs/platform/issue/common/deploy'; import { ILogger } from 'vs/platform/log/common/log'; import { ILoggerMainService } from 'vs/platform/log/electron-main/loggerService'; -// import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; +import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; import product from 'vs/platform/product/common/product'; import { IProductService } from 'vs/platform/product/common/productService'; import { IIPCObjectUrl, IProtocolMainService } from 'vs/platform/protocol/electron-main/protocol'; @@ -64,6 +64,7 @@ export class DeployMainService implements IDeployMainService { // private static readonly DEFAULT_BACKGROUND_COLOR = '#1E1E1E'; private DeployWindow: BrowserWindow | null = null; + private deployWindowrParentWindow: BrowserWindow | null = null; private selectObject = { dirPath: "", @@ -123,6 +124,7 @@ export class DeployMainService implements IDeployMainService { @IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService, @ILoggerMainService private readonly loggerMainService: ILoggerMainService, @IProtocolMainService private readonly protocolMainService: IProtocolMainService, + @INativeHostMainService private readonly nativeHostMainService: INativeHostMainService, @IProductService private readonly productService: IProductService, ) { this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0, osrelease: "", supportList: [] }; @@ -134,6 +136,9 @@ export class DeployMainService implements IDeployMainService { this.loggerSoft = this.loggerMainService.createLogger(URI.file(this.installConfig + "/log/softdetail.log")); this.removeListeners(); this.registerListeners(); + this.deployWindowrParentWindow?.on('close', () => { + this.deployWindowrParentWindow = null; + }) } reset() { this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0, osrelease: "", supportList: [] }; @@ -205,6 +210,7 @@ export class DeployMainService implements IDeployMainService { } this.closeWindow(); + }; listenerInstallProcess = async (event: IpcMainEvent, msg: any) => { @@ -971,6 +977,7 @@ export class DeployMainService implements IDeployMainService { validatedIpcMain.removeListener('kylinide.installWizard.msg.process', this.listenerInstallProcess); validatedIpcMain.removeListener('kylinide.installWizard.removeFileLister', this.listenerRemoveFileLister); validatedIpcMain.removeListener('kylinide.installWizard.init', this.listenerWriteSelectJson); + validatedIpcMain.removeListener('kylinide.installWizard.reloadwindow', this.listenerReloadWindow); } private registerListeners(): void { this.logger.info("注册监听器"); @@ -982,6 +989,7 @@ export class DeployMainService implements IDeployMainService { validatedIpcMain.on('kylinide.installWizard.msg.process', this.listenerInstallProcess); validatedIpcMain.on('kylinide.installWizard.removeFileLister', this.listenerRemoveFileLister); validatedIpcMain.on('kylinide.installWizard.init', this.listenerWriteSelectJson); + validatedIpcMain.on('kylinide.installWizard.reloadwindow', this.listenerReloadWindow); //handle从渲染进程发送的消息 validatedIpcMain.handle('kylinide.installWizard.init.configVersify', this.handleInitConfigVersify); @@ -1183,9 +1191,12 @@ export class DeployMainService implements IDeployMainService { //#region Used by renderer + async openDeployWindow(flag: boolean = true): Promise { return new Promise(async (resolve, reject) => { if (!this.DeployWindow) { + if (!flag) + this.deployWindowrParentWindow = BrowserWindow.getFocusedWindow(); this.reset(); @@ -1231,8 +1242,6 @@ export class DeployMainService implements IDeployMainService { resolve(void 0); } }); - - const listenerSkipWizard = async (event: IpcMainEvent) => { this.logger.info("跳过配置"); if (this.DeployWindow && this.DeployWindow != undefined) { @@ -1247,6 +1256,26 @@ export class DeployMainService implements IDeployMainService { } }); } + + + listenerReloadWindow = async (event: IpcMainEvent, msg: any) => { + if (this.deployWindowrParentWindow) { + this.deployWindowrParentWindow.show(); + dialog.showMessageBox(this.deployWindowrParentWindow, { + type: 'question', + title: "确认", + buttons: ["是", '否'], + defaultId: 0, + message: "是否重新加载窗口?", + detail: '开发环境快速部署安装插件后需要重载窗口使插件生效', + }).then(res => { + if (res.response === 0) { + if (this.deployWindowrParentWindow) + this.nativeHostMainService.reload(this.deployWindowrParentWindow.id); + } + }) + } + } private createDeployBrowserWindow(position: IWindowState, ipcObjectUrl: IIPCObjectUrl, windowKind: string): BrowserWindow { const window = new BrowserWindow({ fullscreen: false,