10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 "{ Package: 'stx:libtool' }" |
12 "{ Package: 'stx:libtool' }" |
13 |
13 |
14 MultiViewToolApplication subclass:#WorkspaceApplication |
14 MultiViewToolApplication subclass:#WorkspaceApplication |
15 instanceVariableNames:'autoDefineVariables syntaxHolder poolsConsideredInDoIts' |
15 instanceVariableNames:'autoDefineVariables syntaxHolder poolsConsideredInDoIts' |
16 classVariableNames:'LastFilterBlockString LastProcessingBlockString LastTeaWaitTime |
16 classVariableNames:'LastFilterBlockString LastProcessingBlockString LastTeaWaitTime |
17 DefaultToolBarVisible Sniplets' |
17 DefaultToolBarVisible Sniplets' |
18 poolDictionaries:'' |
18 poolDictionaries:'' |
19 category:'Interface-Smalltalk' |
19 category:'Interface-Smalltalk' |
20 ! |
20 ! |
21 |
21 |
22 !WorkspaceApplication class methodsFor:'documentation'! |
22 !WorkspaceApplication class methodsFor:'documentation'! |
23 |
23 |
24 copyright |
24 copyright |
111 (TextEditorSpec |
111 (TextEditorSpec |
112 name: 'TextEditor1' |
112 name: 'TextEditor1' |
113 model: selectedSnipletsText |
113 model: selectedSnipletsText |
114 hasHorizontalScrollBar: true |
114 hasHorizontalScrollBar: true |
115 hasVerticalScrollBar: true |
115 hasVerticalScrollBar: true |
|
116 hasKeyboardFocusInitially: false |
116 viewClassName: '' |
117 viewClassName: '' |
117 ) |
118 ) |
118 ) |
119 ) |
119 |
120 |
120 ) |
121 ) |
121 handles: (Any 0.5 1.0) |
122 handles: (Any 0.5 1.0) |
122 ) |
123 ) |
123 (HorizontalPanelViewSpec |
124 (HorizontalPanelViewSpec |
124 name: 'ButtonPanel' |
125 name: 'ButtonPanel' |
|
126 layout: (LayoutFrame 0 0 -70 1 0 1 -40 1) |
|
127 horizontalLayout: center |
|
128 verticalLayout: center |
|
129 horizontalSpace: 3 |
|
130 verticalSpace: 3 |
|
131 component: |
|
132 (SpecCollection |
|
133 collection: ( |
|
134 (ActionButtonSpec |
|
135 label: 'Save Changes' |
|
136 name: 'Button4' |
|
137 translateLabel: true |
|
138 model: saveSelectedSniplet |
|
139 enableChannel: saveEnabled |
|
140 extent: (Point 125 22) |
|
141 ) |
|
142 (ActionButtonSpec |
|
143 label: 'Remove' |
|
144 name: 'Button2' |
|
145 translateLabel: true |
|
146 model: removeSelectedSniplet |
|
147 enableChannel: removeEnabled |
|
148 extent: (Point 125 22) |
|
149 ) |
|
150 (ActionButtonSpec |
|
151 label: 'Paste' |
|
152 name: 'Button3' |
|
153 translateLabel: true |
|
154 model: pasteSelectedSniplet |
|
155 enableChannel: pasteEnabled |
|
156 extent: (Point 125 22) |
|
157 ) |
|
158 ) |
|
159 |
|
160 ) |
|
161 ) |
|
162 (DividerSpec |
|
163 name: 'Separator1' |
|
164 layout: (LayoutFrame 0 0.0 557 0 0 1.0 561 0) |
|
165 ) |
|
166 (HorizontalPanelViewSpec |
|
167 name: 'CloseButtonPanel' |
125 layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
168 layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
126 horizontalLayout: fitSpace |
169 horizontalLayout: fitSpace |
127 verticalLayout: center |
170 verticalLayout: center |
128 horizontalSpace: 3 |
171 horizontalSpace: 3 |
129 verticalSpace: 3 |
172 verticalSpace: 3 |
1643 |
1666 |
1644 manageSniplets |
1667 manageSniplets |
1645 |bindings listOfSniplets removeAction pasteAction |
1668 |bindings listOfSniplets removeAction pasteAction |
1646 hasSelectionHolder removeEnabledHolder pasteEnabledHolder |
1669 hasSelectionHolder removeEnabledHolder pasteEnabledHolder |
1647 selectedSnipletHolder selectedSnipletsTextHolder selectedSnipletsName |
1670 selectedSnipletHolder selectedSnipletsTextHolder selectedSnipletsName |
1648 snipletsDictionary| |
1671 snipletsDictionary saveEnabledHolder saveAction | |
1649 |
1672 |
1650 snipletsDictionary := Workspace sniplets. |
1673 snipletsDictionary := Workspace sniplets. |
1651 snipletsDictionary isEmptyOrNil ifTrue:[ |
1674 snipletsDictionary isEmptyOrNil ifTrue:[ |
1652 Dialog information:'No Sniplets to Manage'. |
1675 Dialog information:'No Sniplets to Manage'. |
1653 ^ self. |
1676 ^ self. |
1668 ]. |
1691 ]. |
1669 |
1692 |
1670 hasSelectionHolder := BlockValue with:[:m | m value notNil] argument:selectedSnipletHolder. |
1693 hasSelectionHolder := BlockValue with:[:m | m value notNil] argument:selectedSnipletHolder. |
1671 removeEnabledHolder := hasSelectionHolder. |
1694 removeEnabledHolder := hasSelectionHolder. |
1672 pasteEnabledHolder := hasSelectionHolder. |
1695 pasteEnabledHolder := hasSelectionHolder. |
|
1696 saveEnabledHolder := BlockValue with:[:m :textHolder| |
|
1697 m value notNil |
|
1698 and:[(snipletsDictionary at:(listOfSniplets at:(selectedSnipletHolder value))) ~= textHolder value] |
|
1699 ] argument: selectedSnipletHolder argument: selectedSnipletsTextHolder. |
1673 |
1700 |
1674 removeAction := [ |
1701 removeAction := [ |
1675 snipletsDictionary removeKey:selectedSnipletsName. |
1702 snipletsDictionary removeKey:selectedSnipletsName. |
1676 listOfSniplets remove:selectedSnipletsName. |
1703 listOfSniplets remove:selectedSnipletsName. |
1677 ]. |
1704 ]. |
1678 |
1705 |
1679 pasteAction := [ |
1706 pasteAction := [ |
1680 |text| |
1707 |text| |
1681 text := snipletsDictionary at:selectedSnipletsName. |
1708 text := snipletsDictionary at:selectedSnipletsName. |
1682 self paste:text |
1709 self paste:text |
|
1710 ]. |
|
1711 saveAction := [ |
|
1712 |originalText newText| |
|
1713 originalText := snipletsDictionary at:selectedSnipletsName. |
|
1714 newText := selectedSnipletsTextHolder value. |
|
1715 originalText ~= newText ifTrue:[ |
|
1716 snipletsDictionary at: selectedSnipletsName put: newText. |
|
1717 ]. |
|
1718 saveEnabledHolder recomputeValue. |
1683 ]. |
1719 ]. |
1684 |
1720 |
1685 bindings := IdentityDictionary new. |
1721 bindings := IdentityDictionary new. |
1686 bindings at:#listOfSniplets put:listOfSniplets. |
1722 bindings at:#listOfSniplets put:listOfSniplets. |
1687 bindings at:#selectedSniplet put:selectedSnipletHolder asValue. |
1723 bindings at:#selectedSniplet put:selectedSnipletHolder asValue. |
1688 bindings at:#selectedSnipletsText put:selectedSnipletsTextHolder. |
1724 bindings at:#selectedSnipletsText put:selectedSnipletsTextHolder. |
1689 bindings at:#removeSelectedSniplet put:removeAction. |
1725 bindings at:#removeSelectedSniplet put:removeAction. |
1690 bindings at:#pasteSelectedSniplet put:pasteAction. |
1726 bindings at:#pasteSelectedSniplet put:pasteAction. |
|
1727 bindings at:#saveSelectedSniplet put:saveAction. |
1691 bindings at:#removeEnabled put:removeEnabledHolder. |
1728 bindings at:#removeEnabled put:removeEnabledHolder. |
|
1729 bindings at:#pasteEnabled put:pasteEnabledHolder. |
|
1730 bindings at:#saveEnabled put:saveEnabledHolder. |
1692 |
1731 |
1693 self openDialogInterface:#manageSnipletsDialogSpec withBindings:bindings |
1732 self openDialogInterface:#manageSnipletsDialogSpec withBindings:bindings |
1694 ! |
1733 ! |
1695 |
1734 |
1696 newEvaluationWorkspace |
1735 newEvaluationWorkspace |