@Override
public void init(ICommonActionExtensionSite aSite) {
site = aSite;
super.init(aSite);
final StructuredViewer viewer = aSite.getStructuredViewer();
final BugContentProvider provider = BugContentProvider.getProvider(site.getContentService());
filterChangeListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (!initDone) {
return;
}
IWorkingSet oldWorkingSet = provider.getCurrentWorkingSet();
IWorkingSet oldWorkingSet1 = (IWorkingSet) event.getOldValue();
IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue();
if (newWorkingSet != null && (oldWorkingSet == newWorkingSet || oldWorkingSet1 == newWorkingSet)) {
return;
}
if (viewer != null) {
provider.setCurrentWorkingSet(newWorkingSet);
if (newWorkingSet == null) {
viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
} else if (oldWorkingSet != newWorkingSet) {
viewer.setInput(newWorkingSet);
}
}
}
};
workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener);
if (provider == null)
throw new NullPointerException("no provider");
workingSetActionGroup.setWorkingSet(provider.getCurrentWorkingSet());
doubleClickAction = new MyAction();
// only if doubleClickAction must know tree selection:
viewer.addSelectionChangedListener(doubleClickAction);
initDone = true;
}