-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Toolbar Icons for Zoom In, Zoom Out and Reset.
Signed-off-by: muddana-satish <satish.muddana@ericsson.com>
- Loading branch information
Showing
5 changed files
with
125 additions
and
3 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
22 changes: 22 additions & 0 deletions
22
theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-toolbar-commands.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 @@ | ||
import { Command } from '@theia/core'; | ||
|
||
export namespace TraceViewerToolbarCommands { | ||
|
||
export const ZOOM_IN: Command = { | ||
id: 'trace.viewer.zoomin', | ||
label: 'Zoom In', | ||
iconClass: 'fa fa-plus-square-o fa-lg', | ||
}; | ||
|
||
export const ZOOM_OUT: Command = { | ||
id: 'trace.viewer.toolbar.zoomout', | ||
label: 'Zoom Out', | ||
iconClass: 'fa fa-minus-square-o fa-lg', | ||
}; | ||
|
||
export const RESET: Command = { | ||
id: 'trace.viewer.toolbar.reset', | ||
label: 'Reset', | ||
iconClass: 'fa fa-home fa-lg', | ||
}; | ||
} |
72 changes: 72 additions & 0 deletions
72
...extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-toolbar-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,72 @@ | ||
import { injectable, inject } from 'inversify'; | ||
import { AbstractViewContribution, ApplicationShell, Widget } from '@theia/core/lib/browser'; | ||
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; | ||
import { CommandRegistry } from '@theia/core'; | ||
import { TraceViewerToolbarCommands } from './trace-viewer-toolbar-commands'; | ||
import { signalManager } from '@trace-viewer/base/lib/signals/signal-manager'; | ||
import { TraceViewerWidget } from './trace-viewer'; | ||
|
||
@injectable() | ||
export class TraceViewerToolbarContribution extends AbstractViewContribution<Widget> implements TabBarToolbarContribution { | ||
@inject(ApplicationShell) protected readonly shell: ApplicationShell; | ||
|
||
constructor() { | ||
super({ | ||
widgetId: TraceViewerWidget.ID, | ||
widgetName: TraceViewerWidget.LABEL, | ||
defaultWidgetOptions: { | ||
area: 'main', | ||
}, | ||
}); | ||
} | ||
|
||
initializeLayout(): void { | ||
this.openView({ activate: false }); | ||
} | ||
|
||
registerCommands(registry: CommandRegistry): void { | ||
super.registerCommands(registry); | ||
registry.registerCommand( | ||
TraceViewerToolbarCommands.ZOOM_IN, { | ||
isVisible: (w: Widget) => w instanceof TraceViewerWidget, | ||
execute: () => { | ||
signalManager().fireZoomTimeGraphSignal(true); | ||
} | ||
}); | ||
registry.registerCommand( | ||
TraceViewerToolbarCommands.ZOOM_OUT, { | ||
isVisible: (w: Widget) => w instanceof TraceViewerWidget, | ||
execute: () => { | ||
signalManager().fireZoomTimeGraphSignal(false); | ||
} | ||
}); | ||
registry.registerCommand( | ||
TraceViewerToolbarCommands.RESET, { | ||
isVisible: (w: Widget) => w instanceof TraceViewerWidget, | ||
execute: () => { | ||
signalManager().fireResetTimeGraphSignal(); | ||
} | ||
}); | ||
} | ||
|
||
registerToolbarItems(registry: TabBarToolbarRegistry): void { | ||
registry.registerItem({ | ||
id: TraceViewerToolbarCommands.ZOOM_IN.id, | ||
command: TraceViewerToolbarCommands.ZOOM_IN.id, | ||
tooltip: TraceViewerToolbarCommands.ZOOM_IN.label, | ||
priority: 1, | ||
}); | ||
registry.registerItem({ | ||
id: TraceViewerToolbarCommands.ZOOM_OUT.id, | ||
command: TraceViewerToolbarCommands.ZOOM_OUT.id, | ||
tooltip: TraceViewerToolbarCommands.ZOOM_OUT.label, | ||
priority: 2, | ||
}); | ||
registry.registerItem({ | ||
id: TraceViewerToolbarCommands.RESET.id, | ||
command: TraceViewerToolbarCommands.RESET.id, | ||
tooltip: TraceViewerToolbarCommands.RESET.label, | ||
priority: 3, | ||
}); | ||
} | ||
} |