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

📄 entryeditorinput.java

📁 基于Eclipse RCP开发的管理工具
💻 JAVA
字号:
 /*    * Copyright 2006 Marcel Schoffelmeer   *   * Licensed under the Apache License, Version 2.0 (the "License");   * you may not use this file except in compliance with the License.   * You may obtain a copy of the License at   *   *    http://www.apache.org/licenses/LICENSE-2.0   *      * Unless required by applicable law or agreed to in writing, software  * distributed under the License is distributed on an "AS IS" BASIS,   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  * See the License for the specific language governing permissions and  * limitations under the License.  */package com.s10r.manager;import java.io.File;import org.eclipse.jface.resource.ImageDescriptor;import org.eclipse.ui.IEditorInput;import org.eclipse.ui.IMemento;import org.eclipse.ui.IPersistableElement;public class EntryEditorInput implements IEditorInput, IPersistableElement{	private File file;	// transient field, required on opening the editor	// hold on to it here so we can modify it in the properties dialog	private String password;	private boolean untitled = false;	private static int untitledCount = 1;	private int untitledNr = 1;	public EntryEditorInput(File file)	{		this.file = file;	}	/*	 * Untitled constructor	 */	public EntryEditorInput()	{		untitled = true;		untitledNr = untitledCount++;	}	public boolean exists()	{		return false;	}	public ImageDescriptor getImageDescriptor()	{		// TODO Auto-generated method stub		return null;	}	public String getName()	{		if (isUntitled())		{			return "Untitled " + untitledNr;		}		else		{			return file.getName();		}	}	public String getPath()	{		// do save untitled instances		if (isUntitled())		{			return null;		}		else		{			return file.getPath();		}	}	public IPersistableElement getPersistable()	{		if (isUntitled())		{			return null;		}		else		{					  return this;		}	}	public String getToolTipText()	{		if (isUntitled())		{			return getName();		}		else		{		   return file.getPath();		}	}	public Object getAdapter(Class adapter)	{		// TODO Auto-generated method stub		return null;	}	@Override	public boolean equals(Object obj)	{		if (this.isUntitled())		{			return false;		}				if (this == obj)		{			return true;		}		else if (obj instanceof EntryEditorInput)		{			EntryEditorInput inputObj = (EntryEditorInput)obj;			// untiled editor inputs are always different			if (inputObj.isUntitled())			{				return false;							}						else			{				return inputObj.getFile().equals(this.getFile());			}		}		else		{			return false;		}	}	public File getFile()	{		return file;	}	public String getFactoryId()	{		return EditorInputElementFactory.ID;	}	/**	 * @param memento	 */	public void saveState(IMemento memento)	{		memento.putString("path", file.getPath());	}	public String getPassword()	{		return password;	}	public void setPassword(String password)	{		this.password = password;	}	public boolean isUntitled()	{		return untitled;	}	public void setUntitled(boolean untitled)	{		this.untitled = untitled;	}	public void setFile(File file)	{		this.file = file;	}		public EntryEditorInput copy()	{		EntryEditorInput entry = new EntryEditorInput();				entry.file = file;		entry.password = password;		entry.untitled = untitled;		return entry;	}	}

⌨️ 快捷键说明

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