Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreeSelection


            /**
             * {@inheritDoc}
             */
            public void selectionChanged( IWorkbenchPart part, ISelection selection )
            {
                TreeSelection treeSelection = ( TreeSelection ) selection;

                Object selectedObject = ( ( TreeSelection ) selection ).getFirstElement();

                if ( treeSelection.size() != 1 || selectedObject == null )
                {
                    removeSchema.setEnabled( false );
                    createANewObjectClass.setEnabled( false );
                    createANewAttributeType.setEnabled( false );
                    deleteAction.setEnabled( false );
View Full Code Here


    if (selection instanceof TreeSelection) {
      //
      // If we have a selection, extract the Java information from it
      //
      TreeSelection sel = (TreeSelection) selection;
      for (Iterator it = sel.iterator(); it.hasNext();) {
        result.add(convertToJavaElement(it.next()));
      }
    } else {
      //
      // No selection, extract the Java information from the current editor, if applicable
View Full Code Here

      int endLine = document.getLineOfOffset(element.getEndOffset()) + 1;

      IModelElement modelElement = BeansModelUtils.getMostSpecificModelElement(startLine, endLine, resource,
          new NullProgressMonitor());
      if (modelElement != null) {
        return new TreeSelection(BeansUIUtils.createTreePath(modelElement));
      }
      return new StructuredSelection(resource);
    }

    return null;
View Full Code Here

        if (editor.getEditorInput() == input && editor.getSite() != null
            && editor.getSite().getSelectionProvider() != null) {
          ISelection selection = editor.getSite().getSelectionProvider().getSelection();
          IModelElement element = BeansUIUtils.getSelectedElement(selection, config);
          if (element != null) {
            return new TreeSelection(BeansUIUtils.createTreePath(element));
          }
        }
      }
    }
    return StructuredSelection.EMPTY;
View Full Code Here

  public void selectionChanged(IAction action, ISelection selection) {
    selectedBean = null;
    selectedFile = null;

    if (selection instanceof TreeSelection) {
      TreeSelection treeSelection = (TreeSelection) selection;
      Object[] objects = treeSelection.toArray();
      if (objects != null && objects.length == 1) {
        if (objects[0] instanceof IBean) {
          IBean bean = (IBean) objects[0];
          IResource resource = bean.getElementResource();
          if (resource instanceof IFile) {
View Full Code Here

    run();
  }

  public void selectionChanged(IAction action, ISelection selection) {
    if (selection instanceof TreeSelection) {
      TreeSelection treeSelection = (TreeSelection) selection;
      Object[] objects = treeSelection.toArray();
      if (objects != null && objects.length == 1) {
        if (objects[0] instanceof IFile) {
          selectedFile = (IFile) objects[0];
          return;
        }
View Full Code Here

TOP

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

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.