@@ -7,6 +7,7 @@ import edofro.menuomatic.WSE_redux as WSE
77
88import org.freeplane.core.ui.components.UITools as ui
99import org.freeplane.plugin.script.proxy.ScriptUtils
10+ import org.freeplane.core.util.MenuUtils as menuUtils
1011
1112
1213import org.freeplane.api.Node as ApiNode
@@ -184,26 +185,55 @@ class ToM{
184185 }
185186
186187 def static addPageTitle (myP , ApiNode nodo ){
188+ def html = htmlTitle(nodo. text)
189+ def bttnText
190+ def bttnToolTip
191+ def bttnAction
192+ def bttnIcon
193+ def botones = []
194+
195+ bttnText = null // 'link'
196+ bttnToolTip = " Click to insert node with link to '${ nodo.text} ' section"
197+ bttnAction = { e ->
198+ def newPageNode = nodo
199+ def selectedNode = c. selected
200+ def linkNode = selectedNode. createChild(newPageNode. text)
201+ linkNode[attributeNewPageLink] = getUriFromNode(newPageNode)
202+ linkNode. link. uri = new URI (' menuitem:_addons.tutorialOMatic.openTutorialPageFromLink_on_single_node' )
203+ }
204+ bttnIcon = menuUtils. getMenuItemIcon(' IconAction.emoji-1F517' )
205+ botones << [bttnText, bttnToolTip, bttnAction, bttnIcon]
206+
187207 if (isEditingMode(nodo)) {
188- def html = htmlTitle(nodo. text)
189- def bttnText1 = " inspect"
190- def bttnToolTip1 = " Click to select the page's source nodes"
191- def bttnAction1 = { e ->
208+ bttnText = null // "inspect"
209+ bttnToolTip = " Click to select the page's source nodes"
210+ bttnAction = { e ->
192211 def pageNode = nodo // .parent
193212 def m = c. mapLoader(nodo. map. file). withView()// .selectNodeById(pageNodeId)
194213 m. load()
195214 pageNode. pathToRoot* . folded = false
196215 c. select(pageNode)
197216 }
198- def bttnText2 = ' reload'
199- def bttnToolTip2 = " Click to reload '${ nodo.text} ' section"
200- def bttnAction2 = { e -> fillPage(myP, nodo, true , true )}
201- myP. add(tomui. createPageTitlePane(html, bttnText1, bttnToolTip1,bttnAction1,bttnText2,bttnToolTip2,bttnAction2), tomui. GBC )
202- } else {
203- addPageTitle(myP, nodo. text)
204- }
217+ bttnIcon = menuUtils. getMenuItemIcon(' IconAction.emoji-1F52C' )
218+ botones << [bttnText, bttnToolTip, bttnAction, bttnIcon]
219+
220+ bttnText = null // 'reload'
221+ bttnToolTip = " Click to reload '${ nodo.text} ' section"
222+ bttnAction = { e -> fillPage(myP, nodo, true , true )}
223+ bttnIcon = menuUtils. getMenuItemIcon(' IconAction.emoji-1F504' )
224+ botones << [bttnText, bttnToolTip, bttnAction, bttnIcon]
225+ }
226+ // else {
227+ // addPageTitle(myP, nodo.text)
228+ // }
229+ myP. add(tomui. createPageTitlePane(html, botones), tomui. GBC )
205230 }
206231
232+ def static getUriFromNode (ApiNode nodo , String sch = ' tutorial' ){
233+ def ssp = nodo. map. file. toURI(). schemeSpecificPart
234+ def frg = nodo. id
235+ return new URI (sch, ssp, frg)
236+ }
207237
208238
209239 def static addNextPagePane (myP , ApiNode lastNode , boolean included = false , boolean showNextButton = true ){
@@ -600,7 +630,13 @@ class ToM{
600630 }
601631 }
602632
603- def static exists (String path ){new File (path). isFile()}
633+ def static exists (String path ){
634+ exists(new File (path))
635+ }
636+
637+ def static exists (File file ){
638+ file. isFile()
639+ }
604640
605641 // end:
606642
@@ -662,7 +698,7 @@ class ToM{
662698 // region: help / debug
663699
664700 def static uiMsg (texto ){
665- // ui.informationMessage(texto.toString())
701+ // ui.informationMessage(texto.toString())
666702 }
667703
668704 // end:
0 commit comments