CTRL + L Hotkey

Opens your last opened file. If there is a more well known global hotkey for this function it should be changed to that
This commit is contained in:
Konloch 2021-07-06 22:38:47 -07:00
parent c60bcb3fb2
commit af26f2c257
4 changed files with 32 additions and 0 deletions

View file

@ -300,6 +300,14 @@ public class BytecodeViewer
return Configuration.java;
}
/**
* Returns true if there is at least one file resource loaded
*/
public static boolean hasResources()
{
return !files.isEmpty();
}
/**
* Returns true if there is currently a tab open with a resource inside of it
*/

View file

@ -1,5 +1,6 @@
package the.bytecode.club.bytecodeviewer;
import sun.security.krb5.Config;
import the.bytecode.club.bytecodeviewer.gui.components.FileChooser;
import the.bytecode.club.bytecodeviewer.gui.components.RunOptions;
import the.bytecode.club.bytecodeviewer.util.DialogueUtils;
@ -126,5 +127,19 @@ public class GlobalHotKeys
if (BytecodeViewer.hasActiveResource())
BytecodeViewer.viewer.workPane.tabs.remove(BytecodeViewer.viewer.workPane.getActiveResource());
}
//CTRL + L
//open last opened resource
else if ((e.getKeyCode() == KeyEvent.VK_L) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0))
{
Configuration.lastHotKeyExecuted = System.currentTimeMillis();
String recentFile = Settings.getRecentFile();
System.out.println("Opening..." + recentFile);
if(!BytecodeViewer.hasResources() && recentFile != null)
BytecodeViewer.openFiles(new File[]{new File(recentFile)}, false);
}
}
}

View file

@ -70,6 +70,14 @@ public class Settings
}
}
public static String getRecentFile()
{
if(recentFiles.isEmpty())
return null;
return recentFiles.get(0);
}
/**
* Add to the recent plugin list
*

View file

@ -19,6 +19,7 @@ of features BCV has, and what they do.
<li>Add (Ctrl + O) - If you add a jar/zip BCV will unzip it, if you add an APK or DEX file, BCV will run dex2jar
then run the jar input process.
</li>
<li>Reopen Recent File (Ctrl + L) - Reopens your last recent opened file.</li>
<li>New Workspace (Ctrl + N) - It clears the opened jars/resources.</li>
<li>Run (Ctrl + R) - Runs the classfiles you've loaded into BCV in a secure sandboxed JVM instance that you can
fully debug.