Skip to content

Commit

Permalink
Address review comments #3
Browse files Browse the repository at this point in the history
- Add PropertyViewContribution to 'Views' and 'Menus' api-tests

Signed-off-by: Nina Doschek <ndoschek@eclipsesource.com>
  • Loading branch information
ndoschek committed Jan 21, 2021
1 parent 7d70f30 commit 78cf349
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions examples/api-tests/src/menus.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('Menus', function () {
const { OutputContribution } = require('@theia/output/lib/browser/output-contribution');
const { PluginFrontendViewContribution } = require('@theia/plugin-ext/lib/main/browser/plugin-frontend-view-contribution');
const { ProblemContribution } = require('@theia/markers/lib/browser/problem/problem-contribution');
const { PropertyViewContribution } = require('@theia/property-view/lib/browser/property-view-contribution');
const { SearchInWorkspaceFrontendContribution } = require('@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-contribution');
const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin');

Expand Down Expand Up @@ -67,6 +68,7 @@ describe('Menus', function () {
container.get(OutputContribution),
container.get(PluginFrontendViewContribution),
container.get(ProblemContribution),
container.get(PropertyViewContribution),
container.get(SearchInWorkspaceFrontendContribution)
]) {
it(`should toggle '${contribution.viewLabel}' view`, async () => {
Expand Down
4 changes: 3 additions & 1 deletion examples/api-tests/src/views.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('Views', function () {
const { ScmContribution } = require('@theia/scm/lib/browser/scm-contribution');
const { OutlineViewContribution } = require('@theia/outline-view/lib/browser/outline-view-contribution');
const { ProblemContribution } = require('@theia/markers/lib/browser/problem/problem-contribution');
const { PropertyViewContribution } = require('@theia/property-view/lib/browser/property-view-contribution');
const { HostedPluginSupport } = require('@theia/plugin-ext/lib/hosted/browser/hosted-plugin');

/** @type {import('inversify').Container} */
Expand All @@ -34,6 +35,7 @@ describe('Views', function () {
const scmContribution = container.get(ScmContribution);
const outlineContribution = container.get(OutlineViewContribution);
const problemContribution = container.get(ProblemContribution);
const propertyViewContribution = container.get(PropertyViewContribution);
const pluginService = container.get(HostedPluginSupport);

before(() => Promise.all([
Expand All @@ -44,7 +46,7 @@ describe('Views', function () {
})()
]));

for (const contribution of [navigatorContribution, scmContribution, outlineContribution, problemContribution]) {
for (const contribution of [navigatorContribution, scmContribution, outlineContribution, problemContribution, propertyViewContribution]) {
it(`should toggle ${contribution.viewLabel}`, async function () {
let view = await contribution.closeView();
if (view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export abstract class DefaultPropertyViewWidgetProvider implements PropertyViewW
}

provideWidget(selection: Object | undefined): Promise<PropertyViewContentWidget> {
return Promise.reject();
throw new Error('not implemented');
}

updateContentWidget(selection: Object | undefined): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ResourcePropertyDataService implements PropertyDataService {
} else if (this.isMonacoEditorSelection(selection)) {
return this.getFileStat((selection as MonacoEditor).uri);
}
return Promise.reject();
return undefined;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ export class ResourcePropertyViewTreeWidget extends TreeWidget implements Proper
if (this.updateNeeded(selection)) {
this.currentSelection = selection;
if (propertyDataService) {
propertyDataService.providePropertyData(selection).then((fileStatObject: FileStat) => {
propertyDataService.providePropertyData(selection).then((fileStatObject?: FileStat) => {
this.fillPropertiesTree(fileStatObject);
});
}
}
}

private fillPropertiesTree(fileStatObject?: FileStat): void {
this.propertiesTree.clear();
if (fileStatObject) {
this.propertiesTree.clear();
const infoNode = this.createCategoryNode('info', 'Info');
this.propertiesTree.set('info', infoNode);

Expand All @@ -104,8 +104,8 @@ export class ResourcePropertyViewTreeWidget extends TreeWidget implements Proper
infoNode.children.push(this.createResultLineNode('lastModification', 'Last modified', this.getLastModificationString(fileStatObject), infoNode));
infoNode.children.push(this.createResultLineNode('created', 'Created', this.getCreationTimeString(fileStatObject), infoNode));
infoNode.children.push(this.createResultLineNode('size', 'Size', this.getSizeString(fileStatObject), infoNode));
this.refreshModelChildren();
}
this.refreshModelChildren();
}

private getLocationString(fileStat: FileStat): string {
Expand Down Expand Up @@ -175,6 +175,7 @@ export class ResourcePropertyViewTreeWidget extends TreeWidget implements Proper
} else if (ResourcePropertiesItemNode.is(node)) {
return this.renderItemNode(node);
}
return undefined;
}

protected renderExpandableNode(node: ResourcePropertiesCategoryNode): React.ReactNode {
Expand Down

0 comments on commit 78cf349

Please sign in to comment.