4 Commits 1da84cf6da ... 8fbec3d5f7

Auteur SHA1 Bericht Datum
  Mariano Montone 8fbec3d5f7 Toggle panels commands menu on right click 3 jaren geleden
  Mariano Montone 0db2f159e7 Make browseIt action invoke Finder 3 jaren geleden
  Mariano Montone 5a8307f9d9 Find method references command 3 jaren geleden
  Mariano Montone 8836f245a7 Find class references command 3 jaren geleden
6 gewijzigde bestanden met toevoegingen van 341 en 19 verwijderingen
  1. 214 0
      src/Helios-Commands-Tools.js
  2. 62 0
      src/Helios-Commands-Tools.st
  3. 43 8
      src/Helios-Core.js
  4. 17 6
      src/Helios-Core.st
  5. 4 4
      src/Helios-Workspace.js
  6. 1 1
      src/Helios-Workspace.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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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: "as yet unclassified",
+//>>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({

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

@@ -225,6 +225,68 @@ label
 	^ 'Find class'
 ! !
 
+HLFindCommand subclass: #HLFindClassReferencesCommand
+	slots: {}
+	package: 'Helios-Commands-Tools'!
+
+!HLFindClassReferencesCommand methodsFor: 'as yet unclassified'!
+
+category
+	^ 'Classes'
+!
+
+execute
+
+	HLReferences new 
+		openAsTab;
+		search: self model selectedClass theNonMetaClass name
+!
+
+isActive
+	^ self model selectedClass notNil
+!
+
+isInputRequired
+	^ false
+! !
+
+!HLFindClassReferencesCommand class methodsFor: 'as yet unclassified'!
+
+menuLabel
+	^ 'Find class references...'
+! !
+
+HLFindCommand subclass: #HLFindMethodReferencesCommand
+	slots: {}
+	package: 'Helios-Commands-Tools'!
+
+!HLFindMethodReferencesCommand methodsFor: 'as yet unclassified'!
+
+category
+	^ 'Methods'
+!
+
+execute
+
+	HLReferences new 
+		openAsTab;
+		search: self model selectedMethod selector
+!
+
+isActive
+	^ self model selectedMethod notNil
+!
+
+isInputRequired
+	^ false
+! !
+
+!HLFindMethodReferencesCommand class methodsFor: 'as yet unclassified'!
+
+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' ].

+ 4 - 4
src/Helios-Workspace.js

@@ -321,11 +321,11 @@ selector: "browseIt",
 protocol: "actions",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "browseIt\x0a\x09[ self model browse: self basicDoIt ] fork",
-referencedClasses: [],
+source: "browseIt\x0a\x09[ Finder findString: self currentLineOrSelection ] fork",
+referencedClasses: ["Finder"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["fork", "browse:", "model", "basicDoIt"]
+messageSends: ["fork", "findString:", "currentLineOrSelection"]
 }, function ($methodClass){ return function (){
 var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -335,7 +335,7 @@ $recv((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return $recv($self._model())._browse_($self._basicDoIt());
+return $recv($globals.Finder)._findString_($self._currentLineOrSelection());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
 //>>excludeEnd("ctx");

+ 1 - 1
src/Helios-Workspace.st

@@ -148,7 +148,7 @@ basicDoIt
 !
 
 browseIt
-	[ self model browse: self basicDoIt ] fork
+	[ Finder findString: self currentLineOrSelection ] fork
 !
 
 clear