blob: 4beee8c4871f078e8056216487738626cb024de8 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.dltk.internal.ui.callhierarchy;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.internal.ui.search.DLTKSearchScopeFactory;
import org.eclipse.dltk.ui.DLTKUIPlugin;
import org.eclipse.dltk.ui.util.ExceptionHandler;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkingSet;
class SelectWorkingSetAction extends Action {
private final SearchScopeActionGroup fGroup;
public SelectWorkingSetAction(SearchScopeActionGroup group) {
super(CallHierarchyMessages.SearchScopeActionGroup_workingset_select_text);
this.fGroup = group;
setToolTipText(CallHierarchyMessages.SearchScopeActionGroup_workingset_select_tooltip);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_SEARCH_SCOPE_ACTION);
if (DLTKCore.DEBUG) {
System.err.println("Add help support here..."); //$NON-NLS-1$
}
}
@Override
public void run() {
try {
IWorkingSet[] workingSets;
workingSets = DLTKSearchScopeFactory.getInstance().queryWorkingSets();
if (workingSets != null) {
this.fGroup.setActiveWorkingSets(workingSets);
SearchUtil.updateLRUWorkingSets(workingSets);
} else {
this.fGroup.setActiveWorkingSets(null);
}
} catch (ModelException e) {
ExceptionHandler.handle(e, DLTKUIPlugin.getActiveWorkbenchShell(),
CallHierarchyMessages.SelectWorkingSetAction_error_title,
CallHierarchyMessages.SelectWorkingSetAction_error_message);
}
}
}