Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixes #30
  • Loading branch information
jeeeyul committed Jul 30, 2015
1 parent 74b2454 commit c39a8e5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Expand Up @@ -12,6 +12,7 @@
import net.jeeeyul.pdetools.snapshot.handlers.RedoAction;
import net.jeeeyul.pdetools.snapshot.handlers.RemoveAllAction;
import net.jeeeyul.pdetools.snapshot.handlers.RemoveSnapshotAction;
import net.jeeeyul.pdetools.snapshot.handlers.ShowInShellAction;
import net.jeeeyul.pdetools.snapshot.handlers.UndoAction;

import org.eclipse.emf.common.notify.Notification;
Expand Down Expand Up @@ -158,6 +159,10 @@ private void configureActions() {
menuManager.add(copyAction);
menuManager.add(removeAction);
menuManager.add(new Separator("additions"));
ShowInShellAction revealAction = new ShowInShellAction(SnapshotCore.getRepository());

snapshotActions.add(revealAction);
menuManager.add(revealAction);
}

@Override
Expand Down
@@ -0,0 +1,46 @@
package net.jeeeyul.pdetools.snapshot.handlers

import net.jeeeyul.pdetools.model.pdetools.SnapshotEntry
import net.jeeeyul.pdetools.model.pdetools.SnapshotRepository
import net.jeeeyul.pdetools.shared.LaunchCommand
import net.jeeeyul.pdetools.snapshot.SnapshotAction
import org.eclipse.core.runtime.Platform

class ShowInShellAction extends SnapshotAction {
new(SnapshotRepository repository) {
super(repository)
}

override getText() {
switch (Platform.OS) {
case Platform.OS_MACOSX: "Reveal in Finder"
case Platform.OS_WIN32: "Show in Explorer"
default: "Show in Shell"
}
}

override run() {
var command = createCommand()
if(command != null){
command.execute()
}
}

def SnapshotEntry getFirstSelectedEntry() {
this.selection.head
}

def LaunchCommand createCommand() {
switch (Platform.OS) {
case Platform.OS_MACOSX: {
new LaunchCommand=>[
commands += "osascript"
commands += "-e"
commands += '''tell app "Finder" to activate reveal Posix file "«firstSelectedEntry.absoulteVisibleFilePath»"'''.toString
]
}

default: null
}
}
}

0 comments on commit c39a8e5

Please sign in to comment.