Selaa lähdekoodia

Merge branch 'master' of mmontone/helios into master

Herby Vojčík 3 vuotta sitten
vanhempi
commit
3ea6897740
6 muutettua tiedostoa jossa 421 lisäystä ja 14 poistoa
  1. 214 0
      src/Helios-Commands-Tools.js
  2. 70 0
      src/Helios-Commands-Tools.st
  3. 43 8
      src/Helios-Core.js
  4. 17 6
      src/Helios-Core.st
  5. 63 0
      src/Helios-Debugger.js
  6. 14 0
      src/Helios-Debugger.st

+ 214 - 0
src/Helios-Commands-Tools.js

@@ -766,6 +766,220 @@ return "Find class";
 $globals.HLFindClassCommand.a$cls);
 
 
+$core.addClass("HLFindClassReferencesCommand", $globals.HLFindCommand, "Helios-Commands-Tools");
+$core.addMethod(
+$core.method({
+selector: "category",
+protocol: "accessing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "category\x0a\x09^ 'Classes'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+return "Classes";
+
+}; }),
+$globals.HLFindClassReferencesCommand);
+
+$core.addMethod(
+$core.method({
+selector: "execute",
+protocol: "executing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "execute\x0a\x0a\x09HLReferences new \x0a\x09\x09openAsTab;\x0a\x09\x09search: self model selectedClass theNonMetaClass name",
+referencedClasses: ["HLReferences"],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["openAsTab", "new", "search:", "name", "theNonMetaClass", "selectedClass", "model"]
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv($globals.HLReferences)._new();
+$recv($1)._openAsTab();
+$recv($1)._search_($recv($recv($recv($self._model())._selectedClass())._theNonMetaClass())._name());
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"execute",{})});
+//>>excludeEnd("ctx");
+}; }),
+$globals.HLFindClassReferencesCommand);
+
+$core.addMethod(
+$core.method({
+selector: "isActive",
+protocol: "testing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "isActive\x0a\x09^ self model selectedClass notNil",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["notNil", "selectedClass", "model"]
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $recv($recv($self._model())._selectedClass())._notNil();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"isActive",{})});
+//>>excludeEnd("ctx");
+}; }),
+$globals.HLFindClassReferencesCommand);
+
+$core.addMethod(
+$core.method({
+selector: "isInputRequired",
+protocol: "testing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "isInputRequired\x0a\x09^ false",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+return false;
+
+}; }),
+$globals.HLFindClassReferencesCommand);
+
+
+$core.addMethod(
+$core.method({
+selector: "menuLabel",
+protocol: "accessing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "menuLabel\x0a\x09^ 'Find class references...'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+return "Find class references...";
+
+}; }),
+$globals.HLFindClassReferencesCommand.a$cls);
+
+
+$core.addClass("HLFindMethodReferencesCommand", $globals.HLFindCommand, "Helios-Commands-Tools");
+$core.addMethod(
+$core.method({
+selector: "category",
+protocol: "accessing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "category\x0a\x09^ 'Methods'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+return "Methods";
+
+}; }),
+$globals.HLFindMethodReferencesCommand);
+
+$core.addMethod(
+$core.method({
+selector: "execute",
+protocol: "executing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "execute\x0a\x0a\x09HLReferences new \x0a\x09\x09openAsTab;\x0a\x09\x09search: self model selectedMethod selector",
+referencedClasses: ["HLReferences"],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["openAsTab", "new", "search:", "selector", "selectedMethod", "model"]
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv($globals.HLReferences)._new();
+$recv($1)._openAsTab();
+$recv($1)._search_($recv($recv($self._model())._selectedMethod())._selector());
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"execute",{})});
+//>>excludeEnd("ctx");
+}; }),
+$globals.HLFindMethodReferencesCommand);
+
+$core.addMethod(
+$core.method({
+selector: "isActive",
+protocol: "testing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "isActive\x0a\x09^ self model selectedMethod notNil",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["notNil", "selectedMethod", "model"]
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $recv($recv($self._model())._selectedMethod())._notNil();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"isActive",{})});
+//>>excludeEnd("ctx");
+}; }),
+$globals.HLFindMethodReferencesCommand);
+
+$core.addMethod(
+$core.method({
+selector: "isInputRequired",
+protocol: "testing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "isInputRequired\x0a\x09^ false",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+return false;
+
+}; }),
+$globals.HLFindMethodReferencesCommand);
+
+
+$core.addMethod(
+$core.method({
+selector: "menuLabel",
+protocol: "accessing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "menuLabel\x0a\x09^ 'Find method references...'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+return "Find method references...";
+
+}; }),
+$globals.HLFindMethodReferencesCommand.a$cls);
+
+
 $core.addClass("HLFindReferencesCommand", $globals.HLFindCommand, "Helios-Commands-Tools");
 $core.addMethod(
 $core.method({

+ 70 - 0
src/Helios-Commands-Tools.st

@@ -225,6 +225,76 @@ label
 	^ 'Find class'
 ! !
 
+HLFindCommand subclass: #HLFindClassReferencesCommand
+	slots: {}
+	package: 'Helios-Commands-Tools'!
+
+!HLFindClassReferencesCommand methodsFor: 'accessing'!
+
+category
+	^ 'Classes'
+! !
+
+!HLFindClassReferencesCommand methodsFor: 'executing'!
+
+execute
+
+	HLReferences new 
+		openAsTab;
+		search: self model selectedClass theNonMetaClass name
+! !
+
+!HLFindClassReferencesCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedClass notNil
+!
+
+isInputRequired
+	^ false
+! !
+
+!HLFindClassReferencesCommand class methodsFor: 'accessing'!
+
+menuLabel
+	^ 'Find class references...'
+! !
+
+HLFindCommand subclass: #HLFindMethodReferencesCommand
+	slots: {}
+	package: 'Helios-Commands-Tools'!
+
+!HLFindMethodReferencesCommand methodsFor: 'accessing'!
+
+category
+	^ 'Methods'
+! !
+
+!HLFindMethodReferencesCommand methodsFor: 'executing'!
+
+execute
+
+	HLReferences new 
+		openAsTab;
+		search: self model selectedMethod selector
+! !
+
+!HLFindMethodReferencesCommand methodsFor: 'testing'!
+
+isActive
+	^ self model selectedMethod notNil
+!
+
+isInputRequired
+	^ false
+! !
+
+!HLFindMethodReferencesCommand class methodsFor: 'accessing'!
+
+menuLabel
+	^ 'Find method references...'
+! !
+
 HLFindCommand subclass: #HLFindReferencesCommand
 	slots: {}
 	package: 'Helios-Commands-Tools'!

+ 43 - 8
src/Helios-Core.js

@@ -3453,13 +3453,14 @@ selector: "renderContentOn:",
 protocol: "rendering",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["html"],
-source: "renderContentOn: html\x0a\x09html ul \x0a    \x09class: self listCssClass;\x0a        with: [ self renderListOn: html ];\x0a\x09\x09onClick: [ self focus ].\x0a    html div class: self buttonsDivCssClass; with: [\x0a      \x09self renderButtonsOn: html ].\x0a        \x0a   self setupKeyBindings",
+source: "renderContentOn: html\x0a\x0a\x09|ul|\x0a\x09\x0a\x09ul := html ul \x0a    \x09\x09class: self listCssClass;\x0a        \x09with: [ self renderListOn: html ];\x0a\x09\x09\x09onClick: [ self focus ].\x0a\x09\x09\x09\x0a\x09ul asJQuery contextmenu: [ self toggleCommandsMenu. false].\x0a\x09\x09\x0a    html div class: self buttonsDivCssClass; with: [\x0a      \x09self renderButtonsOn: html ].\x0a        \x0a   self setupKeyBindings",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["class:", "ul", "listCssClass", "with:", "renderListOn:", "onClick:", "focus", "div", "buttonsDivCssClass", "renderButtonsOn:", "setupKeyBindings"]
+messageSends: ["class:", "ul", "listCssClass", "with:", "renderListOn:", "onClick:", "focus", "contextmenu:", "asJQuery", "toggleCommandsMenu", "div", "buttonsDivCssClass", "renderButtonsOn:", "setupKeyBindings"]
 }, function ($methodClass){ return function (html){
 var self=this,$self=this;
+var ul;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
@@ -3483,7 +3484,7 @@ return $self._renderListOn_(html);
 ,$ctx1.sendIdx["with:"]=1
 //>>excludeEnd("ctx");
 ][0];
-$recv($1)._onClick_((function(){
+ul=$recv($1)._onClick_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -3492,6 +3493,16 @@ return $self._focus();
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
 //>>excludeEnd("ctx");
 }));
+$recv($recv(ul)._asJQuery())._contextmenu_((function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+$self._toggleCommandsMenu();
+return false;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
+//>>excludeEnd("ctx");
+}));
 $2=$recv(html)._div();
 $recv($2)._class_($self._buttonsDivCssClass());
 $recv($2)._with_((function(){
@@ -3500,13 +3511,13 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 return $self._renderButtonsOn_(html);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
 //>>excludeEnd("ctx");
 }));
 $self._setupKeyBindings();
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html})});
+}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html,ul:ul})});
 //>>excludeEnd("ctx");
 }; }),
 $globals.HLListWidget);
@@ -3999,7 +4010,7 @@ $globals.HLNavigationListWidget);
 
 
 $core.addClass("HLToolListWidget", $globals.HLNavigationListWidget, "Helios-Core");
-$core.setSlots($globals.HLToolListWidget, ["model"]);
+$core.setSlots($globals.HLToolListWidget, ["model", "commandsMenuElement"]);
 $core.addMethod(
 $core.method({
 selector: "activateListItem:",
@@ -4423,7 +4434,7 @@ selector: "renderMenuOn:",
 protocol: "rendering",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["html"],
-source: "renderMenuOn: html\x0a\x09| commands |\x0a\x09\x0a\x09commands := self menuCommands.\x0a\x09commands ifEmpty: [ ^ self ].\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'btn-group cog';\x0a\x09\x09with: [\x0a\x09\x09\x09html a\x0a\x09\x09\x09\x09class: 'btn btn-default dropdown-toggle';\x0a\x09\x09\x09\x09at: 'data-toggle' put: 'dropdown';\x0a\x09\x09\x09\x09with: [ (html tag: 'i') class: 'glyphicon glyphicon-chevron-down' ].\x0a\x09\x09html ul \x0a\x09\x09\x09class: 'dropdown-menu pull-right';\x0a\x09\x09\x09with: [ \x0a\x09\x09\x09\x09commands do: [ :each | \x0a\x09\x09\x09\x09\x09html li with: [ html a \x0a\x09\x09\x09\x09\x09\x09with: each menuLabel;\x0a\x09\x09\x09\x09\x09\x09onClick: [ self execute: each ] ] ] ] ]",
+source: "renderMenuOn: html\x0a\x09| commands |\x0a\x09\x0a\x09commands := self menuCommands.\x0a\x09commands ifEmpty: [ ^ self ].\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'btn-group cog';\x0a\x09\x09with: [\x0a\x09\x09\x09commandsMenuElement := html a\x0a\x09\x09\x09\x09class: 'btn btn-default dropdown-toggle';\x0a\x09\x09\x09\x09at: 'data-toggle' put: 'dropdown';\x0a\x09\x09\x09\x09with: [ (html tag: 'i') class: 'glyphicon glyphicon-chevron-down' ].\x0a\x09\x09html ul \x0a\x09\x09\x09class: 'dropdown-menu pull-right';\x0a\x09\x09\x09with: [ \x0a\x09\x09\x09\x09commands do: [ :each | \x0a\x09\x09\x09\x09\x09html li with: [ html a \x0a\x09\x09\x09\x09\x09\x09with: each menuLabel;\x0a\x09\x09\x09\x09\x09\x09onClick: [ self execute: each ] ] ] ] ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
@@ -4463,7 +4474,7 @@ $2=[$recv(html)._a()
 //>>excludeEnd("ctx");
 ][0];
 $recv($2)._at_put_("data-toggle","dropdown");
-[$recv($2)._with_((function(){
+$self.commandsMenuElement=[$recv($2)._with_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
@@ -4575,6 +4586,30 @@ return self;
 }; }),
 $globals.HLToolListWidget);
 
+$core.addMethod(
+$core.method({
+selector: "toggleCommandsMenu",
+protocol: "actions",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "toggleCommandsMenu\x0a\x0a\x09commandsMenuElement asJQuery dropdown: 'toggle'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["dropdown:", "asJQuery"]
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv($recv($self.commandsMenuElement)._asJQuery())._dropdown_("toggle");
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"toggleCommandsMenu",{})});
+//>>excludeEnd("ctx");
+}; }),
+$globals.HLToolListWidget);
+
 $core.addMethod(
 $core.method({
 selector: "unregister",

+ 17 - 6
src/Helios-Core.st

@@ -882,10 +882,16 @@ renderButtonsOn: html
 !
 
 renderContentOn: html
-	html ul 
-    	class: self listCssClass;
-        with: [ self renderListOn: html ];
-		onClick: [ self focus ].
+
+	|ul|
+	
+	ul := html ul 
+    		class: self listCssClass;
+        	with: [ self renderListOn: html ];
+			onClick: [ self focus ].
+			
+	ul asJQuery contextmenu: [ self toggleCommandsMenu. false].
+		
     html div class: self buttonsDivCssClass; with: [
       	self renderButtonsOn: html ].
         
@@ -964,7 +970,7 @@ setupKeyBindings
 ! !
 
 HLNavigationListWidget subclass: #HLToolListWidget
-	slots: {#model}
+	slots: {#model. #commandsMenuElement}
 	package: 'Helios-Core'!
 
 !HLToolListWidget methodsFor: 'accessing'!
@@ -1031,6 +1037,11 @@ reactivateListItem: anItem
 	self model withChangesDo: [ super reactivateListItem: anItem ]
 !
 
+toggleCommandsMenu
+
+	commandsMenuElement asJQuery dropdown: 'toggle'
+!
+
 unregister
 	super unregister.
 	
@@ -1062,7 +1073,7 @@ renderMenuOn: html
 	html div 
 		class: 'btn-group cog';
 		with: [
-			html a
+			commandsMenuElement := html a
 				class: 'btn btn-default dropdown-toggle';
 				at: 'data-toggle' put: 'dropdown';
 				with: [ (html tag: 'i') class: 'glyphicon glyphicon-chevron-down' ].

+ 63 - 0
src/Helios-Debugger.js

@@ -1367,6 +1367,24 @@ return self;
 }; }),
 $globals.HLDebuggerModel);
 
+$core.addMethod(
+$core.method({
+selector: "isReferencesModel",
+protocol: "testing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "isReferencesModel\x0a\x09^ true",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: []
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+return true;
+
+}; }),
+$globals.HLDebuggerModel);
+
 $core.addMethod(
 $core.method({
 selector: "nextNode",
@@ -1428,6 +1446,51 @@ return self;
 }; }),
 $globals.HLDebuggerModel);
 
+$core.addMethod(
+$core.method({
+selector: "openMethod",
+protocol: "testing",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "openMethod\x0a\x09| browser |\x0a\x09\x0a\x09self selectedMethod ifNil: [ ^ self ].\x0a\x09\x0a\x09self withChangesDo: [\x0a\x09\x09browser := HLBrowser openAsTab.\x0a\x09\x09browser openMethod: self selectedMethod ]",
+referencedClasses: ["HLBrowser"],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["ifNil:", "selectedMethod", "withChangesDo:", "openAsTab", "openMethod:"]
+}, function ($methodClass){ return function (){
+var self=this,$self=this;
+var browser;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=[$self._selectedMethod()
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+,$ctx1.sendIdx["selectedMethod"]=1
+//>>excludeEnd("ctx");
+][0];
+if($1 == null || $1.a$nil){
+return self;
+} else {
+$1;
+}
+$self._withChangesDo_((function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+browser=$recv($globals.HLBrowser)._openAsTab();
+return $recv(browser)._openMethod_($self._selectedMethod());
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
+//>>excludeEnd("ctx");
+}));
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"openMethod",{browser:browser})});
+//>>excludeEnd("ctx");
+}; }),
+$globals.HLDebuggerModel);
+
 $core.addMethod(
 $core.method({
 selector: "proceed",

+ 14 - 0
src/Helios-Debugger.st

@@ -409,6 +409,20 @@ onStep
 
 atEnd
 	^ self debugger atEnd
+!
+
+isReferencesModel
+	^ true
+!
+
+openMethod
+	| browser |
+	
+	self selectedMethod ifNil: [ ^ self ].
+	
+	self withChangesDo: [
+		browser := HLBrowser openAsTab.
+		browser openMethod: self selectedMethod ]
 ! !
 
 !HLDebuggerModel class methodsFor: 'instance creation'!