Package org.eclipse.ui.actions

Examples of org.eclipse.ui.actions.SelectionListenerAction


    // Javadoc inherited
    public void run() {
        // By default, delegate to the underlying action, using the current
        // selection
        SelectionListenerAction underlyingAction = getUnderlyingAction();
        underlyingAction.selectionChanged(getStructuredSelection());
        underlyingAction.run();
    }
View Full Code Here


    if (ActionUtils.containsOnlyProjects(selection.toList())) {
      createWorkbenchAction(selection).run();
      return;
    }
    if (selectedResources != null && !selectedResources.isEmpty()) {
      SelectionListenerAction action = createWorkbenchAction(selectedResources);
      if (action != null) {
        action.run();
      }
    }
  }
View Full Code Here

  }

  private SelectionListenerAction createWorkbenchAction(
      IStructuredSelection selection) {
    List<?> list = selection.toList();
    SelectionListenerAction action = null;
    if (fShell == null) {
      fShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
          .getShell();
    }

    if (list.size() == 0
        || list.get(0) instanceof IProject
        || (list.get(0) instanceof IAdaptable && ((IAdaptable) list
            .get(0)).getAdapter(IResource.class) instanceof IProject)) {
      action = new PHPMoveProjectAction(fShell);
      action.selectionChanged(selection);
    } else if (selectedResources != null) {
      action = new MoveResourceAction(fShell);
      if (list.size() == 1) {
        Object object = list.get(0);
        if (object instanceof ElementImplForPhp
            && ((ElementImplForPhp) object).getModelElement() != null) {
          IResource resource = ((ElementImplForPhp) object)
              .getModelElement().getResource();
          if (resource != null) {
            selection = new StructuredSelection(resource);
          }
        }
      }

      // don't open the move dialog, resource could be moved directly
      // using the drop target
      if (target != null && directMove(selection) == true) {
        return null;
      }

      action.selectionChanged(selection);

    }
    return action;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.actions.SelectionListenerAction

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.