package jas2.swingstudio;
import jas2.util.*;
import java.util.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Frame;
import java.awt.Component;
import jas2.hist.*;

public class RecentFilesMenu extends RecentItemsMenu
{
	public RecentFilesMenu() {
		super(length_Key);
	}
	public void addNotify() {
		super.addNotify();
		setEnabled(m_app.getLastFiles());
	}
	protected void itemSelected(String file)
	{
		try
		{
			m_app.openFile(new File(file));
		}
		catch (Exception e)
		{
			m_app.error("Cannot open file "+ file, e);
		}
	}
	protected String toDisplayFormat(String s)
	{
		if (! m_prop.getBoolean(includePath_Key, true))
		{
			int j;
			j = s.lastIndexOf(File.separator);
			if (j >= 0)
				return s.substring(j + 1, s.length());
		}
		return s;
	}
	private final JavaAnalysisStudio m_app = JavaAnalysisStudio.getApp();
	private final UserProperties m_prop = m_app.getUserProperties();
	static final String length_Key = "MaxFileListLength";
	static final String includePath_Key = "InclPath-Files";
}

 

Ads help maintain this website.