📄 helpmanager.java
字号:
package org.jawin.browser.help;
import org.jawin.browser.log.Log;
import java.io.File;
/**
* Manages showing hh.exe help files, perhaps other help systems could be added?
*
* <p>Title: Jawin Code Generation GUI</p>
* <p>Description: GUI for exploring type libraries and generating Java code</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Open Source Incentive</p>
*
* @author Josh Passenger
* @version 1.0
*/
public class HelpManager
{
private static HelpManager instance = null;
private HelpManager()
{
}
public static synchronized void initialize()
{
instance = new HelpManager();
}
public static HelpManager getInstance()
{
if (instance == null)
{
throw new IllegalStateException("HelpManager.getInstance() HelpManager was not initialized");
}
return instance;
}
/**
* Add other types of help if required
*
* @param helpFile
* @param helpIndex
*/
public void showHelp(String helpFile, int helpIndex)
{
String helpFileLower = helpFile.toLowerCase();
if (helpFileLower.endsWith(".chm"))
{
showHtmlHelp(helpFile, helpIndex);
}
else if (helpFileLower.endsWith(".hlp"))
{
showWinHelp(helpFile, helpIndex);
}
}
private void showHtmlHelp(String helpFile, int helpIndex)
{
StringBuffer buffer = new StringBuffer();
buffer.append("hh ");
if (helpIndex != 0)
{
buffer.append("-mapid ");
buffer.append(helpIndex);
buffer.append(" ");
}
if (helpFile.indexOf(' ') > -1)
{
buffer.append("\"");
buffer.append(helpFile);
buffer.append("\" ");
}
else
{
buffer.append(helpFile);
}
try
{
Runtime.getRuntime().exec(buffer.toString());
}
catch (Exception e)
{
Log.getInstance().exception("HelpManager.showHtmlHelp() failed to show help", e);
}
}
private void showWinHelp(String helpFile, int helpIndex)
{
StringBuffer buffer = new StringBuffer();
buffer.append("winhlp32 ");
if (helpFile.indexOf(' ') > -1)
{
buffer.append("\"");
buffer.append(helpFile);
buffer.append("\" ");
}
else
{
buffer.append(helpFile);
}
try
{
Runtime.getRuntime().exec(buffer.toString());
}
catch (Exception e)
{
Log.getInstance().exception("HelpManager.showWinHelp() failed to show help", e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -