Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ISelection


      StructuredViewer viewer = actionSite.getStructuredViewer();
      if (viewer instanceof CommonViewer) {
        CommonViewer serversViewer = (CommonViewer) viewer;
        serversViewer.addOpenListener(new IOpenListener() {
          public void open(OpenEvent event) {
            ISelection s = event.getSelection();
            if (s instanceof IStructuredSelection) {
              IStructuredSelection selection = (IStructuredSelection) s;
              Object[] selectedObjects = selection.toArray();
              if (selectedObjects.length == 1 && selectedObjects[0] instanceof ModuleServer) {
                ModuleServer moduleServer = (ModuleServer) selectedObjects[0];
View Full Code Here


      serviceCommandsViewer.setInput(new ArrayList<ServerService>(0));
    }
  }

  protected ServerService getSelectedService() {
    ISelection iSelection = serviceViewer.getSelection();
    if (iSelection instanceof IStructuredSelection) {
      Object selectObj = ((IStructuredSelection) iSelection).getFirstElement();
      if (selectObj instanceof ServerService) {
        return (ServerService) selectObj;
      }
View Full Code Here

    return serviceCommands;
  }

  protected ServiceCommand getSelectedCommand() {

    ISelection selection = serviceCommandsViewer.getSelection();
    if (selection instanceof IStructuredSelection) {
      return (ServiceCommand) ((IStructuredSelection) selection).getFirstElement();
    }
    return null;
  }
View Full Code Here

 
 
  // Must first init selected server or module.  Or just override execute
  protected void initializeSelection(ExecutionEvent event) throws ExecutionException {
    IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
    ISelection selection = activePart.getSite().getSelectionProvider().getSelection();
    if (selection instanceof IStructuredSelection) {
      Object obj = ((IStructuredSelection) selection).getFirstElement();
      if (obj instanceof IServer) {
        this.selectedServer = (IServer) obj;
      }
View Full Code Here

              IViewSite viewSite = serversViewPart.getViewSite();
              if (viewSite != null) {
                ISelectionProvider selectionProvider = viewSite.getSelectionProvider();
                if (selectionProvider != null) {
                  ISelection selection = selectionProvider.getSelection();
                  if (selection instanceof IStructuredSelection) {
                    return (IStructuredSelection) selection;
                  }
                }
              }
View Full Code Here

public abstract class SelectionResourceCommandHandler extends AbstractResourceCommandHandler
{

    public final Object execute(ExecutionEvent event) throws ExecutionException
    {
        ISelection selection = HandlerUtil.getCurrentSelection(event);

        Object[] objectArray = ((IStructuredSelection) selection).toArray();
        IResource[] resourceArray = new IResource[objectArray.length];
        System.arraycopy(objectArray, 0, resourceArray, 0, objectArray.length);
View Full Code Here

        return container;
    }

    private void handleRemove()
    {
        ISelection s = viewer.getSelection();
        if (!s.isEmpty())
        {
            IStructuredSelection sel = (IStructuredSelection) s;
            resources.remove(sel.getFirstElement());
            viewer.refresh();
        }
View Full Code Here

        }

        @Override
        public void run()
        {
            ISelection s = treeViewer.getSelection();
            if (!s.isEmpty())
            {
                IStructuredSelection sel = (IStructuredSelection) s;
                IModelElement e = (IModelElement) sel.getFirstElement();
                List<IModelElement> users = ModelHelper.findUsers(e);
                String msg = null;
View Full Code Here

        btnRemove.setLayoutData(buttonGD.create());
    }

    private void updateButtonStates()
    {
        ISelection sel = libraryView.getSelection();
        btnEdit.setEnabled(!sel.isEmpty());
        btnRemove.setEnabled(!sel.isEmpty());
    }
View Full Code Here

            setErrorMessage("No resources available");
            getButton(IDialogConstants.OK_ID).setEnabled(false);
        }
        else
        {
            ISelection selection = selected == null ? EMPTY_SELECTION
                : new SingletonSelection(selected);
            setSelected(new SelectionChangedEvent(viewer, selection), true);
        }

        if (job != null)
View Full Code Here

TOP

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

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.