refactoring_custom/SmallSense__CustomBrowserContext.st
author convert-repo
Wed, 11 Dec 2019 04:28:36 +0000
changeset 1116 b51ace366efc
parent 1072 a44c741ee5ef
permissions -rw-r--r--
update tags
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
828
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     1
"
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     2
A custom code generation and refactoring support for Smalltalk/X
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     3
Copyright (C) 2013-2015 Jakub Nesveda
1072
a44c741ee5ef Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 884
diff changeset
     4
Copyright (C) 2015 Jan Vrany
828
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     5
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     6
This library is free software; you can redistribute it and/or
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     7
modify it under the terms of the GNU Lesser General Public
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     8
License as published by the Free Software Foundation; either
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     9
version 2.1 of the License.
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    10
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    11
This library is distributed in the hope that it will be useful,
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    12
but WITHOUT ANY WARRANTY; without even the implied warranty of
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    14
Lesser General Public License for more details.
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    15
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    16
You should have received a copy of the GNU Lesser General Public
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    17
License along with this library; if not, write to the Free Software
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    19
"
833
297eb38e4eee Package jn:refactoring_custom renamed to stx:goodies/smallsense/refactoring_custom
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 830
diff changeset
    20
"{ Package: 'stx:goodies/smallsense/refactoring_custom' }"
500
8c2b58d6b2d5 Code reogranization, Defined CustomContext & basic API.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
830
1a88f5e65fe2 Classes moved to namespace SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 828
diff changeset
    22
"{ NameSpace: SmallSense }"
803
95cdac772759 Fixed failing tests caused by new STX release
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 793
diff changeset
    23
534
f89b11cd6fa5 CustomContext made as abstract class with 2 implementations: Browser and Sub generator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 525
diff changeset
    24
CustomContext subclass:#CustomBrowserContext
780
c45cc4cd91f0 Move perspective variable to CustomContext to be sure that every subclass implements it
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 771
diff changeset
    25
	instanceVariableNames:'state'
500
8c2b58d6b2d5 Code reogranization, Defined CustomContext & basic API.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	classVariableNames:''
8c2b58d6b2d5 Code reogranization, Defined CustomContext & basic API.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	poolDictionaries:''
8c2b58d6b2d5 Code reogranization, Defined CustomContext & basic API.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
	category:'Interface-Refactoring-Custom'
8c2b58d6b2d5 Code reogranization, Defined CustomContext & basic API.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
!
8c2b58d6b2d5 Code reogranization, Defined CustomContext & basic API.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
828
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    31
!CustomBrowserContext class methodsFor:'documentation'!
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    32
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    33
copyright
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    34
"
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    35
A custom code generation and refactoring support for Smalltalk/X
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    36
Copyright (C) 2013-2015 Jakub Nesveda
1072
a44c741ee5ef Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 884
diff changeset
    37
Copyright (C) 2015 Jan Vrany
828
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    38
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    39
This library is free software; you can redistribute it and/or
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    40
modify it under the terms of the GNU Lesser General Public
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    41
License as published by the Free Software Foundation; either
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    42
version 2.1 of the License.
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    43
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    44
This library is distributed in the hope that it will be useful,
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    45
but WITHOUT ANY WARRANTY; without even the implied warranty of
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    46
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    47
Lesser General Public License for more details.
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    48
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    49
You should have received a copy of the GNU Lesser General Public
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    50
License along with this library; if not, write to the Free Software
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    51
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    52
"
4c5acc592dc7 Added copyright notice
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    53
! !
525
06b14d49f485 work in progress - create code generator which generates stub methods for missing subclassResponsibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 506
diff changeset
    54
534
f89b11cd6fa5 CustomContext made as abstract class with 2 implementations: Browser and Sub generator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 525
diff changeset
    55
!CustomBrowserContext class methodsFor:'instance creation'!
506
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    56
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    57
perspective: perspective state: state
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    58
    ^ self new perspective: perspective state: state
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    59
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    60
    "Created: / 26-01-2014 / 11:00:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    61
! !
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    62
534
f89b11cd6fa5 CustomContext made as abstract class with 2 implementations: Browser and Sub generator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 525
diff changeset
    63
!CustomBrowserContext methodsFor:'accessing'!
506
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    64
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    65
perspective:perspectiveArg state:stateArg 
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    66
    perspective := perspectiveArg.
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    67
    state := stateArg.
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    68
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    69
    "Created: / 26-01-2014 / 11:00:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    70
! !
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    71
534
f89b11cd6fa5 CustomContext made as abstract class with 2 implementations: Browser and Sub generator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 525
diff changeset
    72
!CustomBrowserContext methodsFor:'accessing-selection'!
506
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
    73
884
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    74
selectClassNamed:className
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    75
    self browser switchToClassNamed: className
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    76
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    77
    "Created: / 29-08-2015 / 13:25:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    78
!
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    79
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    80
selectClassNamed:className selector:selector
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    81
    | browser class |
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    82
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    83
    browser := self browser.
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    84
    class := browser findClassNamed: className.
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    85
    class notNil ifTrue:[ 
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    86
        browser switchToClass: class selector: selector
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    87
    ].
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    88
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    89
    "Modified: / 29-08-2015 / 13:28:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    90
!
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    91
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    92
selectClassesNamed:classNames
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    93
    classNames size == 1 ifTrue:[ 
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    94
        self selectClassNamed: classNames
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    95
    ].
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    96
    self notYetImplemented
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    97
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    98
    "Modified: / 29-08-2015 / 13:25:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
    99
!
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   100
547
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   101
selectedClassCategories
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   102
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   103
    ^ state selectedCategories value
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   104
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   105
    "Modified: / 05-08-2014 / 21:35:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
547
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   106
!
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   107
506
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   108
selectedClasses
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   109
    "Returns a set of classes currently selected in
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   110
     the browser"
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   111
793
4bc0e09b252e Fixed error on empty selected classes and methods in CustomBrowserContext >> selectedClasses, CustomBrowserContext >> selectedMethods
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 780
diff changeset
   112
    ^ state selectedClasses value ? #() collect:[ :cls | self asRBClass: cls ]
506
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   113
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   114
    "Created: / 26-01-2014 / 22:06:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
746
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 722
diff changeset
   115
    "Modified: / 14-11-2014 / 20:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
793
4bc0e09b252e Fixed error on empty selected classes and methods in CustomBrowserContext >> selectedClasses, CustomBrowserContext >> selectedMethods
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 780
diff changeset
   116
    "Modified: / 29-12-2014 / 09:43:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
547
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   117
!
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   118
629
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   119
selectedCodes
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   120
    | codeSelection currentMethod codeView |
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   121
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   122
    currentMethod := state theSingleSelectedMethod.
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   123
    codeView := state codeView.
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   124
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   125
    (codeView isNil or: [ currentMethod isNil ]) ifTrue: [ 
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   126
        ^ nil
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   127
    ].
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   128
629
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   129
    codeSelection := CustomSourceCodeSelection new.
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   130
    codeSelection
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   131
        selectedInterval: codeView selectedInterval;
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   132
        currentSourceCode: codeView contentsAsString; 
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   133
        selectedMethod: currentMethod; 
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   134
        selectedClass: currentMethod mclass;
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   135
        selectedSelector: currentMethod selector.
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   136
        
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   137
629
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   138
    ^ Array with: codeSelection
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   139
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   140
    "Created: / 18-08-2014 / 21:34:56 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
e85070e8c11b add code selection object (CustomSourceCodeSelection) with code, method, class... to CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 626
diff changeset
   141
    "Modified: / 18-08-2014 / 23:51:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   142
!
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   143
547
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   144
selectedMethods
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   145
793
4bc0e09b252e Fixed error on empty selected classes and methods in CustomBrowserContext >> selectedClasses, CustomBrowserContext >> selectedMethods
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 780
diff changeset
   146
    ^ state selectedMethods value ? #() collect:[ :m | self asRBMethod: m ]
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   147
747
008860f4cbd4 Make CustomContext>>selectedMethods always return a collection of RBMethod...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 746
diff changeset
   148
    "Modified: / 14-11-2014 / 20:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
793
4bc0e09b252e Fixed error on empty selected classes and methods in CustomBrowserContext >> selectedClasses, CustomBrowserContext >> selectedMethods
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 780
diff changeset
   149
    "Modified: / 29-12-2014 / 10:10:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
547
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   150
!
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   151
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   152
selectedPackages
626
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   153
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   154
    ^ state packageFilter value
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   155
a32e9bcc436e work in progress on first refactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 547
diff changeset
   156
    "Modified: / 05-08-2014 / 21:38:14 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
547
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   157
!
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   158
718
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   159
selectedProtocols
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   160
    "Returns a collection of method protocols which are visible and selected in the Browser."
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   161
    
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   162
    |protocols allIncluded|
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   163
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   164
    protocols := state selectedProtocols value.
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   165
     "Support to return all protocols when all protocol ('* all *') is selected in the Browser.
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   166
     This is a little duplicate as in Tools::NewSystemBowser >> selectedProtocolsDo: ,
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   167
     but using this method would require a referece to the Browser and furthermore is marked as private."
722
23ea76589d1b fix error when protocols are empty in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 718
diff changeset
   168
    allIncluded := protocols ? #() 
718
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   169
            includes:(Tools::BrowserList nameListEntryForALL).
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   170
    allIncluded ifTrue:[
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   171
        protocols := Set new.
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   172
        self selectedClasses do:[:class | 
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   173
            protocols addAll:class categories
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   174
        ]
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   175
    ].
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   176
    ^ protocols
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   177
755
37d50424e347 tests fixes - global instance of RBNamespace for creating RBClass holds old data when the global system namespace changes its state - in this case it is old real class instance
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 747
diff changeset
   178
    "Modified: / 19-11-2014 / 08:45:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
718
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   179
!
ed7514e9d76c rename selectedMethodProtocols to selecteProtocols in CustomContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 715
diff changeset
   180
547
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   181
selectedVariables
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   182
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   183
    ^ state variableFilter value
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   184
bdacc7f4986c add support for selected variables in CustomBrowserContext
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 534
diff changeset
   185
    "Modified: / 17-05-2014 / 13:29:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
506
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   186
! !
b611cc119554 Added support for custom menu building and injecting into class browser's menus.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 500
diff changeset
   187
884
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   188
!CustomBrowserContext methodsFor:'private'!
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   189
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   190
browser
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   191
    "raise an error: this method should be implemented (TODO)"
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   192
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   193
    ^ state canvas application
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   194
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   195
    "Created: / 29-08-2015 / 13:25:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   196
! !
919f637c2be9 Added support to update browser's selection after code is generated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 833
diff changeset
   197
668
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   198
!CustomBrowserContext methodsFor:'testing'!
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   199
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   200
isInteractiveContext
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   201
    "Return true, if this generator/refactoring context is interactive,
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   202
     i.e., if it may interact with user (like asking for class name or
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   203
     similar) or not. 
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   204
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   205
     Generally speaking, only top-level context is interactive an only
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   206
     if generator/refactoring was triggerred from menu.
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   207
    "
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   208
    ^ true
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   209
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   210
    "Created: / 16-09-2014 / 09:23:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   211
! !
7f8cddf23efa Separated generator/refactoring initialization from actuall execution.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 629
diff changeset
   212
534
f89b11cd6fa5 CustomContext made as abstract class with 2 implementations: Browser and Sub generator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 525
diff changeset
   213
!CustomBrowserContext class methodsFor:'documentation'!
525
06b14d49f485 work in progress - create code generator which generates stub methods for missing subclassResponsibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 506
diff changeset
   214
06b14d49f485 work in progress - create code generator which generates stub methods for missing subclassResponsibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 506
diff changeset
   215
version_HG
06b14d49f485 work in progress - create code generator which generates stub methods for missing subclassResponsibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 506
diff changeset
   216
06b14d49f485 work in progress - create code generator which generates stub methods for missing subclassResponsibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 506
diff changeset
   217
    ^ '$Changeset: <not expanded> $'
06b14d49f485 work in progress - create code generator which generates stub methods for missing subclassResponsibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 506
diff changeset
   218
! !
06b14d49f485 work in progress - create code generator which generates stub methods for missing subclassResponsibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 506
diff changeset
   219