FileBrowser.st
changeset 2048 f8c010698b75
parent 2035 307ed5143d8b
child 2050 5ef6404d6172
equal deleted inserted replaced
2047:bb2070a26bd2 2048:f8c010698b75
  1490 
  1490 
  1491     dialog addTextLabel:(resources string:'ENCODING_MSG') withCRs.
  1491     dialog addTextLabel:(resources string:'ENCODING_MSG') withCRs.
  1492     dialog addVerticalSpace.
  1492     dialog addVerticalSpace.
  1493     dialog addListBoxOn:list withNumberOfLines:5.
  1493     dialog addListBoxOn:list withNumberOfLines:5.
  1494 
  1494 
  1495     dialog addAbortButton; addOkButton.
  1495     dialog addAbortAndOkButtons.
  1496     dialog open.
  1496     dialog open.
  1497 
  1497 
  1498     dialog accepted ifTrue:[
  1498     dialog accepted ifTrue:[
  1499 	idx := list selectionIndex.
  1499         idx := list selectionIndex.
  1500 	fileEncoding := encodings at:idx.
  1500         fileEncoding := encodings at:idx.
  1501 	subView externalEncoding:fileEncoding.
  1501         subView externalEncoding:fileEncoding.
  1502 
  1502 
  1503 	self validateFontEncodingFor:fileEncoding ask:true.
  1503         self validateFontEncodingFor:fileEncoding ask:true.
  1504     ].
  1504     ].
  1505 
  1505 
  1506     "Modified: 30.6.1997 / 14:41:12 / cg"
  1506     "Modified: 30.6.1997 / 14:41:12 / cg"
  1507 !
  1507 !
  1508 
  1508 
  2454     (box addTextLabel:(resources string:'Create hard link from:')) adjust:#left.
  2454     (box addTextLabel:(resources string:'Create hard link from:')) adjust:#left.
  2455     if1 := box addFilenameInputFieldOn:name1 in:here tabable:true.
  2455     if1 := box addFilenameInputFieldOn:name1 in:here tabable:true.
  2456     (box addTextLabel:(resources string:'to:')) adjust:#left.
  2456     (box addTextLabel:(resources string:'to:')) adjust:#left.
  2457     if2 := box addFilenameInputFieldOn:name2 in:here tabable:true.
  2457     if2 := box addFilenameInputFieldOn:name2 in:here tabable:true.
  2458 
  2458 
  2459     box addAbortButton; addOkButton.
  2459     box addAbortAndOkButtons.
  2460 
  2460 
  2461     orgName1 size > 0 ifTrue:[
  2461     orgName1 size > 0 ifTrue:[
  2462         box focusOnField:if2.
  2462         box focusOnField:if2.
  2463     ].
  2463     ].
  2464     box showAtPointer.
  2464     box showAtPointer.
  2510 
  2510 
  2511     sel := self getSelectedFileName.
  2511     sel := self getSelectedFileName.
  2512 
  2512 
  2513     orgName1 := ''.
  2513     orgName1 := ''.
  2514     (sel size > 0) ifTrue:[
  2514     (sel size > 0) ifTrue:[
  2515 	orgName1 := sel
  2515         orgName1 := sel
  2516     ].
  2516     ].
  2517 
  2517 
  2518     name1 := orgName1 asValue.
  2518     name1 := orgName1 asValue.
  2519     name2 := '' asValue.
  2519     name2 := '' asValue.
  2520 
  2520 
  2522     (box addTextLabel:'Create symbolic link to:') adjust:#left.
  2522     (box addTextLabel:'Create symbolic link to:') adjust:#left.
  2523     if1 := box addFilenameInputFieldOn:name1 in:here tabable:true.
  2523     if1 := box addFilenameInputFieldOn:name1 in:here tabable:true.
  2524     (box addTextLabel:'as:') adjust:#left.
  2524     (box addTextLabel:'as:') adjust:#left.
  2525     if2 := box addFilenameInputFieldOn:name2 in:here tabable:true.
  2525     if2 := box addFilenameInputFieldOn:name2 in:here tabable:true.
  2526 
  2526 
  2527     box addAbortButton; addOkButton.
  2527     box addAbortAndOkButtons.
  2528 
  2528 
  2529     orgName1 size > 0 ifTrue:[
  2529     orgName1 size > 0 ifTrue:[
  2530 	box focusOnField:if2.
  2530         box focusOnField:if2.
  2531     ].
  2531     ].
  2532     box showAtPointer.
  2532     box showAtPointer.
  2533 
  2533 
  2534     box accepted ifTrue:[
  2534     box accepted ifTrue:[
  2535 	name1 := name1 value.
  2535         name1 := name1 value.
  2536 	(name1 size == 0) ifTrue:[
  2536         (name1 size == 0) ifTrue:[
  2537 	    err := 'no name entered'.
  2537             err := 'no name entered'.
  2538 	] ifFalse:[
  2538         ] ifFalse:[
  2539 	    f1 := name1 asFilename.
  2539             f1 := name1 asFilename.
  2540 	    name2 := name2 value.
  2540             name2 := name2 value.
  2541 	    (name2 size == 0) ifTrue:[
  2541             (name2 size == 0) ifTrue:[
  2542 		err := 'no name entered'.
  2542                 err := 'no name entered'.
  2543 	    ] ifFalse:[
  2543             ] ifFalse:[
  2544 		f2 := name2 asFilename.
  2544                 f2 := name2 asFilename.
  2545 		f2 exists ifTrue:[
  2545                 f2 exists ifTrue:[
  2546 		    err := '''%2'' already exists'.
  2546                     err := '''%2'' already exists'.
  2547 		] ifFalse:[
  2547                 ] ifFalse:[
  2548 		    f1 exists ifFalse:[
  2548                     f1 exists ifFalse:[
  2549 			err := '''%1'' does not exist (link created anyway)'.
  2549                         err := '''%1'' does not exist (link created anyway)'.
  2550 		    ].
  2550                     ].
  2551 		    ErrorSignal handle:[:ex |
  2551                     ErrorSignal handle:[:ex |
  2552 			err := ex errorString
  2552                         err := ex errorString
  2553 		    ] do:[
  2553                     ] do:[
  2554 			OperatingSystem createSymbolicLinkFrom:name1 to:name2
  2554                         OperatingSystem createSymbolicLinkFrom:name1 to:name2
  2555 		    ]
  2555                     ]
  2556 		]
  2556                 ]
  2557 	    ]
  2557             ]
  2558 	].
  2558         ].
  2559 
  2559 
  2560 	err notNil ifTrue:[
  2560         err notNil ifTrue:[
  2561 	    self warn:(resources string:err with:(name1 ? '') asText allBold with:(name2 ? '') asText allBold).
  2561             self warn:(resources string:err with:(name1 ? '') asText allBold with:(name2 ? '') asText allBold).
  2562 	    ^ self
  2562             ^ self
  2563 	].
  2563         ].
  2564     ].
  2564     ].
  2565 
  2565 
  2566     "Modified: / 13.8.1998 / 21:26:59 / cg"
  2566     "Modified: / 13.8.1998 / 21:26:59 / cg"
  2567     "Created: / 13.8.1998 / 21:47:14 / cg"
  2567     "Created: / 13.8.1998 / 21:47:14 / cg"
  2568 !
  2568 !
  2614 
  2614 
  2615     orgName1 := ''.
  2615     orgName1 := ''.
  2616     (sel size > 0
  2616     (sel size > 0
  2617     and:[lastFileDiffDirectory notNil
  2617     and:[lastFileDiffDirectory notNil
  2618     and:[lastFileDiffDirectory asFilename isDirectory]]) ifTrue:[
  2618     and:[lastFileDiffDirectory asFilename isDirectory]]) ifTrue:[
  2619 	f := lastFileDiffDirectory asFilename construct:sel.
  2619         f := lastFileDiffDirectory asFilename construct:sel.
  2620 	(f exists
  2620         (f exists
  2621 	and:[f isReadable]) ifTrue:[
  2621         and:[f isReadable]) ifTrue:[
  2622 	    orgName1 := f name
  2622             orgName1 := f name
  2623 	]
  2623         ]
  2624     ].
  2624     ].
  2625 
  2625 
  2626     name1 := orgName1 asValue.
  2626     name1 := orgName1 asValue.
  2627     name2 := self getSelectedFileName asValue.
  2627     name2 := self getSelectedFileName asValue.
  2628     here := currentDirectory pathName.
  2628     here := currentDirectory pathName.
  2631     (box addTextLabel:'show difference between:\\file1 (empty for views contents):' withCRs) adjust:#left.
  2631     (box addTextLabel:'show difference between:\\file1 (empty for views contents):' withCRs) adjust:#left.
  2632     box addFilenameInputFieldOn:name1 in:here tabable:true.
  2632     box addFilenameInputFieldOn:name1 in:here tabable:true.
  2633     (box addTextLabel:'and file2:') adjust:#left.
  2633     (box addTextLabel:'and file2:') adjust:#left.
  2634     box addFilenameInputFieldOn:name2 in:here tabable:true.
  2634     box addFilenameInputFieldOn:name2 in:here tabable:true.
  2635 
  2635 
  2636     box addAbortButton; addOkButton.
  2636     box addAbortAndOkButtons.
  2637 
  2637 
  2638     box showAtPointer.
  2638     box showAtPointer.
  2639 
  2639 
  2640     box accepted ifTrue:[
  2640     box accepted ifTrue:[
  2641 	name1 := name1 value.
  2641         name1 := name1 value.
  2642 	(name1 isNil or:[name1 isEmpty]) ifTrue:[
  2642         (name1 isNil or:[name1 isEmpty]) ifTrue:[
  2643 	    text1 := subView contents.
  2643             text1 := subView contents.
  2644 	    name1 := nil.
  2644             name1 := nil.
  2645 	    l1 := 'browser contents'
  2645             l1 := 'browser contents'
  2646 	] ifFalse:[
  2646         ] ifFalse:[
  2647 	    name1 := currentDirectory filenameFor:name1.
  2647             name1 := currentDirectory filenameFor:name1.
  2648 	    name1 isReadable ifFalse:[
  2648             name1 isReadable ifFalse:[
  2649 		nm := name1.
  2649                 nm := name1.
  2650 		name1 exists ifFalse:[
  2650                 name1 exists ifFalse:[
  2651 		    err := '%1 does not exist'.
  2651                     err := '%1 does not exist'.
  2652 		] ifTrue:[
  2652                 ] ifTrue:[
  2653 		    err := '%1 is not readable'
  2653                     err := '%1 is not readable'
  2654 		].
  2654                 ].
  2655 	    ].
  2655             ].
  2656 	    l1 := name1 pathName
  2656             l1 := name1 pathName
  2657 	].
  2657         ].
  2658 
  2658 
  2659 	name2 := currentDirectory filenameFor:name2 value.
  2659         name2 := currentDirectory filenameFor:name2 value.
  2660 	err isNil ifTrue:[
  2660         err isNil ifTrue:[
  2661 	    name2 isReadable ifFalse:[
  2661             name2 isReadable ifFalse:[
  2662 		nm := name2.
  2662                 nm := name2.
  2663 		name2 exists ifFalse:[
  2663                 name2 exists ifFalse:[
  2664 		    err := '%1 does not exist'.
  2664                     err := '%1 does not exist'.
  2665 		] ifTrue:[
  2665                 ] ifTrue:[
  2666 		    err := '%1 is not readable'
  2666                     err := '%1 is not readable'
  2667 		].
  2667                 ].
  2668 	    ].
  2668             ].
  2669 	].
  2669         ].
  2670 	err notNil ifTrue:[
  2670         err notNil ifTrue:[
  2671 	    self warn:(resources string:err with:nm pathName).
  2671             self warn:(resources string:err with:nm pathName).
  2672 	    ^ self
  2672             ^ self
  2673 	].
  2673         ].
  2674 
  2674 
  2675 	self withWaitCursorDo:[
  2675         self withWaitCursorDo:[
  2676 	    (name1 notNil and:[name1 name ~= orgName1]) ifTrue:[
  2676             (name1 notNil and:[name1 name ~= orgName1]) ifTrue:[
  2677 		lastFileDiffDirectory := name1 directoryName
  2677                 lastFileDiffDirectory := name1 directoryName
  2678 	    ].
  2678             ].
  2679 	    name1 notNil ifTrue:[
  2679             name1 notNil ifTrue:[
  2680 		text1 := name1 contents.
  2680                 text1 := name1 contents.
  2681 	    ].
  2681             ].
  2682 	    text2 := name2 contents.
  2682             text2 := name2 contents.
  2683 	    text1 = text2 ifTrue:[
  2683             text1 = text2 ifTrue:[
  2684 		self information:'same contents'
  2684                 self information:'same contents'
  2685 	    ] ifFalse:[
  2685             ] ifFalse:[
  2686 		d := DiffTextView 
  2686                 d := DiffTextView 
  2687 			openOn:text1 label:l1
  2687                         openOn:text1 label:l1
  2688 			and:text2 label:name2 pathName.
  2688                         and:text2 label:name2 pathName.
  2689 		d label:'file differences'.
  2689                 d label:'file differences'.
  2690 	    ]
  2690             ]
  2691 	]
  2691         ]
  2692     ].
  2692     ].
  2693 
  2693 
  2694     "Created: / 7.12.1995 / 20:33:58 / cg"
  2694     "Created: / 7.12.1995 / 20:33:58 / cg"
  2695     "Modified: / 18.9.1997 / 17:31:46 / stefan"
  2695     "Modified: / 18.9.1997 / 17:31:46 / stefan"
  2696     "Modified: / 25.8.1998 / 21:11:46 / cg"
  2696     "Modified: / 25.8.1998 / 21:11:46 / cg"
  6323 ! !
  6323 ! !
  6324 
  6324 
  6325 !FileBrowser class methodsFor:'documentation'!
  6325 !FileBrowser class methodsFor:'documentation'!
  6326 
  6326 
  6327 version
  6327 version
  6328     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.293 1999-02-25 18:42:37 cg Exp $'
  6328     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.294 1999-03-06 02:14:22 cg Exp $'
  6329 ! !
  6329 ! !