mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2 (#9253)
* Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2 * skip failing tests * remove github-authentication extensions * ignore github compile steps * ignore github compile steps * check in compiled files
This commit is contained in:
@@ -9,7 +9,7 @@ import * as nls from 'vs/nls';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
|
||||
import { IWorkbenchActionRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/actions';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IEditorGroupsService, GroupOrientation } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
@@ -24,8 +24,9 @@ import { InEditorZenModeContext, IsCenteredLayoutContext, EditorAreaVisibleConte
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { SideBarVisibleContext } from 'vs/workbench/common/viewlet';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IViewDescriptorService, IViewContainersRegistry, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
|
||||
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchExtensions.WorkbenchActions);
|
||||
const viewCategory = nls.localize('view', "View");
|
||||
|
||||
// --- Close Side Bar
|
||||
@@ -482,6 +483,42 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
|
||||
order: 0
|
||||
});
|
||||
|
||||
// --- Reset View Positions
|
||||
|
||||
export class ResetViewLocationsAction extends Action {
|
||||
static readonly ID = 'workbench.action.resetViewLocations';
|
||||
static readonly LABEL = nls.localize('resetViewLocations', "Reset View Locations");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IViewDescriptorService private viewDescriptorService: IViewDescriptorService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
const viewContainerRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
|
||||
viewContainerRegistry.all.forEach(viewContainer => {
|
||||
const viewDescriptors = this.viewDescriptorService.getViewDescriptors(viewContainer);
|
||||
|
||||
viewDescriptors.allViewDescriptors.forEach(viewDescriptor => {
|
||||
const defaultContainer = this.viewDescriptorService.getDefaultContainer(viewDescriptor.id);
|
||||
const currentContainer = this.viewDescriptorService.getViewContainer(viewDescriptor.id);
|
||||
|
||||
if (defaultContainer && currentContainer !== defaultContainer) {
|
||||
this.viewDescriptorService.moveViewsToContainer([viewDescriptor], defaultContainer);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
registry.registerWorkbenchAction(SyncActionDescriptor.create(ResetViewLocationsAction, ResetViewLocationsAction.ID, ResetViewLocationsAction.LABEL), 'View: Reset View Locations', viewCategory);
|
||||
|
||||
|
||||
// --- Resize View
|
||||
|
||||
export abstract class BaseResizeViewAction extends Action {
|
||||
|
||||
@@ -1180,6 +1180,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
} else {
|
||||
this.setEditorHidden(false);
|
||||
this.workbenchGrid.resizeView(this.panelPartView, { width: this.state.panel.position === Position.BOTTOM ? size.width : this.state.panel.lastNonMaximizedWidth, height: this.state.panel.position === Position.BOTTOM ? this.state.panel.lastNonMaximizedHeight : size.height });
|
||||
this.editorGroupService.activeGroup.focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ import { ToggleActivityBarVisibilityAction, ToggleMenuBarAction } from 'vs/workb
|
||||
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { CompositeBar, ICompositeBarItem } from 'vs/workbench/browser/parts/compositeBar';
|
||||
import { CompositeBar, ICompositeBarItem, CompositeDragAndDrop } from 'vs/workbench/browser/parts/compositeBar';
|
||||
import { Dimension, addClass, removeNode } from 'vs/base/browser/dom';
|
||||
import { IStorageService, StorageScope, IWorkspaceStorageChangeEvent } from 'vs/platform/storage/common/storage';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { ToggleCompositePinnedAction, ICompositeBarColors, ActivityAction, ICompositeActivity } from 'vs/workbench/browser/parts/compositeBarActions';
|
||||
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { IViewDescriptorService, IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainer, TEST_VIEW_CONTAINER_ID, IViewDescriptorCollection } from 'vs/workbench/common/views';
|
||||
import { IViewDescriptorService, IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainer, TEST_VIEW_CONTAINER_ID, IViewDescriptorCollection, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
import { isUndefinedOrNull, assertIsDefined } from 'vs/base/common/types';
|
||||
@@ -128,6 +128,11 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||
getContextMenuActionsForComposite: () => [],
|
||||
getDefaultCompositeId: () => this.viewletService.getDefaultViewletId(),
|
||||
hidePart: () => this.layoutService.setSideBarHidden(true),
|
||||
dndHandler: new CompositeDragAndDrop(this.viewDescriptorService, ViewContainerLocation.Sidebar,
|
||||
(id: string, focus?: boolean) => this.viewletService.openViewlet(id, focus),
|
||||
(from: string, to: string) => this.compositeBar.move(from, to),
|
||||
() => this.getPinnedViewletIds()
|
||||
),
|
||||
compositeSize: 50,
|
||||
colors: (theme: ITheme) => this.getActivitybarItemColors(theme),
|
||||
overflowActionSize: ActivitybarPart.ACTION_HEIGHT
|
||||
|
||||
@@ -20,6 +20,10 @@ import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { LocalSelectionTransfer } from 'vs/workbench/browser/dnd';
|
||||
import { ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { DraggedViewIdentifier } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views';
|
||||
import { ICompositeDragAndDrop, CompositeDragAndDropData } from 'vs/base/parts/composite/browser/compositeDnd';
|
||||
|
||||
export interface ICompositeBarItem {
|
||||
id: string;
|
||||
@@ -29,12 +33,120 @@ export interface ICompositeBarItem {
|
||||
visible: boolean;
|
||||
}
|
||||
|
||||
export class CompositeDragAndDrop implements ICompositeDragAndDrop {
|
||||
|
||||
constructor(
|
||||
private viewDescriptorService: IViewDescriptorService,
|
||||
private targetContainerLocation: ViewContainerLocation,
|
||||
private openComposite: (id: string, focus?: boolean) => void,
|
||||
private moveComposite: (from: string, to: string) => void,
|
||||
private getVisibleCompositeIds: () => string[]
|
||||
) { }
|
||||
drop(data: CompositeDragAndDropData, targetCompositeId: string | undefined, originalEvent: DragEvent): void {
|
||||
const dragData = data.getData();
|
||||
const viewContainerRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
|
||||
|
||||
if (dragData.type === 'composite') {
|
||||
const currentContainer = viewContainerRegistry.get(dragData.id)!;
|
||||
const currentLocation = viewContainerRegistry.getViewContainerLocation(currentContainer);
|
||||
if (targetCompositeId) {
|
||||
if (currentLocation !== this.targetContainerLocation && this.targetContainerLocation !== ViewContainerLocation.Panel) {
|
||||
const destinationContainer = viewContainerRegistry.get(targetCompositeId);
|
||||
if (destinationContainer) {
|
||||
this.viewDescriptorService.moveViewsToContainer(this.viewDescriptorService.getViewDescriptors(currentContainer)!.allViewDescriptors.filter(vd => vd.canMoveView), destinationContainer);
|
||||
this.openComposite(targetCompositeId, true);
|
||||
}
|
||||
} else {
|
||||
this.moveComposite(dragData.id, targetCompositeId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const viewDescriptor = this.viewDescriptorService.getViewDescriptor(dragData.id);
|
||||
if (viewDescriptor && viewDescriptor.canMoveView) {
|
||||
if (targetCompositeId) {
|
||||
const destinationContainer = viewContainerRegistry.get(targetCompositeId);
|
||||
if (destinationContainer) {
|
||||
if (this.targetContainerLocation === ViewContainerLocation.Sidebar) {
|
||||
this.viewDescriptorService.moveViewsToContainer([viewDescriptor], destinationContainer);
|
||||
this.openComposite(targetCompositeId, true);
|
||||
} else {
|
||||
this.viewDescriptorService.moveViewToLocation(viewDescriptor, this.targetContainerLocation);
|
||||
this.moveComposite(this.viewDescriptorService.getViewContainer(viewDescriptor.id)!.id, targetCompositeId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.viewDescriptorService.moveViewToLocation(viewDescriptor, this.targetContainerLocation);
|
||||
const newCompositeId = this.viewDescriptorService.getViewContainer(dragData.id)!.id;
|
||||
const visibleItems = this.getVisibleCompositeIds();
|
||||
const targetId = visibleItems.length ? visibleItems[visibleItems.length - 1] : undefined;
|
||||
if (targetId && targetId !== newCompositeId) {
|
||||
this.moveComposite(newCompositeId, targetId);
|
||||
}
|
||||
|
||||
this.openComposite(newCompositeId, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onDragOver(data: CompositeDragAndDropData, targetCompositeId: string | undefined, originalEvent: DragEvent): boolean {
|
||||
const dragData = data.getData();
|
||||
const viewContainerRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
|
||||
|
||||
if (dragData.type === 'composite') {
|
||||
// Dragging a composite
|
||||
const currentContainer = viewContainerRegistry.get(dragData.id)!;
|
||||
const currentLocation = viewContainerRegistry.getViewContainerLocation(currentContainer);
|
||||
|
||||
// ... to the same location
|
||||
if (currentLocation === this.targetContainerLocation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ... across view containers but without a destination composite
|
||||
if (!targetCompositeId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ... from panel to the sidebar
|
||||
if (this.targetContainerLocation === ViewContainerLocation.Sidebar) {
|
||||
const destinationContainer = viewContainerRegistry.get(targetCompositeId);
|
||||
return !!destinationContainer &&
|
||||
this.viewDescriptorService.getViewDescriptors(currentContainer)!.allViewDescriptors.some(vd => vd.canMoveView);
|
||||
}
|
||||
// ... from sidebar to the panel
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Dragging an individual view
|
||||
const viewDescriptor = this.viewDescriptorService.getViewDescriptor(dragData.id);
|
||||
|
||||
// ... that cannot move
|
||||
if (!viewDescriptor || !viewDescriptor.canMoveView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ... to create a view container
|
||||
if (!targetCompositeId) {
|
||||
return this.targetContainerLocation === ViewContainerLocation.Panel;
|
||||
}
|
||||
|
||||
// ... into a destination
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ICompositeBarOptions {
|
||||
readonly icon: boolean;
|
||||
readonly orientation: ActionsOrientation;
|
||||
readonly colors: (theme: ITheme) => ICompositeBarColors;
|
||||
readonly compositeSize: number;
|
||||
readonly overflowActionSize: number;
|
||||
readonly dndHandler: ICompositeDragAndDrop;
|
||||
|
||||
getActivityAction: (compositeId: string) => ActivityAction;
|
||||
getCompositePinnedAction: (compositeId: string) => Action;
|
||||
@@ -58,7 +170,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
|
||||
private visibleComposites: string[];
|
||||
private compositeSizeInBar: Map<string, number>;
|
||||
|
||||
private compositeTransfer: LocalSelectionTransfer<DraggedCompositeIdentifier>;
|
||||
private compositeTransfer: LocalSelectionTransfer<DraggedCompositeIdentifier | DraggedViewIdentifier>;
|
||||
|
||||
private readonly _onDidChange: Emitter<void> = this._register(new Emitter<void>());
|
||||
readonly onDidChange = this._onDidChange.event;
|
||||
@@ -107,6 +219,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
|
||||
() => this.getContextMenuActions() as Action[],
|
||||
this.options.colors,
|
||||
this.options.icon,
|
||||
this.options.dndHandler,
|
||||
this
|
||||
);
|
||||
},
|
||||
@@ -134,6 +247,46 @@ export class CompositeBar extends Widget implements ICompositeBar {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.compositeTransfer.hasData(DraggedViewIdentifier.prototype)) {
|
||||
const data = this.compositeTransfer.getData(DraggedViewIdentifier.prototype);
|
||||
if (Array.isArray(data)) {
|
||||
const draggedViewId = data[0].id;
|
||||
this.compositeTransfer.clearData(DraggedViewIdentifier.prototype);
|
||||
|
||||
this.options.dndHandler.drop(new CompositeDragAndDropData('view', draggedViewId), undefined, e);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
this._register(addDisposableListener(parent, EventType.DRAG_OVER, (e: DragEvent) => {
|
||||
if (this.compositeTransfer.hasData(DraggedCompositeIdentifier.prototype)) {
|
||||
EventHelper.stop(e, true);
|
||||
|
||||
const data = this.compositeTransfer.getData(DraggedCompositeIdentifier.prototype);
|
||||
if (Array.isArray(data)) {
|
||||
const draggedCompositeId = data[0].id;
|
||||
|
||||
// Check if drop is allowed
|
||||
if (e.dataTransfer && !this.options.dndHandler.onDragOver(new CompositeDragAndDropData('composite', draggedCompositeId), undefined, e)) {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.compositeTransfer.hasData(DraggedViewIdentifier.prototype)) {
|
||||
EventHelper.stop(e, true);
|
||||
|
||||
const data = this.compositeTransfer.getData(DraggedViewIdentifier.prototype);
|
||||
if (Array.isArray(data)) {
|
||||
const draggedViewId = data[0].id;
|
||||
|
||||
// Check if drop is allowed
|
||||
if (e.dataTransfer && !this.options.dndHandler.onDragOver(new CompositeDragAndDropData('view', draggedViewId), undefined, e)) {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
return actionBarDiv;
|
||||
|
||||
@@ -20,6 +20,8 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { DragAndDropObserver, LocalSelectionTransfer } from 'vs/workbench/browser/dnd';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { DraggedViewIdentifier } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { ICompositeDragAndDrop, CompositeDragAndDropData } from 'vs/base/parts/composite/browser/compositeDnd';
|
||||
|
||||
export interface ICompositeActivity {
|
||||
badge: IBadge;
|
||||
@@ -458,7 +460,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
|
||||
private static manageExtensionAction: ManageExtensionAction;
|
||||
|
||||
private compositeActivity: IActivity | undefined;
|
||||
private compositeTransfer: LocalSelectionTransfer<DraggedCompositeIdentifier>;
|
||||
private compositeTransfer: LocalSelectionTransfer<DraggedCompositeIdentifier | DraggedViewIdentifier>;
|
||||
|
||||
constructor(
|
||||
private compositeActivityAction: ActivityAction,
|
||||
@@ -467,6 +469,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
|
||||
private contextMenuActionsProvider: () => ReadonlyArray<Action>,
|
||||
colors: (theme: ITheme) => ICompositeBarColors,
|
||||
icon: boolean,
|
||||
private dndHandler: ICompositeDragAndDrop,
|
||||
private compositeBar: ICompositeBar,
|
||||
@IContextMenuService private readonly contextMenuService: IContextMenuService,
|
||||
@IKeybindingService private readonly keybindingService: IKeybindingService,
|
||||
@@ -475,7 +478,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
|
||||
) {
|
||||
super(compositeActivityAction, { draggable: true, colors, icon }, themeService);
|
||||
|
||||
this.compositeTransfer = LocalSelectionTransfer.getInstance<DraggedCompositeIdentifier>();
|
||||
this.compositeTransfer = LocalSelectionTransfer.getInstance<DraggedCompositeIdentifier | DraggedViewIdentifier>();
|
||||
|
||||
if (!CompositeActionViewItem.manageExtensionAction) {
|
||||
CompositeActionViewItem.manageExtensionAction = instantiationService.createInstance(ManageExtensionAction);
|
||||
@@ -546,6 +549,31 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
|
||||
}
|
||||
},
|
||||
|
||||
onDragOver: e => {
|
||||
dom.EventHelper.stop(e, true);
|
||||
if (this.compositeTransfer.hasData(DraggedCompositeIdentifier.prototype)) {
|
||||
const data = this.compositeTransfer.getData(DraggedCompositeIdentifier.prototype);
|
||||
if (Array.isArray(data)) {
|
||||
const draggedCompositeId = data[0].id;
|
||||
if (draggedCompositeId !== this.activity.id) {
|
||||
if (e.dataTransfer && !this.dndHandler.onDragOver(new CompositeDragAndDropData('composite', draggedCompositeId), this.activity.id, e)) {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.compositeTransfer.hasData(DraggedViewIdentifier.prototype)) {
|
||||
const data = this.compositeTransfer.getData(DraggedViewIdentifier.prototype);
|
||||
if (Array.isArray(data)) {
|
||||
const draggedViewId = data[0].id;
|
||||
if (e.dataTransfer && !this.dndHandler.onDragOver(new CompositeDragAndDropData('view', draggedViewId), this.activity.id, e)) {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDragLeave: e => {
|
||||
if (this.compositeTransfer.hasData(DraggedCompositeIdentifier.prototype)) {
|
||||
this.updateFromDragging(container, false);
|
||||
@@ -571,16 +599,27 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
|
||||
this.updateFromDragging(container, false);
|
||||
this.compositeTransfer.clearData(DraggedCompositeIdentifier.prototype);
|
||||
|
||||
this.compositeBar.move(draggedCompositeId, this.activity.id);
|
||||
this.dndHandler.drop(new CompositeDragAndDropData('composite', draggedCompositeId), this.activity.id, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.compositeTransfer.hasData(DraggedViewIdentifier.prototype)) {
|
||||
const data = this.compositeTransfer.getData(DraggedViewIdentifier.prototype);
|
||||
if (Array.isArray(data)) {
|
||||
const draggedViewId = data[0].id;
|
||||
|
||||
this.dndHandler.drop(new CompositeDragAndDropData('view', draggedViewId), this.activity.id, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
// Activate on drag over to reveal targets
|
||||
[this.badge, this.label].forEach(b => this._register(new DelayedDragHandler(b, () => {
|
||||
if (!this.compositeTransfer.hasData(DraggedCompositeIdentifier.prototype) && !this.getAction().checked) {
|
||||
if (!(this.compositeTransfer.hasData(DraggedCompositeIdentifier.prototype) ||
|
||||
this.compositeTransfer.hasData(DraggedViewIdentifier.prototype)) &&
|
||||
!this.getAction().checked) {
|
||||
this.getAction().run();
|
||||
}
|
||||
})));
|
||||
|
||||
@@ -22,7 +22,7 @@ import { ClosePanelAction, PanelActivityAction, ToggleMaximizedPanelAction, Togg
|
||||
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
|
||||
import { PANEL_BACKGROUND, PANEL_BORDER, PANEL_ACTIVE_TITLE_FOREGROUND, PANEL_INACTIVE_TITLE_FOREGROUND, PANEL_ACTIVE_TITLE_BORDER, PANEL_DRAG_AND_DROP_BACKGROUND, PANEL_INPUT_BORDER } from 'vs/workbench/common/theme';
|
||||
import { activeContrastBorder, focusBorder, contrastBorder, editorBackground, badgeBackground, badgeForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { CompositeBar, ICompositeBarItem } from 'vs/workbench/browser/parts/compositeBar';
|
||||
import { CompositeBar, ICompositeBarItem, CompositeDragAndDrop } from 'vs/workbench/browser/parts/compositeBar';
|
||||
import { ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositeBarActions';
|
||||
import { IBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@@ -33,7 +33,7 @@ import { IContextKey, IContextKeyService, ContextKeyExpr } from 'vs/platform/con
|
||||
import { isUndefinedOrNull, assertIsDefined } from 'vs/base/common/types';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ViewContainer, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewDescriptorService, IViewDescriptorCollection } from 'vs/workbench/common/views';
|
||||
import { ViewContainer, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewDescriptorService, IViewDescriptorCollection, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
import { MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { ViewMenuActions } from 'vs/workbench/browser/parts/views/viewMenuActions';
|
||||
|
||||
@@ -142,6 +142,11 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
getContextMenuActionsForComposite: (compositeId: string) => this.getContextMenuActionsForComposite(compositeId) as Action[],
|
||||
getDefaultCompositeId: () => this.panelRegistry.getDefaultPanelId(),
|
||||
hidePart: () => this.layoutService.setPanelHidden(true),
|
||||
dndHandler: new CompositeDragAndDrop(this.viewDescriptorService, ViewContainerLocation.Panel,
|
||||
(id: string, focus?: boolean) => this.openPanel(id, focus),
|
||||
(from: string, to: string) => this.compositeBar.move(from, to),
|
||||
() => this.getPinnedPanels().map(p => p.id)
|
||||
),
|
||||
compositeSize: 0,
|
||||
overflowActionSize: 44,
|
||||
colors: (theme: ITheme) => ({
|
||||
@@ -397,7 +402,17 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
||||
|
||||
getPanels(): readonly PanelDescriptor[] {
|
||||
return this.panelRegistry.getPanels()
|
||||
.sort((v1, v2) => typeof v1.order === 'number' && typeof v2.order === 'number' ? v1.order - v2.order : NaN);
|
||||
.sort((v1, v2) => {
|
||||
if (typeof v1.order !== 'number') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (typeof v2.order !== 'number') {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return v1.order - v2.order;
|
||||
});
|
||||
}
|
||||
|
||||
getPinnedPanels(): readonly PanelDescriptor[] {
|
||||
|
||||
@@ -42,6 +42,7 @@ import { parseLinkedText } from 'vs/base/common/linkedText';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import { Link } from 'vs/platform/opener/browser/link';
|
||||
import { LocalSelectionTransfer } from 'vs/workbench/browser/dnd';
|
||||
|
||||
export interface IPaneColors extends IColorMapping {
|
||||
dropBackground?: ColorIdentifier;
|
||||
@@ -57,6 +58,15 @@ export interface IViewPaneOptions extends IPaneOptions {
|
||||
titleMenuId?: MenuId;
|
||||
}
|
||||
|
||||
export class DraggedViewIdentifier {
|
||||
constructor(private _viewId: string) { }
|
||||
|
||||
get id(): string {
|
||||
return this._viewId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const viewsRegistry = Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry);
|
||||
|
||||
interface IItem {
|
||||
@@ -444,6 +454,8 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
|
||||
private paneItems: IViewPaneItem[] = [];
|
||||
private paneview?: PaneView;
|
||||
|
||||
private static viewTransfer = LocalSelectionTransfer.getInstance<DraggedViewIdentifier>();
|
||||
|
||||
private visible: boolean = false;
|
||||
|
||||
private areExtensionsReady: boolean = false;
|
||||
@@ -874,6 +886,22 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
|
||||
|
||||
this.paneItems.splice(index, 0, paneItem);
|
||||
assertIsDefined(this.paneview).addPane(pane, size, index);
|
||||
|
||||
this._register(addDisposableListener(pane.draggableElement, EventType.DRAG_START, (e: DragEvent) => {
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
}
|
||||
|
||||
// Register as dragged to local transfer
|
||||
ViewPaneContainer.viewTransfer.setData([new DraggedViewIdentifier(pane.id)], DraggedViewIdentifier.prototype);
|
||||
}));
|
||||
|
||||
|
||||
this._register(addDisposableListener(pane.draggableElement, EventType.DRAG_END, (e: DragEvent) => {
|
||||
if (ViewPaneContainer.viewTransfer.hasData(DraggedViewIdentifier.prototype)) {
|
||||
ViewPaneContainer.viewTransfer.clearData(DraggedViewIdentifier.prototype);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
removePanes(panes: ViewPane[]): void {
|
||||
@@ -952,7 +980,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
|
||||
}
|
||||
if (!this.areExtensionsReady) {
|
||||
if (this.visibleViewsCountFromCache === undefined) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
// Check in cache so that view do not jump. See #29609
|
||||
return this.visibleViewsCountFromCache === 1;
|
||||
|
||||
@@ -591,7 +591,7 @@ export class ViewsService extends Disposable implements IViewsService {
|
||||
}
|
||||
run(accessor: ServicesAccessor): any {
|
||||
accessor.get(IViewDescriptorService).moveViewToLocation(viewDescriptor, newLocation);
|
||||
accessor.get(IViewsService).openView(viewDescriptor.id);
|
||||
accessor.get(IViewsService).openView(viewDescriptor.id, true);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user