--- a/tools/JavaCodeBundleEditor.st Fri Feb 22 00:08:08 2013 +0000
+++ b/tools/JavaCodeBundleEditor.st Fri Feb 22 00:34:22 2013 +0000
@@ -15,7 +15,6 @@
!
-
!JavaCodeBundleEditor class methodsFor:'interface specs'!
windowSpec
@@ -38,8 +37,8 @@
name: windowSpec
window:
(WindowSpec
- label: 'NewApplication'
- name: 'NewApplication'
+ label: 'Java Code Bundle Editor'
+ name: 'Java Code Bundle Editor'
bounds: (Rectangle 0 0 580 420)
)
component:
@@ -47,8 +46,9 @@
collection: (
(HierarchicalListViewSpec
name: 'HierarchicalListView1'
- layout: (LayoutFrame 0 0 0 0 -100 1 0 1)
+ layout: (LayoutFrame 0 0 0 0 -100 1 -30 1)
model: bundleTreeSelectionHolder
+ menu: listMenu
hasHorizontalScrollBar: true
hasVerticalScrollBar: true
listModel: bundleTree
@@ -106,13 +106,28 @@
)
)
+ (LabelSpec
+ label: 'Drag and drop .jar files above'
+ name: 'Hint'
+ layout: (LayoutFrame 3 0 -30 1 -100 1 0 1)
+ visibilityChannel: readwriteHolder
+ translateLabel: true
+ adjust: left
+ )
+ (LinkButtonSpec
+ label: 'LinkButton'
+ name: 'Button1'
+ layout: (LayoutFrame -100 1 -30 1 0 1 0 1)
+ visibilityChannel: readwriteHolder
+ translateLabel: true
+ labelChannel: browseFilesLabel
+ )
)
)
)
! !
-
!JavaCodeBundleEditor class methodsFor:'menu specs'!
listMenu
@@ -159,7 +174,6 @@
)
! !
-
!JavaCodeBundleEditor class methodsFor:'plugIn spec'!
aspectSelectors
@@ -180,7 +194,6 @@
! !
-
!JavaCodeBundleEditor methodsFor:'accessing'!
bundle: aJavaCodeBundle
@@ -189,17 +202,28 @@
"Created: / 25-01-2013 / 21:50:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!JavaCodeBundleEditor methodsFor:'aspects'!
-!JavaCodeBundleEditor methodsFor:'aspects'!
+browseFilesLabel
+
+ ^'Browse...' asText
+ colorizeAllWith: Color blue;
+ actionForAll:[ self doBrowseFiles ];
+ yourself
+
+ "Created: / 22-02-2013 / 00:22:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
bundleHolder
"return/create the 'bundleHolder' value holder (automatically generated)"
bundleHolder isNil ifTrue:[
- bundleHolder := ValueHolder new.
+ bundleHolder := JavaCodeBundle new asValue.
bundleHolder addDependent:self.
].
^ bundleHolder
+
+ "Modified: / 21-02-2013 / 23:31:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
bundleHolder:something
@@ -274,18 +298,24 @@
"set the 'readonlyHolder' value holder (automatically generated)"
readonlyHolder := something.
+!
+
+readwriteHolder
+ ^BlockValue forLogicalNot: self readonlyHolder
+
+ "Created: / 22-02-2013 / 00:01:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!JavaCodeBundleEditor methodsFor:'aspects-queries'!
canAddHolder
^BlockValue
- with:[:ro :sel| ro value not and:[sel value isNil or:[sel value libraryOrBundle isBundle]]]
+ with:[:ro :sel| ro value not" and:[sel value isNil or:[sel value libraryOrBundle isBundle]]"]
argument: self readonlyHolder
argument: self bundleTreeSelectionHolder
"Created: / 30-01-2013 / 16:43:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2013 / 23:42:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
canEditHolder
@@ -306,7 +336,6 @@
"Modified: / 30-01-2013 / 16:32:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!JavaCodeBundleEditor methodsFor:'change & update'!
update:aspect with: parameter from:changedObject
@@ -338,6 +367,13 @@
"Modified: / 28-01-2013 / 20:35:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!JavaCodeBundleEditor methodsFor:'hooks'!
+
+commonPostOpen
+ self updateTree
+
+ "Created: / 21-02-2013 / 23:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
!JavaCodeBundleEditor methodsFor:'menu actions'!
@@ -349,7 +385,11 @@
parentItem := bundleTree root
].
+ parentItem libraryOrBundle isLibrary ifTrue:[
+ parentItem := parentItem parent.
+ ].
parent := parentItem libraryOrBundle.
+
parent add: libraryOrBundle.
libraryOrBundleItem := Item libraryOrBundle: libraryOrBundle parent: parentItem.
@@ -360,6 +400,7 @@
self updateModifiedChannel
"Created: / 30-01-2013 / 17:20:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-02-2013 / 23:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doAddBundle
@@ -376,29 +417,40 @@
!
doAddLibrary
- "automatically generated by UIEditor ..."
+ | dialog |
+
+ dialog := JavaCodeLibraryEditor new.
+ dialog open ifTrue:[
+ self doAdd: dialog acceptedValue.
+ ]
- "*** the code below performs no action"
- "*** (except for some feedback on the Transcript)"
- "*** Please change as required and accept in the browser."
- "*** (and replace this comment by something more useful ;-)"
+ "Modified: / 21-02-2013 / 23:30:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
- "action to be added ..."
+doBrowseFiles
+ UserPreferences fileBrowserClass openOnDirectory: (JavaCodeLibraryEditor lastDirectory) ? (Filename currentDirectory pathName)
- Transcript showCR:self class name, ': action for #doAddLibrary ...'.
+ "Modified: / 22-02-2013 / 00:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doEdit
- "automatically generated by UIEditor ..."
+ | bundleOrLibrary dialog name |
- "*** the code below performs no action"
- "*** (except for some feedback on the Transcript)"
- "*** Please change as required and accept in the browser."
- "*** (and replace this comment by something more useful ;-)"
+ bundleOrLibrary := self bundleTreeSelectionHolder value.
+ bundleOrLibrary isNil ifTrue:[ ^ self ].
+ bundleOrLibrary := bundleOrLibrary libraryOrBundle.
+ bundleOrLibrary isLibrary ifTrue:[
+ dialog := JavaCodeLibraryEditor new.
+ dialog library: bundleOrLibrary.
+ dialog open.
+ ] ifFalse:[
+ name := Dialog request: (resources string: 'Enter new name') initialAnswer:bundleOrLibrary name.
+ name isNil ifTrue:[^self].
+ bundleOrLibrary name: name.
- "action to be added ..."
+ ]
- Transcript showCR:self class name, ': action for #doEdit ...'.
+ "Modified: / 21-02-2013 / 23:41:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doRemove
@@ -420,7 +472,6 @@
"Modified: / 30-01-2013 / 17:22:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!JavaCodeBundleEditor::Item class methodsFor:'instance creation'!
libraryOrBundle: model parent: parent
@@ -431,7 +482,6 @@
"Created: / 25-01-2013 / 21:53:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!JavaCodeBundleEditor::Item methodsFor:'accessing'!
icon
@@ -454,7 +504,6 @@
libraryOrBundle := something.
! !
-
!JavaCodeBundleEditor::Item methodsFor:'protocol-accessing'!
fetchChildren
@@ -467,7 +516,6 @@
"Created: / 25-01-2013 / 21:52:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!JavaCodeBundleEditor class methodsFor:'documentation'!
version_CVS