use of org.eclipse.ui.IWorkingSet in project liferay-ide by liferay.
the class WorkingSetGroup method selectWorkingSets.
public boolean selectWorkingSets(List<IWorkingSet> workingSets) {
Set<IWorkingSet> defaultSets = _getWorkingSets();
_workingsetComboViewer.setInput(defaultSets);
if (ListUtil.isNotEmpty(workingSets)) {
if (workingSets.size() == 1) {
IWorkingSet workingSet = workingSets.get(0);
if (defaultSets.contains(workingSet)) {
_workingsetComboViewer.setSelection(new StructuredSelection(workingSet));
}
} else {
_workingsetComboViewer.add(workingSets);
_workingsetComboViewer.setSelection(new StructuredSelection((Object) workingSets));
}
return true;
}
return false;
}
use of org.eclipse.ui.IWorkingSet in project liferay-ide by liferay.
the class WorkingSetGroup method updateConfiguration.
protected void updateConfiguration() {
if (addToWorkingSetButton.getSelection()) {
IStructuredSelection selection = (IStructuredSelection) _workingsetComboViewer.getSelection();
Object o = selection.getFirstElement();
if (o != null) {
_workingSets.clear();
if (o instanceof IWorkingSet) {
_workingSets.add((IWorkingSet) o);
} else if (o instanceof List<?>) {
@SuppressWarnings("unchecked") List<IWorkingSet> l = (List<IWorkingSet>) o;
_workingSets.addAll(l);
}
}
}
}
use of org.eclipse.ui.IWorkingSet in project eclipse-cs by checkstyle.
the class AbstractStatsView method focusSelectionChanged.
/**
* Invoked on selection changes within the workspace.
*
* @param part
* the workbench part the selection occurred
* @param selection
* the selection
*/
private void focusSelectionChanged(IWorkbenchPart part, ISelection selection) {
List<IResource> resources = new ArrayList<IResource>();
if (part instanceof IEditorPart) {
IEditorPart editor = (IEditorPart) part;
IFile file = getFile(editor.getEditorInput());
if (file != null) {
resources.add(file);
}
} else {
if (selection instanceof IStructuredSelection) {
for (Iterator<?> iterator = ((IStructuredSelection) selection).iterator(); iterator.hasNext(); ) {
Object object = iterator.next();
if (object instanceof IWorkingSet) {
IWorkingSet workingSet = (IWorkingSet) object;
IAdaptable[] elements = workingSet.getElements();
for (int i = 0; i < elements.length; i++) {
considerAdaptable(elements[i], resources);
}
} else if (object instanceof IAdaptable) {
considerAdaptable((IAdaptable) object, resources);
}
}
}
}
IResource[] focusedResources = new IResource[resources.size()];
resources.toArray(focusedResources);
// check if update necessary -> if so then update
boolean updateNeeded = updateNeeded(mFocusedResources, focusedResources);
if (updateNeeded) {
mFocusedResources = focusedResources;
getFilter().setFocusResource(focusedResources);
refresh();
}
}
use of org.eclipse.ui.IWorkingSet in project egit by eclipse.
the class GitRepositoriesViewTest method removeWorkingSet.
private void removeWorkingSet(String name) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet workingSet = workingSetManager.getWorkingSet(name);
if (workingSet != null)
workingSetManager.removeWorkingSet(workingSet);
}
use of org.eclipse.ui.IWorkingSet in project egit by eclipse.
the class GitRepositoriesViewTest method assertProjectInWorkingSet.
private void assertProjectInWorkingSet(String workingSetName, String projectName) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetName);
IAdaptable[] elements = workingSet.getElements();
assertEquals("Wrong number of projects in working set", 1, elements.length);
IProject project = Utils.getAdapter(elements[0], IProject.class);
assertEquals("Wrong project in working set", projectName, project.getName());
}
Aggregations