Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.IStructuredSelection.toArray()


        if (selection == null) {
            // do nothing
        } else if (selection instanceof IStructuredSelection) {
            IStructuredSelection structuredSelection = (IStructuredSelection) selection;
            for (Object structuredSelectionItem : structuredSelection.toArray()) {
                objectsToAdapt.add(structuredSelectionItem);
            }
        }
        return ArrayUtils
            .getAdaptableObjects(objectsToAdapt.toArray(), adapter);
View Full Code Here


 
  @Override
  public void launch(ISelection selection, String mode) {
    if(selection instanceof IStructuredSelection){
      IStructuredSelection structuredSelection = (IStructuredSelection)selection;
      for(Object obj : structuredSelection.toArray()){
        if(obj instanceof IResource){
          IResource resource = (IResource)obj;
          //if(!resource.getFileExtension().equals("s3d")) continue;
         
          try {
View Full Code Here

        vl.setSelection(new StructuredSelection(fl.toArray()));
        DisposeBindingListener.linkBindingLifeCycle(bnd, editor);
        dlg.open();
        if (dlg.selection != null) {
          IStructuredSelection s = dlg.selection;
          Object[] ar = s.toArray();
          String[] result = new String[ar.length];
          for (int a = 0; a < ar.length; a++) {
            result[a] = ((Field) ar[a]).name;
          }
          currentColumns.clear();
View Full Code Here

      /*
       * On Attr nodes, select the owner Element. On Text nodes, select
       * the parent Element.
       */
      Object[] selectedObjects = new Object[structuredSel.size()];
      System.arraycopy(structuredSel.toArray(), 0, selectedObjects, 0, selectedObjects.length);
      for (int i = 0; i < selectedObjects.length; i++) {
        Object inode = selectedObjects[i];
        if (inode instanceof Node) {
          Node node = (Node) inode;
          // replace Attribute Node with its owner
View Full Code Here

           */
          IStructuredSelection structuredSelection = (IStructuredSelection) selection;
          Object o = structuredSelection.getFirstElement();
          Object o2 = null;
          if (structuredSelection.size() > 1) {
            o2 = structuredSelection.toArray()[structuredSelection.size() - 1];
          }
          else {
            o2 = o;
          }
          if (o instanceof IndexedRegion) {
View Full Code Here

   
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection sel = (IStructuredSelection) event.getSelection();
        if(sel != null) {
          int size = sel.toArray().length;
          if(size > 0) {
            IStatusLineManager slManager = getViewSite().getActionBars().getStatusLineManager();
            slManager.setMessage("Selected " + size + (size > 1 ? " entries." : "entry."));
          }
        }
View Full Code Here

        });
        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                IStructuredSelection sel = (IStructuredSelection) event.getSelection();
                if (sel != null) {
                    int size = sel.toArray().length;
                    if (size > 0) {
                        int done = 0, safe = 0;
                        Object[] selected = sel.toArray();
                        for (int i = 0; i < selected.length; i++) {
                            ViewMatch vm = (ViewMatch) selected[i];
View Full Code Here

                IStructuredSelection sel = (IStructuredSelection) event.getSelection();
                if (sel != null) {
                    int size = sel.toArray().length;
                    if (size > 0) {
                        int done = 0, safe = 0;
                        Object[] selected = sel.toArray();
                        for (int i = 0; i < selected.length; i++) {
                            ViewMatch vm = (ViewMatch) selected[i];
                            if (vm.isDone()) done++;
                            if (vm.isSafe()) safe++;
                        }
View Full Code Here

              IStructuredSelection structured = (IStructuredSelection) selection;
              Object element = structured.getFirstElement();
              upButton.setEnabled(selectedCategories.indexOf(element) > 0);

              // Disables move down button last element is selection:
              Object[] array = structured.toArray();
              element = array[array.length - 1];
              int index = selectedCategories.indexOf(element);
              if (index == selectedCategories.size() - 1) {
                downButton.setEnabled(false);
              } else {
View Full Code Here

    if (selection.isEmpty()) {
      return;
    }

    IStructuredSelection structure = (IStructuredSelection) selection;
    for (Object element : structure.toArray()) {
      int index = selectedCategories.indexOf(element);
      if (index <= selectedCategories.size() - 2) {
        Collections.swap(selectedCategories, index, index + 1);
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.