コード例 #1
0
 /** Copied from @{link LinkEditorAction} */
 @SuppressWarnings("unchecked")
 private IStructuredSelection mergeSelection(
     IStructuredSelection aBase, IStructuredSelection aSelectionToAppend) {
   if (aBase == null || aBase.isEmpty()) {
     return (aSelectionToAppend != null) ? aSelectionToAppend : StructuredSelection.EMPTY;
   } else if (aSelectionToAppend == null || aSelectionToAppend.isEmpty()) {
     return aBase;
   } else {
     List<Object> newItems = new ArrayList<Object>(aBase.toList());
     newItems.addAll(aSelectionToAppend.toList());
     return new StructuredSelection(newItems);
   }
 }
コード例 #2
0
 public final void unloadSelectedCustoms() {
   final IStructuredSelection selection =
       (IStructuredSelection)
           LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer.getSelection();
   final List<Customization> toBeRemoved = new ArrayList<Customization>();
   boolean lockedCustomFound = false;
   for (Object object : selection.toList()) {
     if (this.lockedCustoms.contains(object)) {
       lockedCustomFound = true;
     } else if (object instanceof Customization) {
       final Customization element = (Customization) object;
       toBeRemoved.add(element);
     }
   }
   if (lockedCustomFound) {
     final MessageDialog dialog =
         new MessageDialog(
             null,
             Messages.LoadCustomizationsDialog_LoadCustomizationWarning,
             null,
             Messages.LoadCustomizationsDialog_Can_not_be_unload + this.lockMsg,
             MessageDialog.WARNING,
             new String[] {Messages.LoadCustomizationsDialog_OK},
             1);
     dialog.open();
   }
   removeFromSelection(toBeRemoved);
   refresh();
 }
コード例 #3
0
ファイル: ViewPicture.java プロジェクト: haku/Morrigan
        @Override
        public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
          if (ViewPicture.this.listenToSelectionListener
              && part instanceof IMixedMediaItemDbEditor) {
            if (selection == null || selection.isEmpty()) {
              return;
            }

            IMixedMediaItemDbEditor editor = (IMixedMediaItemDbEditor) part;
            IMediaItemDb<?, ? extends IMediaPicture> list = editor.getMediaList();

            if (selection instanceof IStructuredSelection) {
              IStructuredSelection iSel = (IStructuredSelection) selection;
              ArrayList<IMediaPicture> sel = new ArrayList<IMediaPicture>();
              for (Object selectedObject : iSel.toList()) {
                if (selectedObject != null) {
                  if (selectedObject instanceof IMediaPicture) {
                    IMediaPicture track = (IMediaPicture) selectedObject;
                    sel.add(track);
                  }
                }
              }

              setInput(list, sel);
            }
          }
        }
コード例 #4
0
  @SuppressWarnings("unchecked")
  protected void moveData(final IStructuredSelection structuredSelection) {
    final MoveDataWizard moveDataWizard = new MoveDataWizard((DataAware) getEObject());
    if (new WizardDialog(Display.getDefault().getActiveShell(), moveDataWizard).open()
        == Dialog.OK) {
      final DataAware dataAware = moveDataWizard.getSelectedDataAwareElement();
      try {
        final MoveDataCommand cmd =
            new MoveDataCommand(
                getEditingDomain(),
                (DataAware) getEObject(),
                structuredSelection.toList(),
                dataAware);
        OperationHistoryFactory.getOperationHistory().execute(cmd, null, null);

        if (!(cmd.getCommandResult().getStatus().getSeverity() == Status.OK)) {
          final List<Object> data = (List<Object>) cmd.getCommandResult().getReturnValue();
          String dataNames = "";
          for (final Object d : data) {
            dataNames = dataNames + ((Element) d).getName() + ",";
          }
          dataNames = dataNames.substring(0, dataNames.length() - 1);
          MessageDialog.openWarning(
              Display.getDefault().getActiveShell(),
              Messages.PromoteDataWarningTitle,
              Messages.bind(Messages.PromoteDataWarningMessage, dataNames));
        }

      } catch (final ExecutionException e1) {
        BonitaStudioLog.error(e1);
      }
      refresh();
    }
  }
コード例 #5
0
 /** The table viewer selection has changed. Update the toolbar and menu enablements */
 private void handleSelection() {
   ISelection selection = tableViewer.getSelection();
   if (selection == null || !(selection instanceof IStructuredSelection)) {
     return;
   }
   IStructuredSelection structuredSelection = (IStructuredSelection) selection;
   List selectionList = structuredSelection.toList();
   boolean selectionEmpty = structuredSelection.isEmpty();
   boolean firstRowSelected = true;
   boolean lastRowSelected = true;
   if (!selectionEmpty) {
     SortFilterElement element = (SortFilterElement) selectionList.get(0);
     if (tableViewer.getElementAt(0).equals(element)) {
       firstRowSelected = true;
     } else {
       firstRowSelected = false;
     }
     element = (SortFilterElement) selectionList.get(selectionList.size() - 1);
     if (tableViewer.getElementAt(tableViewer.getTable().getItemCount() - 1).equals(element)) {
       lastRowSelected = true;
     } else {
       lastRowSelected = false;
     }
   }
   if (moveUpToolItem != null) {
     moveUpToolItem.setEnabled(!firstRowSelected && !selectionEmpty);
   }
   if (moveDownToolItem != null) {
     moveDownToolItem.setEnabled(!lastRowSelected && !selectionEmpty);
   }
 }
 /**
  * Since these actions are re-created each time the run/debug as menu is filled, the enablement of
  * this action is static.
  */
 private void updateEnablement() {
   IWorkbenchWindow wb = DebugUIPlugin.getActiveWorkbenchWindow();
   boolean enabled = false;
   if (wb != null) {
     IWorkbenchPage page = wb.getActivePage();
     if (page != null) {
       ISelection selection = page.getSelection();
       if (selection instanceof IStructuredSelection) {
         IStructuredSelection structuredSelection = (IStructuredSelection) selection;
         try {
           // check enablement logic, if any
           Expression expression = fShortcut.getShortcutEnablementExpression();
           if (expression == null) {
             enabled = !structuredSelection.isEmpty();
           } else {
             List list = structuredSelection.toList();
             IEvaluationContext context = new EvaluationContext(null, list);
             context.addVariable("selection", list); // $NON-NLS-1$
             enabled = fShortcut.evalEnablementExpression(context, expression);
           }
         } catch (CoreException e) {
         }
       } else {
         IEditorPart editor = page.getActiveEditor();
         if (editor != null) {
           enabled = true;
         }
       }
     }
   }
   setEnabled(enabled);
 }
コード例 #7
0
  private void updateStatusLine(IStructuredSelection selection) {
    String message;

    if (selection == null || selection.size() == 0) {
      message = "";
    } else if (selection.size() == 1) {
      Object sel = selection.getFirstElement();

      if (sel instanceof IMarker) {
        IMarker marker = (IMarker) sel;

        message = marker.getAttribute(IMarker.MESSAGE, "");
      } else {
        message = "";
      }
    } else {
      List<IMarker> selMarkers = new ArrayList<IMarker>();

      for (Object obj : selection.toList()) {
        if (obj instanceof IMarker) {
          selMarkers.add((IMarker) obj);
        }
      }

      message = getStatusSummary(selMarkers.toArray(new IMarker[selMarkers.size()]));
    }

    getViewSite().getActionBars().getStatusLineManager().setMessage(message);
  }
コード例 #8
0
  private IProject guessProject(IStructuredSelection selection) {
    if (selection == null) {
      return null;
    }

    for (Object element : selection.toList()) {
      if (element instanceof IAdaptable) {
        IResource res = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
        IProject project = res != null ? res.getProject() : null;

        // Is this an Android project?
        try {
          if (project == null || !project.hasNature(AdtConstants.NATURE_DEFAULT)) {
            continue;
          }
        } catch (CoreException e) {
          // checking the nature failed, ignore this resource
          continue;
        }

        return project;
      } else if (element instanceof Pair<?, ?>) {
        // Pair of Project/String
        @SuppressWarnings("unchecked")
        Pair<IProject, String> pair = (Pair<IProject, String>) element;
        return pair.getFirst();
      }
    }

    // Try to figure out the project from the active editor
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
      IWorkbenchPage page = window.getActivePage();
      if (page != null) {
        IEditorPart activeEditor = page.getActiveEditor();
        if (activeEditor instanceof AndroidXmlEditor) {
          Object input = ((AndroidXmlEditor) activeEditor).getEditorInput();
          if (input instanceof FileEditorInput) {
            FileEditorInput fileInput = (FileEditorInput) input;
            return fileInput.getFile().getProject();
          }
        }
      }
    }

    IJavaProject[] projects =
        BaseProjectHelper.getAndroidProjects(
            new IProjectFilter() {
              public boolean accept(IProject project) {
                return project.isAccessible();
              }
            });

    if (projects != null && projects.length == 1) {
      return projects[0].getProject();
    }

    return null;
  }
コード例 #9
0
 @Override
 public void run() {
   IStructuredSelection select = (IStructuredSelection) getColumnViewer().getSelection();
   List<RevisionHistory> viewerInput = (List<RevisionHistory>) getColumnViewer().getInput();
   List<Object> selectObjs = select.toList();
   viewerInput.removeAll(selectObjs);
   getColumnViewer().refresh();
 }
コード例 #10
0
  @Override
  public Object execute(final ExecutionEvent event) throws ExecutionException {
    // Get the currently selected item
    final ISelection sel = HandlerUtil.getActiveMenuSelection(event);
    // Get the filter parameter for the command
    final String var = event.getParameter(PlayUsesPortHandler.FILTER_PARAM);
    // Check if we should send each play command individually or as a group
    final boolean sendList =
        Boolean.parseBoolean(event.getParameter(PlayUsesPortHandler.LIST_PARAM));
    // Get the ports variable for the command - this is only used via programmatic command execution
    final Object ports = HandlerUtil.getVariable(event, PlayUsesPortHandler.PORTS_VAR);

    String message = null;
    final List<ScaUsesPort> portList = new ArrayList<ScaUsesPort>();

    // First, check if we're called from a menu
    if ((sel != null) && (sel instanceof IStructuredSelection)) {
      final IStructuredSelection ss = (IStructuredSelection) sel;
      for (final Object element : ss.toList()) {
        if (element instanceof ScaUsesPort) {
          final ScaUsesPort port = (ScaUsesPort) element;
          portList.add(port);
        } else {
          final Object obj = Platform.getAdapterManager().getAdapter(element, ScaUsesPort.class);
          if (obj instanceof ScaUsesPort) {
            portList.add((ScaUsesPort) obj);
          }
        }
      }

      // If it's called programmatically, ports should be a list of ScaPort objects
    } else if ((ports != null) && (ports instanceof List)) {
      for (final Object element : (List<?>) ports) {
        if (element instanceof ScaUsesPort) {
          final ScaUsesPort port = ((ScaUsesPort) element);
          portList.add(port);
        } else {
          final Object obj = Platform.getAdapterManager().getAdapter(element, ScaUsesPort.class);
          if (obj instanceof ScaUsesPort) {
            portList.add((ScaUsesPort) obj);
          }
        }
      }
    } else {
      message = "Unable to determine what to play";
    }

    // Check if we found any ports to play
    if (portList.size() > 0) {
      message = playPort(var, portList, sendList);
    }

    // Any errors will be put into message
    if (message != null) {
      MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "Unable to Play", message);
    }
    return null;
  }
コード例 #11
0
 public void selectionChanged(SelectionChangedEvent event) {
   currentDiffs.clear();
   ISelection selection = event.getSelection();
   if (selection instanceof IStructuredSelection) {
     IStructuredSelection sel = (IStructuredSelection) selection;
     for (Object obj : sel.toList()) if (obj instanceof FileDiff) currentDiffs.add((FileDiff) obj);
   }
   format();
 }
  @SuppressWarnings("unchecked")
  public void selectionChanged(IAction action, ISelection selection) {
    IStructuredSelection ss = (IStructuredSelection) selection;
    menuContribs.clear();
    menuContribs.addAll(ss.toList());

    boolean isEnabled = isEnabled();
    action.setEnabled(isEnabled);
  }
コード例 #13
0
 @Override
 public void update() {
   IStructuredSelection selection = (IStructuredSelection) this.viewer.getSelection();
   command = createCommand(selection.toList());
   if (null != command && command.canExecute()) {
     setEnabled(true);
   } else {
     setEnabled(false);
   }
 }
コード例 #14
0
 private void handleAdd() {
   IStructuredSelection ssel = (IStructuredSelection) fAvailableListViewer.getSelection();
   if (ssel.size() > 0) {
     Table table = fAvailableListViewer.getTable();
     int index = table.getSelectionIndices()[0];
     doAdd(ssel.toList());
     table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1);
     pageChanged(true, false);
   }
 }
コード例 #15
0
 private void handleRemove() {
   IStructuredSelection ssel = (IStructuredSelection) fImportListViewer.getSelection();
   if (ssel.size() > 0) {
     Table table = fImportListViewer.getTable();
     int index = table.getSelectionIndices()[0];
     doRemove(ssel.toList());
     table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1);
     pageChanged(false, true);
   }
 }
  public void updateList() {

    //		String[] selection = fileExtList.getSelection();
    //		fileExtList.removeAll();
    //		SortedSet<String> keys = new TreeSet<String>();
    //		keys.addAll(delegateConfigs.keySet());
    //		for (String fileExt : keys) {
    //			fileExtList.add(fileExt);
    //		}
    //		fileExtList.setSelection(selection);

    // does only remember the first selection out of a (possible larger) set of selections
    /*		String selection = "";
    if (fileExtListViewer.getSelection() instanceof IStructuredSelection) {
    	IStructuredSelection structuredSelection = (IStructuredSelection) fileExtListViewer.getSelection();
    	if (structuredSelection.getFirstElement() instanceof String) {
    		selection = (String)structuredSelection.getFirstElement();
    	}
    }*/

    String[] selections = null; // = new String[];

    if (fileExtListViewer.getSelection() instanceof IStructuredSelection) {
      IStructuredSelection structuredSelection =
          (IStructuredSelection) fileExtListViewer.getSelection();
      int amountOfChosenEntries = structuredSelection.toList().size();
      selections = new String[amountOfChosenEntries];
      for (int j = 0; j < amountOfChosenEntries; j++) {
        selections[j] = (String) structuredSelection.toList().get(j);
      }
    }

    fileExtListViewer.setInput(null);
    SortedSet<String> keys = new TreeSet<String>();
    keys.addAll(delegateConfigs.keySet());
    for (String fileExt : keys) {
      fileExtListViewer.add(fileExt);
    }

    if (selections != null) {
      fileExtListViewer.getList().setSelection(selections);
    }
  }
コード例 #17
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
  * ExecutionEvent)
  */
 @Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   IStructuredSelection sel = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
   for (Object o : sel.toList()) {
     if (o instanceof UIReader) {
       ((UIReader) o).start();
     }
   }
   return null;
 }
コード例 #18
0
  private boolean checkSelectionForProfiles(IStructuredSelection selection) {
    List list = selection.toList();
    if (list == null || list.size() == 0) return false;

    for (int i = 0; i < list.size(); i++) {
      if (!(list.get(i) instanceof IConnectionProfile)) {
        return false;
      }
    }
    return true;
  }
コード例 #19
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener#getObjectsBeingDropped()
  */
 @Override
 protected List getObjectsBeingDropped() {
   TransferData[] data = getCurrentEvent().dataTypes;
   List eObjects = new ArrayList();
   ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
   if (selection instanceof IStructuredSelection) {
     IStructuredSelection structuredSelection = (IStructuredSelection) selection;
     eObjects.addAll(structuredSelection.toList());
   }
   return eObjects;
 }
コード例 #20
0
  private boolean allProfilesInSelectionAreConnected(IStructuredSelection selection) {
    List list = selection.toList();
    if (list == null || list.size() == 0) return false;

    for (int i = 0; i < list.size(); i++) {
      if (list.get(i) instanceof IConnectionProfile) {
        IConnectionProfile profile = (IConnectionProfile) list.get(i);
        if (profile.getConnectionState() == IConnectionProfile.DISCONNECTED_STATE) return false;
      }
    }
    return true;
  }
コード例 #21
0
    @Override
    public void menuAboutToShow(IMenuManager manager) {
      if (treeViewer.getSelection().isEmpty()) {
        return;
      }
      final EObject root = ((RootObject) treeViewer.getInput()).getRoot();

      if (treeViewer.getSelection() instanceof IStructuredSelection) {
        final IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();

        if (selection.size() == 1 && EObject.class.isInstance(selection.getFirstElement())) {
          final EObject eObject = (EObject) selection.getFirstElement();
          final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
          if (domain == null) {
            return;
          }
          final Collection<?> descriptors = childrenDescriptorCollector.getDescriptors(eObject);
          fillContextMenu(manager, descriptors, editingDomain, eObject);
        }
        if (!selection.toList().contains(root)) {
          manager.add(new Separator(GLOBAL_ADDITIONS));
          addDeleteActionToContextMenu(editingDomain, manager, selection);
        }
        manager.add(new Separator());

        if (selection.getFirstElement() != null
            && EObject.class.isInstance(selection.getFirstElement())) {
          final EObject selectedObject = (EObject) selection.getFirstElement();

          for (final MasterDetailAction menuAction : menuActions) {
            if (menuAction.shouldShow(selectedObject)) {
              final Action newAction =
                  new Action() {
                    @Override
                    public void run() {
                      super.run();
                      menuAction.execute(selectedObject);
                    }
                  };

              newAction.setImageDescriptor(
                  ImageDescriptor.createFromURL(
                      FrameworkUtil.getBundle(menuAction.getClass())
                          .getResource(menuAction.getImagePath())));
              newAction.setText(menuAction.getLabel());

              manager.add(newAction);
            }
          }
        }
      }
    }
コード例 #22
0
 /**
  * Lookup selected objects in UI.
  *
  * @return
  */
 private List<Object> lookupSelectedElements() {
   IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
   ISelection selection = page.getSelection();
   System.out.println("check " + selection);
   if (selection instanceof IStructuredSelection) {
     IStructuredSelection structuredSelection = (IStructuredSelection) selection;
     return structuredSelection.toList();
   } else if (selection instanceof TreeSelection) {
     TreeSelection treeSelection = (TreeSelection) selection;
     return treeSelection.toList();
   }
   return null;
 }
コード例 #23
0
  @Override
  public Object execute(final ExecutionEvent event) throws ExecutionException {
    final ISelection selection = HandlerUtil.getActiveMenuSelection(event);

    // The cast is safe, because our context menus use IStructuredSelections.
    final IStructuredSelection structuredSelection = (IStructuredSelection) selection;

    // prepare the list of internal actions
    final List<Entity> internalActions = new LinkedList<Entity>();

    // something must have been selected for this handler to be called.
    assert structuredSelection.size() > 0;

    String repositoryFile = null;
    IJavaProject javaProject = null;
    for (final Object clickObject : structuredSelection.toList()) {

      // Those casts are safe because this context menu entry is only shown on
      // InternalActionEditParts and InternalAction2EditParts.
      final InternalAction internalAction;
      if (clickObject instanceof InternalActionEditPart) {
        final InternalActionEditPart internalActionEditPart = (InternalActionEditPart) clickObject;
        internalAction = (InternalAction) ((View) internalActionEditPart.getModel()).getElement();
        internalActions.add(internalAction);
      } else {
        final InternalAction2EditPart internalAction2EditPart =
            (InternalAction2EditPart) clickObject;
        internalAction = (InternalAction) ((View) internalAction2EditPart.getModel()).getElement();
        internalActions.add(internalAction);
      }

      repositoryFile =
          ResourcesPlugin.getWorkspace()
              .getRoot()
              .getFile(new Path(internalAction.eResource().getURI().toPlatformString(true)))
              .getProjectRelativePath()
              .toFile()
              .getPath();
      javaProject =
          JavaCore.create(
              ResourcesPlugin.getWorkspace()
                  .getRoot()
                  .getFile(new Path(internalAction.eResource().getURI().toPlatformString(true)))
                  .getProject());
    }

    final BeagleLaunchConfigurationCreator creator =
        new BeagleLaunchConfigurationCreator(internalActions, repositoryFile, javaProject);
    new Thread(creator::createAndLaunchConfiguration).start();
    return null;
  }
コード例 #24
0
    void fireSelectionChanged() {
      if (fSelectionChangedListeners != null) {
        IStructuredSelection selection = getSelection();

        if (fLastSelection != null) {
          List<?> newSelection = selection.toList();
          List<?> oldSelection = fLastSelection.toList();
          int size = newSelection.size();
          if (size == oldSelection.size()) {
            for (int i = 0; i < size; i++) {
              Object newElement = newSelection.get(i);
              Object oldElement = oldSelection.get(i);
              if (newElement != oldElement
                  && newElement.equals(oldElement)
                  && newElement instanceof IJavaElement) {
                // send out a fake selection event to make the Properties view update getKey():
                SelectionChangedEvent event =
                    new SelectionChangedEvent(this, StructuredSelection.EMPTY);
                Object[] listeners = fSelectionChangedListeners.getListeners();
                for (Object listener : listeners) {
                  ((ISelectionChangedListener) listener).selectionChanged(event);
                }
                break;
              }
            }
          }
        }
        fLastSelection = selection;

        SelectionChangedEvent event = new SelectionChangedEvent(this, selection);

        Object[] listeners = fSelectionChangedListeners.getListeners();
        for (int i = 0; i < listeners.length; i++) {
          ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
          listener.selectionChanged(event);
        }
      }
    }
コード例 #25
0
ファイル: OpenCallHierarchyAction.java プロジェクト: SjB/Dart
  @Override
  public void run(IStructuredSelection selection) {
    List<?> elements = selection.toList();
    if (!CallHierarchy.arePossibleInputElements(elements)) {
      elements = Collections.EMPTY_LIST;
    }

    TypeMember[] members = elements.toArray(new TypeMember[elements.size()]);
    if (!ActionUtil.areProcessable(getShell(), members)) {
      return;
    }

    CallHierarchyUI.openView(members, getSite().getWorkbenchWindow());
  }
コード例 #26
0
  private void removeSelection() {
    IStructuredSelection selection = (IStructuredSelection) getTreeViewer().getSelection();
    List<String> list = selection.toList();
    for (String s : list) {
      if (NEW_ENTRY_TEXT.equals(s)) {
        continue; // don't delete this one.
      }
      input.remove(s);
    }
    saveCurrentCommands(null);

    // updates the selection
    updateGui();
  }
コード例 #27
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
   */
  public void run(IAction action) {
    if (mSelection != null && allProfilesInSelectionAreConnected(mSelection)) {
      List list = mSelection.toList();
      if (list == null || list.size() == 0) return;

      for (int i = 0; i < list.size(); i++) {
        if (list.get(i) instanceof IConnectionProfile) {
          IConnectionProfile profile = (IConnectionProfile) list.get(i);
          disConnectSubProfiles(profile);
          profile.disconnect(null);
        }
      }
    }
  }
コード例 #28
0
 public final void upButtonClicked() {
   final IStructuredSelection selection =
       (IStructuredSelection)
           LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer.getSelection();
   int minIndex = 0;
   for (Object selectedObject : selection.toList()) {
     if (selectedObject instanceof Customization) {
       final Customization customization = (Customization) selectedObject;
       final int index = this.selectedCustomizations.indexOf(customization);
       this.selectedCustomizations.move(Math.max(index - 1, minIndex++), customization);
     }
   }
   LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer.refresh();
 }
コード例 #29
0
ファイル: DeleteAction.java プロジェクト: anod/pdt
 public void run(IStructuredSelection selection) {
   if (ReorgUtils.containsOnlyProjects(selection.toList())) {
     createWorkbenchAction(selection).run();
     return;
   }
   try {
     startDeleteRefactoring(selection.toArray(), getShell());
   } catch (CoreException e) {
     ExceptionHandler.handle(
         e,
         RefactoringMessages.OpenRefactoringWizardAction_refactoring,
         RefactoringMessages.OpenRefactoringWizardAction_exception);
   }
 }
コード例 #30
0
ファイル: DeleteAction.java プロジェクト: anod/pdt
 /*
  * @see SelectionDispatchAction#selectionChanged(IStructuredSelection)
  */
 public void selectionChanged(IStructuredSelection selection) {
   if (ReorgUtils.containsOnlyProjects(selection.toList())) {
     setEnabled(createWorkbenchAction(selection).isEnabled());
     return;
   }
   try {
     setEnabled(RefactoringAvailabilityTester.isDeleteAvailable(selection.toArray()));
   } catch (CoreException e) {
     // no ui here - this happens on selection changes
     // http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
     if (ScriptModelUtil.isExceptionToBeLogged(e)) DLTKUIPlugin.log(e);
     setEnabled(false);
   }
 }