diff options
author | kchong | 2006-12-21 18:09:30 +0000 |
---|---|---|
committer | kchong | 2006-12-21 18:09:30 +0000 |
commit | bd3c88800f77c30f1c23bed702d10b8c20342d5b (patch) | |
tree | 611bf50880b7fcfb1115b71c4c746c26c286d249 /bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui | |
parent | 995db34657fd4578e1c15b1c67ff398d2e6047d6 (diff) | |
download | webtools.webservices-200612211813.tar.gz webtools.webservices-200612211813.tar.xz webtools.webservices-200612211813.zip |
This commit was manufactured by cvs2svn to create tag 'v200612211813'.v200612211813
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui')
5 files changed, 0 insertions, 365 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesAction.java deleted file mode 100644 index 6c2a082cf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesAction.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.search.actions; -import javax.xml.namespace.QName; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.search.ui.NewSearchUI; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.core.search.scope.SearchScope; -import org.eclipse.wst.common.core.search.scope.WorkspaceSearchScope; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Binding; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Interface; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Message; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; -import org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper; -import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery; -import org.eclipse.wst.xsd.ui.internal.search.actions.FindAction; - -public class WSDLFindReferencesAction extends FindAction -{ - public WSDLFindReferencesAction(IEditorPart editor) - { - super(editor); - } - - public void setActionDefinitionId(String string) - { - } - - /** - * To be used by subclass in its run() Returns the file where the selection of - * a component (from the user) occurs ie. Returns the file that the user is - * currently working on. - * - * @return The IFile representation of the current working file. - */ - protected IFile getCurrentFile() - { - if (editor != null) - { - IEditorInput input = editor.getEditorInput(); - if (input instanceof IFileEditorInput) - { - IFileEditorInput fileEditorInput = (IFileEditorInput) input; - return fileEditorInput.getFile(); - } - } - return null; - } - - /** - * To be used by subclass in its run().. Determines the metaName of the WSDL - * component given to this method. - * - * @param component - * The component of which we want to determine the name - * @return - * The first one is for MetaName/Type, second for ElementQualifiedName - */ - protected QualifiedName[] determineMetaAndQualifiedName(WSDLBaseAdapter component) - { - QualifiedName names[] = null; - QName qName; - if (component instanceof W11Message ) - { - names = new QualifiedName[2]; - names[0] = IWSDLSearchConstants.MESSAGE_META_NAME; - qName = ((Message) component.getTarget()).getQName(); - names[1] = new QualifiedName(qName.getNamespaceURI(), qName.getLocalPart()); - } - else if (component instanceof W11Interface) - { - names = new QualifiedName[2]; - names[0] = IWSDLSearchConstants.PORT_TYPE_META_NAME; - qName = ((PortType) component.getTarget()).getQName(); - names[1] = new QualifiedName(qName.getNamespaceURI(), qName.getLocalPart()); - } - else if (component instanceof W11Binding) - { - names = new QualifiedName[2]; - names[0] = IWSDLSearchConstants.BINDING_META_NAME; - qName = ((Binding) component.getTarget()).getQName(); - names[1] = new QualifiedName(qName.getNamespaceURI(), qName.getLocalPart()); - - } - return names; - } - - protected WSDLBaseAdapter getWSDLNamedComponent() - { - if (editor != null) - { - ISelectionProvider provider = (ISelectionProvider) editor.getAdapter(ISelectionProvider.class); - ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class); - if (provider != null) - { - ISelection selection = provider.getSelection(); - if (mapper != null) - { - selection = mapper.mapSelection(selection); - } - if (selection != null && selection instanceof IStructuredSelection) - { - IStructuredSelection s = (IStructuredSelection) selection; - Object o = s.getFirstElement(); - if (o != null && o instanceof WSDLBaseAdapter) - { - return (WSDLBaseAdapter) o; - } - } - } - } - // The expected component we get from the editor does not meet - // our expectation - return null; - } - - public void run() - { - String pattern = ""; - WSDLBaseAdapter component = getWSDLNamedComponent(); - IFile file = getCurrentFile(); - QualifiedName[] names = determineMetaAndQualifiedName(component); - if (file != null && component != null && names != null) - { - SearchScope scope = new WorkspaceSearchScope(); - String scopeDescription = "Workspace"; - XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, names[1], - names[0], XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription); - NewSearchUI.activateSearchResultView(); - NewSearchUI.runQueryInBackground(searchQuery); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesInProjectAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesInProjectAction.java deleted file mode 100644 index 0bb521c5c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesInProjectAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.search.actions; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IPath; -import org.eclipse.search.ui.NewSearchUI; -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.core.search.scope.ProjectSearchScope; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery; - -public class WSDLFindReferencesInProjectAction extends WSDLFindReferencesAction{ - public WSDLFindReferencesInProjectAction(IEditorPart editor) - { - super(editor); - } - - public void run() - { - String pattern = ""; - WSDLBaseAdapter component = getWSDLNamedComponent(); - IFile file = getCurrentFile(); - QualifiedName[] names = determineMetaAndQualifiedName(component); - if (file != null && component != null && names != null) - { - IPath fullPath = file.getFullPath(); - ProjectSearchScope scope = new ProjectSearchScope(fullPath); - String scopeDescription = "Project"; - XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, names[1], - names[0], XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription); - NewSearchUI.activateSearchResultView(); - NewSearchUI.runQueryInBackground(searchQuery); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesInWorkingSetAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesInWorkingSetAction.java deleted file mode 100644 index d51016cc3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLFindReferencesInWorkingSetAction.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.search.actions; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.window.Window; -import org.eclipse.search.ui.NewSearchUI; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.core.search.scope.WorkingSetSearchScope; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery; - -public class WSDLFindReferencesInWorkingSetAction extends WSDLFindReferencesAction{ - - public WSDLFindReferencesInWorkingSetAction(IEditorPart editor) { - super(editor); - } - - public void run(){ - IWorkingSet[] workingSets = queryWorkingSets(); - if ( workingSets == null || workingSets.length == 0) - // The user chooses nothing, no point to continue. - return; - String pattern = ""; - - WSDLBaseAdapter component = getWSDLNamedComponent(); - IFile file = getCurrentFile(); - QualifiedName[] names = determineMetaAndQualifiedName(component); - if ( file != null && component != null){ - // 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, names[1], names[0], XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription); - NewSearchUI.activateSearchResultView(); - NewSearchUI.runQueryInBackground(searchQuery); - } - } - - /** - * 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; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLReferencesSearchGroup.java b/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLReferencesSearchGroup.java deleted file mode 100644 index a5b527fe2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLReferencesSearchGroup.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.search.actions; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.xsd.ui.internal.search.SearchMessages; -import org.eclipse.wst.xsd.ui.internal.search.actions.ReferencesSearchGroup; - -public class WSDLReferencesSearchGroup extends ReferencesSearchGroup { - /** - * Note: This constructor is for internal use only. Clients should not call this constructor. - * @param editor - */ - public WSDLReferencesSearchGroup(IEditorPart editor) { - super(editor); - } - - protected void initialize() { -// fGroupId= ITextEditorActionConstants.GROUP_FIND; - - fFindReferencesAction= new WSDLFindReferencesAction(fEditor); - fFindReferencesAction.setText(SearchMessages.Search_FindDeclarationAction_label); - fFindReferencesAction.setActionDefinitionId("SEARCH_REFERENCES_IN_WORKSPACE"); - //fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$ - - fFindReferencesInProjectAction= new WSDLFindReferencesInProjectAction(fEditor); - fFindReferencesInProjectAction.setText(SearchMessages.Search_FindDeclarationsInProjectAction_label); - fFindReferencesInProjectAction.setActionDefinitionId("SEARCH_REFERENCES_IN_PROJECT"); - //fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$ - - fFindReferencesInWorkingSetAction= new WSDLFindReferencesInWorkingSetAction(fEditor); - fFindReferencesInWorkingSetAction.setText(SearchMessages.Search_FindDeclarationsInWorkingSetAction_label); - fFindReferencesInWorkingSetAction.setActionDefinitionId(".SEARCH_REFERENCES_IN_WORKING_SET"); - //fEditor.setAction("SearchReferencesInWorkingSet", fFindReferencesInWorkingSetAction); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLSearchReferencesGroupActionDelegate.java b/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLSearchReferencesGroupActionDelegate.java deleted file mode 100644 index 55fc2095a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-search/org/eclipse/wst/wsdl/ui/internal/search/actions/WSDLSearchReferencesGroupActionDelegate.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.search.actions; - -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.wst.xsd.ui.internal.search.actions.BaseGroupActionDelegate; -import org.eclipse.wst.xsd.ui.internal.search.actions.XSDSearchGroupSubMenu; - -public class WSDLSearchReferencesGroupActionDelegate extends BaseGroupActionDelegate -{ - protected void fillMenu(Menu menu) { - try - { - if (fSelection == null) { - return; - } - if (workbenchPart != null) - { - IWorkbenchPartSite site = workbenchPart.getSite(); - if (site == null) - return; - - IEditorPart editor = site.getPage().getActiveEditor(); - if ( editor != null ){ - WSDLReferencesSearchGroup referencesGroup = new WSDLReferencesSearchGroup(editor); - XSDSearchGroupSubMenu subMenu = new XSDSearchGroupSubMenu(referencesGroup); - subMenu.fill(menu, -1); - } - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } -} |