trackeditor: keep recently opened files and menu items in sync
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8289 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 8915ee0fef8bcac19d8170b92bc83537d0b8e85d Former-commit-id: 85676231cde25b068d7b68c6ff0c5f762cbe1f8a
This commit is contained in:
parent
bd56bcd310
commit
88241deaa4
1 changed files with 30 additions and 10 deletions
|
@ -250,6 +250,34 @@ public class EditorFrame extends JFrame
|
||||||
preferences.remove(RECENT_FILES_STRING+i);
|
preferences.remove(RECENT_FILES_STRING+i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < recentFiles.size(); i++)
|
||||||
|
{
|
||||||
|
if (recentFilesMenu.getItem(i) != null)
|
||||||
|
{
|
||||||
|
if (recentFilesMenu.getItem(i).getText() != recentFiles.get(i))
|
||||||
|
{
|
||||||
|
recentFilesMenu.getItem(i).setText(recentFiles.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addRecentFilesMenuItem(recentFiles.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addRecentFilesMenuItem(String filename)
|
||||||
|
{
|
||||||
|
JMenuItem recentFileMenuItem = new JMenuItem(filename);
|
||||||
|
recentFileMenuItem.addActionListener(new ActionListener()
|
||||||
|
{
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
openProject(((JMenuItem) e.getSource()).getText());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
recentFilesMenu.add(recentFileMenuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -625,15 +653,7 @@ public class EditorFrame extends JFrame
|
||||||
if (!file.equals(""))
|
if (!file.equals(""))
|
||||||
{
|
{
|
||||||
recentFiles.add(file);
|
recentFiles.add(file);
|
||||||
JMenuItem recentFileMenuItem = new JMenuItem(file);
|
addRecentFilesMenuItem(file);
|
||||||
recentFileMenuItem.addActionListener(new ActionListener()
|
|
||||||
{
|
|
||||||
public void actionPerformed(ActionEvent e)
|
|
||||||
{
|
|
||||||
openProject(((JMenuItem) e.getSource()).getText());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
recentFilesMenu.add(recentFileMenuItem);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue