Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ITreeSelection


public class SortMembersObjectAction implements IObjectActionDelegate {

    public void run(IAction action) {
        if (_lastSelection != null && _lastSelection instanceof ITreeSelection) {
            ITreeSelection treeSelection = (ITreeSelection) _lastSelection;
            Iterator<?> iterator = treeSelection.iterator();
            while (iterator.hasNext()) {
                ICompilationUnit compilationUnit = (ICompilationUnit) iterator
                        .next();
                try {
                    IEditorPart editor = EditorUtility.openInEditor(
View Full Code Here


      public void doubleClick(DoubleClickEvent e) {
        if (!(e.getSelection() instanceof ITreeSelection)) {
          return;
        }

        ITreeSelection selection = (ITreeSelection) e.getSelection();
        TreePath[] paths = selection.getPaths();
        if (paths != null && paths.length > 0) {
          viewer.setExpandedState(paths[0], !viewer.getExpandedState(paths[0]));
        }
      }
    });
View Full Code Here

    @Override
    public String getEditorTitle() {
        String editorTitle = "Graph";

        if (getSelection() instanceof ITreeSelection) {
            ITreeSelection strucSelection = (ITreeSelection) getSelection();
            Object elem = strucSelection.getFirstElement();
            if (elem instanceof IJavaElement) {
                IJavaElement javaElem = (IJavaElement) elem;
                editorTitle = javaElem.getElementName();
            }
        }
View Full Code Here

     */
    public static IJavaProject getProject(ISelection selection) throws EvolizerException {
        IJavaProject project = null;
       
        if (selection instanceof ITreeSelection) {
            ITreeSelection treeSelection = (ITreeSelection) selection;
            // select project from first selected element
            project = ((IJavaElement) treeSelection.getFirstElement()).getJavaProject();
        } else if (selection instanceof IStructuredSelection) {
            IStructuredSelection structuredSelection = (IStructuredSelection) selection;
            project = ((IJavaElement) structuredSelection.getFirstElement()).getJavaProject();
        } else {
            throw new EvolizerException("Could not determine the project from the selection");
View Full Code Here

    lastSourceWorkbenchWindow = workbenchWindow;
    String sourceViewId =
      fetchSourceViewId(workbenchWindow);
    lastSourceViewId = sourceViewId;
    File target = null;
    ITreeSelection treeSel =
      fetchTreeSelection(workbenchWindow, sourceViewId);
    // If we have a selection,
    if(treeSel!=null) {
      IProject proj = null;
      // Then we try to get a selected Java element
View Full Code Here

   */
  public Object editSelectedJavaElement(
      IWorkbenchWindow workbenchWindow,
      String sourceViewId
  ) throws ExecutionException {
    ITreeSelection treeSel =
      fetchTreeSelection(workbenchWindow, sourceViewId);
    // If we have a selection,
    if(treeSel!=null) {
      IJavaElement el = selectedJavaElement(treeSel);
      return edit(
View Full Code Here

  protected Object editCurrentSelection(IWorkbenchWindow w)
  throws ExecutionException {
    lastSourceWorkbenchWindow = w;
    String sourceViewId = fetchSourceViewId(w);
    lastSourceViewId = sourceViewId;
    ITreeSelection treeSel = fetchTreeSelection(
        w,
        sourceViewId
    );
    // If we have a selection,
    if(treeSel!=null) {
View Full Code Here

  throws ExecutionException  {
    String sourceViewId =
      fetchSourceViewId(
          workbenchWindow
      );
    ITreeSelection treeSel =
      fetchTreeSelection(workbenchWindow, sourceViewId);
    // If we have a selection,
    if(treeSel!=null) {
      IJavaElement el = selectedJavaElement(treeSel);
      return el;
View Full Code Here

   */
  public Object reverseFromSelectedJavaElement(
      IWorkbenchWindow workbenchWindow,
      String sourceViewId
  ) throws ExecutionException {
    ITreeSelection treeSel =
      fetchTreeSelection(workbenchWindow, sourceViewId);
    // If we have a selection,
    if(treeSel!=null) {
      IJavaElement el = selectedJavaElement(treeSel);
      return reverse(
View Full Code Here

      IWorkbenchWindow workbenchWindow,
      String sourceViewId
  )
  throws ExecutionException {
    ISelection selection = null;
    ITreeSelection treeSel = null;
    if((workbenchWindow!=null)&&(sourceViewId!=null)) {
      // Accessing the workbench pages
      IWorkbenchPage[] pages = workbenchWindow.getPages();
      if(pages!=null) {
        // For each of these pages...
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.ITreeSelection

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.