Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor')
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/WSDLComponentRenameParticipant.java43
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/RenameComponentAction.java204
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorActionGroup.java46
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorGroupActionDelegate.java61
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLSelectionDispatchAction.java39
5 files changed, 0 insertions, 393 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/WSDLComponentRenameParticipant.java b/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/WSDLComponentRenameParticipant.java
deleted file mode 100644
index ecfc73d5d..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/WSDLComponentRenameParticipant.java
+++ /dev/null
@@ -1,43 +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.refactor;
-
-import java.util.List;
-
-import org.eclipse.wst.wsdl.WSDLElement;
-import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.ComponentRenameArguments;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.XMLComponentRenameParticipant;
-import org.eclipse.xsd.XSDNamedComponent;
-
-/**
- * This participant takes case of renaming matches that are XSD components
- */
-public class WSDLComponentRenameParticipant extends XMLComponentRenameParticipant {
-
- protected boolean initialize(Object element) {
-
- if(element instanceof WSDLElement || element instanceof XSDNamedComponent){
- if(getArguments() instanceof ComponentRenameArguments){
- matches = (List)((ComponentRenameArguments)getArguments()).getMatches().get(IWSDLSearchConstants.WSDL_NAMESPACE);
- }
- if(matches != null){
- return true;
- }
- }
- return false;
- }
-
- public String getName() {
-
- return "WSDL component rename participant"; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/RenameComponentAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/RenameComponentAction.java
deleted file mode 100644
index 0939528e2..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/RenameComponentAction.java
+++ /dev/null
@@ -1,204 +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.refactor.actions;
-
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.actions.GlobalBuildAction;
-import org.eclipse.wst.common.ui.internal.dialogs.SaveDirtyFilesDialog;
-import org.eclipse.wst.wsdl.Binding;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.Message;
-import org.eclipse.wst.wsdl.PortType;
-import org.eclipse.wst.wsdl.WSDLElement;
-import org.eclipse.wst.wsdl.internal.impl.DefinitionImpl;
-import org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl;
-import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin;
-import org.eclipse.wst.wsdl.ui.internal.util.NodeAssociationManager;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringComponent;
-import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
-import org.eclipse.wst.xsd.ui.internal.refactor.XMLRefactoringComponent;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameComponentProcessor;
-import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.w3c.dom.Element;
-
-public class RenameComponentAction extends WSDLSelectionDispatchAction {
-
- private RefactoringComponent selectedComponent;
-
- public RenameComponentAction(ISelection selection,
- Definition model) {
- super(selection);
- setModel(model);
- }
-
- protected boolean doCanEnableXSDSelection(XSDNamedComponent selectedObject) {
-
- selectedComponent = null;
- if (selectedObject != null) {
- selectedComponent = new XMLRefactoringComponent(
- selectedObject,
- (IDOMElement)selectedObject.getElement(),
- selectedObject.getName(),
- selectedObject.getTargetNamespace());
-
- // if it's element reference, then this action is not appropriate
- if (selectedObject instanceof XSDElementDeclaration) {
- XSDElementDeclaration element = (XSDElementDeclaration) selectedObject;
- if (element.isElementDeclarationReference()) {
- selectedComponent = null;
- }
- }
- if(selectedObject instanceof XSDTypeDefinition){
- XSDTypeDefinition type = (XSDTypeDefinition) selectedObject;
- XSDConcreteComponent parent = type.getContainer();
- if (parent instanceof XSDElementDeclaration) {
- XSDElementDeclaration element = (XSDElementDeclaration) parent;
- if(element.getAnonymousTypeDefinition().equals(type)){
- selectedComponent = null;
- }
- }
- else if(parent instanceof XSDAttributeDeclaration) {
- XSDAttributeDeclaration element = (XSDAttributeDeclaration) parent;
- if(element.getAnonymousTypeDefinition().equals(type)){
- selectedComponent = null;
- }
- }
- }
- }
-
- return canRun();
- }
-
- protected boolean doCanEnableWSDLSelection(WSDLElement selectedObject) {
-
- selectedComponent = null;
- String localName = null;
- String namespace = null;
- if (selectedObject instanceof Binding){
- localName = ((Binding)selectedObject).getQName().getLocalPart();
- namespace = ((Binding)selectedObject).getQName().getNamespaceURI();
- }
- else if (selectedObject instanceof PortType){
- localName = ((PortType)selectedObject).getQName().getLocalPart();
- namespace = ((PortType)selectedObject).getQName().getNamespaceURI();
- }
- else if (selectedObject instanceof Message){
- localName = ((Message)selectedObject).getQName().getLocalPart();
- namespace = ((Message)selectedObject).getQName().getNamespaceURI();
- }
- if(localName != null){
- selectedComponent = new XMLRefactoringComponent(
- selectedObject,
- (IDOMElement)selectedObject.getElement(),
- localName,
- namespace);
- }
-
-
- return canRun();
- }
-
- protected boolean canEnable(Object selectedObject) {
-
- if (selectedObject instanceof XSDNamedComponent) {
- return doCanEnableXSDSelection((XSDNamedComponent) selectedObject);
- } else if(selectedObject instanceof WSDLElementImpl){
- return doCanEnableWSDLSelection((WSDLElementImpl) selectedObject);
- }
- if (selectedObject instanceof Element) {
- Element node = (Element) selectedObject;
- if (getDefinition() != null) {
- // issue (eb) dependency on utility class to get component from the model based on element
- Object concreteComponent = (new NodeAssociationManager()).getModelObjectForNode(getDefinition(), node);
- return canEnable(concreteComponent);
- }
- }
- return false;
-
- }
-
- public boolean canRun() {
-
- return selectedComponent != null;
- }
-
- public void run(ISelection selection) {
-
- boolean rc = SaveDirtyFilesDialog.saveDirtyFiles();
- if (!rc)
- {
- return;
- }
- RenameComponentProcessor processor = new RenameComponentProcessor(selectedComponent, selectedComponent.getName());
- RenameRefactoring refactoring = new RenameRefactoring(processor);
- try {
- RefactoringWizard wizard = new RenameRefactoringWizard(
- refactoring,
- RefactoringMessages
- .getString("RenameComponentWizard.defaultPageTitle"), //$NON-NLS-1$ TODO: provide correct strings
- RefactoringMessages
- .getString("RenameComponentWizard.inputPage.description"), //$NON-NLS-1$
- null)
- {
- public boolean performFinish()
- {
- // TODO Auto-generated method stub
- boolean rc = super.performFinish();
- //((DefinitionImpl)getDefinition()).reconcileReferences(true);
- return rc;
- }
-
- };
- RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(
- wizard);
- op.run(WSDLEditorPlugin.getShell(), wizard
- .getDefaultPageTitle());
- triggerBuild();
-
- Display.getCurrent().asyncExec(new Runnable()
- {
- public void run()
- {
- ((DefinitionImpl)getDefinition()).reconcileReferences(true);
- }
- });
-
- } catch (InterruptedException e) {
- // do nothing. User action got cancelled
- }
-
- if (getModel() instanceof DefinitionImpl) {
- ((DefinitionImpl) getModel()).reconcileReferences(true);
- }
- }
-
- public static void triggerBuild() {
- if (ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding()) {
- new GlobalBuildAction(WSDLEditorPlugin.getInstance().getWorkbench()
- .getActiveWorkbenchWindow(),
- IncrementalProjectBuilder.INCREMENTAL_BUILD).run();
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorActionGroup.java b/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorActionGroup.java
deleted file mode 100644
index cd4a71692..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorActionGroup.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.refactor.actions;
-
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.xsd.ui.internal.refactor.actions.RenameAction;
-import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup;
-
-public class WSDLRefactorActionGroup extends RefactorActionGroup {
-
-
- private static final String RENAME_ELEMENT = "org.eclipse.wst.wsdl.ui.refactor.rename.element"; //$NON-NLS-1$
-
-
- public WSDLRefactorActionGroup(ISelection selection,
- Definition definition) {
-
- super(selection);
- if( definition != null){
- fEditorActions = new ArrayList();
- RenameComponentAction action = new RenameComponentAction(selection, definition);
- fRenameAction = new RenameAction(selection);
- fRenameAction.setRenameComponentAction(action);
- fRenameAction.setActionDefinitionId(RENAME_ELEMENT);
- fEditorActions.add(fRenameAction);
- initAction(fRenameAction, selection);
- }
- }
-
- public void dispose() {
- //disposeAction(fRenameAction, fSelectionProvider);
- super.dispose();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorGroupActionDelegate.java b/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorGroupActionDelegate.java
deleted file mode 100644
index a245f9e24..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLRefactorGroupActionDelegate.java
+++ /dev/null
@@ -1,61 +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.refactor.actions;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.ui.internal.ISelectionMapper;
-import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup;
-import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupActionDelegate;
-import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupSubMenu;
-
-public class WSDLRefactorGroupActionDelegate extends RefactorGroupActionDelegate
-{
- public WSDLRefactorGroupActionDelegate()
- {
- super();
- }
- /**
- * Fills the menu with applicable refactor sub-menues
- *
- * @param menu
- * The menu to fill
- */
- protected void fillMenu(Menu menu)
- {
- if (fSelection == null)
- {
- return;
- }
- if (workbenchPart != null)
- {
- IWorkbenchPartSite site = workbenchPart.getSite();
- if (site == null)
- return;
- IEditorPart editor = site.getPage().getActiveEditor();
- if (editor != null)
- {
- ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class);
- ISelection selection = mapper != null ? mapper.mapSelection(fSelection) : fSelection;
- Definition definition = (Definition) editor.getAdapter(Definition.class);
- if (definition != null)
- {
- RefactorActionGroup refactorMenuGroup = new WSDLRefactorActionGroup(selection, definition);
- RefactorGroupSubMenu subMenu = new RefactorGroupSubMenu(refactorMenuGroup);
- subMenu.fill(menu, -1);
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLSelectionDispatchAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLSelectionDispatchAction.java
deleted file mode 100644
index a80f6344c..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-refactor/org/eclipse/wst/wsdl/ui/internal/refactor/actions/WSDLSelectionDispatchAction.java
+++ /dev/null
@@ -1,39 +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.refactor.actions;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.xsd.ui.internal.refactor.actions.SelectionDispatchAction;
-
-
-public class WSDLSelectionDispatchAction extends SelectionDispatchAction
-{
- public static final String RENAME_ELEMENT = "org.eclipse.wst.wsdl.ui.refactor.rename.element"; //$NON-NLS-1$
-
- public WSDLSelectionDispatchAction(ISelection selection)
- {
- super(selection);
- }
-
- protected Definition getDefinition(){
- Object model = getModel();
- if(model instanceof Definition)
- {
- return (Definition) model;
- }
-
- return null;
- }
-
-
-
-}

Back to the top