957 |
959 |
958 clearHistory |
960 clearHistory |
959 Workspace clearDoItHistory |
961 Workspace clearDoItHistory |
960 ! |
962 ! |
961 |
963 |
962 copySelection |
|
963 self selectedWorkspacesTextView copySelection |
|
964 ! |
|
965 |
|
966 cutSelection |
|
967 self selectedWorkspacesTextView cutSelection |
|
968 ! |
|
969 |
|
970 doIt |
964 doIt |
971 self selectedWorkspacesTextView doIt |
965 self selectedWorkspacesTextView doIt |
972 ! |
|
973 |
|
974 filterText |
|
975 |template filterBlock newList oldList answer nDeleted deletedLines| |
|
976 |
|
977 template := |
|
978 '"/ general text filter; |
|
979 "/ the following block should evaluate to true for all lines |
|
980 "/ you want to keep - lines for which the block returns false will be removed. |
|
981 "/ Beginner warning: Smalltalk know-how is useful here. |
|
982 |
|
983 [:line | |
|
984 "/ any condition on line. |
|
985 "/ Notice, that line might be a Text object (i.e. non-string), |
|
986 "/ so you may want to use line string. |
|
987 "/ |
|
988 "/ Useful queries on the line are: |
|
989 "/ - size the length of the line |
|
990 "/ - hasChangeOfEmphasis any bold, italic etc. |
|
991 "/ - startsWith:someString |
|
992 "/ - endsWith:someString |
|
993 |
|
994 "/ example filter (removes all empty lines) |
|
995 "/ |
|
996 "/ line size > 0 |
|
997 |
|
998 "/ example filter (removes all lines which do not end with some suffix) |
|
999 "/ |
|
1000 "/ (line asLowercase endsWith:''foo'') not |
|
1001 |
|
1002 "/ dummy filter (keeps all lines) |
|
1003 "/ |
|
1004 true |
|
1005 ] |
|
1006 '. |
|
1007 |
|
1008 filterBlock := self askForFilterBlock:'Filter block:' |
|
1009 template:template |
|
1010 rememberIn:#LastFilterBlockString. |
|
1011 filterBlock isNil ifTrue:[^ self]. |
|
1012 |
|
1013 oldList := self selectedWorkspacesTextView list. |
|
1014 oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
1015 newList := oldList select:filterBlock. |
|
1016 newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
|
1017 nDeleted := oldList size - newList size. |
|
1018 nDeleted == 0 ifTrue:[ |
|
1019 self information:'No lines were deleted.'. |
|
1020 ^ self |
|
1021 ]. |
|
1022 |
|
1023 answer := Dialog confirmWithCancel:(resources |
|
1024 string:'%1 lines remain (%2 deleted). Change text ?' |
|
1025 with:newList size |
|
1026 with:nDeleted) |
|
1027 labels:#( 'Cancel' 'No, Show Deleted' 'Yes'). |
|
1028 answer isNil ifTrue:[^ self]. |
|
1029 answer ifFalse:[ |
|
1030 deletedLines := oldList reject:filterBlock. |
|
1031 TextBox openOn:(deletedLines asStringCollection) title:'Filtered lines'. |
|
1032 ^ self. |
|
1033 ]. |
|
1034 |
|
1035 self selectedWorkspacesTextView list:newList. |
|
1036 ! |
|
1037 |
|
1038 googleSpellingSuggestion |
|
1039 self selectedWorkspacesTextView googleSpellingSuggestion |
|
1040 ! |
966 ! |
1041 |
967 |
1042 inspectIt |
968 inspectIt |
1043 self inspectIt:false |
969 self inspectIt:false |
1044 ! |
970 ! |
1382 self selectedWorkspacesTextView spyOnIt |
1291 self selectedWorkspacesTextView spyOnIt |
1383 ! |
1292 ! |
1384 |
1293 |
1385 timeIt |
1294 timeIt |
1386 self selectedWorkspacesTextView timeIt |
1295 self selectedWorkspacesTextView timeIt |
|
1296 ! ! |
|
1297 |
|
1298 !WorkspaceApplication methodsFor:'menu-actions-editing'! |
|
1299 |
|
1300 babelFishTranslate:fromToModeString |
|
1301 "translate the selected text and paste it after the selection" |
|
1302 |
|
1303 self selectedWorkspace babelFishTranslate:fromToModeString |
|
1304 ! |
|
1305 |
|
1306 copySelection |
|
1307 self selectedWorkspacesTextView copySelection |
|
1308 ! |
|
1309 |
|
1310 cutSelection |
|
1311 self selectedWorkspacesTextView cutSelection |
|
1312 ! |
|
1313 |
|
1314 filterText |
|
1315 |template filterBlock newList oldList answer nDeleted deletedLines| |
|
1316 |
|
1317 template := |
|
1318 '"/ general text filter; |
|
1319 "/ the following block should evaluate to true for all lines |
|
1320 "/ you want to keep - lines for which the block returns false will be removed. |
|
1321 "/ Beginner warning: Smalltalk know-how is useful here. |
|
1322 |
|
1323 [:line | |
|
1324 "/ any condition on line. |
|
1325 "/ Notice, that line might be a Text object (i.e. non-string), |
|
1326 "/ so you may want to use line string. |
|
1327 "/ |
|
1328 "/ Useful queries on the line are: |
|
1329 "/ - size the length of the line |
|
1330 "/ - hasChangeOfEmphasis any bold, italic etc. |
|
1331 "/ - startsWith:someString |
|
1332 "/ - endsWith:someString |
|
1333 |
|
1334 "/ example filter (removes all empty lines) |
|
1335 "/ |
|
1336 "/ line size > 0 |
|
1337 |
|
1338 "/ example filter (removes all lines which do not end with some suffix) |
|
1339 "/ |
|
1340 "/ (line asLowercase endsWith:''foo'') not |
|
1341 |
|
1342 "/ dummy filter (keeps all lines) |
|
1343 "/ |
|
1344 true |
|
1345 ] |
|
1346 '. |
|
1347 |
|
1348 filterBlock := self askForFilterBlock:'Filter block:' |
|
1349 template:template |
|
1350 rememberIn:#LastFilterBlockString. |
|
1351 filterBlock isNil ifTrue:[^ self]. |
|
1352 |
|
1353 oldList := self selectedWorkspacesTextView list. |
|
1354 oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
1355 newList := oldList select:filterBlock. |
|
1356 newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
|
1357 nDeleted := oldList size - newList size. |
|
1358 nDeleted == 0 ifTrue:[ |
|
1359 self information:'No lines were deleted.'. |
|
1360 ^ self |
|
1361 ]. |
|
1362 |
|
1363 answer := Dialog confirmWithCancel:(resources |
|
1364 string:'%1 lines remain (%2 deleted). Change text ?' |
|
1365 with:newList size |
|
1366 with:nDeleted) |
|
1367 labels:#( 'Cancel' 'No, Show Deleted' 'Yes'). |
|
1368 answer isNil ifTrue:[^ self]. |
|
1369 answer ifFalse:[ |
|
1370 deletedLines := oldList reject:filterBlock. |
|
1371 TextBox openOn:(deletedLines asStringCollection) title:'Filtered lines'. |
|
1372 ^ self. |
|
1373 ]. |
|
1374 |
|
1375 self selectedWorkspacesTextView list:newList. |
|
1376 ! |
|
1377 |
|
1378 googleSpellingSuggestion |
|
1379 self selectedWorkspacesTextView googleSpellingSuggestion |
|
1380 ! |
|
1381 |
|
1382 paste |
|
1383 self selectedWorkspacesTextView paste |
|
1384 ! |
|
1385 |
|
1386 paste:aString |
|
1387 self selectedWorkspacesTextView paste:aString. |
|
1388 ! |
|
1389 |
|
1390 pasteLastDoIt |
|
1391 |s| |
|
1392 |
|
1393 s := self lastDoItsString. |
|
1394 s notNil ifTrue:[ |
|
1395 self paste:s |
|
1396 ] |
|
1397 ! |
|
1398 |
|
1399 selectAll |
|
1400 self selectedWorkspacesTextView selectAll. |
1387 ! ! |
1401 ! ! |
1388 |
1402 |
1389 !WorkspaceApplication methodsFor:'menu-dynamic'! |
1403 !WorkspaceApplication methodsFor:'menu-dynamic'! |
1390 |
1404 |
1391 pasteRecentDoItMenu |
1405 pasteRecentDoItMenu |