Added Global Keyboard Hook for refreshing using Ctrl+Shift+3

Created a Jna Global Keyboard Hook class and added hot key for
refreshing the windows xml (Ctrl + Shift + 3).
Fixed cancel button to dispose window properly.
This commit is contained in:
Edward Jakubowski
2014-04-21 19:45:34 -04:00
parent b5082e2b22
commit 7a267a6d9a
8 changed files with 247 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.JLabel;
import javax.swing.JTextPane;
@@ -45,7 +46,7 @@ import com.sun.jna.platform.win32.WinDef.HWND;
public class WindowsEnumeratedXml implements Runnable{
public static Exception lastException = null;
public static AtomicBoolean enumeratingXmlFlag = new AtomicBoolean(false);
public JTextPane outputPane = null;
public JLabel lblStatus = null;
public WindowsEnumeratedXml() {
@@ -64,9 +65,13 @@ public class WindowsEnumeratedXml implements Runnable{
outputPane.setCaretPosition(0);
double seconds = ((double)(System.nanoTime() - startTime) / 1000000000);
lblStatus.setText("Windows Enumerated Xml loaded in " + new DecimalFormat("#.###").format(seconds) + " seconds");
enumeratingXmlFlag.set(false);
}
public static void getXmlThreaded(JTextPane outputPane, JLabel lblStatus) {
if (enumeratingXmlFlag.get())
return; //something is already running
enumeratingXmlFlag.set(true); //if we don't do this the multiple xml's could get combined on the textpane
Thread t = new Thread(new WindowsEnumeratedXml(outputPane, lblStatus));
t.start();
}