Hi,
I would like to create a code browser, where the top pane is a finder which adds a new pane when some clicks on a class name. The following code works fine except with interactions like:
1- select a class 2- select a selector of this class 3- select a class in the newly added pane
This tries to display the source code of the class selected in step 3 for the selector of step 2 (which is wrong because selector of step 2 is only defined in the class of step 1).
Can somebody help me please? The code is:
|extTabulator finder intTabulator|
intTabulator := GLMTabulator new column: #classes; column: #selectors; yourself.
intTabulator transmit to: #classes; andShow: [:a | a list title: 'classes'; display: [:class | class allSuperclasses]]. intTabulator transmit from: #classes; to: #selectors; andShow: [:a | a list title: 'selectors'; display: [:class | class selectors]].
finder := GLMFinder new. finder custom: intTabulator.
"Makes the finder add an new pane when selecting a class" intTabulator transmit from: #classes; toOutsidePort: #selection.
extTabulator := GLMTabulator new row: #finder; row: #source; yourself. extTabulator transmit to: #finder; andShow: [:a | a custom: finder].
"Makes the internet tabulator exports the currently selected selector" intTabulator transmit from: #selectors; toOutsidePort: #selector.
extTabulator transmit from: #finder; from: #finder port: #selector; to: #source; andShow: [:a | a text display: [:class :selector | class name, '>>', selector, String cr, ((class includesSelector: selector) ifTrue: ['ok'] ifFalse: ['ERROR: class does not have this selector!'])]].
extTabulator openOn: IdentitySet.
Hi,
I am not sure I like the whole setup of the browser :). Anyway, you would want to reset the #selector port every time you select a class. Add this:
intTabulator transmit from: #classes; toOutsidePort: #selector; transformed: [nil].
It is hackish, but this is because you want to reason outside of the intTabulator browser about something that is internal.
Cheers, Doru
On 21 Jul 2011, at 08:03, Damien Cassou wrote:
Hi,
I would like to create a code browser, where the top pane is a finder which adds a new pane when some clicks on a class name. The following code works fine except with interactions like:
1- select a class 2- select a selector of this class 3- select a class in the newly added pane
This tries to display the source code of the class selected in step 3 for the selector of step 2 (which is wrong because selector of step 2 is only defined in the class of step 1).
Can somebody help me please? The code is:
|extTabulator finder intTabulator|
intTabulator := GLMTabulator new column: #classes; column: #selectors; yourself.
intTabulator transmit to: #classes; andShow: [:a | a list title: 'classes'; display: [:class | class allSuperclasses]]. intTabulator transmit from: #classes; to: #selectors; andShow: [:a | a list title: 'selectors'; display: [:class | class selectors]].
finder := GLMFinder new. finder custom: intTabulator.
"Makes the finder add an new pane when selecting a class" intTabulator transmit from: #classes; toOutsidePort: #selection.
extTabulator := GLMTabulator new row: #finder; row: #source; yourself. extTabulator transmit to: #finder; andShow: [:a | a custom: finder].
"Makes the internet tabulator exports the currently selected selector" intTabulator transmit from: #selectors; toOutsidePort: #selector.
extTabulator transmit from: #finder; from: #finder port: #selector; to: #source; andShow: [:a | a text display: [:class :selector | class name, '>>', selector, String cr, ((class includesSelector: selector) ifTrue: ['ok'] ifFalse: ['ERROR: class does not have this selector!'])]].
extTabulator openOn: IdentitySet.
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"There are no old things, there are only old ways of looking at them."
On Thu, Jul 21, 2011 at 9:03 AM, Tudor Girba tudor@tudorgirba.com wrote:
I am not sure I like the whole setup of the browser
Your solution worked perfectly. What setup would you propose to have similar browsing interactions?
I would have encapsulated class + selector from the intTabulator in a dedicated port. Like that you would be able to reason about one value.
So, the script could look like:
|extTabulator finder intTabulator|
intTabulator := GLMTabulator new row: #classes; row: #selectors; yourself.
intTabulator transmit to: #classes; andShow: [:a | a list title: 'classes'; display: [:class | class allSuperclasses]]. intTabulator transmit from: #classes; to: #selectors; andShow: [:a | a list title: 'selectors'; display: [:class | class selectors]].
"Makes the finder add an new pane when selecting a class" intTabulator transmit from: #classes; toOutsidePort: #selection.
"Makes the internet tabulator exports the currently selected class and selector" intTabulator transmit from: #classes; from: #selectors; toOutsidePort: #classSelector; transformed: [:class :selector | class -> selector ].
finder := GLMFinder new. finder custom: intTabulator.
extTabulator := GLMTabulator new row: #finder; row: #source; yourself. extTabulator transmit to: #finder; andShow: [:a | a custom: finder].
extTabulator transmit from: #finder port: #classSelector; to: #source; andShow: [:a | a text display: [:classSelector | classSelector key name, '>>', classSelector value asString ]].
extTabulator openOn: IdentitySet.
Cheers, Doru
On 21 Jul 2011, at 09:37, Damien Cassou wrote:
On Thu, Jul 21, 2011 at 9:03 AM, Tudor Girba tudor@tudorgirba.com wrote: I am not sure I like the whole setup of the browser
Your solution worked perfectly. What setup would you propose to have similar browsing interactions?
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Beauty is where we see it."