Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fixes #30
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
46 changes: 46 additions & 0 deletions
46
net.jeeeyul.pdetools/src/net/jeeeyul/pdetools/snapshot/handlers/ShowInShellAction.xtend
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,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 | ||
} | ||
} | ||
} |