소스 검색

Fixes #850 #851 #852 #853

Nicolas Petton 10 년 전
부모
커밋
f3e6d809c9
4개의 변경된 파일238개의 추가작업 그리고 8개의 파일을 삭제
  1. 64 0
      src/Helios-Browser.js
  2. 16 0
      src/Helios-Browser.st
  3. 120 6
      src/Helios-Core.js
  4. 38 2
      src/Helios-Core.st

+ 64 - 0
src/Helios-Browser.js

@@ -1962,6 +1962,22 @@ referencedClasses: []
 }),
 globals.HLClassesListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedClass_(anItem);
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{anItem:anItem},globals.HLClassesListWidget)})},
+args: ["anItem"],
+source: "reselectItem: anItem\x0a\x09self model forceSelectedClass: anItem",
+messageSends: ["forceSelectedClass:", "model"],
+referencedClasses: []
+}),
+globals.HLClassesListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "selectItem:",
@@ -3178,6 +3194,22 @@ referencedClasses: []
 }),
 globals.HLMethodsListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedMethod_(anItem);
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{anItem:anItem},globals.HLMethodsListWidget)})},
+args: ["anItem"],
+source: "reselectItem: anItem\x0a\x09self model forceSelectedMethod: anItem",
+messageSends: ["forceSelectedMethod:", "model"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "selectItem:",
@@ -3560,6 +3592,22 @@ referencedClasses: []
 }),
 globals.HLPackagesListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedPackage_(anItem);
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{anItem:anItem},globals.HLPackagesListWidget)})},
+args: ["anItem"],
+source: "reselectItem: anItem\x0a\x09self model forceSelectedPackage: anItem",
+messageSends: ["forceSelectedPackage:", "model"],
+referencedClasses: []
+}),
+globals.HLPackagesListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "selectItem:",
@@ -3853,6 +3901,22 @@ referencedClasses: []
 }),
 globals.HLProtocolsListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._model())._forceSelectedProtocol_(anItem);
+return self}, function($ctx1) {$ctx1.fill(self,"reselectItem:",{anItem:anItem},globals.HLProtocolsListWidget)})},
+args: ["anItem"],
+source: "reselectItem: anItem\x0a\x09self model forceSelectedProtocol: anItem",
+messageSends: ["forceSelectedProtocol:", "model"],
+referencedClasses: []
+}),
+globals.HLProtocolsListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "selectItem:",

+ 16 - 0
src/Helios-Browser.st

@@ -503,6 +503,10 @@ observeSystem
 		to: self
 !
 
+reselectItem: anItem
+	self model forceSelectedClass: anItem
+!
+
 selectItem: aClass
     self model selectedClass: aClass
 !
@@ -1007,6 +1011,10 @@ observeSystem
 		to: self
 !
 
+reselectItem: anItem
+	self model forceSelectedMethod: anItem
+!
+
 selectItem: aSelector
 	aSelector ifNil: [ ^ self model selectedMethod: nil ].
 
@@ -1192,6 +1200,10 @@ observeSystem
 		to: self
 !
 
+reselectItem: anItem
+	self model forceSelectedPackage: anItem
+!
+
 selectItem: aPackage
 	super selectItem: aPackage.
 	self model selectedPackage: aPackage
@@ -1303,6 +1315,10 @@ observeSystem
 		to: self
 !
 
+reselectItem: anItem
+	self model forceSelectedProtocol: anItem
+!
+
 selectItem: aString
     self model selectedProtocol: aString
 ! !

+ 120 - 6
src/Helios-Core.js

@@ -505,6 +505,82 @@ referencedClasses: []
 }),
 globals.HLToolModel);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedClass:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._selectedClass_(nil);
+$ctx1.sendIdx["selectedClass:"]=1;
+$1=self._selectedClass_(aClass);
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedClass:",{aClass:aClass},globals.HLToolModel)})},
+args: ["aClass"],
+source: "forceSelectedClass: aClass\x0a\x09self \x09\x0a\x09\x09selectedClass: nil;\x0a\x09\x09selectedClass: aClass",
+messageSends: ["selectedClass:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedMethod:",
+protocol: 'accessing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._selectedMethod_(nil);
+$ctx1.sendIdx["selectedMethod:"]=1;
+$1=self._selectedMethod_(aMethod);
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedMethod:",{aMethod:aMethod},globals.HLToolModel)})},
+args: ["aMethod"],
+source: "forceSelectedMethod: aMethod\x0a\x09self \x09\x0a\x09\x09selectedMethod: nil;\x0a\x09\x09selectedMethod: aMethod",
+messageSends: ["selectedMethod:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedPackage:",
+protocol: 'accessing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._selectedPackage_(nil);
+$ctx1.sendIdx["selectedPackage:"]=1;
+$1=self._selectedPackage_(aPackage);
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedPackage:",{aPackage:aPackage},globals.HLToolModel)})},
+args: ["aPackage"],
+source: "forceSelectedPackage: aPackage\x0a\x09self \x09\x0a\x09\x09selectedPackage: nil;\x0a\x09\x09selectedPackage: aPackage",
+messageSends: ["selectedPackage:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "forceSelectedProtocol:",
+protocol: 'accessing',
+fn: function (aProtocol){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+self._selectedProtocol_(nil);
+$ctx1.sendIdx["selectedProtocol:"]=1;
+$1=self._selectedProtocol_(aProtocol);
+return self}, function($ctx1) {$ctx1.fill(self,"forceSelectedProtocol:",{aProtocol:aProtocol},globals.HLToolModel)})},
+args: ["aProtocol"],
+source: "forceSelectedProtocol: aProtocol\x0a\x09self \x09\x0a\x09\x09selectedProtocol: nil;\x0a\x09\x09selectedProtocol: aProtocol",
+messageSends: ["selectedProtocol:"],
+referencedClasses: []
+}),
+globals.HLToolModel);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "handleCompileError:",
@@ -2523,6 +2599,23 @@ referencedClasses: []
 }),
 globals.HLListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reactivateListItem:",
+protocol: 'actions',
+fn: function (aListItem){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._activateListItem_(aListItem);
+self._reselectItem_(self._selectedItem());
+return self}, function($ctx1) {$ctx1.fill(self,"reactivateListItem:",{aListItem:aListItem},globals.HLListWidget)})},
+args: ["aListItem"],
+source: "reactivateListItem: aListItem\x0a\x09self activateListItem: aListItem.\x0a\x09self reselectItem: self selectedItem",
+messageSends: ["activateListItem:", "reselectItem:", "selectedItem"],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "refresh",
@@ -2618,15 +2711,15 @@ return self._renderItemLabel_on_(anObject,html);
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
 $5=_st($4)._onClick_((function(){
 return smalltalk.withContext(function($ctx3) {
-return self._activateListItem_(_st(li)._asJQuery());
+return self._reactivateListItem_(_st(li)._asJQuery());
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
 return $5;
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
 $ctx1.sendIdx["with:"]=1;
 return self}, function($ctx1) {$ctx1.fill(self,"renderItem:on:",{anObject:anObject,html:html,li:li},globals.HLListWidget)})},
 args: ["anObject", "html"],
-source: "renderItem: anObject on: html\x0a\x09| li |\x0a    \x0a\x09li := html li.\x0a\x09li asJQuery data: 'item' put: anObject.\x0a    li\x0a\x09\x09class: (self listCssClassForItem: anObject);\x0a        with: [ \x0a        \x09html a\x0a            \x09with: [ \x0a            \x09\x09(html tag: 'i') class: (self cssClassForItem: anObject).\x0a  \x09\x09\x09\x09\x09self renderItemLabel: anObject on: html ];\x0a\x09\x09\x09\x09onClick: [\x0a                  \x09self activateListItem: li asJQuery ] ]",
-messageSends: ["li", "data:put:", "asJQuery", "class:", "listCssClassForItem:", "with:", "a", "tag:", "cssClassForItem:", "renderItemLabel:on:", "onClick:", "activateListItem:"],
+source: "renderItem: anObject on: html\x0a\x09| li |\x0a    \x0a\x09li := html li.\x0a\x09li asJQuery data: 'item' put: anObject.\x0a    li\x0a\x09\x09class: (self listCssClassForItem: anObject);\x0a        with: [ \x0a        \x09html a\x0a            \x09with: [ \x0a            \x09\x09(html tag: 'i') class: (self cssClassForItem: anObject).\x0a  \x09\x09\x09\x09\x09self renderItemLabel: anObject on: html ];\x0a\x09\x09\x09\x09onClick: [\x0a                  \x09self reactivateListItem: li asJQuery ] ]",
+messageSends: ["li", "data:put:", "asJQuery", "class:", "listCssClassForItem:", "with:", "a", "tag:", "cssClassForItem:", "renderItemLabel:on:", "onClick:", "reactivateListItem:"],
 referencedClasses: []
 }),
 globals.HLListWidget);
@@ -2666,6 +2759,20 @@ referencedClasses: []
 }),
 globals.HLListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "reselectItem:",
+protocol: 'actions',
+fn: function (anObject){
+var self=this;
+return self},
+args: ["anObject"],
+source: "reselectItem: anObject\x0a\x09",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "selectItem:",
@@ -2722,7 +2829,7 @@ fn: function (){
 var self=this;
 function $HLRepeatedKeyDownHandler(){return globals.HLRepeatedKeyDownHandler||(typeof HLRepeatedKeyDownHandler=="undefined"?nil:HLRepeatedKeyDownHandler)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2;
+var $1,$2,$3;
 $1=_st($HLRepeatedKeyDownHandler())._on_(self);
 _st($1)._whileKeyDown_do_((38),(function(){
 return smalltalk.withContext(function($ctx2) {
@@ -2734,10 +2841,17 @@ return smalltalk.withContext(function($ctx2) {
 return self._activateNextListItem();
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
 $2=_st($1)._rebindKeys();
+_st(_st(self._wrapper())._asJQuery())._keydown_((function(e){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(_st(e)._which()).__eq((13));
+if(smalltalk.assert($3)){
+return self._reselectItem_(self._selectedItem());
+};
+}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)})}));
 return self}, function($ctx1) {$ctx1.fill(self,"setupKeyBindings",{},globals.HLListWidget)})},
 args: [],
-source: "setupKeyBindings \x0a\x09(HLRepeatedKeyDownHandler on: self)\x0a\x09\x09whileKeyDown: 38 do: [ self activatePreviousListItem ];\x0a\x09\x09whileKeyDown: 40 do: [ self activateNextListItem ];\x0a\x09\x09rebindKeys",
-messageSends: ["whileKeyDown:do:", "on:", "activatePreviousListItem", "activateNextListItem", "rebindKeys"],
+source: "setupKeyBindings \x0a\x09(HLRepeatedKeyDownHandler on: self)\x0a\x09\x09whileKeyDown: 38 do: [ self activatePreviousListItem ];\x0a\x09\x09whileKeyDown: 40 do: [ self activateNextListItem ];\x0a\x09\x09rebindKeys.\x0a\x09\x09\x0a\x09self wrapper asJQuery keydown: [ :e |\x0a        e which = 13 ifTrue: [ \x0a        \x09self reselectItem: self selectedItem ] ]",
+messageSends: ["whileKeyDown:do:", "on:", "activatePreviousListItem", "activateNextListItem", "rebindKeys", "keydown:", "asJQuery", "wrapper", "ifTrue:", "=", "which", "reselectItem:", "selectedItem"],
 referencedClasses: ["HLRepeatedKeyDownHandler"]
 }),
 globals.HLListWidget);

+ 38 - 2
src/Helios-Core.st

@@ -122,6 +122,30 @@ availableProtocols
 	^ self environment availableProtocolsFor: self selectedClass
 !
 
+forceSelectedClass: aClass
+	self 	
+		selectedClass: nil;
+		selectedClass: aClass
+!
+
+forceSelectedMethod: aMethod
+	self 	
+		selectedMethod: nil;
+		selectedMethod: aMethod
+!
+
+forceSelectedPackage: aPackage
+	self 	
+		selectedPackage: nil;
+		selectedPackage: aPackage
+!
+
+forceSelectedProtocol: aProtocol
+	self 	
+		selectedProtocol: nil;
+		selectedProtocol: aProtocol
+!
+
 packageToCommit
 	"Answer the package to commit depending on the context:
 	- if a Method is selected, answer its package
@@ -880,11 +904,19 @@ focus
 		self selectedItem ifNil: [ self activateFirstListItem ] ]
 !
 
+reactivateListItem: aListItem
+	self activateListItem: aListItem.
+	self reselectItem: self selectedItem
+!
+
 refresh
 	super refresh.
 	self selectedItem ifNotNil: [self ensureVisible: (self findListItemFor: self selectedItem)].
 !
 
+reselectItem: anObject
+!
+
 selectItem: anObject
 	self selectedItem: anObject
 ! !
@@ -901,7 +933,11 @@ setupKeyBindings
 	(HLRepeatedKeyDownHandler on: self)
 		whileKeyDown: 38 do: [ self activatePreviousListItem ];
 		whileKeyDown: 40 do: [ self activateNextListItem ];
-		rebindKeys
+		rebindKeys.
+		
+	self wrapper asJQuery keydown: [ :e |
+        e which = 13 ifTrue: [ 
+        	self reselectItem: self selectedItem ] ]
 ! !
 
 !HLListWidget methodsFor: 'rendering'!
@@ -932,7 +968,7 @@ renderItem: anObject on: html
             		(html tag: 'i') class: (self cssClassForItem: anObject).
   					self renderItemLabel: anObject on: html ];
 				onClick: [
-                  	self activateListItem: li asJQuery ] ]
+                  	self reactivateListItem: li asJQuery ] ]
 !
 
 renderItemLabel: anObject on: html