Fixed Recent Files & Plugins
This commit is contained in:
parent
9f8c46bcdc
commit
964040e83c
3 changed files with 26 additions and 2 deletions
|
@ -509,7 +509,11 @@ public class BytecodeViewer
|
|||
*/
|
||||
public static void startPlugin(File file) {
|
||||
if (!file.exists())
|
||||
{
|
||||
BytecodeViewer.showMessage("The plugin file " + file.getAbsolutePath() + " could not be found.");
|
||||
Settings.removeRecentPlugin(file);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
PluginManager.runPlugin(file);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class Settings
|
|||
*
|
||||
* @param f the recent file
|
||||
*/
|
||||
public static void addRecentFile(File f)
|
||||
public static synchronized void addRecentFile(File f)
|
||||
{
|
||||
recentFiles.remove(f.getAbsolutePath()); // already added on the list
|
||||
recentFiles.add(0, f.getAbsolutePath());
|
||||
|
@ -61,12 +61,21 @@ public class Settings
|
|||
resetRecentFilesMenu();
|
||||
}
|
||||
|
||||
public static synchronized void removeRecentFile(File f)
|
||||
{
|
||||
if(recentFiles.remove(f.getAbsolutePath()))
|
||||
{
|
||||
DiskWriter.replaceFile(filesName, MiscUtils.listToString(recentFiles), false);
|
||||
resetRecentFilesMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the recent plugin list
|
||||
*
|
||||
* @param f the plugin file
|
||||
*/
|
||||
public static void addRecentPlugin(File f)
|
||||
public static synchronized void addRecentPlugin(File f)
|
||||
{
|
||||
recentPlugins.remove(f.getAbsolutePath()); // already added on the list
|
||||
recentPlugins.add(0, f.getAbsolutePath());
|
||||
|
@ -75,6 +84,15 @@ public class Settings
|
|||
resetRecentFilesMenu();
|
||||
}
|
||||
|
||||
public static synchronized void removeRecentPlugin(File f)
|
||||
{
|
||||
if(recentPlugins.remove(f.getAbsolutePath()))
|
||||
{
|
||||
DiskWriter.replaceFile(pluginsName, MiscUtils.listToString(recentPlugins), false);
|
||||
resetRecentFilesMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* resets the recent files menu
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package the.bytecode.club.bytecodeviewer.resources.importing;
|
||||
|
||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
import the.bytecode.club.bytecodeviewer.Settings;
|
||||
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourcelist.ResourceListPane;
|
||||
import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI;
|
||||
|
@ -49,6 +50,7 @@ public class ImportResource implements Runnable
|
|||
{
|
||||
update = false;
|
||||
BytecodeViewer.showMessage("The file " + file.getAbsolutePath() + " could not be found.");
|
||||
Settings.removeRecentFile(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue