Package org.eclipse.jface.viewers

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


    IStructuredSelection structure = (IStructuredSelection) selection;
    if (selectedCategories.indexOf(structure.getFirstElement()) <= 0) {
      return;
    }

    for (Object element : structure.toArray()) {
      int index = selectedCategories.indexOf(element);
      Collections.swap(selectedCategories, index, index - 1);
    }
    refreshViewers();
  }
View Full Code Here


public class PivotApplicationLaunchShortcut implements ILaunchShortcut {
    @Override
    public void launch(ISelection selection, String mode) {
        if (selection instanceof IStructuredSelection) {
            IStructuredSelection structuredSelection = (IStructuredSelection)selection;
            Object[] elements = structuredSelection.toArray();

            if (elements.length == 1) {
                launch(elements[0], mode);
            }
        }
View Full Code Here

    @Override
    public void launch(ISelection selection, String mode) {
        if (selection instanceof IStructuredSelection) {
            IStructuredSelection structuredSelection = (IStructuredSelection)selection;
            Object[] elements = structuredSelection.toArray();

            if (elements.length == 1) {
                launch(elements[0], mode);
            }
        }
View Full Code Here

     
      if (sel instanceof IStructuredSelection) {
        IStructuredSelection selection = (IStructuredSelection) sel;
       
        if( selection.getFirstElement() instanceof Card ) {
          Object[] selArr = selection.toArray();
          Card[] transferableCard = new Card[selArr.length];
          for (int i = 0; i < selArr.length; i++) {
            if(selArr[i] instanceof Card)
              transferableCard[i] = (Card)selArr[i];
            else
View Full Code Here

        ISelectionProvider provider = part.getSite().getSelectionProvider();
        if (null != provider) {
            if (provider.getSelection() instanceof IStructuredSelection) {
                try {
                    IStructuredSelection selection = (IStructuredSelection) provider.getSelection();
                    Object[] obj = selection.toArray();
                    List<Object> documents = new ArrayList<Object>();
                    for (int i=0; i<obj.length; i++) {
                        if (obj[i] instanceof IFile) {
                            IFile file = (IFile) obj[i];
                            documents.add(file);
View Full Code Here

    public void widgetSelected(SelectionEvent event) {
      IStructuredSelection selection = (IStructuredSelection) EOGeneratorFormPage.this.getModelsTableViewer().getSelection();
      if (!selection.isEmpty()) {
        List<EOModelReference> models = EOGeneratorFormPage.this.getModel().getModels();
        List<EOModelReference> newModels = new LinkedList<EOModelReference>(models);
        Object[] selections = selection.toArray();
        for (int i = 0; i < selections.length; i++) {
          newModels.remove(selections[i]);
        }
        EOGeneratorFormPage.this.getModel().setModels(newModels);
        EOGeneratorFormPage.this.getModelsTableViewer().refresh();
View Full Code Here

    public void widgetSelected(SelectionEvent event) {
      IStructuredSelection selection = (IStructuredSelection) EOGeneratorFormPage.this.getRefModelsTableViewer().getSelection();
      if (!selection.isEmpty()) {
        List<EOModelReference> refModels = EOGeneratorFormPage.this.getModel().getRefModels();
        List<EOModelReference> newRefModels = new LinkedList<EOModelReference>(refModels);
        Object[] selections = selection.toArray();
        for (int i = 0; i < selections.length; i++) {
          newRefModels.remove(selections[i]);
        }
        EOGeneratorFormPage.this.getModel().setRefModels(newRefModels);
        EOGeneratorFormPage.this.getRefModelsTableViewer().refresh();
View Full Code Here

    public void widgetSelected(SelectionEvent event) {
      IStructuredSelection selection = (IStructuredSelection) EOGeneratorFormPage.this.getDefinesTableViewer().getSelection();
      if (!selection.isEmpty()) {
        List<Define> defines = EOGeneratorFormPage.this.getModel().getDefines();
        List<Define> newDefines = new LinkedList<Define>(defines);
        Object[] selections = selection.toArray();
        for (int i = 0; i < selections.length; i++) {
          newDefines.remove(selections[i]);
        }
        EOGeneratorFormPage.this.getModel().setDefines(newDefines);
        EOGeneratorFormPage.this.getDefinesTableViewer().refresh();
View Full Code Here

        public void widgetSelected(SelectionEvent e) {
          ISelection s = fList.getSelection();
          if (s instanceof IStructuredSelection) {
            IStructuredSelection sel = (IStructuredSelection) s;
            fList.remove(sel.toArray());
            save();
          }
        }
      });
      return comp;
View Full Code Here

    Object source = e.getSource();
    if (source == fClearButton) {
      folders.clear();
    } else if (source == fRemoveButton) {
      IStructuredSelection selection = (IStructuredSelection) fLocationsViewer.getSelection();
      Object[] array = selection.toArray();
      for (int i = 0; i < array.length; i++) {
        if (array[i] instanceof RutaPageFolder) {
          for (Iterator iterator = folders.iterator(); iterator.hasNext();) {
            RutaPageFolder f = (RutaPageFolder) iterator.next();
            if (f == array[i]) {
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.