use of org.eclipse.ui.IWorkingSet in project che by eclipse.
the class JavaSearchScopeFactory method createJavaSearchScope.
public IJavaSearchScope createJavaSearchScope(IWorkingSet[] workingSets, int includeMask) {
if (workingSets == null || workingSets.length < 1)
return EMPTY_SCOPE;
Set<IJavaElement> javaElements = new HashSet<IJavaElement>(workingSets.length * 10);
for (int i = 0; i < workingSets.length; i++) {
IWorkingSet workingSet = workingSets[i];
if (workingSet.isEmpty() && workingSet.isAggregateWorkingSet()) {
return createWorkspaceScope(includeMask);
}
addJavaElements(javaElements, workingSet);
}
return createJavaSearchScope(javaElements, includeMask);
}
use of org.eclipse.ui.IWorkingSet in project translationstudio8 by heartsome.
the class WorkingSetActionProvider method setWorkingSet.
/**
* Set current active working set.
*
* @param workingSet
* working set to be activated, may be <code>null</code>
*/
protected void setWorkingSet(IWorkingSet workingSet) {
this.workingSet = workingSet;
emptyWorkingSet = workingSet != null && workingSet.isAggregateWorkingSet() && workingSet.isEmpty();
ignoreFilterChangeEvents = true;
try {
workingSetActionGroup.setWorkingSet(workingSet);
} finally {
ignoreFilterChangeEvents = false;
}
if (viewer != null) {
setWorkingSetFilter(workingSet);
if (workingSet == null || emptyWorkingSet || !extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS)) {
if (viewer.getInput() != originalViewerInput) {
viewer.setInput(originalViewerInput);
} else {
viewer.refresh();
}
} else {
if (!workingSet.isAggregateWorkingSet()) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
viewer.setInput(workingSetManager.createAggregateWorkingSet("", "", //$NON-NLS-1$ //$NON-NLS-2$
new IWorkingSet[] { workingSet }));
} else {
viewer.setInput(workingSet);
}
}
}
}
use of org.eclipse.ui.IWorkingSet in project eclipse.platform.text by eclipse.
the class ScopePart method handleChooseWorkingSet.
private boolean handleChooseWorkingSet() {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSetSelectionDialog dialog = workingSetManager.createWorkingSetSelectionDialog(fUseSelection.getShell(), true);
if (fWorkingSets != null)
dialog.setSelection(fWorkingSets);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getSelection();
if (result.length > 0) {
setSelectedWorkingSets((IWorkingSet[]) result);
return true;
}
// $NON-NLS-1$
fWorkingSetText.setText("");
fWorkingSets = null;
if (fScope == ISearchPageContainer.WORKING_SET_SCOPE)
setSelectedScope(ISearchPageContainer.WORKSPACE_SCOPE);
return false;
}
if (fWorkingSets != null) {
// test if selected working set has been removed
int i = 0;
while (i < fWorkingSets.length) {
IWorkingSet workingSet = fWorkingSets[i];
if (!workingSet.isAggregateWorkingSet() && workingSetManager.getWorkingSet(workingSet.getName()) == null)
break;
i++;
}
if (i < fWorkingSets.length) {
// $NON-NLS-1$
fWorkingSetText.setText("");
fWorkingSets = null;
updateSearchPageContainerActionPerformedEnablement();
}
}
return false;
}
use of org.eclipse.ui.IWorkingSet in project eclipse.platform.text by eclipse.
the class ScopePart method setSelectedWorkingSets.
/**
* Sets the selected working set for this part.
* This method must only be called on a created part.
*
* @param workingSets the working set to be selected
*/
public void setSelectedWorkingSets(IWorkingSet[] workingSets) {
Assert.isNotNull(workingSets);
setSelectedScope(ISearchPageContainer.WORKING_SET_SCOPE);
fWorkingSets = null;
Set<IWorkingSet> existingWorkingSets = new HashSet<>(workingSets.length);
for (IWorkingSet workingSet2 : workingSets) {
String name = workingSet2.getName();
IWorkingSet workingSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
if (workingSet != null)
existingWorkingSets.add(workingSet);
}
if (!existingWorkingSets.isEmpty())
fWorkingSets = existingWorkingSets.toArray(new IWorkingSet[existingWorkingSets.size()]);
saveState();
if (fWorkingSetText != null)
fWorkingSetText.setText(toString(fWorkingSets));
}
use of org.eclipse.ui.IWorkingSet in project eclipse.platform.text by eclipse.
the class ScopePart method toString.
public static String toString(IWorkingSet[] workingSets) {
// $NON-NLS-1$
String result = "";
if (workingSets != null && workingSets.length > 0) {
Arrays.sort(workingSets, new WorkingSetComparator());
boolean firstFound = false;
for (IWorkingSet workingSet : workingSets) {
String workingSetName = workingSet.getLabel();
if (firstFound)
result = Messages.format(SearchMessages.ScopePart_workingSetConcatenation, new String[] { result, workingSetName });
else {
result = workingSetName;
firstFound = true;
}
}
}
return result;
}
Aggregations