Browse Source

Completion for HLMoveMethodToProtocolCommand

Nicolas Petton 12 years ago
parent
commit
45578cfca3

+ 13 - 0
js/Helios-Browser.deploy.js

@@ -1571,6 +1571,19 @@ return $1;
 messageSends: ["availableClassNames", "environment"]}),
 smalltalk.HLBrowserModel);
 
+smalltalk.addMethod(
+"_availableProtocols",
+smalltalk.method({
+selector: "availableProtocols",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._environment())._availableProtocolsFor_(_st(self)._selectedClass());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availableProtocols",{},smalltalk.HLBrowserModel)})},
+messageSends: ["availableProtocolsFor:", "selectedClass", "environment"]}),
+smalltalk.HLBrowserModel);
+
 smalltalk.addMethod(
 "_compilationProtocol",
 smalltalk.method({

+ 18 - 0
js/Helios-Browser.js

@@ -2046,6 +2046,24 @@ referencedClasses: []
 }),
 smalltalk.HLBrowserModel);
 
+smalltalk.addMethod(
+"_availableProtocols",
+smalltalk.method({
+selector: "availableProtocols",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._environment())._availableProtocolsFor_(_st(self)._selectedClass());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"availableProtocols",{},smalltalk.HLBrowserModel)})},
+args: [],
+source: "availableProtocols\x0a\x09^ self environment availableProtocolsFor: self selectedClass",
+messageSends: ["availableProtocolsFor:", "selectedClass", "environment"],
+referencedClasses: []
+}),
+smalltalk.HLBrowserModel);
+
 smalltalk.addMethod(
 "_compilationProtocol",
 smalltalk.method({

+ 48 - 2
js/Helios-Commands-Browser.deploy.js

@@ -369,15 +369,61 @@ smalltalk.HLMoveMethodToClassCommand.klass);
 
 
 smalltalk.addClass('HLMoveMethodToProtocolCommand', smalltalk.HLMoveMethodToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+"_displayLabel",
+smalltalk.method({
+selector: "displayLabel",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return "select a protocol";
+}, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+messageSends: []}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
 smalltalk.addMethod(
 "_execute",
 smalltalk.method({
 selector: "execute",
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(_st(self)._model())._moveMethodToProtocol();
+return smalltalk.withContext(function($ctx1) { 
_st(_st(self)._model())._moveMethodToProtocol_(_st(self)._input());
 return self}, function($ctx1) {$ctx1.fill(self,"execute",{},smalltalk.HLMoveMethodToProtocolCommand)})},
-messageSends: ["moveMethodToProtocol", "model"]}),
+messageSends: ["moveMethodToProtocol:", "input", "model"]}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+"_inputCompletion",
+smalltalk.method({
+selector: "inputCompletion",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._model())._availableProtocols();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+messageSends: ["availableProtocols", "model"]}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+"_inputLabel",
+smalltalk.method({
+selector: "inputLabel",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return "Move method to a protocol:";
+}, function($ctx1) {$ctx1.fill(self,"inputLabel",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+messageSends: []}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+"_isInputRequired",
+smalltalk.method({
+selector: "isInputRequired",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return true;
+}, function($ctx1) {$ctx1.fill(self,"isInputRequired",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+messageSends: []}),
 smalltalk.HLMoveMethodToProtocolCommand);
 
 

+ 69 - 3
js/Helios-Commands-Browser.js

@@ -519,6 +519,22 @@ smalltalk.HLMoveMethodToClassCommand.klass);
 
 
 smalltalk.addClass('HLMoveMethodToProtocolCommand', smalltalk.HLMoveMethodToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+"_displayLabel",
+smalltalk.method({
+selector: "displayLabel",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return "select a protocol";
+}, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+args: [],
+source: "displayLabel\x0a\x09^ 'select a protocol'",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
 smalltalk.addMethod(
 "_execute",
 smalltalk.method({
@@ -526,11 +542,61 @@ selector: "execute",
 category: 'executing',
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(_st(self)._model())._moveMethodToProtocol();
+return smalltalk.withContext(function($ctx1) { 
_st(_st(self)._model())._moveMethodToProtocol_(_st(self)._input());
 return self}, function($ctx1) {$ctx1.fill(self,"execute",{},smalltalk.HLMoveMethodToProtocolCommand)})},
 args: [],
-source: "execute\x0a\x09self model moveMethodToProtocol",
-messageSends: ["moveMethodToProtocol", "model"],
+source: "execute\x0a\x09self model moveMethodToProtocol: self input",
+messageSends: ["moveMethodToProtocol:", "input", "model"],
+referencedClasses: []
+}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+"_inputCompletion",
+smalltalk.method({
+selector: "inputCompletion",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._model())._availableProtocols();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+args: [],
+source: "inputCompletion\x0a\x09^ self model availableProtocols",
+messageSends: ["availableProtocols", "model"],
+referencedClasses: []
+}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+"_inputLabel",
+smalltalk.method({
+selector: "inputLabel",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return "Move method to a protocol:";
+}, function($ctx1) {$ctx1.fill(self,"inputLabel",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+args: [],
+source: "inputLabel\x0a\x09^ 'Move method to a protocol:'",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.HLMoveMethodToProtocolCommand);
+
+smalltalk.addMethod(
+"_isInputRequired",
+smalltalk.method({
+selector: "isInputRequired",
+category: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return true;
+}, function($ctx1) {$ctx1.fill(self,"isInputRequired",{},smalltalk.HLMoveMethodToProtocolCommand)})},
+args: [],
+source: "isInputRequired\x0a\x09^ true",
+messageSends: [],
 referencedClasses: []
 }),
 smalltalk.HLMoveMethodToProtocolCommand);

+ 32 - 0
js/Helios-Environments.deploy.js

@@ -26,6 +26,17 @@ return self}, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltal
 messageSends: ["subclassResponsibility"]}),
 smalltalk.HLEnvironment);
 
+smalltalk.addMethod(
+"_availableProtocolsFor_",
+smalltalk.method({
+selector: "availableProtocolsFor:",
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
_st(self)._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass},smalltalk.HLEnvironment)})},
+messageSends: ["subclassResponsibility"]}),
+smalltalk.HLEnvironment);
+
 smalltalk.addMethod(
 "_classBuilder",
 smalltalk.method({
@@ -127,6 +138,27 @@ return $1;
 messageSends: ["collect:", "name", "classes", "current"]}),
 smalltalk.HLLocalEnvironment);
 
+smalltalk.addMethod(
+"_availableProtocolsFor_",
+smalltalk.method({
+selector: "availableProtocolsFor:",
+fn: function (aClass){
+var self=this;
+var protocols;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+protocols=_st(aClass)._protocols();
+$1=_st(aClass)._superclass();
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+_st(protocols)._addAll_(_st(self)._availableProtocolsFor_(_st(aClass)._superclass()));
+};
+$2=_st(_st(protocols)._asSet())._asArray();
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.HLLocalEnvironment)})},
+messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"]}),
+smalltalk.HLLocalEnvironment);
+
 smalltalk.addMethod(
 "_classBuilder",
 smalltalk.method({

+ 42 - 0
js/Helios-Environments.js

@@ -37,6 +37,22 @@ referencedClasses: []
 }),
 smalltalk.HLEnvironment);
 
+smalltalk.addMethod(
+"_availableProtocolsFor_",
+smalltalk.method({
+selector: "availableProtocolsFor:",
+category: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
_st(self)._subclassResponsibility();
+return self}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass},smalltalk.HLEnvironment)})},
+args: ["aClass"],
+source: "availableProtocolsFor: aClass\x0a\x09self subclassResponsibility",
+messageSends: ["subclassResponsibility"],
+referencedClasses: []
+}),
+smalltalk.HLEnvironment);
+
 smalltalk.addMethod(
 "_classBuilder",
 smalltalk.method({
@@ -178,6 +194,32 @@ referencedClasses: ["Smalltalk"]
 }),
 smalltalk.HLLocalEnvironment);
 
+smalltalk.addMethod(
+"_availableProtocolsFor_",
+smalltalk.method({
+selector: "availableProtocolsFor:",
+category: 'accessing',
+fn: function (aClass){
+var self=this;
+var protocols;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+protocols=_st(aClass)._protocols();
+$1=_st(aClass)._superclass();
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+_st(protocols)._addAll_(_st(self)._availableProtocolsFor_(_st(aClass)._superclass()));
+};
+$2=_st(_st(protocols)._asSet())._asArray();
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.HLLocalEnvironment)})},
+args: ["aClass"],
+source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray",
+messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"],
+referencedClasses: []
+}),
+smalltalk.HLLocalEnvironment);
+
 smalltalk.addMethod(
 "_classBuilder",
 smalltalk.method({

+ 4 - 0
st/Helios-Browser.st

@@ -709,6 +709,10 @@ availableClassNames
 	^ self environment availableClassNames
 !
 
+availableProtocols
+	^ self environment availableProtocolsFor: self selectedClass
+!
+
 environment
 	^ environment ifNil: [ HLManager current environment ]
 !

+ 21 - 1
st/Helios-Commands-Browser.st

@@ -213,10 +213,30 @@ HLMoveMethodToCommand subclass: #HLMoveMethodToProtocolCommand
 	instanceVariableNames: ''
 	package: 'Helios-Commands-Browser'!
 
+!HLMoveMethodToProtocolCommand methodsFor: 'accessing'!
+
+displayLabel
+	^ 'select a protocol'
+!
+
+inputCompletion
+	^ self model availableProtocols
+!
+
+inputLabel
+	^ 'Move method to a protocol:'
+! !
+
 !HLMoveMethodToProtocolCommand methodsFor: 'executing'!
 
 execute
-	self model moveMethodToProtocol
+	self model moveMethodToProtocol: self input
+! !
+
+!HLMoveMethodToProtocolCommand methodsFor: 'testing'!
+
+isInputRequired
+	^ true
 ! !
 
 !HLMoveMethodToProtocolCommand class methodsFor: 'accessing'!

+ 12 - 0
st/Helios-Environments.st

@@ -11,6 +11,10 @@ availableClassNames
 	self subclassResponsibility
 !
 
+availableProtocolsFor: aClass
+	self subclassResponsibility
+!
+
 classBuilder
 	^ self subclassResponsibility
 !
@@ -65,6 +69,14 @@ availableClassNames
 		collect: [ :each | each name ]
 !
 
+availableProtocolsFor: aClass
+	| protocols |
+	
+	protocols := aClass protocols.
+	aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].
+	^ protocols asSet asArray
+!
+
 classBuilder
 	^ ClassBuilder new
 !