Browse Source

Helios: Fixes method selection when a method is moved

Nicolas Petton 11 years ago
parent
commit
16e435e66f
3 changed files with 74 additions and 60 deletions
  1. 28 23
      js/Helios-Browser.deploy.js
  2. 30 25
      js/Helios-Browser.js
  3. 16 12
      st/Helios-Browser.st

+ 28 - 23
js/Helios-Browser.deploy.js

@@ -1264,19 +1264,23 @@ selector: "onMethodMoved:",
 fn: function (aMethod){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4;
-$1=_st(_st(_st(self)._model())._selectedClass()).__eq(_st(aMethod)._methodClass());
+var $1,$2,$3,$4,$5;
+$1=_st(_st(_st(self)._model())._selectedMethod()).__eq(aMethod);
 if(! smalltalk.assert($1)){
 $2=self;
 return $2;
 };
-$3=self;
-_st($3)._selectedItem_(nil);
-_st($3)._selectItem_(nil);
-_st($3)._setItemsForSelectedProtocol();
-$4=_st($3)._refresh();
+$3=_st(_st(_st(self)._model())._selectedProtocol()).__eq(_st(_st(self)._model())._allProtocol());
+if(! smalltalk.assert($3)){
+$4=self;
+_st($4)._selectedItem_(nil);
+_st($4)._selectItem_(nil);
+_st($4)._setItemsForSelectedProtocol();
+$5=_st($4)._refresh();
+$5;
+};
 return self}, function($ctx1) {$ctx1.fill(self,"onMethodMoved:",{aMethod:aMethod},smalltalk.HLMethodsListWidget)})},
-messageSends: ["ifFalse:", "=", "methodClass", "selectedClass", "model", "selectedItem:", "selectItem:", "setItemsForSelectedProtocol", "refresh"]}),
+messageSends: ["ifFalse:", "=", "selectedMethod", "model", "selectedItem:", "selectItem:", "setItemsForSelectedProtocol", "refresh", "allProtocol", "selectedProtocol"]}),
 smalltalk.HLMethodsListWidget);
 
 smalltalk.addMethod(
@@ -1324,25 +1328,26 @@ smalltalk.method({
 selector: "onMethodSelected:",
 fn: function (aMethod){
 var self=this;
+var selector;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4,$5;
-_st(self)._selectedItem_(aMethod);
-$1=aMethod;
-if(($receiver = $1) == nil || $receiver == undefined){
-$2=self;
-return $2;
+var $1,$2,$3;
+$1=_st(aMethod)._isCompiledMethod();
+if(smalltalk.assert($1)){
+selector=_st(aMethod)._selector();
 } else {
-$1;
+selector=nil;
 };
-$3=_st(self)._hasFocus();
-if(! smalltalk.assert($3)){
-$4=self;
-_st($4)._activateItem_(aMethod);
-$5=_st($4)._focus();
-$5;
+_st(self)._selectedItem_(selector);
+$2=selector;
+if(($receiver = $2) == nil || $receiver == undefined){
+$3=self;
+return $3;
+} else {
+$2;
 };
-return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{aMethod:aMethod},smalltalk.HLMethodsListWidget)})},
-messageSends: ["selectedItem:", "ifNil:", "ifFalse:", "activateItem:", "focus", "hasFocus"]}),
+_st(self)._activateItem_(selector);
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{aMethod:aMethod,selector:selector},smalltalk.HLMethodsListWidget)})},
+messageSends: ["ifTrue:ifFalse:", "selector", "isCompiledMethod", "selectedItem:", "ifNil:", "activateItem:"]}),
 smalltalk.HLMethodsListWidget);
 
 smalltalk.addMethod(

+ 30 - 25
js/Helios-Browser.js

@@ -1610,21 +1610,25 @@ category: 'reactions',
 fn: function (aMethod){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4;
-$1=_st(_st(_st(self)._model())._selectedClass()).__eq(_st(aMethod)._methodClass());
+var $1,$2,$3,$4,$5;
+$1=_st(_st(_st(self)._model())._selectedMethod()).__eq(aMethod);
 if(! smalltalk.assert($1)){
 $2=self;
 return $2;
 };
-$3=self;
-_st($3)._selectedItem_(nil);
-_st($3)._selectItem_(nil);
-_st($3)._setItemsForSelectedProtocol();
-$4=_st($3)._refresh();
+$3=_st(_st(_st(self)._model())._selectedProtocol()).__eq(_st(_st(self)._model())._allProtocol());
+if(! smalltalk.assert($3)){
+$4=self;
+_st($4)._selectedItem_(nil);
+_st($4)._selectItem_(nil);
+_st($4)._setItemsForSelectedProtocol();
+$5=_st($4)._refresh();
+$5;
+};
 return self}, function($ctx1) {$ctx1.fill(self,"onMethodMoved:",{aMethod:aMethod},smalltalk.HLMethodsListWidget)})},
 args: ["aMethod"],
-source: "onMethodMoved: aMethod\x0a\x09self model selectedClass = aMethod methodClass ifFalse: [ ^ self ].\x0a    \x0a\x09self \x0a\x09\x09selectedItem: nil; \x0a\x09\x09selectItem: nil;\x0a\x09\x09setItemsForSelectedProtocol;\x0a    \x09refresh",
-messageSends: ["ifFalse:", "=", "methodClass", "selectedClass", "model", "selectedItem:", "selectItem:", "setItemsForSelectedProtocol", "refresh"],
+source: "onMethodMoved: aMethod\x0a\x09self model selectedMethod = aMethod ifFalse: [ ^ self ].\x0a    \x0a\x09self model selectedProtocol = self model allProtocol ifFalse: [\x0a\x09\x09self \x0a\x09\x09\x09selectedItem: nil; \x0a\x09\x09\x09selectItem: nil;\x0a\x09\x09\x09setItemsForSelectedProtocol;\x0a    \x09\x09refresh ]",
+messageSends: ["ifFalse:", "=", "selectedMethod", "model", "selectedItem:", "selectItem:", "setItemsForSelectedProtocol", "refresh", "allProtocol", "selectedProtocol"],
 referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);
@@ -1680,27 +1684,28 @@ selector: "onMethodSelected:",
 category: 'reactions',
 fn: function (aMethod){
 var self=this;
+var selector;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4,$5;
-_st(self)._selectedItem_(aMethod);
-$1=aMethod;
-if(($receiver = $1) == nil || $receiver == undefined){
-$2=self;
-return $2;
+var $1,$2,$3;
+$1=_st(aMethod)._isCompiledMethod();
+if(smalltalk.assert($1)){
+selector=_st(aMethod)._selector();
 } else {
-$1;
+selector=nil;
 };
-$3=_st(self)._hasFocus();
-if(! smalltalk.assert($3)){
-$4=self;
-_st($4)._activateItem_(aMethod);
-$5=_st($4)._focus();
-$5;
+_st(self)._selectedItem_(selector);
+$2=selector;
+if(($receiver = $2) == nil || $receiver == undefined){
+$3=self;
+return $3;
+} else {
+$2;
 };
-return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{aMethod:aMethod},smalltalk.HLMethodsListWidget)})},
+_st(self)._activateItem_(selector);
+return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{aMethod:aMethod,selector:selector},smalltalk.HLMethodsListWidget)})},
 args: ["aMethod"],
-source: "onMethodSelected: aMethod\x0a\x09self selectedItem: aMethod.\x0a\x09aMethod ifNil: [ ^ self ].\x0a    \x0a\x09self hasFocus ifFalse: [\x0a\x09\x09self \x0a\x09\x09\x09activateItem: aMethod;\x0a\x09\x09\x09focus ]",
-messageSends: ["selectedItem:", "ifNil:", "ifFalse:", "activateItem:", "focus", "hasFocus"],
+source: "onMethodSelected: aMethod\x0a\x09| selector |\x0a\x09selector := aMethod isCompiledMethod \x0a\x09\x09ifTrue: [ aMethod selector ]\x0a\x09\x09ifFalse: [ nil ].\x0a\x09\x09\x0a\x09self selectedItem: selector.\x0a\x09\x0a\x09selector ifNil: [ ^ self ].\x0a    \x0a\x09self activateItem: selector",
+messageSends: ["ifTrue:ifFalse:", "selector", "isCompiledMethod", "selectedItem:", "ifNil:", "activateItem:"],
 referencedClasses: []
 }),
 smalltalk.HLMethodsListWidget);

+ 16 - 12
st/Helios-Browser.st

@@ -572,13 +572,14 @@ onMethodAdded: aMethod
 !
 
 onMethodMoved: aMethod
-	self model selectedClass = aMethod methodClass ifFalse: [ ^ self ].
+	self model selectedMethod = aMethod ifFalse: [ ^ self ].
     
-	self 
-		selectedItem: nil; 
-		selectItem: nil;
-		setItemsForSelectedProtocol;
-    	refresh
+	self model selectedProtocol = self model allProtocol ifFalse: [
+		self 
+			selectedItem: nil; 
+			selectItem: nil;
+			setItemsForSelectedProtocol;
+    		refresh ]
 !
 
 onMethodRemoved: aMethod
@@ -595,13 +596,16 @@ onMethodRemoved: aMethod
 !
 
 onMethodSelected: aMethod
-	self selectedItem: aMethod.
-	aMethod ifNil: [ ^ self ].
+	| selector |
+	selector := aMethod isCompiledMethod 
+		ifTrue: [ aMethod selector ]
+		ifFalse: [ nil ].
+		
+	self selectedItem: selector.
+	
+	selector ifNil: [ ^ self ].
     
-	self hasFocus ifFalse: [
-		self 
-			activateItem: aMethod;
-			focus ]
+	self activateItem: selector
 !
 
 onMethodsFocusRequested