Package org.eclipse.ui

Examples of org.eclipse.ui.IActionDelegate


    /* (non-Javadoc)
     * Method declared on PluginAction.
     */
    protected void initDelegate() {
        super.initDelegate();
    final IActionDelegate actionDelegate = getDelegate();
    if (actionDelegate instanceof IObjectActionDelegate
        && activePart != null) {
      final IObjectActionDelegate objectActionDelegate = (IObjectActionDelegate) actionDelegate;
      final ISafeRunnable runnable = new ISafeRunnable() {
        public void run() throws Exception {
View Full Code Here


   * @param targetPart
   *            the new part target
   */
    public void setActivePart(IWorkbenchPart targetPart) {
        activePart = targetPart;
        IActionDelegate delegate = getDelegate();
        if (delegate instanceof IObjectActionDelegate && activePart != null) {
      final IObjectActionDelegate objectActionDelegate = (IObjectActionDelegate) delegate;
      final ISafeRunnable runnable = new ISafeRunnable() {
        public void run() throws Exception {
          objectActionDelegate.setActivePart(ObjectPluginAction.this,
View Full Code Here

  /**
   * Returns the pulldown delegate. If it does not exist it is created. Can
   * return <code>null</code> if delegate creation failed.
   */
  protected IWorkbenchWindowPulldownDelegate getPulldownDelegate() {
    IActionDelegate delegate = getDelegate();
    if (delegate == null) {
      createDelegate();
      delegate = getDelegate();
    }
    return (IWorkbenchWindowPulldownDelegate) delegate;
View Full Code Here

  }
 
  @Override
  public void run(IAction action) {
    final IFile agentFile = getSelectedAgentFile();
    final IActionDelegate wizard = getActionToRun();
    WorkbenchJob job = new WorkbenchJob(Display.getCurrent(),"Launch Wizard") {
     
      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        final Action action = new Action() {};
        wizard.selectionChanged(action, new StructuredSelection(agentFile));
          wizard.run(action);
      return Status.OK_STATUS;
      }
    };
    job.schedule();
  }
View Full Code Here

  }
 
  @Override
  public void run(IAction action) {
    final IFile agentFile = getSelectedAgentFile();
    final IActionDelegate wizard = getActionToRun();
    WorkbenchJob job = new WorkbenchJob(Display.getCurrent(),"Launch Wizard") {
     
      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        final Action action = new Action() {};
        wizard.selectionChanged(action, new StructuredSelection(agentFile));
          wizard.run(action);
      return Status.OK_STATUS;
      }
    };
    job.schedule();
  }
View Full Code Here

            } else if (actionObject instanceof IAction) {
                IAction action = (IAction) actionObject;
                action.run();

            } else if (actionObject instanceof IActionDelegate) {
                final IActionDelegate delegate = (IActionDelegate) actionObject;
                if (delegate instanceof IWorkbenchWindowActionDelegate)
                    ((IWorkbenchWindowActionDelegate) delegate).init(PlatformUI
                        .getWorkbench().getActiveWorkbenchWindow());
                Action proxy = new Action(this.action) {

                    public void run() {
                        delegate.run(this);
                    }
                };
                proxy.run();
            } else
                // we could not create the class.
View Full Code Here

          if (provider.isEnabled()) {
            shareMenu.add(new Action(provider.getName()) {
              @Override
              public void run() {
                if (SendLinkAction.ID.equals(provider.getId())) {
                  IActionDelegate action = new SendLinkAction();
                  action.selectionChanged(null, selection);
                  action.run(null);
                } else {
                  Object obj = selection.getFirstElement();
                  if (StringUtils.isSet((String) obj) && !URIUtils.ABOUT_BLANK.equals(obj)) {
                    String shareLink = provider.toShareUrl((String) obj, null);
                    new OpenInBrowserAction(new StructuredSelection(shareLink)).run();
View Full Code Here

          if (provider.isEnabled()) {
            shareMenu.add(new Action(provider.getName()) {
              @Override
              public void run() {
                if (SendLinkAction.ID.equals(provider.getId())) {
                  IActionDelegate action = new SendLinkAction();
                  action.selectionChanged(null, selection);
                  action.run(null);
                } else {
                  Object obj = selection.getFirstElement();
                  if (StringUtils.isSet((String) obj) && !URIUtils.ABOUT_BLANK.equals(obj)) {
                    String shareLink = provider.toShareUrl((String) obj, null);
                    new OpenInBrowserAction(new StructuredSelection(shareLink)).run();
View Full Code Here

          /* Update */
          manager.add(new Action(Messages.ApplicationActionBarAdvisor_UPDATE) {
            @Override
            public void run() {
              IActionDelegate action = new ReloadTypesAction();
              action.selectionChanged(null, selection);
              action.run(null);
            }

            @Override
            public ImageDescriptor getImageDescriptor() {
              return OwlUI.getImageDescriptor("icons/elcl16/reload.gif"); //$NON-NLS-1$
View Full Code Here

   */
  public void share(IStructuredSelection selection, ShareProvider provider) {

    /* Special Case "Send E-Mail" action */
    if (SendLinkAction.ID.equals(provider.getId())) {
      IActionDelegate action = new SendLinkAction();
      action.selectionChanged(null, selection);
      action.run(null);
    }

    /* Other Action */
    else {
      Object obj = selection.getFirstElement();
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IActionDelegate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.