Package org.eclipse.ui

Examples of org.eclipse.ui.ISelectionService


  /***
   * ���ѡ����Ŀ
   * @return
   */
  public static IProject getCurrentProject(){ 
        ISelectionService selectionService =  
            Workbench.getInstance().getActiveWorkbenchWindow().getSelectionService()
        ISelection selection = selectionService.getSelection()
        IProject project = null
        if(selection instanceof IStructuredSelection) { 
            Object element = ((IStructuredSelection)selection).getFirstElement()
            if (element instanceof IResource) { 
                project= ((IResource)element).getProject()
View Full Code Here


      fSuperListener = new SuperListener(this);
     
      //showMessage("Registering the plugin");
     
      //To track if the plugin is selected
      ISelectionService service = site.getWorkbenchWindow().getSelectionService();
     
      //We add a listener to notify if the selection has changed
      service.addPostSelectionListener(fSuperListener);
     
      //A file that can be edited by more than one client
      FileBuffers.getTextFileBufferManager().addFileBufferListener(fSuperListener);
     
    }
View Full Code Here

  public Document getDoc() {
    return doc;
  }
  public static IProject getCurrentSelectedProject() {
    IProject project = null;
    ISelectionService selectionService =
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();

    ISelection selection = selectionService.getSelection();

    if(selection instanceof IStructuredSelection) {
      Object element = ((IStructuredSelection)selection).getFirstElement();

      if (element instanceof IResource) {
View Full Code Here

  public final Map getCurrentState() {
    final Map currentState = new TreeMap();
    final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    if (window != null) {
      final ISelectionService service = window.getSelectionService();
      final ISelection selection = service.getSelection();
      currentState.put(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
    } else {
      currentState.put(ISources.ACTIVE_CURRENT_SELECTION_NAME, null);
    }
    return currentState;
View Full Code Here

   *            Whether the selection listener should be removed; otherwise,
   *            it should be added.
   */
  private final void swapListeners(final IWorkbenchWindow window,
      final boolean remove) {
    final ISelectionService selectionService = window.getSelectionService();
    if (remove) {
      window.getSelectionService().removeSelectionListener(
          CurrentSelectionSourceProvider.this);
      selectionChanged(null, null);
    } else {
      window.getSelectionService().addSelectionListener(
          CurrentSelectionSourceProvider.this);
      selectionChanged(null, selectionService.getSelection());
    }
  }
View Full Code Here

     * NOTE: the first time this function is called will be before the
     * active workbench window is instantiated Eclipse RCP causes this
     * function to fail quietly, so we just don't set the already installed
     * flag true until after it is successful
     */
    ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
    final IHandler handler = this;
    selectionService.addSelectionListener(new ISelectionListener() {
      @Override
      public void selectionChanged(IWorkbenchPart part, ISelection selection) {
        fireHandlerChanged(new HandlerEvent(handler, true, false));
      }
    });
View Full Code Here

  public void setEnabled(Object evaluationContext) {
    installSelectionListener();
  }

  protected static IStructuredSelection getSelection() {
    ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
    IStructuredSelection selection = (IStructuredSelection) selectionService.getSelection();
    return selection;
  }
View Full Code Here

        //        initScrolledComposite(parent);
        createBrowser(rootComposite);

        // Add selection listener to detect click in problems view or bug tree
        // view
        ISelectionService theService = getSite().getWorkbenchWindow().getSelectionService();

        selectionListener = new MarkerSelectionListener(this);
        theService.addSelectionListener(selectionListener);

        return rootComposite;
    }
View Full Code Here

        ctfData.horizontalSpan = 2;
        cloudTextField.setLayoutData(ctfData);

        // Add selection listener to detect click in problems view or bug tree
        // view
        ISelectionService theService = getSite().getWorkbenchWindow().getSelectionService();
        selectionListener = new MarkerSelectionListener(this);
        theService.addSelectionListener(selectionListener);
        return main;
    }
View Full Code Here

      logReaderService = (LogReaderService)bundleContext.getService(logReaderServiceReference);
      logReaderService.addLogListener(this);
    }
   
    try {
      ISelectionService selServive = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
      selServive.addSelectionListener(taskListSelectionListener);
    } catch (NullPointerException e) {}
   
    spentTimeManager = RedmineCorePlugin.getDefault().getSpentTimeManager(TasksUi.getTaskActivityManager());
   
   
View Full Code Here

TOP

Related Classes of org.eclipse.ui.ISelectionService

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.