use of org.eclipse.ui.IWorkingSet in project translationstudio8 by heartsome.
the class WorkingSetsContentProvider method inputChanged.
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (newInput instanceof IWorkingSet) {
IWorkingSet rootSet = (IWorkingSet) newInput;
helper = new WorkingSetHelper(rootSet);
}
}
use of org.eclipse.ui.IWorkingSet in project translationstudio8 by heartsome.
the class ProjectExplorer method getFrameToolTipText.
/**
* Returns the tool tip text for the given element.
*
* @param element
* the element
* @return the tooltip
* @noreference
*/
public String getFrameToolTipText(Object element) {
String result;
if (!(element instanceof IResource)) {
if (element instanceof IAggregateWorkingSet) {
result = WorkbenchNavigatorMessages.resources_ProjectExplorerPart_workingSetModel;
} else if (element instanceof IWorkingSet) {
result = ((IWorkingSet) element).getLabel();
} else {
result = super.getFrameToolTipText(element);
}
} else {
IPath path = ((IResource) element).getFullPath();
if (path.isRoot()) {
result = WorkbenchNavigatorMessages.resources_ProjectExplorerPart_workspace;
} else {
result = path.makeRelative().toString();
}
}
if (rootMode == PROJECTS) {
if (workingSetLabel == null)
return result;
if (result.length() == 0)
return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip, new String[] { workingSetLabel });
return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip2, new String[] { result, workingSetLabel });
}
// be null.
if (element != null && !(element instanceof IWorkingSet) && getCommonViewer() != null) {
FrameList frameList = getCommonViewer().getFrameList();
// Happens during initialization
if (frameList == null)
return result;
int index = frameList.getCurrentIndex();
IWorkingSet ws = null;
while (index >= 0) {
Frame frame = frameList.getFrame(index);
if (frame instanceof TreeFrame) {
Object input = ((TreeFrame) frame).getInput();
if (input instanceof IWorkingSet && !(input instanceof IAggregateWorkingSet)) {
ws = (IWorkingSet) input;
break;
}
}
index--;
}
if (ws != null) {
return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip3, new String[] { ws.getLabel(), result });
}
return result;
}
return result;
}
use of org.eclipse.ui.IWorkingSet in project translationstudio8 by heartsome.
the class WorkingSetActionProvider method initWorkingSetFilter.
/**
* Restores the working set filter from the persistence store.
*/
protected void initWorkingSetFilter(String workingSetName) {
IWorkingSet workingSet = null;
if (workingSetName != null && workingSetName.length() > 0) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
workingSet = workingSetManager.getWorkingSet(workingSetName);
} else if (PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)) {
// use the window set by default if the global preference is set
workingSet = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getAggregateWorkingSet();
}
if (workingSet != null) {
setWorkingSet(workingSet);
}
}
use of org.eclipse.ui.IWorkingSet in project xtext-eclipse by eclipse.
the class MultiOrganizeImportsHandler method collectRelevantFiles.
private void collectRelevantFiles(Object element, Multimap<IProject, IFile> result) {
try {
if (element instanceof IJavaElement) {
IJavaElement elem = (IJavaElement) element;
if (elem.exists()) {
switch(elem.getElementType()) {
case IJavaElement.PACKAGE_FRAGMENT:
collectRelevantFiles((IPackageFragment) elem, result);
break;
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
collectRelevantFiles((IPackageFragmentRoot) elem, result);
break;
case IJavaElement.JAVA_PROJECT:
IPackageFragmentRoot[] roots;
roots = ((IJavaProject) elem).getPackageFragmentRoots();
for (int k = 0; k < roots.length; k++) {
collectRelevantFiles(roots[k], result);
}
break;
}
}
} else if (element instanceof LogicalPackage) {
IPackageFragment[] packageFragments = ((LogicalPackage) element).getFragments();
for (int k = 0; k < packageFragments.length; k++) {
IPackageFragment pack = packageFragments[k];
if (pack.exists()) {
collectRelevantFiles(pack, result);
}
}
} else if (element instanceof IWorkingSet) {
IWorkingSet workingSet = (IWorkingSet) element;
IAdaptable[] elements = workingSet.getElements();
for (int j = 0; j < elements.length; j++) {
collectRelevantFiles(elements[j], result);
}
} else if (element instanceof IFile) {
collectIFiles(result, new Object[] { element });
}
} catch (JavaModelException e) {
e.printStackTrace();
}
}
use of org.eclipse.ui.IWorkingSet in project eclipse.platform.text by eclipse.
the class FindInWorkingSetActionDelegate method createQuery.
@Override
protected ISearchQuery createQuery(TextSearchQueryProvider provider, String searchForString) throws CoreException {
IWorkbenchPage page = getWorkbenchPage();
if (page != null) {
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(page.getWorkbenchWindow().getShell(), true);
if (dialog.open() == Window.OK) {
IWorkingSet[] workingSets = dialog.getSelection();
if (workingSets != null) {
return provider.createQuery(searchForString, workingSets);
}
}
}
throw new OperationCanceledException();
}
Aggregations