use of org.eclipse.ui.IWorkingSet in project erlide_eclipse by erlang.
the class ReferencesSearchGroup method fillContextMenu.
@Override
public void fillContextMenu(final IMenuManager manager) {
final MenuManager erlangSearchMM = new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
addAction(fFindReferencesAction, erlangSearchMM);
addAction(fFindReferencesInProjectAction, erlangSearchMM);
erlangSearchMM.add(new Separator());
for (final IWorkingSet[] i : SearchUtil.getLRUWorkingSets().getSorted()) {
addWorkingSetAction(i, erlangSearchMM);
}
addAction(fFindReferencesInWorkingSetAction, erlangSearchMM);
if (!erlangSearchMM.isEmpty()) {
manager.appendToGroup(fGroupId, erlangSearchMM);
}
}
use of org.eclipse.ui.IWorkingSet in project eclipse.platform.releng by eclipse.
the class AdvancedFixCopyrightAction method addResource.
private void addResource(Object element, ArrayList<IResource> resources) {
if (element instanceof IResource) {
resources.add((IResource) element);
} else if (element instanceof IWorkingSet) {
IWorkingSet ws = (IWorkingSet) element;
IAdaptable[] elements = ws.getElements();
for (int i = 0; i < elements.length; i++) addResource(elements[i], resources);
} else if (element instanceof IAdaptable) {
IAdaptable a = (IAdaptable) element;
addResource(a.getAdapter(IResource.class), resources);
}
}
use of org.eclipse.ui.IWorkingSet in project webtools.sourceediting by eclipse.
the class NewProjectDataModelFacetWizard method postPerformFinish.
/**
* <p>
* Invoked after the user has clicked the "Finish" button of the wizard. The default
* implementation will attempt to update the final perspective to the value specified by
* { @link #getFinalPerspectiveID() }
* </p>
*
* @throws InvocationTargetException
*
* @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizard#postPerformFinish()
*/
protected void postPerformFinish() throws InvocationTargetException {
String projName = getProjectName();
IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
IWorkbench workbench = WSTWebUIPlugin.getDefault().getWorkbench();
// add to the selected working sets
if (newProject != null && beginingPages != null && beginingPages.length > 0 && beginingPages[0] instanceof DataModelFacetCreationWizardPage) {
DataModelFacetCreationWizardPage mainPage = (DataModelFacetCreationWizardPage) beginingPages[0];
IWorkingSet[] workingSets = mainPage.getSelectedWorkingSets();
workbench.getWorkingSetManager().addToWorkingSets(newProject, workingSets);
}
// open the "final" perspective
if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0) {
final IConfigurationElement element = new DelegateConfigurationElement(configurationElement) {
@Override
public String getAttribute(String aName) {
if (aName.equals("finalPerspective")) {
// $NON-NLS-1$
return getFinalPerspectiveID();
}
return super.getAttribute(aName);
}
};
BasicNewProjectResourceWizard.updatePerspective(element);
} else
BasicNewProjectResourceWizard.updatePerspective(configurationElement);
// select and reveal
BasicNewResourceWizard.selectAndReveal(newProject, workbench.getActiveWorkbenchWindow());
}
use of org.eclipse.ui.IWorkingSet in project webtools.sourceediting by eclipse.
the class FindReferencesInWorkingSetAction method run.
public void run() {
IWorkingSet[] workingSets = queryWorkingSets();
if (workingSets == null || workingSets.length == 0)
// The user chooses nothing, no point to continue.
return;
String pattern = "";
XSDNamedComponent component = getXSDNamedComponent();
IFile file = getCurrentFile();
if (file != null && component != null) {
QualifiedName metaName = determineMetaName(component);
QualifiedName elementQName = new QualifiedName(component.getTargetNamespace(), component.getName());
// Create a scope from the selected working sets
WorkingSetSearchScope scope = new WorkingSetSearchScope();
for (int i = 0; i < workingSets.length; i++) {
IAdaptable[] elements = workingSets[i].getElements();
scope.addAWorkingSetToScope(elements);
}
String scopeDescription = "Working Set";
XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription);
NewSearchUI.activateSearchResultView();
NewSearchUI.runQueryInBackground(searchQuery);
}
}
use of org.eclipse.ui.IWorkingSet in project webtools.sourceediting by eclipse.
the class FindReferencesInWorkingSetAction method queryWorkingSets.
/**
* Calls a dialog asking the user to choose the working Sets he wants
* to do the search on
* @return
*/
public static IWorkingSet[] queryWorkingSets() {
Shell shell = XSDEditorPlugin.getShell();
if (shell == null)
return null;
IWorkingSetSelectionDialog dialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell, true);
if (dialog.open() == Window.OK) {
IWorkingSet[] workingSets = dialog.getSelection();
if (workingSets.length > 0)
return workingSets;
}
return null;
}
Aggregations