add class category, package, protocol, namespace and code view perspectives to CustomPerspective
--- a/CustomPerspective.st Mon Oct 13 20:53:59 2014 +0200
+++ b/CustomPerspective.st Tue Oct 14 12:31:40 2014 +0200
@@ -21,6 +21,20 @@
privateIn:CustomPerspective
!
+CustomPerspective subclass:#ClassCategory
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:CustomPerspective
+!
+
+CustomPerspective subclass:#CodeView
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:CustomPerspective
+!
+
CustomPerspective subclass:#InstanceVariable
instanceVariableNames:''
classVariableNames:''
@@ -35,6 +49,42 @@
privateIn:CustomPerspective
!
+CustomPerspective subclass:#Namespace
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:CustomPerspective
+!
+
+CustomPerspective subclass:#Package
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:CustomPerspective
+!
+
+CustomPerspective subclass:#Protocol
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:CustomPerspective
+!
+
+!CustomPerspective class methodsFor:'documentation'!
+
+documentation
+"
+ Represends a perspective marker from which is pop-up menu invoked.
+
+ When we select for example some class from the class menu in the Browser
+ (the STX IDE) then method isClassPerspective should return true and other
+ perspectives should return false.
+
+ [author:]
+ Jakub Nesveda <nesvejak@fit.cvut.cz>
+
+"
+! !
!CustomPerspective class methodsFor:'instance creation'!
@@ -69,12 +119,24 @@
!CustomPerspective class methodsFor:'accessing'!
+classCategoryPerspective
+ ^ CustomPerspective::ClassCategory instance
+
+ "Created: / 14-10-2014 / 10:11:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
classPerspective
^ CustomPerspective::Class instance
"Created: / 26-01-2014 / 10:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+codeViewPerspective
+ ^ CustomPerspective::CodeView instance
+
+ "Created: / 14-10-2014 / 10:17:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
instanceVariablePerspective
^ CustomPerspective::InstanceVariable instance
@@ -85,6 +147,24 @@
^ CustomPerspective::Method instance
"Created: / 24-08-2014 / 11:14:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+namespacePerspective
+ ^ CustomPerspective::Namespace instance
+
+ "Created: / 14-10-2014 / 10:18:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+packagePerspective
+ ^ CustomPerspective::Package instance
+
+ "Created: / 14-10-2014 / 10:18:18 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+protocolPerspective
+ ^ CustomPerspective::Protocol instance
+
+ "Created: / 14-10-2014 / 10:18:36 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
!CustomPerspective class methodsFor:'testing'!
@@ -97,12 +177,24 @@
!CustomPerspective methodsFor:'testing'!
+isClassCategoryPerspective
+ ^ false
+
+ "Created: / 14-10-2014 / 09:33:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
isClassPerspective
^ false
"Created: / 26-01-2014 / 13:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+isCodeViewPerspective
+ ^ false
+
+ "Created: / 14-10-2014 / 09:30:24 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
isInstanceVariablePerspective
^ false
@@ -113,6 +205,24 @@
^ false
"Created: / 24-08-2014 / 11:12:46 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+isNamespacePerspective
+ ^ false
+
+ "Created: / 14-10-2014 / 09:32:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+isPackagePerspective
+ ^ false
+
+ "Created: / 14-10-2014 / 09:32:06 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+isProtocolPerspective
+ ^ false
+
+ "Created: / 14-10-2014 / 09:29:51 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
!CustomPerspective::Class methodsFor:'testing'!
@@ -123,6 +233,22 @@
"Created: / 26-01-2014 / 13:10:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CustomPerspective::ClassCategory methodsFor:'testing'!
+
+isClassCategoryPerspective
+ ^ true
+
+ "Created: / 14-10-2014 / 10:09:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomPerspective::CodeView methodsFor:'testing'!
+
+isCodeViewPerspective
+ ^ true
+
+ "Created: / 14-10-2014 / 10:10:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
!CustomPerspective::InstanceVariable methodsFor:'testing'!
isInstanceVariablePerspective
@@ -139,6 +265,30 @@
"Created: / 24-08-2014 / 11:13:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !
+!CustomPerspective::Namespace methodsFor:'testing'!
+
+isNamespacePerspective
+ ^ true
+
+ "Created: / 14-10-2014 / 10:10:12 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomPerspective::Package methodsFor:'testing'!
+
+isPackagePerspective
+ ^ true
+
+ "Created: / 14-10-2014 / 10:10:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomPerspective::Protocol methodsFor:'testing'!
+
+isProtocolPerspective
+ ^ true
+
+ "Created: / 14-10-2014 / 10:10:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
!CustomPerspective class methodsFor:'documentation'!
version_HG
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CustomPerspectiveTests.st Tue Oct 14 12:31:40 2014 +0200
@@ -0,0 +1,185 @@
+"{ Package: 'jn:refactoring_custom' }"
+
+TestCase subclass:#CustomPerspectiveTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Refactoring-Custom-Tests'
+!
+
+!CustomPerspectiveTests methodsFor:'tests'!
+
+test_all_perspectives_false_as_default
+ | perspective |
+
+ perspective := CustomPerspective new.
+
+ self deny: perspective isClassCategoryPerspective.
+ self deny: perspective isClassPerspective.
+ self deny: perspective isCodeViewPerspective.
+ self deny: perspective isInstanceVariablePerspective.
+ self deny: perspective isMethodPerspective.
+ self deny: perspective isNamespacePerspective.
+ self deny: perspective isPackagePerspective.
+ self deny: perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:47:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_class_category_perspective
+ |perspective|
+
+ perspective := CustomPerspective classCategoryPerspective.
+ self assert:perspective isClassCategoryPerspective.
+ self deny:perspective isClassPerspective.
+ self deny:perspective isCodeViewPerspective.
+ self deny:perspective isInstanceVariablePerspective.
+ self deny:perspective isMethodPerspective.
+ self deny:perspective isNamespacePerspective.
+ self deny:perspective isPackagePerspective.
+ self deny:perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:49:35 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_class_perspective
+ |perspective|
+
+ perspective := CustomPerspective classPerspective.
+ self deny:perspective isClassCategoryPerspective.
+ self assert:perspective isClassPerspective.
+ self deny:perspective isCodeViewPerspective.
+ self deny:perspective isInstanceVariablePerspective.
+ self deny:perspective isMethodPerspective.
+ self deny:perspective isNamespacePerspective.
+ self deny:perspective isPackagePerspective.
+ self deny:perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:50:33 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_code_view_perspective
+ | perspective |
+
+ perspective := CustomPerspective codeViewPerspective.
+
+ self deny: perspective isClassCategoryPerspective.
+ self deny: perspective isClassPerspective.
+ self assert: perspective isCodeViewPerspective.
+ self deny: perspective isInstanceVariablePerspective.
+ self deny: perspective isMethodPerspective.
+ self deny: perspective isNamespacePerspective.
+ self deny: perspective isPackagePerspective.
+ self deny: perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:51:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_instance_variable_perspective
+ | perspective |
+
+ perspective := CustomPerspective instanceVariablePerspective.
+
+ self deny: perspective isClassCategoryPerspective.
+ self deny: perspective isClassPerspective.
+ self deny: perspective isCodeViewPerspective.
+ self assert: perspective isInstanceVariablePerspective.
+ self deny: perspective isMethodPerspective.
+ self deny: perspective isNamespacePerspective.
+ self deny: perspective isPackagePerspective.
+ self deny: perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:54:12 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_is_abstract
+
+ self assert: CustomPerspective isAbstract.
+
+ "Created: / 14-10-2014 / 11:57:32 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_method_variable_perspective
+ | perspective |
+
+ perspective := CustomPerspective methodPerspective.
+
+ self deny: perspective isClassCategoryPerspective.
+ self deny: perspective isClassPerspective.
+ self deny: perspective isCodeViewPerspective.
+ self deny: perspective isInstanceVariablePerspective.
+ self assert: perspective isMethodPerspective.
+ self deny: perspective isNamespacePerspective.
+ self deny: perspective isPackagePerspective.
+ self deny: perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:54:41 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_namespace_perspective
+ | perspective |
+
+ perspective := CustomPerspective namespacePerspective.
+
+ self deny: perspective isClassCategoryPerspective.
+ self deny: perspective isClassPerspective.
+ self deny: perspective isCodeViewPerspective.
+ self deny: perspective isInstanceVariablePerspective.
+ self deny: perspective isMethodPerspective.
+ self assert: perspective isNamespacePerspective.
+ self deny: perspective isPackagePerspective.
+ self deny: perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:55:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_package_perspective
+ | perspective |
+
+ perspective := CustomPerspective packagePerspective.
+
+ self deny: perspective isClassCategoryPerspective.
+ self deny: perspective isClassPerspective.
+ self deny: perspective isCodeViewPerspective.
+ self deny: perspective isInstanceVariablePerspective.
+ self deny: perspective isMethodPerspective.
+ self deny: perspective isNamespacePerspective.
+ self assert: perspective isPackagePerspective.
+ self deny: perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:56:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_protocol_perspective
+ | perspective |
+
+ perspective := CustomPerspective protocolPerspective.
+
+ self deny: perspective isClassCategoryPerspective.
+ self deny: perspective isClassPerspective.
+ self deny: perspective isCodeViewPerspective.
+ self deny: perspective isInstanceVariablePerspective.
+ self deny: perspective isMethodPerspective.
+ self deny: perspective isNamespacePerspective.
+ self deny: perspective isPackagePerspective.
+ self assert: perspective isProtocolPerspective.
+
+ "Created: / 14-10-2014 / 11:56:46 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_singleton
+ | perspective_01 perspective_02 |
+
+ perspective_01 := CustomPerspective new.
+ perspective_02 := CustomPerspective new.
+
+ self assert: perspective_01 == perspective_02.
+
+ CustomPerspective flushSingleton.
+ perspective_02 := CustomPerspective new.
+
+ self deny: perspective_01 == perspective_02.
+
+ "Created: / 14-10-2014 / 12:01:47 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+