소스 검색

Fixed method announcement handling

Nicolas Petton 12 년 전
부모
커밋
0e3f90ef18
3개의 변경된 파일195개의 추가작업 그리고 103개의 파일을 삭제
  1. 77 43
      js/Helios-Browser.deploy.js
  2. 92 48
      js/Helios-Browser.js
  3. 26 12
      st/Helios-Browser.st

+ 77 - 43
js/Helios-Browser.deploy.js

@@ -829,16 +829,22 @@ smalltalk.method({
 selector: "methodsInProtocol:",
 fn: function (aString){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $2,$1;
-$2=_st(aString).__eq(_st(self)._allProtocol());
-if(smalltalk.assert($2)){
-$1=_st(_st(_st(self)._model())._selectedClass())._methods();
+return smalltalk.withContext(function($ctx1) { 
var $1,$3,$2;
+$1=_st(_st(self)._model())._selectedClass();
+if(($receiver = $1) == nil || $receiver == undefined){
+return [];
 } else {
-$1=_st(_st(_st(self)._model())._selectedClass())._methodsInProtocol_(aString);
+$1;
 };
-return $1;
+$3=_st(aString).__eq(_st(self)._allProtocol());
+if(smalltalk.assert($3)){
+$2=_st(_st(_st(self)._model())._selectedClass())._methods();
+} else {
+$2=_st(_st(_st(self)._model())._selectedClass())._methodsInProtocol_(aString);
+};
+return $2;
 }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString}, smalltalk.HLMethodsListWidget)})},
-messageSends: ["ifTrue:ifFalse:", "methods", "selectedClass", "model", "methodsInProtocol:", "=", "allProtocol"]}),
+messageSends: ["ifNil:", "selectedClass", "model", "ifTrue:ifFalse:", "methods", "methodsInProtocol:", "=", "allProtocol"]}),
 smalltalk.HLMethodsListWidget);
 
 smalltalk.addMethod(
@@ -884,20 +890,16 @@ smalltalk.method({
 selector: "onMethodAdded:",
 fn: function (aMethod){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-var $early={};
-try {
-_st(_st(self)._items())._detect_ifNone_((function(each){
-return smalltalk.withContext(function($ctx2) {
return _st(each).__eq(_st(aMethod)._selector());
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
-return smalltalk.withContext(function($ctx2) {
$1=self;
-throw $early=[$1];
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+$1=_st(_st(_st(self)._model())._selectedClass()).__eq(_st(aMethod)._methodClass());
+if(! smalltalk.assert($1)){
+$2=self;
+return $2;
+};
+_st(self)._setItemsForSelectedProtocol();
 _st(self)._refresh();
-return self}
-catch(e) {if(e===$early)return e[0]; throw e}
-}, function($ctx1) {$ctx1.fill(self,"onMethodAdded:",{aMethod:aMethod}, smalltalk.HLMethodsListWidget)})},
-messageSends: ["detect:ifNone:", "=", "selector", "items", "refresh"]}),
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodAdded:",{aMethod:aMethod}, smalltalk.HLMethodsListWidget)})},
+messageSends: ["ifFalse:", "=", "methodClass", "selectedClass", "model", "setItemsForSelectedProtocol", "refresh"]}),
 smalltalk.HLMethodsListWidget);
 
 smalltalk.addMethod(
@@ -906,7 +908,7 @@ smalltalk.method({
 selector: "onMethodRemoved:",
 fn: function (aMethod){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2,$3;
 var $early={};
 try {
 _st(_st(self)._items())._detect_ifNone_((function(each){
@@ -915,17 +917,23 @@ return smalltalk.withContext(function($ctx2) {
return _st(each).__eq(_st(aMethod
 return smalltalk.withContext(function($ctx2) {
$1=self;
 throw $early=[$1];
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-$2=_st(_st(_st(aMethod)._methodClass()).__eq(_st(_st(self)._model())._selectedClass()))._and_((function(){
-return smalltalk.withContext(function($ctx2) {
return _st(_st(aMethod)._selector()).__eq(_st(self)._selectedItem());
+$2=_st(self)._selectedItem();
+if(($receiver = $2) == nil || $receiver == undefined){
+$2;
+} else {
+$3=_st(_st(_st(aMethod)._methodClass()).__eq(_st(_st(self)._model())._selectedClass()))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
return _st(_st(aMethod)._selector()).__eq(_st(_st(self)._selectedItem())._selector());
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-if(smalltalk.assert($2)){
+if(smalltalk.assert($3)){
 _st(self)._selectItem_(nil);
 };
+};
+_st(self)._setItemsForSelectedProtocol();
 _st(self)._refresh();
 return self}
 catch(e) {if(e===$early)return e[0]; throw e}
 }, function($ctx1) {$ctx1.fill(self,"onMethodRemoved:",{aMethod:aMethod}, smalltalk.HLMethodsListWidget)})},
-messageSends: ["detect:ifNone:", "=", "selector", "items", "ifTrue:", "selectItem:", "and:", "selectedItem", "selectedClass", "model", "methodClass", "refresh"]}),
+messageSends: ["detect:ifNone:", "=", "selector", "items", "ifNotNil:", "ifTrue:", "selectItem:", "and:", "selectedItem", "selectedClass", "model", "methodClass", "setItemsForSelectedProtocol", "refresh"]}),
 smalltalk.HLMethodsListWidget);
 
 smalltalk.addMethod(
@@ -954,24 +962,11 @@ smalltalk.method({
 selector: "onProtocolSelected:",
 fn: function (aString){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$3,$4,$2;
-_st(self)._selectedItem_(nil);
-$1=self;
-$3=_st(_st(self)._model())._selectedClass();
-if(($receiver = $3) == nil || $receiver == undefined){
-$2=[];
-} else {
-$4=aString;
-if(($receiver = $4) == nil || $receiver == undefined){
-$2=[];
-} else {
-$2=_st(self)._selectorsInProtocol_(aString);
-};
-};
-_st($1)._items_($2);
+return smalltalk.withContext(function($ctx1) { 
_st(self)._selectedItem_(nil);
+_st(self)._setItemsForSelectedProtocol();
 _st(self)._refresh();
 return self}, function($ctx1) {$ctx1.fill(self,"onProtocolSelected:",{aString:aString}, smalltalk.HLMethodsListWidget)})},
-messageSends: ["selectedItem:", "items:", "ifNil:ifNotNil:", "selectorsInProtocol:", "selectedClass", "model", "refresh"]}),
+messageSends: ["selectedItem:", "setItemsForSelectedProtocol", "refresh"]}),
 smalltalk.HLMethodsListWidget);
 
 smalltalk.addMethod(
@@ -1053,9 +1048,17 @@ smalltalk.method({
 selector: "selectItem:",
 fn: function (aSelector){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(_st(self)._model())._selectedMethod_(_st(self)._methodForSelector_(aSelector));
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+$1=aSelector;
+if(($receiver = $1) == nil || $receiver == undefined){
+$2=_st(_st(self)._model())._selectedMethod_(nil);
+return $2;
+} else {
+$1;
+};
+_st(_st(self)._model())._selectedMethod_(_st(self)._methodForSelector_(aSelector));
 return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aSelector:aSelector}, smalltalk.HLMethodsListWidget)})},
-messageSends: ["selectedMethod:", "methodForSelector:", "model"]}),
+messageSends: ["ifNil:", "selectedMethod:", "model", "methodForSelector:"]}),
 smalltalk.HLMethodsListWidget);
 
 smalltalk.addMethod(
@@ -1086,6 +1089,37 @@ return $1;
 messageSends: ["collect:", "selector", "methodsInProtocol:"]}),
 smalltalk.HLMethodsListWidget);
 
+smalltalk.addMethod(
+"_setItemsForProtocol_",
+smalltalk.method({
+selector: "setItemsForProtocol:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $2,$4,$3,$1;
+$2=self;
+$4=aString;
+if(($receiver = $4) == nil || $receiver == undefined){
+$3=[];
+} else {
+$3=_st(self)._selectorsInProtocol_(aString);
+};
+$1=_st($2)._items_($3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"setItemsForProtocol:",{aString:aString}, smalltalk.HLMethodsListWidget)})},
+messageSends: ["items:", "ifNil:ifNotNil:", "selectorsInProtocol:"]}),
+smalltalk.HLMethodsListWidget);
+
+smalltalk.addMethod(
+"_setItemsForSelectedProtocol",
+smalltalk.method({
+selector: "setItemsForSelectedProtocol",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
_st(self)._setItemsForProtocol_(_st(_st(self)._model())._selectedProtocol());
+return self}, function($ctx1) {$ctx1.fill(self,"setItemsForSelectedProtocol",{}, smalltalk.HLMethodsListWidget)})},
+messageSends: ["setItemsForProtocol:", "selectedProtocol", "model"]}),
+smalltalk.HLMethodsListWidget);
+
 
 smalltalk.HLMethodsListWidget.klass.iVarNames = ['selectorsCache'];
 smalltalk.addMethod(

+ 92 - 48
js/Helios-Browser.js

@@ -1085,18 +1085,24 @@ selector: "methodsInProtocol:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $2,$1;
-$2=_st(aString).__eq(_st(self)._allProtocol());
-if(smalltalk.assert($2)){
-$1=_st(_st(_st(self)._model())._selectedClass())._methods();
+return smalltalk.withContext(function($ctx1) { 
var $1,$3,$2;
+$1=_st(_st(self)._model())._selectedClass();
+if(($receiver = $1) == nil || $receiver == undefined){
+return [];
 } else {
-$1=_st(_st(_st(self)._model())._selectedClass())._methodsInProtocol_(aString);
+$1;
 };
-return $1;
+$3=_st(aString).__eq(_st(self)._allProtocol());
+if(smalltalk.assert($3)){
+$2=_st(_st(_st(self)._model())._selectedClass())._methods();
+} else {
+$2=_st(_st(_st(self)._model())._selectedClass())._methodsInProtocol_(aString);
+};
+return $2;
 }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString}, smalltalk.HLMethodsListWidget)})},
 args: ["aString"],
-source: "methodsInProtocol: aString\x0a\x09^ aString = self allProtocol\x0a    \x09ifTrue: [ self model selectedClass methods ]\x0a      \x09ifFalse: [ self model selectedClass methodsInProtocol: aString ]",
-messageSends: ["ifTrue:ifFalse:", "methods", "selectedClass", "model", "methodsInProtocol:", "=", "allProtocol"],
+source: "methodsInProtocol: aString\x0a\x09self model selectedClass ifNil: [ ^ #() ].\x0a    \x0a\x09^ aString = self allProtocol\x0a    \x09ifTrue: [ self model selectedClass methods ]\x0a      \x09ifFalse: [ self model selectedClass methodsInProtocol: aString ]",
+messageSends: ["ifNil:", "selectedClass", "model", "ifTrue:ifFalse:", "methods", "methodsInProtocol:", "=", "allProtocol"],
 referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);
@@ -1155,22 +1161,18 @@ selector: "onMethodAdded:",
 category: 'reactions',
 fn: function (aMethod){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-var $early={};
-try {
-_st(_st(self)._items())._detect_ifNone_((function(each){
-return smalltalk.withContext(function($ctx2) {
return _st(each).__eq(_st(aMethod)._selector());
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
-return smalltalk.withContext(function($ctx2) {
$1=self;
-throw $early=[$1];
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+$1=_st(_st(_st(self)._model())._selectedClass()).__eq(_st(aMethod)._methodClass());
+if(! smalltalk.assert($1)){
+$2=self;
+return $2;
+};
+_st(self)._setItemsForSelectedProtocol();
 _st(self)._refresh();
-return self}
-catch(e) {if(e===$early)return e[0]; throw e}
-}, function($ctx1) {$ctx1.fill(self,"onMethodAdded:",{aMethod:aMethod}, smalltalk.HLMethodsListWidget)})},
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodAdded:",{aMethod:aMethod}, smalltalk.HLMethodsListWidget)})},
 args: ["aMethod"],
-source: "onMethodAdded: aMethod\x0a\x09self items detect: [ :each | each = aMethod selector ] ifNone: [ ^ self ].\x0a    \x0a    self refresh",
-messageSends: ["detect:ifNone:", "=", "selector", "items", "refresh"],
+source: "onMethodAdded: aMethod\x0a\x09self model selectedClass = aMethod methodClass ifFalse: [ ^ self ].\x0a    \x0a    self setItemsForSelectedProtocol.\x0a    self refresh",
+messageSends: ["ifFalse:", "=", "methodClass", "selectedClass", "model", "setItemsForSelectedProtocol", "refresh"],
 referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);
@@ -1182,7 +1184,7 @@ selector: "onMethodRemoved:",
 category: 'reactions',
 fn: function (aMethod){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2,$3;
 var $early={};
 try {
 _st(_st(self)._items())._detect_ifNone_((function(each){
@@ -1191,19 +1193,25 @@ return smalltalk.withContext(function($ctx2) {
return _st(each).__eq(_st(aMethod
 return smalltalk.withContext(function($ctx2) {
$1=self;
 throw $early=[$1];
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-$2=_st(_st(_st(aMethod)._methodClass()).__eq(_st(_st(self)._model())._selectedClass()))._and_((function(){
-return smalltalk.withContext(function($ctx2) {
return _st(_st(aMethod)._selector()).__eq(_st(self)._selectedItem());
+$2=_st(self)._selectedItem();
+if(($receiver = $2) == nil || $receiver == undefined){
+$2;
+} else {
+$3=_st(_st(_st(aMethod)._methodClass()).__eq(_st(_st(self)._model())._selectedClass()))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
return _st(_st(aMethod)._selector()).__eq(_st(_st(self)._selectedItem())._selector());
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-if(smalltalk.assert($2)){
+if(smalltalk.assert($3)){
 _st(self)._selectItem_(nil);
 };
+};
+_st(self)._setItemsForSelectedProtocol();
 _st(self)._refresh();
 return self}
 catch(e) {if(e===$early)return e[0]; throw e}
 }, function($ctx1) {$ctx1.fill(self,"onMethodRemoved:",{aMethod:aMethod}, smalltalk.HLMethodsListWidget)})},
 args: ["aMethod"],
-source: "onMethodRemoved: aMethod\x0a\x09self items detect: [ :each | each = aMethod selector ] ifNone: [ ^ self ].\x0a    \x0a    (aMethod methodClass = self model selectedClass and: [ aMethod selector = self selectedItem ])\x0a  \x09\x09ifTrue: [ self selectItem: nil ].\x0a    \x0a    self refresh",
-messageSends: ["detect:ifNone:", "=", "selector", "items", "ifTrue:", "selectItem:", "and:", "selectedItem", "selectedClass", "model", "methodClass", "refresh"],
+source: "onMethodRemoved: aMethod\x0a\x09self items detect: [ :each | each = aMethod selector ] ifNone: [ ^ self ].\x0a\x0a    self selectedItem ifNotNil: [\x0a      \x09(aMethod methodClass = self model selectedClass and: [ aMethod selector = self selectedItem selector ])\x0a  \x09\x09\x09ifTrue: [ self selectItem: nil ] ].\x0a    self setItemsForSelectedProtocol.\x0a\x0aself refresh",
+messageSends: ["detect:ifNone:", "=", "selector", "items", "ifNotNil:", "ifTrue:", "selectItem:", "and:", "selectedItem", "selectedClass", "model", "methodClass", "setItemsForSelectedProtocol", "refresh"],
 referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);
@@ -1240,26 +1248,13 @@ selector: "onProtocolSelected:",
 category: 'reactions',
 fn: function (aString){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$3,$4,$2;
-_st(self)._selectedItem_(nil);
-$1=self;
-$3=_st(_st(self)._model())._selectedClass();
-if(($receiver = $3) == nil || $receiver == undefined){
-$2=[];
-} else {
-$4=aString;
-if(($receiver = $4) == nil || $receiver == undefined){
-$2=[];
-} else {
-$2=_st(self)._selectorsInProtocol_(aString);
-};
-};
-_st($1)._items_($2);
+return smalltalk.withContext(function($ctx1) { 
_st(self)._selectedItem_(nil);
+_st(self)._setItemsForSelectedProtocol();
 _st(self)._refresh();
 return self}, function($ctx1) {$ctx1.fill(self,"onProtocolSelected:",{aString:aString}, smalltalk.HLMethodsListWidget)})},
 args: ["aString"],
-source: "onProtocolSelected: aString\x0a    self selectedItem: nil.\x0a    \x0a    self items: (self model selectedClass \x0a    \x09ifNil: [ #() ]\x0a      \x09ifNotNil: [ aString\x0a    \x09\x09ifNil: [ #() ]\x0a      \x09\x09ifNotNil: [ self selectorsInProtocol: aString ] ]).\x0a        \x0a    self refresh",
-messageSends: ["selectedItem:", "items:", "ifNil:ifNotNil:", "selectorsInProtocol:", "selectedClass", "model", "refresh"],
+source: "onProtocolSelected: aString\x0a    self selectedItem: nil.\x0a    \x0a\x09self setItemsForSelectedProtocol.\x0a    self refresh",
+messageSends: ["selectedItem:", "setItemsForSelectedProtocol", "refresh"],
 referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);
@@ -1364,11 +1359,19 @@ selector: "selectItem:",
 category: 'actions',
 fn: function (aSelector){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(_st(self)._model())._selectedMethod_(_st(self)._methodForSelector_(aSelector));
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+$1=aSelector;
+if(($receiver = $1) == nil || $receiver == undefined){
+$2=_st(_st(self)._model())._selectedMethod_(nil);
+return $2;
+} else {
+$1;
+};
+_st(_st(self)._model())._selectedMethod_(_st(self)._methodForSelector_(aSelector));
 return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aSelector:aSelector}, smalltalk.HLMethodsListWidget)})},
 args: ["aSelector"],
-source: "selectItem: aSelector\x0a   \x09self model selectedMethod: (self methodForSelector: aSelector)\x0a    ",
-messageSends: ["selectedMethod:", "methodForSelector:", "model"],
+source: "selectItem: aSelector\x0a\x09aSelector ifNil: [ ^ self model selectedMethod: nil ].\x0a\x0a   \x09self model selectedMethod: (self methodForSelector: aSelector)\x0a    ",
+messageSends: ["ifNil:", "selectedMethod:", "model", "methodForSelector:"],
 referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);
@@ -1411,6 +1414,47 @@ referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);
 
+smalltalk.addMethod(
+"_setItemsForProtocol_",
+smalltalk.method({
+selector: "setItemsForProtocol:",
+category: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $2,$4,$3,$1;
+$2=self;
+$4=aString;
+if(($receiver = $4) == nil || $receiver == undefined){
+$3=[];
+} else {
+$3=_st(self)._selectorsInProtocol_(aString);
+};
+$1=_st($2)._items_($3);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"setItemsForProtocol:",{aString:aString}, smalltalk.HLMethodsListWidget)})},
+args: ["aString"],
+source: "setItemsForProtocol: aString\x0a\x09^ self items: (aString\x0a    \x09ifNil: [ #() ]\x0a      \x09ifNotNil: [ self selectorsInProtocol: aString ])",
+messageSends: ["items:", "ifNil:ifNotNil:", "selectorsInProtocol:"],
+referencedClasses: []
+}),
+smalltalk.HLMethodsListWidget);
+
+smalltalk.addMethod(
+"_setItemsForSelectedProtocol",
+smalltalk.method({
+selector: "setItemsForSelectedProtocol",
+category: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
_st(self)._setItemsForProtocol_(_st(_st(self)._model())._selectedProtocol());
+return self}, function($ctx1) {$ctx1.fill(self,"setItemsForSelectedProtocol",{}, smalltalk.HLMethodsListWidget)})},
+args: [],
+source: "setItemsForSelectedProtocol\x0a\x09self setItemsForProtocol: self model selectedProtocol",
+messageSends: ["setItemsForProtocol:", "selectedProtocol", "model"],
+referencedClasses: []
+}),
+smalltalk.HLMethodsListWidget);
+
 
 smalltalk.HLMethodsListWidget.klass.iVarNames = ['selectorsCache'];
 smalltalk.addMethod(

+ 26 - 12
st/Helios-Browser.st

@@ -351,6 +351,8 @@ methodForSelector: aSelector
 !
 
 methodsInProtocol: aString
+	self model selectedClass ifNil: [ ^ #() ].
+    
 	^ aString = self allProtocol
     	ifTrue: [ self model selectedClass methods ]
       	ifFalse: [ self model selectedClass methodsInProtocol: aString ]
@@ -401,6 +403,8 @@ observeSystem
 !
 
 selectItem: aSelector
+	aSelector ifNil: [ ^ self model selectedMethod: nil ].
+
    	self model selectedMethod: (self methodForSelector: aSelector)
 ! !
 
@@ -417,21 +421,36 @@ initialize
     self flushSelectorsCache
 ! !
 
+!HLMethodsListWidget methodsFor: 'private'!
+
+setItemsForProtocol: aString
+	^ self items: (aString
+    	ifNil: [ #() ]
+      	ifNotNil: [ self selectorsInProtocol: aString ])
+!
+
+setItemsForSelectedProtocol
+	self setItemsForProtocol: self model selectedProtocol
+! !
+
 !HLMethodsListWidget methodsFor: 'reactions'!
 
 onMethodAdded: aMethod
-	self items detect: [ :each | each = aMethod selector ] ifNone: [ ^ self ].
+	self model selectedClass = aMethod methodClass ifFalse: [ ^ self ].
     
+    self setItemsForSelectedProtocol.
     self refresh
 !
 
 onMethodRemoved: aMethod
 	self items detect: [ :each | each = aMethod selector ] ifNone: [ ^ self ].
-    
-    (aMethod methodClass = self model selectedClass and: [ aMethod selector = self selectedItem ])
-  		ifTrue: [ self selectItem: nil ].
-    
-    self refresh
+
+    self selectedItem ifNotNil: [
+      	(aMethod methodClass = self model selectedClass and: [ aMethod selector = self selectedItem selector ])
+  			ifTrue: [ self selectItem: nil ] ].
+    self setItemsForSelectedProtocol.
+
+self refresh
 !
 
 onMethodSelected: aMethod
@@ -444,12 +463,7 @@ onMethodSelected: aMethod
 onProtocolSelected: aString
     self selectedItem: nil.
     
-    self items: (self model selectedClass 
-    	ifNil: [ #() ]
-      	ifNotNil: [ aString
-    		ifNil: [ #() ]
-      		ifNotNil: [ self selectorsInProtocol: aString ] ]).
-        
+	self setItemsForSelectedProtocol.
     self refresh
 ! !