0

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!

5
  • It is not clear what you are asking. At one point you seem to want the working set containing a file (but a file can be in multiple working sets). At another point you seem to want to select the active working set - but select the working set where? There isn't one active working set, different views may have different working sets active. Commented Jul 8, 2019 at 6:52
  • I want to select the working set containing a file. Which working set should be selected is already implemented. Maybe the added picture can help you understand my question. Commented Jul 8, 2019 at 6:58
  • Select the working set where? There isn't just one active working set. The Project view may have a different working set to the Packages view for example. Commented Jul 8, 2019 at 7:02
  • It should be selected in the package explorer Commented Jul 8, 2019 at 7:13
  • Package explorer doesn't provide an API to set the working set. Commented Jul 8, 2019 at 7:22

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

4 Comments

and is there a way to open a file of a workingset? When i open a file from a working set, the working might be selected...
What do you mean by 'open a file of a working set'?
with PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet("emi").getElements() i get all elements of a specific workingSet. And if i open a file of this elements in Eclipse, the workingSet should also be selected
Package explorer does not provide any APIs to do anything like this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.