Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreeSelection$InitializeData


            | ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION);
    ((CCombo) branchesEditor.getControl()).addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        CCombo combo = (CCombo) e.widget;
        TreeSelection sel = (TreeSelection) treeViewer.getSelection();
        int selectedIdx = combo.getSelectionIndex();
        Repository repo = (Repository) sel.getFirstElement();

        if (selectedIdx != -1) {
          selectedBranches.put(repo, combo.getItem(selectedIdx));
          setPageComplete(true);
        } else {
View Full Code Here


        && (refName.startsWith(Constants.R_HEADS) || refName
            .startsWith(Constants.R_REMOTES));

    // handle multiple selection
    if (((TreeSelection) branchTree.getSelection()).size() > 1) {
      TreeSelection selection = (TreeSelection) branchTree
          .getSelection();
      deleteButton.setEnabled(onlyBranchesExcludingCurrentAreSelected(selection));
      renameButton.setEnabled(false);
      if (newButton != null)
        newButton.setEnabled(false);
View Full Code Here

  private static final String UNSUPPORTED_OP = "UNSUPPORTED"; //$NON-NLS-1$

  @Override
  public IStatus validateDrop(Object target, int operationCode,
      TransferData transferType) {
    TreeSelection selection = (TreeSelection) LocalSelectionTransfer
        .getTransfer().getSelection();

    String operation = getOperationType(selection);

    if (!UNSUPPORTED_OP.equals(operation)) {
View Full Code Here

  }

  @Override
  public IStatus handleDrop(CommonDropAdapter aDropAdapter,
      DropTargetEvent aDropTargetEvent, Object aTarget) {
    TreeSelection selection = (TreeSelection) LocalSelectionTransfer
        .getTransfer().getSelection();
    String operation = getOperationType(selection);

    if (STAGE_OP.equals(operation))
      runCommand(ADD_TO_INDEX, selection);
View Full Code Here

      return;
    }
  }

  private void setInputAsExplorerProject(IWorkbenchPart part) {
    final TreeSelection input = (TreeSelection) ((ScriptExplorerPart) part)
        .getTreeViewer().getSelection();
    IScriptProject scriptProject = null;
    // getting selected project (from ScriptExplorerPart selection.
    if (input.getFirstElement() instanceof IModelElement) {
      scriptProject = (IScriptProject) ((IModelElement) input
          .getFirstElement())
          .getAncestor(IModelElement.SCRIPT_PROJECT);
    }

    if (null == scriptProject) {
View Full Code Here

              segments[4] = frame;
              TreePath treePath = new TreePath(segments);
              // set the current launch as the LaunchViewer
              // selection.
              ((InternalTreeModelViewer) view.getViewer())
                  .setSelection(new TreeSelection(treePath),
                      true, true);
            } catch (DebugException e) {
            }
          }
        });
View Full Code Here

    tree.setMenu(menu);
  }

  protected void fillContextMenu(IMenuManager manager) {
    manager.removeAll();
    TreeSelection selection = (TreeSelection)filteredTree.getViewer().getSelection();
   
    Action fRemoveAction = new Action("Remove Class-Mapping") {
      @Override
      public void run() {
        StructuredSelection structuredSelection = (StructuredSelection)mappings.getSelection();
        Element selected = (Element)structuredSelection.getFirstElement();
       
        if ("mapping".equals(selected.getNodeName())) {
          deleteItem();
        } else if ("field".equals(selected.getNodeName()) || "field-exclude".equals(selected.getNodeName())) {
          //delete mapping
          Element parentNode = (Element)selected.getParentNode();         
          parentNode.getParentNode().removeChild(parentNode);
          mappings.refresh();
        }
      }
    };

    Action fFieldRemoveAction = new Action("Remove Field-Mapping") {
      @Override
      public void run() {
        deleteItem();
      }
    };

   
    if (!selection.isEmpty()) {
      manager.add(fAddClassMappingAction);
      manager.add(fRemoveAction);
      manager.add(new Separator());
      manager.add(fAddFieldMappingAction);
      manager.add(fAddFieldExcludeMappingAction);     

      Element element = (Element)selection.getFirstElement();
      if ("field".equals(element.getNodeName()) || "field-exclude".equals(element.getNodeName())) {
        manager.add(fFieldRemoveAction);
      }     
    }
  }
View Full Code Here

  private void hookDoubleClickActions() {
    directoryTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

      public void doubleClick(DoubleClickEvent event) {
        ISelection selection = event.getSelection();
        TreeSelection sel = (TreeSelection)event.getSelection();
        Object firstElement = sel.getFirstElement();
        if (firstElement instanceof RemoteFile) {
          RemoteFile remFile = (RemoteFile) firstElement;
          String absolutePath = remFile.getAbsolutePath();
         
          StructuredSelection selection2 = (StructuredSelection)comboViewer.getSelection();
View Full Code Here

              if (directoryName.indexOf("[") == 0) {
                  directoryName = directoryName.substring(1,directoryName.length()-1);
              }
             
              if (inputElement instanceof TreeSelection) {
          TreeSelection selection = (TreeSelection) inputElement;
          Object firstElement = selection.getFirstElement();
         
          if (firstElement instanceof RemoteFile) {
            RemoteFile remFile = (RemoteFile) firstElement;
            if(remFile != null){
             directoryName = remFile.getFileItem().getName().getPath();
View Full Code Here

     * different classes to handle info
     */
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    ISelection selection = (ISelection) event.data;
    if (selection instanceof TreeSelection) {
      TreeSelection treeSelection = (TreeSelection) selection;
      IAdaptable firstElement = (IAdaptable) treeSelection.getFirstElement();
      IFile file = (IFile) firstElement.getAdapter(IFile.class);
      if (file != null && file.isAccessible()) {
        File dropped = file.getLocation().toFile();
        String currentpath = ((IResource) ((FileEditorInput) editor.getEditorInput()).getFile()).getParent().getLocation()
            .toString();
        File target = new File(currentpath);

        String relPath = "";

        relPath = file.getProjectRelativePath().toString();
        RelativePath relpather = new RelativePath();

        relPath = relpather.getRelativePath(target, dropped);

        // System.out.println("Dropped File: " +
        // dropped.getAbsolutePath());
        // System.out.println("Target File:  " +
        // target.getAbsolutePath());
        // System.out.println("Relative path:" + relPath);

        InsertFileLink ifl = new InsertFileLink(dropped, relPath, editor);
        ifl.run();
      }
      System.err.println(treeSelection.getPaths()[0].toString());

    }
    // Object result =
    // localSelectionTransfer.nativeToJava(event.currentDataType);
  }
View Full Code Here

TOP

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

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.