-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from EdoFro/wip
v0.0.8
- Loading branch information
Showing
12 changed files
with
1,565 additions
and
1,303 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import javax.swing.JComponent | ||
|
||
import edofro.menuomatic.MenuAction as MA | ||
import edofro.tutorialomatic.ToM as tom | ||
|
||
|
||
|
||
def newPageStyle = 'ToM_newPage' | ||
MenuHelperFolderName = 'Tutorial-o-Matic' | ||
|
||
//get command under mouse pointer | ||
def action = getAction() | ||
if(!action) { | ||
msg("No command found under mouse arrow") | ||
return 'NOK' | ||
} | ||
|
||
//open menuHelp Tutorial mindmap | ||
def mapa = getMap() | ||
if(!mapa) { | ||
msg("Help map couldn't be found") | ||
return 'NOK' | ||
} | ||
|
||
|
||
//obtener nodo de acción | ||
def linkAccion = "menuitem:_${action.key}".toString() | ||
def actionNode = mapa.root.find{n -> n.link.text == linkAccion}.take(1) | ||
|
||
// abrir tutorial en página de nodo de acción | ||
if(!actionNode) { | ||
msg("Command '${MA.getLabelText(action)}' was not found in '${mapa.name}'") | ||
return 'NOK' | ||
} | ||
|
||
def newPageNode = actionNode[0].pathToRoot.reverse().find{it.style.name == newPageStyle} | ||
|
||
if(!newPageNode) { | ||
msg("Command '${MA.getLabelText(action)}' has no helping page in '${mapa.name}'") | ||
return 'NOK' | ||
} | ||
|
||
tom.openTutorialPage(newPageNode.id, mapa) | ||
|
||
return "Done" | ||
|
||
// methods | ||
def getAction(){ | ||
JComponent component = (JComponent) MA.getComponent() | ||
return MA.getAction(component) | ||
} | ||
|
||
def msg(t){ | ||
ui.informationMessage(t.toString()) | ||
} | ||
|
||
|
||
//region: opens tutorial map | ||
def getMap(){ | ||
def m = c.openMaps.find{it.name == 'menuHelp'} | ||
return m ?: getMapFromUserdirectory(MenuHelperFolderName, 'menuHelp.mm') | ||
} | ||
|
||
def getMapFromUserdirectory(addonFolderName,mapFileName){ | ||
def sep = File.separator | ||
def userDir = c.userDirectory.path | ||
def pathName = userDir + sep + "doc" + sep + addonFolderName + sep + mapFileName | ||
def tutMap = tom.getMapFromPath(pathName, false) | ||
return tutMap | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version=v0.0.7 | ||
downloadUrl=https://github.com/EdoFro/Freeplane_Tutorial_AddOn/releases/download/v0.0.7/Tutorial-o-Matic-v0.0.7.addon.mm | ||
version=v0.0.8 | ||
downloadUrl=https://github.com/EdoFro/Freeplane_Tutorial_AddOn/releases/download/v0.0.8/Tutorial-o-Matic-v0.0.8.addon.mm | ||
changelogUrl=https://github.com/EdoFro/Freeplane_Tutorial_AddOn/releases/latest/download/history.md | ||
freeplaneVersionFrom=v1.9.9 |
Oops, something went wrong.