use of org.eclipse.n4js.ui.workingsets.WorkingSetManager in project n4js by eclipse.
the class GHOLD_101_WorkingSetsTest_PluginUITest method activateWorkingSetManager.
private void activateWorkingSetManager(final Class<? extends WorkingSetManager> clazz) {
final WorkingSetManager manager = from(broker.getWorkingSetManagers()).firstMatch(m -> m.getId().equals(clazz.getName())).orNull();
checkNotNull(manager, "Working set manager does not exist with ID: " + clazz);
broker.setActiveManager(manager);
broker.setWorkingSetTopLevel(true);
waitForIdleState();
final IContributionItem dropDownContribution = getWorkingSetDropDownContribution();
assertNotNull("Select working set drop down contribution was null when working sets are configured as top level elements.", dropDownContribution);
}
use of org.eclipse.n4js.ui.workingsets.WorkingSetManager in project n4js by eclipse.
the class SelectAllProjectExplorer_PluginUITest method activateWorkingSetManager.
private void activateWorkingSetManager(final Class<? extends WorkingSetManager> clazz) {
final WorkingSetManager manager = from(broker.getWorkingSetManagers()).firstMatch(m -> m.getId().equals(clazz.getName())).orNull();
checkNotNull(manager, "Working set manager does not exist with ID: " + clazz);
broker.setActiveManager(manager);
broker.setWorkingSetTopLevel(true);
waitForIdleState();
final IContributionItem dropDownContribution = getWorkingSetDropDownContribution();
assertNotNull("Select working set drop down contribution was null when working sets are configured as top level elements.", dropDownContribution);
}
use of org.eclipse.n4js.ui.workingsets.WorkingSetManager in project n4js by eclipse.
the class N4JSActionBarContributionProvider method workingSetManagerStateChanged.
@Override
public void workingSetManagerStateChanged(final WorkingSetManagerChangeEvent event) {
final Diff<WorkingSet> diff = event.getDiff();
final WorkingSetManager activeManager = workingSetManagerBroker.getActiveManager();
final String changedId = event.getId();
if (actionBars != null && activeManager != null && !diff.isEmpty() && workingSetManagerBroker.isWorkingSetTopLevel() && activeManager.getId().equals(changedId)) {
final WorkingSet[] allItems = diff.getNewAllItems();
final WorkingSet[] items = diff.getNewItems();
updateShowHiddenAction(allItems, items);
actionBars.updateActionBars();
}
}
use of org.eclipse.n4js.ui.workingsets.WorkingSetManager in project n4js by eclipse.
the class N4JSActionBarContributionProvider method topLevelElementChanged.
@Override
public void topLevelElementChanged(final boolean workingSetTopLevel) {
if (actionBars != null) {
final IToolBarManager toolBarManager = actionBars.getToolBarManager();
toolBarManager.remove(selectWorkingSetDelegate);
toolBarManager.remove(showHiddenWorkingSetsDelegate);
if (workingSetManagerBroker.isWorkingSetTopLevel()) {
toolBarManager.add(selectWorkingSetDelegate);
final WorkingSetManager manager = workingSetManagerBroker.getActiveManager();
if (manager != null) {
WorkingSet[] allItems = manager.getAllWorkingSets();
WorkingSet[] items = manager.getWorkingSets();
updateShowHiddenAction(allItems, items);
}
}
selectTopLevelElementAction.fillActionBars(actionBars);
actionBars.updateActionBars();
}
}
use of org.eclipse.n4js.ui.workingsets.WorkingSetManager in project n4js by eclipse.
the class HideWorkingSetAction method run.
@Override
public void run() {
final IStructuredSelection selection = getStructuredSelection();
final Object[] selectionElements = selection.toArray();
final WorkingSet[] selectedWorkingSets = Arrays2.filter(selectionElements, WorkingSet.class);
final WorkingSetManager manager = selectedWorkingSets[0].getWorkingSetManager();
final WorkingSetDiffBuilder builder = new WorkingSetDiffBuilder(manager);
final WorkingSet[] newAllItems = manager.getAllWorkingSets();
final List<WorkingSet> newItems = newArrayList(manager.getWorkingSets());
for (final WorkingSet toHide : selectedWorkingSets) {
newItems.remove(toHide);
}
final Diff<WorkingSet> diff = builder.build(Iterables.toArray(newItems, WorkingSet.class), newAllItems);
if (!diff.isEmpty()) {
manager.updateState(diff);
manager.saveState(new NullProgressMonitor());
manager.getWorkingSetManagerBroker().refreshNavigator();
}
}
Aggregations