Global Hotkeys Cleanup

This commit is contained in:
Konloch 2021-07-06 20:07:55 -07:00
parent 99fde7156e
commit 33f524040b

View file

@ -20,10 +20,13 @@ public class GlobalHotKeys
/** /**
* Checks the hotkeys * Checks the hotkeys
*/ */
public static void keyPressed(KeyEvent e) { public static void keyPressed(KeyEvent e)
{
if (System.currentTimeMillis() - Configuration.lastHotKeyExecuted <= (4000)) if (System.currentTimeMillis() - Configuration.lastHotKeyExecuted <= (4000))
return; return;
//CTRL + O
//open resource
if ((e.getKeyCode() == KeyEvent.VK_O) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) if ((e.getKeyCode() == KeyEvent.VK_O) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{ {
Configuration.lastHotKeyExecuted = System.currentTimeMillis(); Configuration.lastHotKeyExecuted = System.currentTimeMillis();
@ -38,21 +41,41 @@ public class GlobalHotKeys
BytecodeViewer.updateBusyStatus(true); BytecodeViewer.updateBusyStatus(true);
BytecodeViewer.openFiles(new File[]{file}, true); BytecodeViewer.openFiles(new File[]{file}, true);
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} else if ((e.getKeyCode() == KeyEvent.VK_N) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { }
//CTRL + N
//new workspace
else if ((e.getKeyCode() == KeyEvent.VK_N) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{
Configuration.lastHotKeyExecuted = System.currentTimeMillis(); Configuration.lastHotKeyExecuted = System.currentTimeMillis();
BytecodeViewer.resetWorkspace(true); BytecodeViewer.resetWorkspace(true);
} else if ((e.getKeyCode() == KeyEvent.VK_T) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { }
//CTRL + T
//compile
else if ((e.getKeyCode() == KeyEvent.VK_T) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{
Configuration.lastHotKeyExecuted = System.currentTimeMillis(); Configuration.lastHotKeyExecuted = System.currentTimeMillis();
Thread t = new Thread(() -> BytecodeViewer.compile(true, false), "Compile"); Thread t = new Thread(() -> BytecodeViewer.compile(true, false), "Compile");
t.start(); t.start();
} else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { }
//CTRL + R
//Run remote code
else if ((e.getKeyCode() == KeyEvent.VK_R) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{
Configuration.lastHotKeyExecuted = System.currentTimeMillis(); Configuration.lastHotKeyExecuted = System.currentTimeMillis();
if (BytecodeViewer.promptIfNoLoadedClasses()) if (BytecodeViewer.promptIfNoLoadedClasses())
return; return;
new RunOptions().setVisible(true); new RunOptions().setVisible(true);
} else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { }
//CTRL + S
//Export resources
else if ((e.getKeyCode() == KeyEvent.VK_S) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{
Configuration.lastHotKeyExecuted = System.currentTimeMillis(); Configuration.lastHotKeyExecuted = System.currentTimeMillis();
if (BytecodeViewer.promptIfNoLoadedClasses()) if (BytecodeViewer.promptIfNoLoadedClasses())
@ -93,6 +116,9 @@ public class GlobalHotKeys
}, "Resource Export"); }, "Resource Export");
resourceExport.start(); resourceExport.start();
} }
//CTRL + W
//close active resource (currently opened tab)
else if ((e.getKeyCode() == KeyEvent.VK_W) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) else if ((e.getKeyCode() == KeyEvent.VK_W) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{ {
Configuration.lastHotKeyExecuted = System.currentTimeMillis(); Configuration.lastHotKeyExecuted = System.currentTimeMillis();