265 adjust: left |
265 adjust: left |
266 ) |
266 ) |
267 (FilenameInputFieldSpec |
267 (FilenameInputFieldSpec |
268 name: 'HGCommand' |
268 name: 'HGCommand' |
269 layout: (LayoutFrame 125 0 0 0 -100 1 0 1) |
269 layout: (LayoutFrame 125 0 0 0 -100 1 0 1) |
|
270 enableChannel: hgEnabled |
270 model: hgCommand |
271 model: hgCommand |
271 acceptOnPointerLeave: true |
272 acceptOnPointerLeave: true |
272 emptyFieldReplacementText: 'Autodetect' |
273 emptyFieldReplacementText: 'Autodetect' |
273 ) |
274 ) |
274 (ActionButtonSpec |
275 (ActionButtonSpec |
275 label: 'Test' |
276 label: 'Test' |
276 name: 'HGCommandTest' |
277 name: 'HGCommandTest' |
277 layout: (LayoutFrame -100 1 0 0 -8 1 0 1) |
278 layout: (LayoutFrame -100 1 0 0 -8 1 0 1) |
|
279 visibilityChannel: false |
278 translateLabel: true |
280 translateLabel: true |
279 model: doTestHGCommand |
281 model: doTestHGCommand |
280 enableChannel: svnEnabled |
282 ) |
|
283 (ActionButtonSpec |
|
284 label: 'Browse' |
|
285 name: 'BrowseButton' |
|
286 layout: (LayoutFrame -100 1 0 0 -8 1 0 1) |
|
287 translateLabel: true |
|
288 model: doSelectHGCommand |
|
289 enableChannel: hgEnabled |
281 ) |
290 ) |
282 ) |
291 ) |
283 |
292 |
284 ) |
293 ) |
285 extent: (Point 695 25) |
294 extent: (Point 695 25) |
318 foregroundColor: (Color 0.0 0.0 100.0) |
328 foregroundColor: (Color 0.0 0.0 100.0) |
319 translateLabel: true |
329 translateLabel: true |
320 labelChannel: hgrcAspect |
330 labelChannel: hgrcAspect |
321 adjust: left |
331 adjust: left |
322 model: doEditHGRC |
332 model: doEditHGRC |
|
333 enableChannel: hgEnabled |
323 ) |
334 ) |
324 (ActionButtonSpec |
335 (ActionButtonSpec |
325 label: 'Edit' |
336 label: 'Edit' |
326 name: 'Button1' |
337 name: 'Button1' |
327 layout: (LayoutFrame -106 1 -17 0.5 -6 1 8 0.5) |
338 layout: (LayoutFrame -106 1 -17 0.5 -6 1 8 0.5) |
328 translateLabel: true |
339 translateLabel: true |
329 model: doEditHGRC |
340 model: doEditHGRC |
|
341 enableChannel: hgEnabled |
330 ) |
342 ) |
331 ) |
343 ) |
332 |
344 |
333 ) |
345 ) |
334 extent: (Point 695 92) |
346 extent: (Point 695 92) |
373 doCheckSettings |
383 doCheckSettings |
374 "Perform some sanity check on current configuration" |
384 "Perform some sanity check on current configuration" |
375 |
385 |
376 self doCheckUsername ifFalse:[ ^ self ]. |
386 self doCheckUsername ifFalse:[ ^ self ]. |
377 self doCheckMenuLayout ifFalse:[ ^ self ]. |
387 self doCheckMenuLayout ifFalse:[ ^ self ]. |
|
388 self doCheckCommand ifFalse:[ ^ self ]. |
378 self infoPanel hide. |
389 self infoPanel hide. |
379 |
390 |
380 "Created: / 18-02-2014 / 10:04:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
391 "Created: / 18-02-2014 / 10:04:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
381 "Modified: / 18-02-2014 / 11:57:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
392 "Modified: / 21-02-2014 / 10:32:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
382 ! |
393 ! |
383 |
394 |
384 doEditHGRC |
395 doEditHGRC |
385 <resource: #uiCallback> |
396 <resource: #uiCallback> |
386 |
397 |
398 editor loadFile: hgrc. |
409 editor loadFile: hgrc. |
399 editor syntaxHolder value: nil. |
410 editor syntaxHolder value: nil. |
400 ] |
411 ] |
401 |
412 |
402 "Modified: / 18-02-2014 / 10:43:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
413 "Modified: / 18-02-2014 / 10:43:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
414 ! |
|
415 |
|
416 doSelectHGCommand |
|
417 | guess executable | |
|
418 |
|
419 guess := OperatingSystem pathOfCommand: 'hg'. |
|
420 executable := Dialog requestFileName:(resources string:'Select hg command') default: guess ifFail:[ ^ self ]. |
|
421 self hgCommand value: executable |
|
422 |
|
423 "Created: / 21-02-2014 / 10:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
403 ! |
424 ! |
404 |
425 |
405 doTestHGCommand |
426 doTestHGCommand |
406 |
427 |
407 self hgCommand value isEmptyOrNil ifTrue:[ |
428 self hgCommand value isEmptyOrNil ifTrue:[ |
438 "Created: / 19-11-2012 / 21:32:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
459 "Created: / 19-11-2012 / 21:32:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
439 "Modified: / 21-01-2013 / 05:12:39 / jv" |
460 "Modified: / 21-01-2013 / 05:12:39 / jv" |
440 ! ! |
461 ! ! |
441 |
462 |
442 !HGSourceCodeManagementSettingsAppl methodsFor:'actions-checks'! |
463 !HGSourceCodeManagementSettingsAppl methodsFor:'actions-checks'! |
|
464 |
|
465 doCheckCommand |
|
466 "Check `hg` command. Return true if `hg` command exists |
|
467 and of supported version, false otherwise." |
|
468 |
|
469 | executable | |
|
470 |
|
471 executable := self hgCommand value. |
|
472 executable isEmptyOrNil ifTrue:[ |
|
473 executable := OperatingSystem pathOfCommand:'hg'. |
|
474 executable isNil ifTrue:[ |
|
475 self infoPanel |
|
476 reset; |
|
477 beWarning; |
|
478 message: (resources string:'Cannot find path to `hg` command'); |
|
479 addButtonWithLabel: (self resources string:'Browse') action: [self infoPanel hide. self doSelectHGCommand ]; |
|
480 show. |
|
481 ^ false |
|
482 ]. |
|
483 ]. |
|
484 [ |
|
485 HGCommand hgCommandValidate: executable |
|
486 ] on: HGInvalidVersionError do:[:ex | |
|
487 self infoPanel |
|
488 reset; |
|
489 beWarning; |
|
490 message: (resources string:'Unssuported Mercurial version %1' with: (ex parameter asStringWith: $.)); |
|
491 addButtonWithLabel: (self resources string:'Browse') action: [self infoPanel hide. self doSelectHGCommand ]; |
|
492 show. |
|
493 ^ false |
|
494 ] on: HGCommandError do:[:ex | |
|
495 self infoPanel |
|
496 reset; |
|
497 beWarning; |
|
498 message: (resources string:ex description); |
|
499 addButtonWithLabel: (self resources string:'Browse') action: [self infoPanel hide. self doSelectHGCommand ]; |
|
500 show. |
|
501 ^ false |
|
502 ]. |
|
503 ^ true. |
|
504 |
|
505 "Created: / 21-02-2014 / 09:58:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
506 ! |
443 |
507 |
444 doCheckMenuLayout |
508 doCheckMenuLayout |
445 "Check if browser SCM menu layouyt is not #old. Return true, if yes, |
509 "Check if browser SCM menu layouyt is not #old. Return true, if yes, |
446 false otherwise. As a sideffect, show message in info panel" |
510 false otherwise. As a sideffect, show message in info panel" |
447 |
511 |
454 addButtonWithLabel: (self resources string:'Use ''Compact''') action: [ |
518 addButtonWithLabel: (self resources string:'Use ''Compact''') action: [ |
455 UserPreferences current sourceCodeManagementMenuLayout: #compact. |
519 UserPreferences current sourceCodeManagementMenuLayout: #compact. |
456 (Dialog confirm: (resources string: 'Settings changed to ''Compact''\\Save settings?') withCRs) ifTrue:[ |
520 (Dialog confirm: (resources string: 'Settings changed to ''Compact''\\Save settings?') withCRs) ifTrue:[ |
457 SettingsDialog saveSettingsWithoutAskingForFile |
521 SettingsDialog saveSettingsWithoutAskingForFile |
458 ]. |
522 ]. |
459 self infoPanel hide. |
523 self doCheckCommand |
460 ]; |
524 ]; |
461 addButtonWithLabel: (self resources string:'Use ''Inline''') action: [ |
525 addButtonWithLabel: (self resources string:'Use ''Inline''') action: [ |
462 UserPreferences current sourceCodeManagementMenuLayout: #inline. |
526 UserPreferences current sourceCodeManagementMenuLayout: #inline. |
463 (Dialog confirm: (resources string: 'Settings changed to ''Compact''\\Save settings?') withCRs) ifTrue:[ |
527 (Dialog confirm: (resources string: 'Settings changed to ''Compact''\\Save settings?') withCRs) ifTrue:[ |
464 SettingsDialog saveSettingsWithoutAskingForFile |
528 SettingsDialog saveSettingsWithoutAskingForFile |
465 ]. |
529 ]. |
466 self infoPanel hide. |
530 self doCheckCommand |
467 ]; |
531 ]; |
468 addButtonWithLabel: (resources string:'Ignore') action: [IgnoreCheckUsername := true. self infoPanel hide.]; |
532 addButtonWithLabel: (resources string:'Ignore') action: [IgnoreCheckUsername := true. self infoPanel hide.]; |
469 show. |
533 show. |
470 ^ false |
534 ^ false |
471 ]. |
535 ]. |
472 ^ true. |
536 ^ true. |
473 |
537 |
474 "Created: / 18-02-2014 / 11:46:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
538 "Created: / 18-02-2014 / 11:46:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
539 "Modified: / 21-02-2014 / 10:32:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
475 ! |
540 ! |
476 |
541 |
477 doCheckUsername |
542 doCheckUsername |
478 "Check if username is configured. Return true, if yes, |
543 "Check if username is configured. Return true, if yes, |
479 false otherwise. As a sideffect, show message in info panel" |
544 false otherwise. As a sideffect, show message in info panel" |
580 shownInBrowserMenusHolder onChangeSend:#doCheckSettings to:self. |
646 shownInBrowserMenusHolder onChangeSend:#doCheckSettings to:self. |
581 ]. |
647 ]. |
582 ^ shownInBrowserMenusHolder. |
648 ^ shownInBrowserMenusHolder. |
583 |
649 |
584 "Created: / 18-02-2014 / 10:05:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
650 "Created: / 18-02-2014 / 10:05:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
651 ! ! |
|
652 |
|
653 !HGSourceCodeManagementSettingsAppl methodsFor:'aspects-queries'! |
|
654 |
|
655 hgEnabled |
|
656 ^ self shownInBrowserMenusHolder |
|
657 |
|
658 "Created: / 21-02-2014 / 10:37:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
585 ! ! |
659 ! ! |
586 |
660 |
587 !HGSourceCodeManagementSettingsAppl methodsFor:'helpers'! |
661 !HGSourceCodeManagementSettingsAppl methodsFor:'helpers'! |
588 |
662 |
589 settingsAspectFor: settingName |
663 settingsAspectFor: settingName |