diff options
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-search')
19 files changed, 0 insertions, 1168 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java deleted file mode 100644 index 5c465b3ce0..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search; - -import org.eclipse.wst.common.core.search.pattern.QualifiedName; - -public interface IXSDSearchConstants { - - public static final String XMLSCHEMA_NAMESPACE = "http://www.w3.org/2001/XMLSchema"; - public static String XSD_CONTENT_TYPE_ID = "org.eclipse.wst.xsd.core.xsdsource"; - - public static final QualifiedName TYPE_META_NAME = new QualifiedName (XMLSCHEMA_NAMESPACE, "type"); - public static final QualifiedName COMPLEX_TYPE_META_NAME = new QualifiedName (XMLSCHEMA_NAMESPACE, "complexType"); - public static final QualifiedName SIMPLE_TYPE_META_NAME = new QualifiedName (XMLSCHEMA_NAMESPACE, "simpleType"); - public static final QualifiedName ELEMENT_META_NAME = new QualifiedName (XMLSCHEMA_NAMESPACE, "element"); - public static final QualifiedName ATTRIBUTE_META_NAME = new QualifiedName (XMLSCHEMA_NAMESPACE, "attribute"); - public static final QualifiedName ATTRIBUTE_GROUP_META_NAME = new QualifiedName (XMLSCHEMA_NAMESPACE, "attributeGroup"); - public static final QualifiedName GROUP_META_NAME = new QualifiedName (XMLSCHEMA_NAMESPACE, "group"); - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java deleted file mode 100644 index 1def0d9698..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import org.eclipse.wst.common.core.search.pattern.SearchPattern; -import org.eclipse.wst.xml.core.internal.search.ComponentSearchContributor; -import org.eclipse.wst.xml.core.internal.search.XMLSearchPattern; -import org.eclipse.xsd.util.XSDConstants; - -public class XSDSearchContributor extends ComponentSearchContributor { - - - protected void initializeReferences() { - references = new HashMap(); - String ns = IXSDSearchConstants.XMLSCHEMA_NAMESPACE; - - List patterns = new ArrayList(); - patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.REF_ATTRIBUTE)); - patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE)); - references.put(IXSDSearchConstants.ELEMENT_META_NAME, patterns); - - patterns = new ArrayList(); - patterns.add(new XMLSearchPattern( ns, XSDConstants.RESTRICTION_ELEMENT_TAG, XSDConstants.BASE_ATTRIBUTE)); - patterns.add(new XMLSearchPattern( ns, XSDConstants.EXTENSION_ELEMENT_TAG, XSDConstants.BASE_ATTRIBUTE)); - patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.TYPE_ATTRIBUTE)); - references.put(IXSDSearchConstants.COMPLEX_TYPE_META_NAME, patterns); - - patterns = new ArrayList(); - patterns.add(new XMLSearchPattern( ns, XSDConstants.RESTRICTION_ELEMENT_TAG, XSDConstants.BASE_ATTRIBUTE)); - patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.TYPE_ATTRIBUTE)); - patterns.add(new XMLSearchPattern( ns, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDConstants.TYPE_ATTRIBUTE)); - patterns.add(new XMLSearchPattern( ns, XSDConstants.UNION_ELEMENT_TAG, XSDConstants.MEMBERTYPES_ATTRIBUTE)); - patterns.add(new XMLSearchPattern( ns, XSDConstants.LIST_ELEMENT_TAG, XSDConstants.ITEMTYPE_ATTRIBUTE)); - - references.put(IXSDSearchConstants.SIMPLE_TYPE_META_NAME, patterns); - - } - - protected void initializeDeclarations(){ - - declarations = new HashMap(); - String ns = IXSDSearchConstants.XMLSCHEMA_NAMESPACE; - - SearchPattern pattern = new XMLSearchPattern( ns, "element", "name"); - declarations.put(IXSDSearchConstants.ELEMENT_META_NAME, pattern); - - pattern = new XMLSearchPattern(ns, "complexType", "name"); - declarations.put(IXSDSearchConstants.COMPLEX_TYPE_META_NAME, pattern); - - pattern = new XMLSearchPattern(ns, "simpleType", "name"); - declarations.put(IXSDSearchConstants.SIMPLE_TYPE_META_NAME, pattern); - - pattern = new XMLSearchPattern(ns, "attribute", "name"); - declarations.put(IXSDSearchConstants.ATTRIBUTE_META_NAME, pattern); - - pattern = new XMLSearchPattern(ns, "attributeGroup", "name"); - declarations.put(IXSDSearchConstants.ATTRIBUTE_GROUP_META_NAME, pattern); - - pattern = new XMLSearchPattern(ns, "group", "name"); - declarations.put(IXSDSearchConstants.GROUP_META_NAME, pattern); - - } - - protected void initializeSupportedNamespaces() { - namespaces = new String[]{ IXSDSearchConstants.XMLSCHEMA_NAMESPACE}; - } - - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java deleted file mode 100644 index 2051804c7e..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search; - -import java.util.Map; -import org.eclipse.wst.common.core.search.pattern.SearchPattern; -import org.eclipse.wst.xml.core.internal.search.ComponentSearchContributor; -import org.eclipse.wst.xml.core.internal.search.XMLComponentSearchPattern; -import org.eclipse.wst.xml.core.internal.search.XMLSearchParticipant; - -public class XSDSearchParticipant extends XMLSearchParticipant { - - private static String ID = "org.eclipse.wst.xsd.search.XSDSearchParticipant"; - - public XSDSearchParticipant() - { - super(); - id = ID; - } - - public String[] getSupportedContentTypes() - { - String[] result = { "org.eclipse.wst.xsd.core.xsdsource" }; - return result; - } - - public boolean isApplicable(SearchPattern pattern, Map searchOptions) - { - if(pattern instanceof XMLComponentSearchPattern ){ - XMLComponentSearchPattern componentPattern = (XMLComponentSearchPattern)pattern; - String namespace = componentPattern.getMetaName().getNamespace(); - if(IXSDSearchConstants.XMLSCHEMA_NAMESPACE.equals(namespace)){ - return true; - } - } - return false; - } - - public ComponentSearchContributor getSearchContributor() { - return new XSDSearchContributor(); - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java deleted file mode 100644 index 4dfefbde7f..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search; - -import org.eclipse.core.resources.IFile; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.core.search.pattern.SearchPattern; -import org.eclipse.wst.common.core.search.scope.SearchScope; -import org.eclipse.wst.common.ui.internal.search.AbstractSearchQuery; -import org.eclipse.wst.xml.core.internal.search.XMLComponentDeclarationPattern; -import org.eclipse.wst.xml.core.internal.search.XMLComponentReferencePattern; - -public class XSDSearchQuery extends AbstractSearchQuery -{ - public final static int LIMIT_TO_DECLARATIONS = 1; - public final static int LIMIT_TO_REFERENCES = 2; - - int fLimitTo = 0; - IFile fContextFile; - QualifiedName fElementQName; - QualifiedName fTypeName; - - public XSDSearchQuery(String pattern, IFile file, QualifiedName elementQName, QualifiedName typeName, int limitTo, SearchScope scope, String scopeDescription) - { - super(pattern, scope, scopeDescription); - fLimitTo = limitTo; - fContextFile = file; - fElementQName = elementQName; - fTypeName = typeName; - } - - protected SearchPattern createSearchPattern(QualifiedName typeName) - { - if (fLimitTo == LIMIT_TO_DECLARATIONS) - { - return new XMLComponentDeclarationPattern(fContextFile, fElementQName, fTypeName); - } - else if (fLimitTo == LIMIT_TO_REFERENCES) - { - return new XMLComponentReferencePattern(fContextFile, fElementQName, fTypeName); - } - return null; - } -} - diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java deleted file mode 100644 index add0d884b6..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuCreator; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.events.MenuAdapter; -import org.eclipse.swt.events.MenuEvent; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.ui.IEditorActionDelegate; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - -public abstract class BaseGroupActionDelegate implements IObjectActionDelegate, IEditorActionDelegate, IMenuCreator -{ - protected ISelection fSelection; - private IAction fDelegateAction; - // whether to re-fill the menu (reset on selection change) - private boolean fFillMenu = true; - protected IWorkbenchPart workbenchPart; - - - public BaseGroupActionDelegate() - { - - } - - /* - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - workbenchPart = targetPart; - } - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#dispose() - */ - public void dispose() { - // nothing to do - } - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control) - */ - public Menu getMenu(Control parent) { - // never called - return null; - } - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu) - */ - public Menu getMenu(Menu parent) { - //Create the new menu. The menu will get filled when it is about to be shown. see fillMenu(Menu). - Menu menu = new Menu(parent); - /** - * Add listener to repopulate the menu each time - * it is shown because MenuManager.update(boolean, boolean) - * doesn't dispose pulldown ActionContribution items for each popup menu. - */ - menu.addMenuListener(new MenuAdapter() { - public void menuShown(MenuEvent e) { - if (fFillMenu) { - Menu m = (Menu)e.widget; - MenuItem[] items = m.getItems(); - for (int i=0; i < items.length; i++) { - items[i].dispose(); - } - fillMenu(m); - fFillMenu = false; - } - } - }); - return menu; - } - - /* - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - // Never called because we become a menu. - } - - /* - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - fDelegateAction = action; - updateWith(selection); - - } - - public void setActiveEditor(IAction action, IEditorPart targetEditor) { - workbenchPart = targetEditor; - fDelegateAction = action; - if (targetEditor != null && targetEditor.getEditorSite() != null && targetEditor.getEditorSite().getSelectionProvider() != null) { - updateWith(targetEditor.getEditorSite().getSelectionProvider().getSelection()); - } - - } - - public void updateWith(ISelection selection) { - fSelection = selection; - if (fDelegateAction != null) { - boolean enable = false; - if (selection != null) { - if (selection instanceof ITextSelection) { - //if (((ITextSelection) selection).getLength() > 0) { - enable = true; - //} - } - else if(selection instanceof IStructuredSelection ){ - enable = !selection.isEmpty(); - } - } - // enable action - fDelegateAction.setEnabled(enable); - - // fill submenu - fFillMenu = true; - fDelegateAction.setMenuCreator(this); - - - } - - } - - - protected abstract void fillMenu(Menu menu); - - - -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java deleted file mode 100644 index 0bc530a597..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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 - *******************************************************************************/ -// TODO... open a bugzilla to get the JDT class moved to non internal platform -package org.eclipse.wst.xsd.ui.internal.search.actions; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.util.Assert; - -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.actions.ActionContext; -import org.eclipse.ui.actions.ActionGroup; - -public class CompositeActionGroup extends ActionGroup { - - private ActionGroup[] fGroups; - - public CompositeActionGroup() { - } - - public CompositeActionGroup(ActionGroup[] groups) { - setGroups(groups); - } - - protected void setGroups(ActionGroup[] groups) { - Assert.isTrue(fGroups == null); - Assert.isNotNull(groups); - fGroups= groups; - } - - public ActionGroup get(int index) { - if (fGroups == null) - return null; - return fGroups[index]; - } - - public void addGroup(ActionGroup group) { - if (fGroups == null) { - fGroups= new ActionGroup[] { group }; - } else { - ActionGroup[] newGroups= new ActionGroup[fGroups.length + 1]; - System.arraycopy(fGroups, 0, newGroups, 0, fGroups.length); - newGroups[fGroups.length]= group; - fGroups= newGroups; - } - } - - public void dispose() { - super.dispose(); - if (fGroups == null) - return; - for (int i= 0; i < fGroups.length; i++) { - fGroups[i].dispose(); - } - } - - public void fillActionBars(IActionBars actionBars) { - super.fillActionBars(actionBars); - if (fGroups == null) - return; - for (int i= 0; i < fGroups.length; i++) { - fGroups[i].fillActionBars(actionBars); - } - } - - public void fillContextMenu(IMenuManager menu) { - super.fillContextMenu(menu); - if (fGroups == null) - return; - for (int i= 0; i < fGroups.length; i++) { - fGroups[i].fillContextMenu(menu); - } - } - - public void setContext(ActionContext context) { - super.setContext(context); - if (fGroups == null) - return; - for (int i= 0; i < fGroups.length; i++) { - fGroups[i].setContext(context); - } - } - - public void updateActionBars() { - super.updateActionBars(); - if (fGroups == null) - return; - for (int i= 0; i < fGroups.length; i++) { - fGroups[i].updateActionBars(); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java deleted file mode 100644 index 05308e26c2..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -// TODO.. fill in the content -public class DeclarationsSearchGroup -{ -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java deleted file mode 100644 index c4d666421b..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.ui.IEditorPart; -public class FindAction extends Action implements ISelectionChangedListener -{ - IEditorPart editor; - - protected FindAction(IEditorPart editor) - { - this.editor = editor; - } - - public void selectionChanged(SelectionChangedEvent event) - { - // TODO Auto-generated method stub - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java deleted file mode 100644 index c7a95205ac..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; -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.xsd.ui.internal.editor.ISelectionMapper; -import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants; -import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDNamedComponent; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -public class FindReferencesAction extends FindAction -{ - public FindReferencesAction(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 XSD - * component given to this method. - * - * @param component - * The component of which we want to determine the name - * @return - */ - protected QualifiedName determineMetaName(XSDNamedComponent component) - { - QualifiedName metaName = null; - if (component instanceof XSDComplexTypeDefinition) - { - metaName = IXSDSearchConstants.COMPLEX_TYPE_META_NAME; - } - else if (component instanceof XSDSimpleTypeDefinition) - { - metaName = IXSDSearchConstants.SIMPLE_TYPE_META_NAME; - } - else if (component instanceof XSDElementDeclaration) - { - metaName = IXSDSearchConstants.ELEMENT_META_NAME; - } - return metaName; - } - - protected XSDNamedComponent getXSDNamedComponent() - { - 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 XSDNamedComponent) - { - return (XSDNamedComponent) o; - } - } - } - } - // The expected component we get from the editor does not meet - // our expectation - return null; - } - - public void run() - { - 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()); - SearchScope scope = new WorkspaceSearchScope(); - String scopeDescription = "Workspace"; - XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription); - NewSearchUI.activateSearchResultView(); - NewSearchUI.runQueryInBackground(searchQuery); - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java deleted file mode 100644 index cab3b943b1..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.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.xsd.ui.internal.search.XSDSearchQuery; -import org.eclipse.xsd.XSDNamedComponent; -public class FindReferencesInProjectAction extends FindReferencesAction -{ - public FindReferencesInProjectAction(IEditorPart editor) - { - super(editor); - } - - public void run() - { - 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()); - IPath fullPath = (IPath) file.getFullPath(); - ProjectSearchScope scope = new ProjectSearchScope(fullPath); - String scopeDescription = "Workspace"; - XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription); - NewSearchUI.activateSearchResultView(); - NewSearchUI.runQueryInBackground(searchQuery); - } - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java deleted file mode 100644 index 72e82a4500..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.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.xsd.ui.internal.editor.XSDEditorPlugin; -import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery; -import org.eclipse.xsd.XSDNamedComponent; - -public class FindReferencesInWorkingSetAction extends FindReferencesAction{ - - public FindReferencesInWorkingSetAction(IEditorPart editor) { - super(editor); - } - - public void setActionDefinitionId(String string) - { - - } - - 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 = "Workspace"; - XSDSearchQuery searchQuery = - new XSDSearchQuery(pattern, file, elementQName, metaName, 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.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java deleted file mode 100644 index 0efc8ff10a..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -// TODO... fill in the content -public class ImplementorsSearchGroup -{ -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java deleted file mode 100644 index 463e241e49..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -// TODO... fill in the content -public class OccurrencesSearchGroup -{ -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java deleted file mode 100644 index 0bbd916389..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -import java.util.List; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchSite; - - -public class ReferencesSearchGroup extends SearchGroup { - - private static final String MENU_TEXT= "References...";//SearchMessages.group_references; - - private IWorkbenchSite fSite; - private IEditorPart fEditor; - private IActionBars fActionBars; - -// private String fGroupId; - - private FindReferencesAction fFindReferencesAction; - private FindReferencesInProjectAction fFindReferencesInProjectAction; - private FindReferencesInWorkingSetAction fFindReferencesInWorkingSetAction; - - - /** - * Note: This constructor is for internal use only. Clients should not call this constructor. - * @param editor - */ - public ReferencesSearchGroup(IEditorPart editor) { - Assert.isNotNull(editor); - fEditor= editor; - fSite= fEditor.getSite(); -// fGroupId= ITextEditorActionConstants.GROUP_FIND; - - fFindReferencesAction= new FindReferencesAction(editor); - fFindReferencesAction.setText("Workspace"); - fFindReferencesAction.setActionDefinitionId("SEARCH_REFERENCES_IN_WORKSPACE"); - //fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$ - - fFindReferencesInProjectAction= new FindReferencesInProjectAction(fEditor); - fFindReferencesInProjectAction.setText("Project"); - fFindReferencesInProjectAction.setActionDefinitionId("SEARCH_REFERENCES_IN_PROJECT"); - //fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$ - - fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(fEditor); - fFindReferencesInWorkingSetAction.setText("Working Set..."); - fFindReferencesInWorkingSetAction.setActionDefinitionId(".SEARCH_REFERENCES_IN_WORKING_SET"); - //fEditor.setAction("SearchReferencesInWorkingSet", fFindReferencesInWorkingSetAction); //$NON-NLS-1$ - } - - /* - private void registerAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection) { - action.update(selection); - provider.addSelectionChangedListener(action); - }*/ - - /** - * Note: this method is for internal use only. Clients should not call this method. - * - * @return the menu label - */ - protected String getName() { - return MENU_TEXT; - } - - public void fillActions(List list) - { - list.add(fFindReferencesAction); - //list.add(fFindReferencesInHierarchyAction); - list.add(fFindReferencesInProjectAction); - list.add(new Separator()); - list.add(fFindReferencesInWorkingSetAction); - } - - /* (non-Javadoc) - * Method declared in ActionGroup - */ - public void fillActionBars(IActionBars actionBars) { - Assert.isNotNull(actionBars); - super.fillActionBars(actionBars); - fActionBars= actionBars; - updateGlobalActionHandlers(); - } - - -// private void addAction(IAction action, IMenuManager manager) { -// if (action.isEnabled()) { -// manager.add(action); -// } -// } - - /* - private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) { - FindAction action; - if (fEditor != null) - action= new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets)); - else - action= new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets)); - action.update(getContext().getSelection()); - addAction(action, manager); - } - */ - - /* (non-Javadoc) - * Method declared on ActionGroup. - */ - public void fillContextMenu(IMenuManager manager) { - /* - MenuManager javaSearchMM= new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH); - addAction(fFindReferencesAction, javaSearchMM); - addAction(fFindReferencesInProjectAction, javaSearchMM); - addAction(fFindReferencesInHierarchyAction, javaSearchMM); - - javaSearchMM.add(new Separator()); - - Iterator iter= SearchUtil.getLRUWorkingSets().sortedIterator(); - while (iter.hasNext()) { - addWorkingSetAction((IWorkingSet[]) iter.next(), javaSearchMM); - } - addAction(fFindReferencesInWorkingSetAction, javaSearchMM); - - if (!javaSearchMM.isEmpty()) - manager.appendToGroup(fGroupId, javaSearchMM); - */ - } - - /* - * Overrides method declared in ActionGroup - */ - public void dispose() { - ISelectionProvider provider= fSite.getSelectionProvider(); - if (provider != null) { - disposeAction(fFindReferencesAction, provider); - disposeAction(fFindReferencesInProjectAction, provider); - // disposeAction(fFindReferencesInHierarchyAction, provider); - disposeAction(fFindReferencesInWorkingSetAction, provider); - } - fFindReferencesAction= null; - fFindReferencesInProjectAction= null; - //fFindReferencesInHierarchyAction= null; - fFindReferencesInWorkingSetAction= null; - updateGlobalActionHandlers(); - super.dispose(); - } - - private void updateGlobalActionHandlers() { - if (fActionBars != null) { -// fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_WORKSPACE, fFindReferencesAction); -// fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_PROJECT, fFindReferencesInProjectAction); -// fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_HIERARCHY, fFindReferencesInHierarchyAction); -// fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_WORKING_SET, fFindReferencesInWorkingSetAction); - } - } - - private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) { - if (action != null) - provider.removeSelectionChangedListener(action); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java deleted file mode 100644 index 18071ba221..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -import java.util.List; -import org.eclipse.ui.actions.ActionGroup; - -public abstract class SearchGroup extends ActionGroup -{ - public abstract void fillActions(List list); -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java deleted file mode 100644 index ec6846db85..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -import org.eclipse.jface.util.Assert; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.ActionGroup; - -public class XSDSearchActionGroup extends ActionGroup -{ -// private ReferencesSearchGroup fReferencesGroup; -// private DeclarationsSearchGroup fDeclarationsGroup; -// private ImplementorsSearchGroup fImplementorsGroup; -// private OccurrencesSearchGroup fOccurrencesGroup; -// private IEditorPart fEditor; - - public XSDSearchActionGroup(IEditorPart editor) - { - Assert.isNotNull(editor); -// fEditor = editor; -// fReferencesGroup = new ReferencesSearchGroup(editor); -// fDeclarationsGroup = new DeclarationsSearchGroup(); -// fImplementorsGroup = new ImplementorsSearchGroup(); -// fOccurrencesGroup = new OccurrencesSearchGroup(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java deleted file mode 100644 index 91c55c61d1..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -import org.eclipse.swt.widgets.Menu; - -//org.eclipse.wst.xsd.ui.internal.search.actions.XSDSearchGroupActionDelegate -public class XSDSearchDeclarationsGroupActionDelegate extends BaseGroupActionDelegate -{ - protected void fillMenu(Menu menu) { - - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java deleted file mode 100644 index 65d6ff4cbd..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -import java.util.ArrayList; -import java.util.Iterator; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.Separator; -import org.eclipse.ui.actions.CompoundContributionItem; - -public class XSDSearchGroupSubMenu extends CompoundContributionItem -{ - SearchGroup searchActionGroup; - - public XSDSearchGroupSubMenu(SearchGroup refactorMenuGroup) - { - super(); - searchActionGroup = refactorMenuGroup; - } - - public XSDSearchGroupSubMenu(String id) - { - super(id); - } - - protected IContributionItem[] getContributionItems() - { - ArrayList actionsList = new ArrayList(); - ArrayList contribList = new ArrayList(); - searchActionGroup.fillActions(actionsList); - if (actionsList != null && !actionsList.isEmpty()) - { - for (Iterator iter = actionsList.iterator(); iter.hasNext();) - { - Object o = iter.next(); - if (o instanceof IAction) - { - IAction action = (IAction)o; - contribList.add(new ActionContributionItem(action)); - } - else if (o instanceof Separator) - { - Separator separator = (Separator)o; - contribList.add(separator); - } - } - } - else - { - Action dummyAction = new Action("XSDSeachActionGroup_no_refactoring_available") - { - // dummy inner class; no methods - }; - dummyAction.setEnabled(false); - contribList.add(new ActionContributionItem(dummyAction)); - } - return (IContributionItem[]) contribList.toArray(new IContributionItem[contribList.size()]); - } -} diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java deleted file mode 100644 index 6466896520..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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.xsd.ui.internal.search.actions; - -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.IEditorPart; - -//org.eclipse.wst.xsd.ui.internal.search.actions.XSDSearchGroupActionDelegate -public class XSDSearchReferencesGroupActionDelegate extends BaseGroupActionDelegate -{ - protected void fillMenu(Menu menu) { - try - { - if (fSelection == null) { - return; - } - if (workbenchPart instanceof IEditorPart) - { - ReferencesSearchGroup referencesGroup = new ReferencesSearchGroup((IEditorPart)workbenchPart); - XSDSearchGroupSubMenu subMenu = new XSDSearchGroupSubMenu(referencesGroup); - subMenu.fill(menu, -1); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } -} |