zoukankan      html  css  js  c++  java
  • Eclipse Action

    • Interface IAction
    •  1 package org.eclipse.jface.action;
       2 import org.eclipse.core.commands.IHandlerAttributes;
       3 import org.eclipse.jface.resource.ImageDescriptor;
       4 import org.eclipse.jface.util.IPropertyChangeListener;
       5 import org.eclipse.swt.events.HelpListener;
       6 import org.eclipse.swt.widgets.Event;
       7 public interface IAction {
       8     public static int AS_UNSPECIFIED = 0x00;
       9     public static int AS_PUSH_BUTTON = 0x01;
      10     public static int AS_CHECK_BOX = 0x02;
      11     public static int AS_DROP_DOWN_MENU = 0x04;
      12     public static int AS_RADIO_BUTTON = 0x08;
      13     public static final String TEXT = "text"; 
      14     public static final String ENABLED = "enabled"; 
      15     public static final String IMAGE = "image";
      16     public static final String TOOL_TIP_TEXT = "toolTipText"; 
      17     public static final String DESCRIPTION = "description"; 
      18     public static final String CHECKED = "checked";
      19     public static final String RESULT = "result"; 
      20     public static final String HANDLED = IHandlerAttributes.ATTRIBUTE_HANDLED;
      21     public void addPropertyChangeListener(IPropertyChangeListener listener);
      22     public int getAccelerator();
      23     public String getActionDefinitionId();
      24     public String getDescription();
      25     public ImageDescriptor getDisabledImageDescriptor();
      26     public HelpListener getHelpListener();
      27     public ImageDescriptor getHoverImageDescriptor();
      28     public String getId();
      29     public ImageDescriptor getImageDescriptor();
      30     public IMenuCreator getMenuCreator();
      31     public int getStyle();
      32     public String getText();
      33     public String getToolTipText();
      34     public boolean isChecked();
      35     public boolean isEnabled();
      36     public boolean isHandled();
      37     public void removePropertyChangeListener(IPropertyChangeListener listener);
      38     public void run();
      39     public void runWithEvent(Event event);
      40     public void setActionDefinitionId(String id);
      41     public void setChecked(boolean checked);
      42     public void setDescription(String text);
      43     public void setDisabledImageDescriptor(ImageDescriptor newImage);
      44     public void setEnabled(boolean enabled);
      45     public void setHelpListener(HelpListener listener);
      46     public void setHoverImageDescriptor(ImageDescriptor newImage);
      47     public void setId(String id);
      48     public void setImageDescriptor(ImageDescriptor newImage);
      49     public void setMenuCreator(IMenuCreator creator);
      50     public void setText(String text);
      51     public void setToolTipText(String text);
      52     public void setAccelerator(int keycode);
      53 }
      IAction
    • IPageService
    • 1 public interface IPageService {
      2     public void addPageListener(IPageListener listener);
      3     public void addPerspectiveListener(IPerspectiveListener listener);
      4     public IWorkbenchPage getActivePage();
      5     public void removePageListener(IPageListener listener);
      6     public void removePerspectiveListener(IPerspectiveListener listener);
      7 }
    • IRunnableContext
    • 1 public interface IRunnableContext {
      2     public void run(boolean fork, boolean cancelable,
      3             IRunnableWithProgress runnable) throws InvocationTargetException,
      4             InterruptedException;
      5 }
    • IServiceLocator
    • 1 public interface IServiceLocator {
      2     public Object getService(Class api);
      3     public boolean hasService(Class api);
      4 }
    • IShellProvider
    • 1 public interface IShellProvider {   
      2     Shell getShell();
      3 }
    • IWorkbenchWindow:A workbench window is a top level window in a workbench. Visually, a workbench window has a menubar, a toolbar, a status bar, and a main area for displaying a single page consisting of a collection of views and editors. Each workbench window has a collection of 0 or more pages; the active page is the one that is being presented to the end user; at most one page is active in a window at a time. Same as Activity???
    •  1 public interface IWorkbenchWindow extends IPageService, 
       2                                           IRunnableContext,
       3                                           IServiceLocator, 
       4                                           IShellProvider
       5 {
       6     public boolean close();
       7     public IWorkbenchPage getActivePage();
       8     public IWorkbenchPage[] getPages();
       9     public IPartService getPartService();
      10     public ISelectionService getSelectionService();
      11     public Shell getShell();
      12     public IWorkbench getWorkbench();
      13     public boolean isApplicationMenu(String menuId);
      14     public IWorkbenchPage openPage(String perspectiveId, IAdaptable input)
      15             throws WorkbenchException;
      16     public IWorkbenchPage openPage(IAdaptable input) throws WorkbenchException;
      17     public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
      18     public void setActivePage(IWorkbenchPage page);
      19     public IExtensionTracker getExtensionTracker();
      20 }
    • Interface IActionDelegate
    • 1 package org.eclipse.ui;
      2 import org.eclipse.jface.action.IAction;
      3 import org.eclipse.jface.viewers.ISelection;
      4 
      5 public interface IActionDelegate {
      6     public void run(IAction action);
      7     public void selectionChanged(IAction action, ISelection selection);
      8 }
    • IWorkbenchWindowActionDelegate
    • 1 package org.eclipse.ui;
      2 
      3 import org.eclipse.ui.IActionDelegate;
      4 import org.eclipse.ui.IWorkbenchWindow;
      5 
      6 public interface IWorkbenchWindowActionDelegate extends IActionDelegate {
      7     public void dispose();
      8     public void init(IWorkbenchWindow window);
      9 }
    • HelloAction 
    •  1 package com.dragon.contribution.hello.actions;
       2 
       3 import org.eclipse.jface.action.IAction;
       4 import org.eclipse.jface.viewers.ISelection;
       5 import org.eclipse.ui.IWorkbenchWindow;
       6 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
       7 import org.eclipse.jface.dialogs.MessageDialog;
       8 
       9 
      10 public class HelloAction implements IWorkbenchWindowActionDelegate {
      11     private IWorkbenchWindow window;
      12     
      13     public HelloAction() {
      14     }
      15     public void run(IAction action) { //implementation when clicking menu or button in tools button
      16         MessageDialog.openInformation(
      17             window.getShell(),
      18             "Hello",
      19             "Hello, Eclipse world");
      20     }
      21     public void selectionChanged(IAction action, ISelection selection) {
      22     }
      23     public void dispose() {
      24     }
      25     public void init(IWorkbenchWindow window) { //called by Eclipse core and pass window object created by runtime kernel
      26         this.window = window;
      27     }
      28 }
  • 相关阅读:
    vscode英文显示设置为中文语言
    vscode各插件使用-背景图-scss
    公众号关联小程序
    js点击遮罩空白区域关闭,点击遮罩内元素不关闭
    swiper使用-点击跳转指定页
    小程序内部引导关注公众号实现方法
    jq赋值input值为空
    sass中代码使用
    Sources”参数中指定了多次。“Sources”参数不支持重复项
    将已存在小程序项目添加云开发配置
  • 原文地址:https://www.cnblogs.com/iiiDragon/p/3297531.html
Copyright © 2011-2022 走看看