📄 newpasswordentryaction.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.actions;import org.eclipse.jface.action.Action;import org.eclipse.ui.IPartListener;import org.eclipse.ui.IWorkbenchPart;import org.eclipse.ui.IWorkbenchWindow;import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;import org.eclipse.ui.plugin.AbstractUIPlugin;import com.s10r.manager.Application;import com.s10r.manager.EntryEditor;public class NewPasswordEntryAction extends Action implements IWorkbenchAction, IPartListener{ public final static String ID = "manager_rcp.newpasswordentry"; private IWorkbenchWindow window; private EntryEditor entryEditor; /** * OpenAction constructor */ public NewPasswordEntryAction(IWorkbenchWindow window) { this.window = window; setText("New Password Entry"); setToolTipText("New Password Entry"); setId("you want and ID 1234?"); setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, "icons/key_add.png")); window.getPartService().addPartListener(this); } /** * Opens an existing file */ @Override public void run() { if (entryEditor != null) { entryEditor.addNewPasswordEntry(); } } public void dispose() { window.getPartService().removePartListener(this); } public void partActivated(IWorkbenchPart part) { if (part instanceof EntryEditor) { entryEditor = (EntryEditor)part; } } public void partBroughtToTop(IWorkbenchPart part) { // TODO Auto-generated method stub } public void partClosed(IWorkbenchPart part) { if (part == entryEditor) { System.out.println("NewPasswordEntryAction: entryEditor closed"); entryEditor = null; } } public void partDeactivated(IWorkbenchPart part) { // TODO Auto-generated method stub } public void partOpened(IWorkbenchPart part) { // TODO Auto-generated method stub }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -