javastringeclipsepluginsworking-set

Select Eclipse WorkingSet with String


I am currently working on a Eclipse Plug-In (Java). The Plug-In is showing some files in a table, and when I double click the column, I want to select the Workingset which it is in. The method to get the Workingset is already finished (returns the Workingset as a String). I just need help to select the Workingset.

private void jumpToWorkset()
  {
    m_viewer.addDoubleClickListener(new IDoubleClickListener()
    {
      @Override
      public void doubleClick(DoubleClickEvent event)
      {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        Object first = selection.getFirstElement();
        MyFileInformation b = (MyFileInformation) first;
        String ws=b.getWorkingSet();
        //Insert Code to select working set here
      }
    });
  }

description If you need any further information feel free to ask!


Solution

  • The IWorkingSetManager looks after working sets. Get this with:

    IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
    

    Individual workings sets are represented by IWorkingSet get that using:

    IWorkingSet workingSet = manager.getWorkingSet("name");
    

    The active workbench window working set can be set using the IWorkbenchPage.setWorkingSets method.

    Individual views may have their own active working set. These don't usually provide an API to set the value.