-
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.
Signed-off-by: jpinkney <josh.pinkney@mail.utoronto.ca>
- Loading branch information
Showing
17 changed files
with
576 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Theia - Progress Monitor Extension | ||
|
||
Contributes a progress widget to Theia. | ||
|
||
## License | ||
|
||
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) | ||
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) |
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 @@ | ||
{ | ||
"extends": "../../configs/base.tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib" | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
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,47 @@ | ||
{ | ||
"name": "@theia/progress-monitor-extension", | ||
"version": "0.3.13", | ||
"description": "Theia - Progress Monitor Extension", | ||
"dependencies": { | ||
"@theia/core": "^0.3.13", | ||
"@theia/editor": "^0.3.13" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"frontend": "lib/browser/progress-monitor-frontend-module" | ||
} | ||
], | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/theia-ide/theia.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/theia-ide/theia/issues" | ||
}, | ||
"homepage": "https://github.com/theia-ide/theia", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"prepare": "yarn run clean && yarn run build", | ||
"clean": "theiaext clean", | ||
"build": "theiaext build", | ||
"watch": "theiaext watch", | ||
"test": "theiaext test", | ||
"docs": "theiaext docs" | ||
}, | ||
"devDependencies": { | ||
"@theia/ext-scripts": "^0.3.12" | ||
}, | ||
"nyc": { | ||
"extends": "../../configs/nyc.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,17 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2018 Red Hat, Inc. 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 | ||
********************************************************************************/ | ||
export * from './progress-service'; | ||
export * from './progress-protocol'; |
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,81 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2018 Red Hat, Inc. 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 { injectable, inject } from "inversify"; | ||
import { Message } from '@phosphor/messaging'; | ||
import { Disposable } from "@theia/core"; | ||
import { Widget, BaseWidget, Key } from "@theia/core/lib/browser"; | ||
import { ProgressWidget } from "./progress-widget"; | ||
|
||
@injectable() | ||
export class ProgressDialog extends BaseWidget { | ||
|
||
protected readonly contentNode: HTMLDivElement; | ||
|
||
protected isOpen: boolean = false; | ||
|
||
constructor( | ||
@inject(ProgressWidget) readonly widget: ProgressWidget | ||
) { | ||
super(); | ||
|
||
this.contentNode = document.createElement("div"); | ||
this.contentNode.classList.add('theia-ProgressContent'); | ||
|
||
this.node.classList.add('theia-ProgressWidgetDialog'); | ||
|
||
this.node.appendChild(this.contentNode); | ||
|
||
this.toDispose.push(widget); | ||
|
||
this.update(); | ||
} | ||
|
||
protected onUpdateRequest(msg: Message): void { | ||
super.onUpdateRequest(msg); | ||
this.widget.update(); | ||
} | ||
|
||
protected onAfterAttach(msg: Message): void { | ||
super.onAfterAttach(msg); | ||
Widget.attach(this.widget, this.contentNode); | ||
this.toDisposeOnDetach.push(Disposable.create(() => | ||
Widget.detach(this.widget) | ||
)); | ||
|
||
this.addKeyListener(document.body, Key.ESCAPE, e => { | ||
this.close(); | ||
this.isOpen = false; | ||
}); | ||
} | ||
|
||
protected onActivateRequest(msg: Message): void { | ||
super.onActivateRequest(msg); | ||
this.widget.activate(); | ||
} | ||
|
||
async toggleOpen(): Promise<void> { | ||
if (this.isOpen) { | ||
this.close(); | ||
} else { | ||
const thisStatusBarItem = document.getElementsByClassName("theia-ProgressStatusBar").item(0) as HTMLElement; | ||
Widget.attach(this, thisStatusBarItem); | ||
this.activate(); | ||
} | ||
this.isOpen = !this.isOpen; | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
packages/progress-monitor/src/browser/progress-monitor-frontend-module.ts
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,39 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2018 Red Hat, Inc. 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 { ContainerModule, interfaces } from "inversify"; | ||
import { WidgetFactory, FrontendApplicationContribution } from "@theia/core/lib/browser"; | ||
import { ProgressMonitorService } from "./progress-service"; | ||
import { ProgressDialog } from "./progress-dialog"; | ||
import { ProgressStatusBar } from "./progress-status-bar"; | ||
import { ProgressWidget } from "./progress-widget"; | ||
|
||
export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => { | ||
|
||
bind(ProgressDialog).toSelf(); | ||
|
||
bind(ProgressStatusBar).toSelf().inSingletonScope(); | ||
bind(FrontendApplicationContribution).toDynamicValue(ctx => ctx.container.get(ProgressStatusBar)).inSingletonScope(); | ||
|
||
bind(ProgressMonitorService).toSelf().inSingletonScope(); | ||
|
||
bind(ProgressWidget).toSelf(); | ||
bind(WidgetFactory).toDynamicValue(ctx => ({ | ||
id: "progress-monitor-extension", | ||
createWidget: () => ctx.container.get(ProgressWidget) | ||
})); | ||
|
||
}); |
24 changes: 24 additions & 0 deletions
24
packages/progress-monitor/src/browser/progress-protocol.ts
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,24 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2018 Red Hat, Inc. 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 | ||
********************************************************************************/ | ||
|
||
export interface ProgressReport { | ||
location: string; // Location denoting what part of theia this item is coming from | ||
id: string; | ||
task: string; | ||
workDone: number; | ||
totalWork: number; | ||
complete: boolean; | ||
} |
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,31 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2018 Red Hat, Inc. 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 { injectable } from "inversify"; | ||
import { Emitter, Event } from "@theia/core/lib/common"; | ||
import { ProgressReport } from "./progress-protocol"; | ||
|
||
@injectable() | ||
export class ProgressMonitorService { | ||
|
||
protected readonly onContributionAddedOrUpdatedEmitter = new Emitter<ProgressReport>(); | ||
public onContributionAdded: Event<ProgressReport> = this.onContributionAddedOrUpdatedEmitter.event; | ||
|
||
addOrUpdateContribution(progressContribution: ProgressReport): void { | ||
this.onContributionAddedOrUpdatedEmitter.fire(progressContribution); | ||
} | ||
|
||
} |
Oops, something went wrong.