Skip to content

Commit

Permalink
Merge pull request #1549 from uqbar-project/fix-#340-clear-repl-history
Browse files Browse the repository at this point in the history
Fix #340 - add a clear history button for console
  • Loading branch information
fdodino committed Dec 3, 2018
2 parents 26834e5 + 35862dd commit 5005987
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ class WollokReplConsole extends TextConsole {
page.viewer.textWidget.content.replaceTextRange(outputTextEnd, document.length - outputTextEnd, inputBuffer.replace(System.lineSeparator, ""))
]
}

def clearHistory() { lastCommands.clear }

def canWriteAt(int offset) { !partitioner.isReadOnly(offset) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class WollokReplConsoleActionsParticipant implements IConsolePageParticipant {
IPageBookViewPage page
ShowOutdatedAction outdated
Action export
Action clearHistory
Action stop
IActionBars bars
WollokReplConsole console
Expand Down Expand Up @@ -76,6 +77,7 @@ class WollokReplConsoleActionsParticipant implements IConsolePageParticipant {

createTerminateAllButton
createRemoveButton
createClearHistory
this.outdated = new ShowOutdatedAction(this)

bars => [
Expand All @@ -86,7 +88,9 @@ class WollokReplConsoleActionsParticipant implements IConsolePageParticipant {
appendToGroup(IConsoleConstants.LAUNCH_GROUP, outdated)
appendToGroup(IConsoleConstants.LAUNCH_GROUP, new Separator)
appendToGroup(IConsoleConstants.LAUNCH_GROUP, stop)
appendToGroup(IConsoleConstants.LAUNCH_GROUP, new Separator)
appendToGroup(IConsoleConstants.LAUNCH_GROUP, export)
appendToGroup(IConsoleConstants.LAUNCH_GROUP, clearHistory)
]

updateActionBars
Expand All @@ -113,6 +117,15 @@ class WollokReplConsoleActionsParticipant implements IConsolePageParticipant {
}
}

def createClearHistory() {
val imageDescriptor = ImageDescriptor.createFromURL(new URL("platform:/plugin/org.eclipse.equinox.security.ui/icons/storage/value_delete.gif"))
this.clearHistory = new Action(WollokRepl_CLEAR_HISTORY_TITLE, imageDescriptor) {
override run() {
console.clearHistory
}
}
}

override activated() {
if (page === null)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class WollokLaunchUIMessages extends NLS {

public static String WollokRepl_STOP_TITLE;
public static String WollokRepl_EXPORT_HISTORY_TITLE;
public static String WollokRepl_CLEAR_HISTORY_TITLE;
public static String WollokRepl_SYNCED_MESSAGE;
public static String WollokRepl_OUTDATED_MESSAGE;
public static String WollokRepl_SYNCED_TOOLTIP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ WollokTestState_RUNNING = Running

WollokRepl_STOP_TITLE = Stop
WollokRepl_EXPORT_HISTORY_TITLE = Export History
WollokRepl_CLEAR_HISTORY_TITLE = Clear History
WollokRepl_SYNCED_MESSAGE = Synced
WollokRepl_OUTDATED_MESSAGE = Outdated
WollokRepl_SYNCED_TOOLTIP = Project {0} is synced with REPL session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ WollokTestState_OK = Ok
WollokTestState_PENDING = Pendiente
WollokTestState_RUNNING = Corriendo

WollokRepl_STOP_TITLE = Detener
WollokRepl_EXPORT_HISTORY_TITLE = Exportar el historial
WollokRepl_STOP_TITLE = Detener la consola
WollokRepl_EXPORT_HISTORY_TITLE = Exportar el historial de comandos ejecutados
WollokRepl_CLEAR_HISTORY_TITLE = Borrar el historial de comandos ejecutados
WollokRepl_SYNCED_MESSAGE = Sincronizado
WollokRepl_OUTDATED_MESSAGE = Desactualizado
WollokRepl_SYNCED_TOOLTIP = El proyecto {0} est\u00E1 sincronizado con la sesi\u00F3n de la consola REPL
Expand Down

0 comments on commit 5005987

Please sign in to comment.