blob: a316ea3ddae742723b3ace1db3c1c1a6a64ff4dd [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2002, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<LINK REL="STYLESHEET" HREF="../../book.css" TYPE="text/css">
<title>ShowJarContents Class After Editing</title>
</head>
<body bgcolor="#ffffff">
<h1>ShowJarContents Class After Editing</h1>
<p>
<pre><samp>
package samples.ui.actions;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.files.ui.actions.SystemAbstractRemoteFilePopupMenuExtensionAction;
import org.eclipse.rse.shells.ui.RemoteCommandHelpers;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
public class ShowJarContents2 extends SystemAbstractRemoteFilePopupMenuExtensionAction {
public ShowJarContents2() {
super();
}
public void run() {
IRemoteFile selectedFile = getFirstSelectedRemoteFile();
String cmdToRun = "jar -tvf " + selectedFile.getAbsolutePath();
runCommand(cmdToRun);
}
private void runCommand(String command) {
IRemoteCmdSubSystem cmdss = getRemoteCmdSubSystem();
if (cmdss != null && cmdss.isConnected()) {
RemoteCommandHelpers.runUniversalCommand(getShell(), command, ".", cmdss);
} else {
MessageDialog.openError(getShell(), "No command subsystem", "Found no command subsystem");
}
}
/**
* Gets the Command subsystem associated with the current host
*/
private IRemoteCmdSubSystem getRemoteCmdSubSystem() {
IHost myHost = getSubSystem().getHost();
IRemoteCmdSubSystem[] subsys = RemoteCommandHelpers.getCmdSubSystems(myHost);
for (int i = 0; i < subsys.length; i++) {
if (subsys[i].getSubSystemConfiguration().supportsCommands()) {
return subsys[i];
}
}
return null;
}
}
</samp></pre>
</p>
</body>
</html>