use of org.eclipse.ui.IWorkingSet in project erlide_eclipse by erlang.
the class ImplementorsSearchGroup method fillContextMenu.
@Override
public void fillContextMenu(final IMenuManager manager) {
final MenuManager erlangSearchMM = new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
addAction(fFindImplementorsAction, erlangSearchMM);
addAction(fFindImplementorsInProjectAction, erlangSearchMM);
erlangSearchMM.add(new Separator());
for (final IWorkingSet[] i : SearchUtil.getLRUWorkingSets().getSorted()) {
addWorkingSetAction(i, erlangSearchMM);
}
addAction(fFindImplementorsInWorkingSetAction, erlangSearchMM);
if (!erlangSearchMM.isEmpty()) {
manager.appendToGroup(fGroupId, erlangSearchMM);
}
}
use of org.eclipse.ui.IWorkingSet in project liferay-ide by liferay.
the class WorkingSets method getAssignedWorkingSets.
/**
* Returns all working sets the element directly belongs to. Returns empty
* collection if the element does not belong to any working set. The order of
* returned working sets is not specified.
*
* @since 1.5
*/
public static List<IWorkingSet> getAssignedWorkingSets(IResource element) {
List<IWorkingSet> list = new ArrayList<>();
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
for (IWorkingSet workingSet : workingSetManager.getWorkingSets()) {
for (IAdaptable adaptable : workingSet.getElements()) {
if (adaptable.getAdapter(IResource.class) == element) {
list.add(workingSet);
}
}
}
return list;
}
use of org.eclipse.ui.IWorkingSet in project liferay-ide by liferay.
the class SelectionUtil method getSelectedWorkingSet.
public static IWorkingSet getSelectedWorkingSet(IStructuredSelection selection) {
Object element = selection == null ? null : selection.getFirstElement();
if (element == null) {
return null;
}
IWorkingSet workingSet = getType(element, IWorkingSet.class);
if (workingSet != null) {
return workingSet;
}
IResource resource = getType(element, IResource.class);
if (resource != null) {
return WorkingSets.getAssignedWorkingSet(resource.getProject());
}
return null;
// IResource resource = getType(element, IResource.class);
// if(resource != null) {
// return getWorkingSet(resource);
// }
// IPackageFragmentRoot fragment = getType(element, IPackageFragmentRoot.class);
// if(fragment != null) {
// IJavaProject javaProject = fragment.getJavaProject();
// if(javaProject != null) {
// IResource resource = getType(javaProject, IResource.class);
// if(resource != null) {
// return getWorkingSet(resource.getProject());
// }
// }
// }
}
use of org.eclipse.ui.IWorkingSet in project liferay-ide by liferay.
the class WorkingSetCustomPart method init.
@Override
protected void init() {
super.init();
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
ISelectionService service = (ISelectionService) activeWorkbenchWindow.getSelectionService();
ISelection selection = service.getSelection();
if (selection instanceof IStructuredSelection) {
final IWorkingSet workingSet = SelectionUtil.getSelectedWorkingSet((IStructuredSelection) selection);
if (workingSet != null) {
_workingSets.add(workingSet);
}
}
}
use of org.eclipse.ui.IWorkingSet in project liferay-ide by liferay.
the class WorkingSetGroup method _getWorkingSets.
private Set<IWorkingSet> _getWorkingSets() {
Set<IWorkingSet> workingSets = new HashSet<>();
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
for (IWorkingSet workingSet : workingSetManager.getWorkingSets()) {
if (!workingSet.isEmpty()) {
IAdaptable[] elements = workingSet.getElements();
IResource resource = (IResource) elements[0].getAdapter(IResource.class);
if (resource != null) {
workingSets.add(workingSet);
}
} else {
if (_working_set_ids.contains(workingSet.getId())) {
workingSets.add(workingSet);
}
}
}
return workingSets;
}
Aggregations