diff --git a/package.json b/package.json index 1170f41..7db00f6 100644 --- a/package.json +++ b/package.json @@ -131,6 +131,12 @@ "dark": "resources/icon/dark/search-entity-view.svg" } }, + { + "command": "ibiz-modeling-studio.gitlab.open-project", + "title": "%command.ibiz-modeling-studio.gitlab.open-project%", + "category": "%command.ibiz-modeling-studio.category%", + "icon": "resources/icon/gitlab.svg" + }, { "command": "ibiz-modeling-studio.user.login-reply-path-handle", "title": "处理粘贴板中的登录地址", @@ -145,15 +151,20 @@ "group": "navigation@10" }, { - "command": "ibiz-modeling-studio.mos-fs.open-model-by-path", + "command": "ibiz-modeling-studio.gitlab.open-project", "when": "view == iBizExplorer.ModelExpTree", "group": "navigation@20" }, { - "command": "ibiz-modeling-studio.mos-fs.search-entity", + "command": "ibiz-modeling-studio.mos-fs.open-model-by-path", "when": "view == iBizExplorer.ModelExpTree", "group": "navigation@30" }, + { + "command": "ibiz-modeling-studio.mos-fs.search-entity", + "when": "view == iBizExplorer.ModelExpTree", + "group": "navigation@40" + }, { "command": "ibiz-modeling-studio.system-info-terminal.show", "when": "view == iBizExplorer.ModelExpTree", diff --git a/package.nls.json b/package.nls.json index 4dad42c..be7cd32 100644 --- a/package.nls.json +++ b/package.nls.json @@ -14,6 +14,7 @@ "command.ibiz-modeling-studio.mos-fs.open-model-by-path": "Open Model By Path", "command.ibiz-modeling-studio.mos-fs.search-entity": "Search Entity", "command.ibiz-modeling-studio.mos-fs.search-entity-view": "Search Entity View", + "command.ibiz-modeling-studio.gitlab.open-project": "Open Project GitLab", "properties.ibiz-modeling-studio.ibiz-modeling-studio-domain": "Modeling Studio Domain", "properties.ibiz-modeling-studio.console.auto-display": "After the message terminal is closed, the terminal is reopened when the message is received", "properties.ibiz-modeling-studio.ibiz-modeling-link.enable": "Enable iBizModeling Link Recognition" diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index 7a3a7ad..e2d66b1 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -14,6 +14,7 @@ "command.ibiz-modeling-studio.mos-fs.open-model-by-path": "根据路径查找模型", "command.ibiz-modeling-studio.mos-fs.search-entity": "查找实体", "command.ibiz-modeling-studio.mos-fs.search-entity-view": "查找实体视图", + "command.ibiz-modeling-studio.gitlab.open-project": "打开项目 GitLab", "properties.ibiz-modeling-studio.ibiz-modeling-studio-domain": "建模工场域", "properties.ibiz-modeling-studio.console.auto-display": "消息终端关闭后,收到时消息重新打开终端", "properties.ibiz-modeling-studio.ibiz-modeling-link.enable": "启用 iBizModeling 链接识别" diff --git a/src/commands/gitlab/open-project.ts b/src/commands/gitlab/open-project.ts new file mode 100644 index 0000000..7db812e --- /dev/null +++ b/src/commands/gitlab/open-project.ts @@ -0,0 +1,27 @@ +import { commands, Uri, window } from 'vscode'; +import { CommandConst } from '../../constants'; +import { ctx } from '../../context'; + +/** + * 打开项目 gitlab + * + * @author chitanda + * @date 2021-12-13 11:12:57 + * @export + * @class OpenProjectCommand + */ +export class OpenProjectCommand { + constructor() { + commands.registerCommand(CommandConst.GITLAB.OPEN_PROJECT, this.execute.bind(this)); + } + + protected async execute(): Promise { + const gitLab = ctx.get('gitRemote'); + if (!gitLab) { + window.showErrorMessage('GitLab 地址不存在,请先在 .ibizproject 中配置'); + return; + } + const uri = Uri.parse(gitLab); + commands.executeCommand(CommandConst.VSCODE.OPEN, uri); + } +} diff --git a/src/commands/index.ts b/src/commands/index.ts index 1d273ca..3a36358 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,4 +1,5 @@ import { ExtensionContext } from 'vscode'; +import { OpenProjectCommand } from './gitlab/open-project'; import { OpenIBizModelingCommand } from './ibiz-modeling/open-ibiz-modeling'; import { CopyPathCommand } from './mos-fs/copy-path'; import { OpenFileCommand } from './mos-fs/open-file'; @@ -22,6 +23,7 @@ import { UserLogoutCommand } from './user/logout'; * @param {ExtensionContext} _context */ export function installCommands(_context: ExtensionContext): void { + new OpenProjectCommand(); new OpenIBizModelingCommand(); // mos-fs 相关 { @@ -33,9 +35,18 @@ export function installCommands(_context: ExtensionContext): void { new SearchEntityCommand(); new SearchEntityViewCommand(); } - new SystemPublishCommand(); - new SystemInfoTerminalShowCommand(); - new TemplatePublishCommand(); - new UserLoginCommand(); - new UserLogoutCommand(); + // 系统相关 + { + new SystemPublishCommand(); + new SystemInfoTerminalShowCommand(); + } + // 模板相关 + { + new TemplatePublishCommand(); + } + // 用户相关 + { + new UserLoginCommand(); + new UserLogoutCommand(); + } } diff --git a/src/constants/command/command.ts b/src/constants/command/command.ts index 86bb5bd..5a3e78d 100644 --- a/src/constants/command/command.ts +++ b/src/constants/command/command.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ +import { GitLabConst } from './gitlab/gitlab'; import { IBizModeling } from './ibiz-modeling/ibiz-modeling'; import { MosFSConst } from './mos-fs/mos-fs'; import { SystemInfoTerminalConst } from './system-info-terminal/system-info-terminal'; @@ -33,4 +34,6 @@ export class CommandConst { static readonly USER: UserConst = new UserConst(); static readonly MOS_FS: MosFSConst = new MosFSConst(); + + static readonly GITLAB: GitLabConst = new GitLabConst(); } diff --git a/src/constants/command/gitlab/gitlab.ts b/src/constants/command/gitlab/gitlab.ts new file mode 100644 index 0000000..22794c6 --- /dev/null +++ b/src/constants/command/gitlab/gitlab.ts @@ -0,0 +1,18 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +/** + * gitlab 相关指令集 + * + * @author chitanda + * @date 2021-12-13 11:12:37 + * @export + * @class GitLabConst + */ +export class GitLabConst { + /** + * 打开当前项目的 gitlab + * + * @author chitanda + * @date 2021-12-13 11:12:47 + */ + readonly OPEN_PROJECT = 'ibiz-modeling-studio.gitlab.open-project'; +}