Skip to content

Commit

Permalink
tree-editor: fix deprecations
Browse files Browse the repository at this point in the history
Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed May 30, 2022
1 parent 55fead2 commit 2a826f7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions templates/tree-editor/tree-label-provider-contribution.ts
@@ -1,14 +1,15 @@
import { LabelProviderContribution } from '@theia/core/lib/browser';
import URI from '@theia/core/lib/common/uri';
import { FileStat } from '@theia/filesystem/lib/common';
import { FileStat } from '@theia/filesystem/lib/common/files';
import { injectable } from '@theia/core/shared/inversify';

@injectable()
export class TreeLabelProviderContribution implements LabelProviderContribution {
canHandle(uri: object): number {
let toCheck = uri;

canHandle(element: object): number {
let toCheck = element;
if (FileStat.is(toCheck)) {
toCheck = new URI(toCheck.uri);
toCheck = toCheck.resource;
}
if (toCheck instanceof URI) {
if (toCheck.path.ext === '.tree') {
Expand All @@ -21,6 +22,6 @@ export class TreeLabelProviderContribution implements LabelProviderContribution
getIcon(): string {
return 'fa fa-coffee dark-purple';
}

// We don't need to specify getName() nor getLongName() because the default uri label provider is responsible for them.
}

0 comments on commit 2a826f7

Please sign in to comment.