1489 "Modified: / 08-07-2019 / 00:10:12 / Claus Gittinger" |
1491 "Modified: / 08-07-2019 / 00:10:12 / Claus Gittinger" |
1490 ! ! |
1492 ! ! |
1491 |
1493 |
1492 !FileVersionDiffBrowser methodsFor:'private'! |
1494 !FileVersionDiffBrowser methodsFor:'private'! |
1493 |
1495 |
|
1496 acceptInRightView |
|
1497 |text| |
|
1498 |
|
1499 text := self diffTextView text2. |
|
1500 self halt. |
|
1501 |
|
1502 "Created: / 08-07-2019 / 02:32:30 / Claus Gittinger" |
|
1503 ! |
|
1504 |
1494 addAcceptToTextViewMenus |
1505 addAcceptToTextViewMenus |
1495 "add to the standard diff text view or single text views menu an accept entry. |
1506 "add to the standard diff text view an accept entry. |
1496 The acceptAction will fetch the corresponding change and apply it |
1507 The acceptAction will store the selected version into the file" |
1497 (not the shown text) |
1508 |
1498 |
1509 |rightView| |
1499 <return: self> |
1510 |
1500 " |
1511 self isMultipleVersionBrowser ifFalse:[^ self]. |
1501 |
1512 |
1502 |diffTextView leftView rightView singleView| |
|
1503 |
|
1504 diffTextView := self diffTextView. |
1513 diffTextView := self diffTextView. |
1505 leftView := diffTextView leftTextView. |
|
1506 rightView := diffTextView rightTextView. |
1514 rightView := diffTextView rightTextView. |
1507 singleView := self componentAt:#singleTextView. |
1515 |
1508 |
1516 rightView acceptAction:[:theCode | |
1509 (Array |
1517 |version code| |
1510 with:leftView |
1518 |
1511 with:rightView |
1519 version := self selectedVersionHolder value. |
1512 with:singleView) |
1520 code := self getFile:(self fileHolder value) version:version. |
1513 do:[:v | |
1521 self fileHolder value contents:code. |
1514 |mGen| |
1522 ]. |
1515 |
1523 rightView menuHolder:[ |
1516 mGen := [ |
1524 |m| |
1517 |m| |
1525 m := rightView editMenu. |
1518 |
1526 m enable:#accept. |
1519 m := v editMenu. |
1527 m |
1520 |
1528 ]. |
1521 (m selectorAt:#accept) isNil ifTrue:[ |
1529 rightView menuMessage:#value. |
1522 m addLabels:(resources array:#('-' 'Accept')) |
1530 |
1523 selectors:#(nil #accept) |
1531 "Modified: / 08-07-2019 / 02:45:49 / Claus Gittinger" |
1524 after:#copySelection. |
|
1525 ]. |
|
1526 m |
|
1527 actionAt:#accept |
|
1528 put:[ |
|
1529 v == singleView ifTrue:[ |
|
1530 self acceptInSingleView |
|
1531 ] ifFalse:[ |
|
1532 v == leftView ifTrue:[ |
|
1533 self acceptInLeftView |
|
1534 ] ifFalse:[ |
|
1535 self acceptInRightView |
|
1536 ]. |
|
1537 ]. |
|
1538 ]. |
|
1539 m selectorAt:#accept put:nil. |
|
1540 m enable:#copySelection. |
|
1541 m setEnable:#accept to:[self canAcceptInCodeView]. |
|
1542 m |
|
1543 ]. |
|
1544 v menuHolder:mGen. |
|
1545 v menuMessage:#value. |
|
1546 ] |
|
1547 ! |
1532 ! |
1548 |
1533 |
1549 getFile:fileName version:version |
1534 getFile:fileName version:version |
1550 |errStream errorMessages inStream contents| |
1535 |errStream errorMessages inStream contents| |
1551 |
1536 |
1592 self diffTextView text1:'' text2:''. |
1577 self diffTextView text1:'' text2:''. |
1593 |
1578 |
1594 "Modified (comment): / 08-07-2019 / 00:06:09 / Claus Gittinger" |
1579 "Modified (comment): / 08-07-2019 / 00:06:09 / Claus Gittinger" |
1595 ! |
1580 ! |
1596 |
1581 |
1597 showDiffTextView |
|
1598 " |
|
1599 if a method change is selected, then show the diff text view. |
|
1600 Add an accept entry to the popup menu. |
|
1601 |
|
1602 <return: self> |
|
1603 " |
|
1604 |
|
1605 (self componentAt:#diffTextViewBox) raise; beVisible. |
|
1606 (self componentAt:#diffTextView) realizeAllSubViews. |
|
1607 |
|
1608 "/ self addAcceptToTextViewMenus. |
|
1609 |
|
1610 "Modified: / 08-07-2019 / 00:02:19 / Claus Gittinger" |
|
1611 ! |
|
1612 |
|
1613 showSingleTextView |
1582 showSingleTextView |
1614 " |
1583 " |
1615 if a method is selected which is only in version A or B of the class, |
1584 if a method is selected which is only in version A or B of the class, |
1616 then show the text view. |
1585 then show the text view. |
1617 Add an accept entry to the popup menu. |
1586 Add an accept entry to the popup menu. |
1621 |
1590 |
1622 (self componentAt:#diffTextViewBox) beInvisible. |
1591 (self componentAt:#diffTextViewBox) beInvisible. |
1623 "/ self addAcceptToTextViewMenus. |
1592 "/ self addAcceptToTextViewMenus. |
1624 |
1593 |
1625 "Modified: / 08-07-2019 / 00:03:10 / Claus Gittinger" |
1594 "Modified: / 08-07-2019 / 00:03:10 / Claus Gittinger" |
1626 ! |
|
1627 |
|
1628 showVersionInfoIfNothingSelected |
|
1629 "show the revision info (author, date, time and logMessage), |
|
1630 if no method is selected" |
|
1631 |
|
1632 |revInfo infoText| |
|
1633 |
|
1634 "/ self information:''. |
|
1635 |
|
1636 versionInfoList notNil ifTrue:[ |
|
1637 revInfo := versionInfoList detect:[:info | (info at:#revision) = selectedVersionHolder value] ifNone:nil. |
|
1638 revInfo notNil ifTrue:[ |
|
1639 infoText := 'Revision: %1\Author: %2\Date: %3\Log:\\%4' withCRs |
|
1640 bindWith:(revInfo at:#revision) |
|
1641 with:(revInfo at:#author) |
|
1642 with:(revInfo at:#date) |
|
1643 with:(revInfo at:#logMessage). |
|
1644 ]. |
|
1645 ]. |
|
1646 self showSingleTextView. |
|
1647 |
|
1648 "Modified: / 05-02-2017 / 11:49:47 / cg" |
|
1649 "Modified (comment): / 08-07-2019 / 00:06:32 / Claus Gittinger" |
|
1650 ! ! |
1595 ! ! |
1651 |
1596 |
1652 !FileVersionDiffBrowser methodsFor:'setup'! |
1597 !FileVersionDiffBrowser methodsFor:'setup'! |
1653 |
1598 |
1654 setupForAllVersionsOfFile:aFilename |
1599 setupForAllVersionsOfFile:aFilename |
1671 |
1616 |
1672 self diffTextView text1:text1 text2:text2. |
1617 self diffTextView text1:text1 text2:text2. |
1673 self diffTextLabelA value:('File: %1' bindWith:aFilename baseName). |
1618 self diffTextLabelA value:('File: %1' bindWith:aFilename baseName). |
1674 self diffTextLabelB value:aVersionA. |
1619 self diffTextLabelB value:aVersionA. |
1675 |
1620 |
|
1621 self addAcceptToTextViewMenus. |
|
1622 |
1676 "Created: / 07-07-2019 / 19:57:27 / Claus Gittinger" |
1623 "Created: / 07-07-2019 / 19:57:27 / Claus Gittinger" |
1677 "Modified: / 08-07-2019 / 01:13:47 / Claus Gittinger" |
1624 "Modified: / 08-07-2019 / 02:29:10 / Claus Gittinger" |
1678 ! |
1625 ! |
1679 |
1626 |
1680 setupForFile:fileA labelA:labelA andFile:fileB labelB:labelB |
1627 setupForFile:fileA labelA:labelA andFile:fileB labelB:labelB |
1681 "generate the diffs from the two files A and B. |
1628 "generate the diffs from the two files A and B. |
1682 When setting the diffs, the labels, list etc. of the receiver |
1629 When setting the diffs, the labels, list etc. of the receiver |