Theia IDE CF-Manifest-YAML client - missing files
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { injectable, inject } from "inversify";
|
||||
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from "@theia/core/lib/common";
|
||||
import { CommonMenus } from "@theia/core/lib/browser";
|
||||
|
||||
export const CfManifestYamlCommand = {
|
||||
id: 'CfManifestYaml.command',
|
||||
label: "Shows a message"
|
||||
};
|
||||
|
||||
@injectable()
|
||||
export class CfManifestYamlCommandContribution implements CommandContribution {
|
||||
|
||||
constructor(
|
||||
@inject(MessageService) private readonly messageService: MessageService,
|
||||
) { }
|
||||
|
||||
registerCommands(registry: CommandRegistry): void {
|
||||
registry.registerCommand(CfManifestYamlCommand, {
|
||||
execute: () => this.messageService.info('Hello World!')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@injectable()
|
||||
export class CfManifestYamlMenuContribution implements MenuContribution {
|
||||
|
||||
registerMenus(menus: MenuModelRegistry): void {
|
||||
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
|
||||
commandId: CfManifestYamlCommand.id,
|
||||
label: 'Say Hello'
|
||||
});
|
||||
}
|
||||
}
|
||||
3
theia-extensions/theia-cf-manifest-yaml/properties.json
Normal file
3
theia-extensions/theia-cf-manifest-yaml/properties.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/manifest-yaml-language-server-0.1.5-201803080105.jar"
|
||||
}
|
||||
34
theia-extensions/theia-cf-manifest-yaml/script.js
Normal file
34
theia-extensions/theia-cf-manifest-yaml/script.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const download = require('download');
|
||||
const PROPERTIES = require('./properties.json');
|
||||
|
||||
let fileExists = function(path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.access(path, fs.R_OK, error => {
|
||||
resolve(!error || error.code !== 'ENOENT');
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
const serverDownloadUrl = PROPERTIES.jarUrl;
|
||||
|
||||
const serverHome = path.join(__dirname, 'server');
|
||||
|
||||
const localFileName = path.join(serverHome, 'cf-manifest-language-server.jar');
|
||||
|
||||
fileExists(localFileName).then(exists => {
|
||||
if (!exists) {
|
||||
console.log(`Downloading ${serverDownloadUrl} to ${localFileName}`);
|
||||
fileExists(serverHome)
|
||||
.then(doesExist => { if (!doesExist) fs.mkdir(serverHome) })
|
||||
.then(() => download(serverDownloadUrl))
|
||||
.then(data => fs.writeFileSync(localFileName, data))
|
||||
.then(() => fileExists(localFileName))
|
||||
.then(doesExist => { if (!doesExist) throw Error(`Failed to install the ${this.getServerName()} language server`) })
|
||||
.then(() => console.log(`Successfully downloaded ${serverDownloadUrl}`));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { injectable, inject } from "inversify";
|
||||
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from "@theia/core/lib/common";
|
||||
import { CommonMenus } from "@theia/core/lib/browser";
|
||||
|
||||
export const HelloWorldCommand = {
|
||||
id: 'HelloWorld.command',
|
||||
label: "Shows a message"
|
||||
};
|
||||
|
||||
@injectable()
|
||||
export class HelloWorldCommandContribution implements CommandContribution {
|
||||
|
||||
constructor(
|
||||
@inject(MessageService) private readonly messageService: MessageService,
|
||||
) { }
|
||||
|
||||
registerCommands(registry: CommandRegistry): void {
|
||||
registry.registerCommand(HelloWorldCommand, {
|
||||
execute: () => this.messageService.info('Hello World!')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@injectable()
|
||||
export class HelloWorldMenuContribution implements MenuContribution {
|
||||
|
||||
registerMenus(menus: MenuModelRegistry): void {
|
||||
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
|
||||
commandId: HelloWorldCommand.id,
|
||||
label: 'Say Hello'
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated using theia-extension-generator
|
||||
*/
|
||||
|
||||
import { HelloWorldCommandContribution, HelloWorldMenuContribution } from './hello-world-contribution';
|
||||
import {
|
||||
CommandContribution,
|
||||
MenuContribution
|
||||
} from "@theia/core/lib/common";
|
||||
|
||||
import { ContainerModule } from "inversify";
|
||||
|
||||
export default new ContainerModule(bind => {
|
||||
// add your contribution bindings here
|
||||
|
||||
bind(CommandContribution).to(HelloWorldCommandContribution);
|
||||
bind(MenuContribution).to(HelloWorldMenuContribution);
|
||||
|
||||
});
|
||||
10
theia-extensions/theia-cf-manifest-yaml/tsconfig.json
Normal file
10
theia-extensions/theia-cf-manifest-yaml/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../configs/base.tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user