-
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.
Initial contribution of property-view extension
Signed-off-by: Nina Doschek <ndoschek@eclipsesource.com>
- Loading branch information
Showing
29 changed files
with
1,221 additions
and
1 deletion.
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
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: 'compile.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,44 @@ | ||
<div align='center'> | ||
|
||
<br /> | ||
|
||
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' /> | ||
|
||
<h2>ECLIPSE THEIA - PROPERTY-VIEW EXTENSION</h2> | ||
|
||
<hr /> | ||
|
||
</div> | ||
|
||
## Description | ||
|
||
The `@theia/property-view` extension contributes a generic, global property view based on Theia's global selection. | ||
|
||
The property view widget can be opened/toggled either via menu _View->Properties_ or via shortcut <kbd>Shift+Alt+P</kbd>. It is located in the bottom dock area by default. | ||
|
||
The following two default content widgets are implemented in this extension: | ||
- EmptyPropertyViewWidget: If no other widget can be provided, a simple message (_No properties available_) is shown. | ||
- ResourcePropertyViewWidget: Can handle `FileSelection`s and `Navigatable` selections (which provide their resource URI) and displays the general `FileStat` information (e.g. location, name, last modified) in a TreeWidget. | ||
|
||
To contribute a specific property view, it is necessary to implement a `PropertyViewDataService` which gathers the property data for a selection as well as a `PropertyViewWidgetProvider` which provides a suitable content widget to display the property data for a specific selection inside the property view widget. | ||
|
||
</br> | ||
|
||
## Additional Information | ||
|
||
- [API documentation for `@theia/property-view`](https://eclipse-theia.github.io/theia/docs/next/modules/property_view.html) | ||
- [Theia - GitHub](https://github.com/eclipse-theia/theia) | ||
- [Theia - Website](https://theia-ide.org/) | ||
|
||
## 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) | ||
|
||
## Trademark | ||
"Theia" is a trademark of the Eclipse Foundation | ||
https://www.eclipse.org/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,19 @@ | ||
{ | ||
"extends": "../../configs/base.tsconfig", | ||
"compilerOptions": { | ||
"composite": true, | ||
"rootDir": "src", | ||
"outDir": "lib" | ||
}, | ||
"include": [ | ||
"src" | ||
], | ||
"references": [ | ||
{ | ||
"path": "../core/compile.tsconfig.json" | ||
}, | ||
{ | ||
"path": "../filesystem/compile.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,46 @@ | ||
{ | ||
"name": "@theia/property-view", | ||
"version": "1.11.0", | ||
"description": "Theia - Property View Extension", | ||
"dependencies": { | ||
"@theia/core": "1.11.0", | ||
"@theia/filesystem": "1.11.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"frontend": "lib/browser/property-view-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/eclipse-theia/theia.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/eclipse-theia/theia/issues" | ||
}, | ||
"homepage": "https://github.com/eclipse-theia/theia", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"lint": "theiaext lint", | ||
"build": "theiaext build", | ||
"watch": "theiaext watch", | ||
"clean": "theiaext clean", | ||
"test": "theiaext test" | ||
}, | ||
"devDependencies": { | ||
"@theia/ext-scripts": "1.11.0" | ||
}, | ||
"nyc": { | ||
"extends": "../../configs/nyc.json" | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
packages/property-view/src/browser/empty-property-view-widget-provider.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,78 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2020 EclipseSource 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 { ReactWidget } from '@theia/core/lib/browser'; | ||
import { injectable } from 'inversify'; | ||
import * as React from 'react'; | ||
import { PropertyViewContentWidget } from './property-view-content-widget'; | ||
import { DefaultPropertyViewWidgetProvider } from './property-view-widget-provider'; | ||
|
||
class EmptyPropertyViewWidget extends ReactWidget implements PropertyViewContentWidget { | ||
|
||
static readonly ID = 'theia-empty-property-view'; | ||
static readonly LABEL = 'No Properties'; | ||
|
||
constructor() { | ||
super(); | ||
this.id = EmptyPropertyViewWidget.ID; | ||
this.title.label = EmptyPropertyViewWidget.LABEL; | ||
this.title.caption = EmptyPropertyViewWidget.LABEL; | ||
this.title.closable = false; | ||
this.node.tabIndex = 0; | ||
} | ||
|
||
updatePropertyViewContent(): void { | ||
this.update(); | ||
} | ||
|
||
protected render(): React.ReactNode { | ||
return this.emptyComponent; | ||
} | ||
|
||
protected emptyComponent: JSX.Element = <div className={'theia-widget-noInfo'}>No properties available.</div>; | ||
|
||
} | ||
|
||
/** | ||
* `DefaultPropertyViewWidgetProvider` is implemented to provide the PropertyViewEmptyWidget | ||
* if the given selection is undefined or no other provider can handle the given selection. | ||
*/ | ||
@injectable() | ||
export class EmptyPropertyViewWidgetProvider extends DefaultPropertyViewWidgetProvider { | ||
|
||
static readonly ID = 'no-properties'; | ||
readonly id = EmptyPropertyViewWidgetProvider.ID; | ||
readonly label = 'DefaultPropertyViewWidgetProvider'; | ||
|
||
private emptyWidget: EmptyPropertyViewWidget; | ||
|
||
constructor() { | ||
super(); | ||
this.emptyWidget = new EmptyPropertyViewWidget(); | ||
} | ||
|
||
canHandle(selection: Object | undefined): number { | ||
return selection === undefined ? 1 : 0; | ||
} | ||
|
||
provideWidget(selection: Object | undefined): Promise<EmptyPropertyViewWidget> { | ||
return Promise.resolve(this.emptyWidget); | ||
} | ||
|
||
updateContentWidget(selection: Object | undefined): void { | ||
this.emptyWidget.updatePropertyViewContent(); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
packages/property-view/src/browser/property-data-service.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,48 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2020 EclipseSource 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 const PropertyDataService = Symbol('PropertyDataService'); | ||
/** | ||
* `PropertyDataService` should be implemented to provide property data for the given selection. | ||
*/ | ||
export interface PropertyDataService { | ||
|
||
/** | ||
* A unique id for this provider. | ||
*/ | ||
readonly id: string; | ||
/** | ||
* A human-readable name for this provider. | ||
*/ | ||
readonly label?: string; | ||
|
||
/** | ||
* Test whether this provider can provide property data for the given selection. | ||
* Return a nonzero number if this provider can provide; otherwise it cannot. | ||
* Never reject. | ||
* | ||
* A returned value indicating a priority of this provider. | ||
*/ | ||
canHandleSelection(selection: Object | undefined): number; | ||
|
||
/** | ||
* Provide property data for the given selection. | ||
* Resolve to a property view content widget. | ||
* Never reject if `canHandle` return a positive number; otherwise should reject. | ||
*/ | ||
providePropertyData(selection: Object | undefined): Promise<Object | undefined>; | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
packages/property-view/src/browser/property-view-content-widget.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,22 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2020 EclipseSource 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 { Widget } from '@theia/core/lib/browser/widgets/widget'; | ||
import { PropertyDataService } from './property-data-service'; | ||
|
||
export interface PropertyViewContentWidget extends Widget { | ||
updatePropertyViewContent(propertyDataService?: PropertyDataService, selection?: Object): void; | ||
} |
36 changes: 36 additions & 0 deletions
36
packages/property-view/src/browser/property-view-contribution.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,36 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2020 EclipseSource 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 { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution'; | ||
import { injectable } from 'inversify'; | ||
import { PropertyViewWidget } from './property-view-widget'; | ||
|
||
@injectable() | ||
export class PropertyViewContribution extends AbstractViewContribution<PropertyViewWidget> { | ||
|
||
constructor() { | ||
super({ | ||
widgetId: PropertyViewWidget.ID, | ||
widgetName: PropertyViewWidget.LABEL, | ||
defaultWidgetOptions: { | ||
area: 'bottom' | ||
}, | ||
toggleCommandId: 'property-view:toggle', | ||
toggleKeybinding: 'shift+alt+p' | ||
}); | ||
} | ||
|
||
} |
Oops, something went wrong.