-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a552c06
commit 292d5ed
Showing
32 changed files
with
2,784 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
extends: [ | ||
'../../configs/build.eslintrc.json' | ||
], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: 'tsconfig.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2022 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
// This script generates an JSON array of font-awesome classnames from the font-awesome.css files | ||
const fontAwesomeCSSPath = path.resolve(__dirname, '../../node_modules/font-awesome/css/font-awesome.css'); | ||
const fontAwesomeDestination = path.resolve(__dirname, './src/browser/font-awesome.json'); | ||
|
||
const codiconCSSPath = path.resolve(__dirname, '../../node_modules/@vscode/codicons/dist/codicon.css') | ||
const codiconDestination = path.resolve(__dirname, './src/browser/codicon.json') | ||
|
||
const faContent = fs.readFileSync(fontAwesomeCSSPath, 'utf-8'); | ||
const regexp = /([\w,-]*):before/gm; | ||
let faArray; | ||
const faMatches = []; | ||
while (faArray = regexp.exec(faContent)) { | ||
faMatches.push(faArray[1]); | ||
} | ||
fs.writeFileSync(fontAwesomeDestination, JSON.stringify(faMatches)); | ||
|
||
const codiconContent = fs.readFileSync(codiconCSSPath, 'utf-8'); | ||
let codiconArray; | ||
const codiconMatches = []; | ||
while (codiconArray = regexp.exec(codiconContent)) { | ||
codiconMatches.push(codiconArray[1]); | ||
} | ||
fs.writeFileSync(codiconDestination, JSON.stringify(codiconMatches)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@theia/toolbar", | ||
"version": "1.22.1", | ||
"description": "Theia - Toolbar", | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"homepage": "https://github.com/eclipse-theia/theia", | ||
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/eclipse-theia/theia.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/eclipse-theia/theia/issues" | ||
}, | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"build": "theiaext build", | ||
"clean": "theiaext clean", | ||
"compile": "theiaext compile", | ||
"lint": "theiaext lint", | ||
"test": "theiaext test", | ||
"watch": "theiaext watch" | ||
}, | ||
"dependencies": { | ||
"@theia/core": "1.22.1", | ||
"@theia/editor": "1.22.1", | ||
"@theia/file-search": "1.22.1", | ||
"@theia/filesystem": "1.22.1", | ||
"@theia/monaco": "1.22.1", | ||
"@theia/search-in-workspace": "1.22.1", | ||
"@theia/userstorage": "1.22.1", | ||
"@theia/workspace": "1.22.1", | ||
"ajv": "^6.5.3", | ||
"jsonc-parser": "^2.2.0", | ||
"perfect-scrollbar": "^1.3.0" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"frontend": "lib/browser/main-toolbar-frontend-module" | ||
} | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
packages/toolbar/src/browser/abstract-main-toolbar-contribution.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2022 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import * as React from '@theia/core/shared/react'; | ||
import { CommandService, Emitter } from '@theia/core'; | ||
import { injectable, inject } from '@theia/core/shared/inversify'; | ||
import { ContextMenuRenderer, KeybindingRegistry } from '@theia/core/lib/browser'; | ||
import { ReactTabBarToolbarContribution, ToolbarAlignment } from './main-toolbar-interfaces'; | ||
|
||
@injectable() | ||
export abstract class AbstractMainToolbarContribution implements ReactTabBarToolbarContribution { | ||
abstract id: string; | ||
abstract column: ToolbarAlignment; | ||
abstract priority: number; | ||
newGroup = true; | ||
|
||
protected didChangeEmitter = new Emitter<void>(); | ||
readonly onDidChange = this.didChangeEmitter.event; | ||
|
||
@inject(KeybindingRegistry) protected readonly keybindingRegistry: KeybindingRegistry; | ||
@inject(ContextMenuRenderer) protected readonly contextMenuRenderer: ContextMenuRenderer; | ||
@inject(CommandService) protected readonly commandService: CommandService; | ||
|
||
abstract render(): React.ReactNode; | ||
|
||
toJSON(): { id: string; group: string } { | ||
return { id: this.id, group: 'contributed' }; | ||
} | ||
|
||
protected resolveKeybindingForCommand(commandID: string | undefined): string { | ||
if (!commandID) { | ||
return ''; | ||
} | ||
const keybindings = this.keybindingRegistry.getKeybindingsForCommand(commandID); | ||
if (keybindings.length > 0) { | ||
const binding = keybindings[0]; | ||
const bindingKeySequence = this.keybindingRegistry.resolveKeybinding(binding); | ||
const keyCode = bindingKeySequence[0]; | ||
return ` (${this.keybindingRegistry.acceleratorForKeyCode(keyCode, '+')})`; | ||
} | ||
return ''; | ||
} | ||
} |
Oops, something went wrong.