⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recentfilesmenu.java

📁 Java写的文本编辑器
💻 JAVA
字号:
/* * RecentFilesMenu.java - Recent file list menu * Copyright (C) 2000, 2001 Slava Pestov * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */package org.gjt.sp.jedit.gui;import javax.swing.*;import java.awt.event.*;import java.util.Vector;import org.gjt.sp.jedit.io.VFSManager;import org.gjt.sp.jedit.io.VFS;import org.gjt.sp.jedit.*;public class RecentFilesMenu extends EnhancedMenu{	public RecentFilesMenu()	{		super("recent-files");	}	public void setPopupMenuVisible(boolean b)	{		if(b)		{			final View view = EditAction.getView(this);			if(getMenuComponentCount() != 0)				removeAll();			ActionListener actionListener = new ActionListener()			{				public void actionPerformed(ActionEvent evt)				{					jEdit.openFile(view,evt.getActionCommand());					view.getStatus().setMessage(null);				}			};			MouseListener mouseListener = new MouseAdapter()			{				public void mouseEntered(MouseEvent evt)				{					view.getStatus().setMessage(						((JMenuItem)evt.getSource())						.getActionCommand());				}				public void mouseExited(MouseEvent evt)				{					view.getStatus().setMessage(null);				}			};			Vector recentVector = BufferHistory.getBufferHistory();			if(recentVector.size() == 0)			{				add(GUIUtilities.loadMenuItem("no-recent"));				return;			}			/*			 * While recentVector has 50 entries or so, we only display			 * a few of those in the menu (otherwise it will be way too			 * long)			 */			int recentFileCount = Math.min(recentVector.size(),				Integer.parseInt(jEdit.getProperty("history")));			for(int i = recentVector.size() - 1;				i >= recentVector.size() - recentFileCount;				i--)			{				String path = ((BufferHistory.Entry)recentVector					.elementAt(i)).path;				VFS vfs = VFSManager.getVFSForPath(path);				JMenuItem menuItem = new JMenuItem(vfs.getFileName(path));				menuItem.setActionCommand(path);				menuItem.addActionListener(actionListener);				menuItem.addMouseListener(mouseListener);				add(menuItem);			}		}		super.setPopupMenuVisible(b);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -