66
77import _ = require( 'vs/base/parts/tree/browser/tree' ) ;
88import Mouse = require( 'vs/base/browser/mouseEvent' ) ;
9- import { DefaultDragAndDrop } from 'vs/base/parts/tree/browser/treeDefaults' ;
10- import URI from 'vs/base/common/uri' ;
11- import { basename } from 'vs/base/common/paths' ;
12- import { getPathLabel } from 'vs/base/common/labels' ;
13- import { DataTransfers } from 'vs/base/browser/dnd' ;
149
1510export class ElementsDragAndDropData implements _ . IDragAndDropData {
1611
@@ -76,48 +71,4 @@ export class DesktopDragAndDropData implements _.IDragAndDropData {
7671 files : this . files
7772 } ;
7873 }
79- }
80-
81- export class SimpleFileResourceDragAndDrop extends DefaultDragAndDrop {
82-
83- constructor ( private toResource : ( obj : any ) => URI ) {
84- super ( ) ;
85- }
86-
87- public getDragURI ( tree : _ . ITree , obj : any ) : string {
88- const resource = this . toResource ( obj ) ;
89- if ( resource ) {
90- return resource . toString ( ) ;
91- }
92-
93- return void 0 ;
94- }
95-
96- public getDragLabel ( tree : _ . ITree , elements : any [ ] ) : string {
97- if ( elements . length > 1 ) {
98- return String ( elements . length ) ;
99- }
100-
101- const resource = this . toResource ( elements [ 0 ] ) ;
102- if ( resource ) {
103- return basename ( resource . fsPath ) ;
104- }
105-
106- return void 0 ;
107- }
108-
109- public onDragStart ( tree : _ . ITree , data : _ . IDragAndDropData , originalEvent : Mouse . DragMouseEvent ) : void {
110- const sources : object [ ] = data . getData ( ) ;
111-
112- let source : object = null ;
113- if ( sources . length > 0 ) {
114- source = sources [ 0 ] ;
115- }
116-
117- // Apply some datatransfer types to allow for dragging the element outside of the application
118- const resource = this . toResource ( source ) ;
119- if ( resource ) {
120- originalEvent . dataTransfer . setData ( DataTransfers . TEXT , getPathLabel ( resource ) ) ;
121- }
122- }
12374}
0 commit comments