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.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java215
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java146
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java57
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java257
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties55
7 files changed, 0 insertions, 872 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java
deleted file mode 100644
index 7318d093ef..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java
+++ /dev/null
@@ -1,215 +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.xsd.ui.internal.refactor.wizard;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.wst.xsd.ui.internal.refactor.actions.RenameAction;
-import org.eclipse.wst.xsd.ui.internal.refactor.actions.SelectionDispatchAction;
-
-/**
- * Action group that adds refactor actions (for example 'Rename', 'Move') to a
- * context menu and the global menu bar.
- *
- */
-public abstract class RefactorActionGroup extends ActionGroup {
-
- private static class NoActionAvailable extends Action {
- public NoActionAvailable() {
- setEnabled(true);
- setText(RefactoringWizardMessages.RefactorActionGroup_no_refactoring_available);
- }
- }
-
- /**
- * Pop-up menu: name of group for reorganize actions (value
- * <code>"group.reorganize"</code>).
- */
- public static final String GROUP_REORGANIZE = IWorkbenchActionConstants.GROUP_REORGANIZE;
-
- public static final String MENU_ID = "org.eclipse.wst.xsd.ui.refactoring.menu"; //$NON-NLS-1$
-
- public static final String RENAME = "org.eclipse.wst.xsd.ui.refactoring.actions.Rename"; //$NON-NLS-1$
-
-
- protected static void initAction(SelectionDispatchAction action,
- ISelection selection) {
-
- Assert.isNotNull(selection);
- Assert.isNotNull(action);
- action.update(selection);
- //provider.addSelectionChangedListener(action);
- }
-
- protected List fEditorActions;
-
- private String fGroupName = GROUP_REORGANIZE;
-
- private Action fNoActionAvailable = new NoActionAvailable();
-
- protected RenameAction fRenameAction;
-
- protected SelectionDispatchAction fRenameTargetNamespace;
-
- protected ISelection selection;
-
- public RefactorActionGroup(ISelection selection) {
- this.selection = selection;
-
- }
-
- public int addAction(IAction action) {
- if (action != null && action.isEnabled()) {
- fEditorActions.add(action);
- return 1;
- }
- return 0;
- }
-
- private void addRefactorSubmenu(IMenuManager menu) {
-
- IMenuManager refactorSubmenu = new MenuManager(RefactoringWizardMessages.RefactorMenu_label, MENU_ID);
- refactorSubmenu.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- refactorMenuShown(manager);
- }
- });
- refactorSubmenu.add(fNoActionAvailable);
- if (menu.find(refactorSubmenu.getId()) == null) {
- if (menu.find(fGroupName) == null) {
- menu.add(refactorSubmenu);
- } else {
- menu.appendToGroup(fGroupName, refactorSubmenu);
- }
- }
- }
-
- protected void disposeAction(ISelectionChangedListener action,
- ISelectionProvider provider) {
- if (action != null)
- provider.removeSelectionChangedListener(action);
- }
-
- /*
- * (non-Javadoc) Method declared in ActionGroup
- */
- public void fillActionBars(IActionBars actionBars) {
- super.fillActionBars(actionBars);
- actionBars.setGlobalActionHandler(RENAME, fRenameAction);
- retargetFileMenuActions(actionBars);
- }
-
- public void fillActions(List enabledActions) {
-
- if(selection != null && fEditorActions != null){
- for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
- Action action = (Action) iter.next();
- if (action instanceof SelectionDispatchAction) {
- SelectionDispatchAction selectionAction = (SelectionDispatchAction) action;
- selectionAction.update(selection);
- }
-
- }
- for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
- Action action = (Action) iter.next();
- if (action != null) {
- enabledActions.add(action);
- }
- }
- }
-
- }
-
- /*
- * (non-Javadoc) Method declared in ActionGroup
- */
- public void fillContextMenu(IMenuManager menu) {
- super.fillContextMenu(menu);
- addRefactorSubmenu(menu);
- }
-
- private int fillRefactorMenu(IMenuManager refactorSubmenu) {
- int added = 0;
- refactorSubmenu.add(new Separator(GROUP_REORGANIZE));
- for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
- Action action = (Action) iter.next();
- if (action != null && action.isEnabled()) {
- fEditorActions.add(action);
- return 1;
- }
- }
- return added;
- }
-
- private void refactorMenuHidden(IMenuManager manager) {
-
- for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
- Action action = (Action) iter.next();
- if (action instanceof SelectionDispatchAction) {
- SelectionDispatchAction selectionAction = (SelectionDispatchAction) action;
- selectionAction.update(selection);
- }
-
- }
- }
-
- private void refactorMenuShown(final IMenuManager refactorSubmenu) {
- // we know that we have an MenuManager since we created it in
- // addRefactorSubmenu.
- Menu menu = ((MenuManager) refactorSubmenu).getMenu();
- menu.addMenuListener(new MenuAdapter() {
- public void menuHidden(MenuEvent e) {
- refactorMenuHidden(refactorSubmenu);
- }
- });
-
- for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
- Action action = (Action) iter.next();
- if (action instanceof SelectionDispatchAction) {
- SelectionDispatchAction selectionAction = (SelectionDispatchAction) action;
- selectionAction.update(selection);
- }
- }
- refactorSubmenu.removeAll();
- if (fillRefactorMenu(refactorSubmenu) == 0)
- refactorSubmenu.add(fNoActionAvailable);
- }
-
- /**
- * Retargets the File actions with the corresponding refactoring actions.
- *
- * @param actionBars
- * the action bar to register the move and rename action with
- */
- public void retargetFileMenuActions(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(),
- fRenameAction);
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java
deleted file mode 100644
index 29c56783ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java
+++ /dev/null
@@ -1,146 +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.refactor.wizard;
-
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-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 RefactorGroupActionDelegate 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;
- protected ResourceSet resourceSet = new ResourceSetImpl();
-
-
- public RefactorGroupActionDelegate() {
-
- }
-
- /*
- * @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-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java
deleted file mode 100644
index 77780e100f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java
+++ /dev/null
@@ -1,57 +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.refactor.wizard;
-
-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.ui.actions.CompoundContributionItem;
-
-public class RefactorGroupSubMenu extends CompoundContributionItem {
-
- RefactorActionGroup fRefactorMenuGroup;
-
-
- public RefactorGroupSubMenu(RefactorActionGroup refactorMenuGroup) {
- super();
- fRefactorMenuGroup = refactorMenuGroup;
- }
-
- public RefactorGroupSubMenu(String id) {
- super(id);
- }
-
- protected IContributionItem[] getContributionItems() {
- ArrayList actionsList = new ArrayList();
- ArrayList contribList = new ArrayList();
- fRefactorMenuGroup.fillActions(actionsList);
-
- if (actionsList != null && !actionsList.isEmpty()) {
- for (Iterator iter = actionsList.iterator(); iter.hasNext();) {
- IAction action = (IAction) iter.next();
- contribList.add(new ActionContributionItem(action));
- }
- } else {
- Action dummyAction = new Action(RefactoringWizardMessages.RefactorActionGroup_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-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java
deleted file mode 100644
index 6bac54b55e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java
+++ /dev/null
@@ -1,70 +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.xsd.ui.internal.refactor.wizard;
-
-import org.eclipse.osgi.util.NLS;
-
-public class RefactoringWizardMessages extends NLS {
-
- private static final String BUNDLE_NAME= "org.eclipse.wst.xsd.ui.internal.refactor.wizard.messages";//$NON-NLS-1$
-
- public static String RefactorMenu_label;
- public static String RefactorActionGroup_no_refactoring_available;
-
- public static String RenameAction_rename;
- public static String RenameAction_unavailable;
- public static String RenameAction_text;
-
- public static String RenameInputWizardPage_new_name;
- public static String RenameRefactoringWizard_internal_error;
-
- public static String RenameTargetNamespace_text;
-
- public static String RenameXSDElementAction_exception;
- public static String RenameXSDElementAction_not_available;
- public static String RenameXSDElementAction_name;
-
- public static String RenameSupport_dialog_title;
- public static String RenameSupport_not_available;
-
- public static String RenameComponentWizard_defaultPageTitle;
- public static String RenameComponentWizard_inputPage_description;
-
- public static String RenameInputWizardPage_update_references;
- public static String XSDComponentRenameChange_name;
- public static String XSDComponentRenameChange_Renaming;
- public static String ResourceRenameParticipant_compositeChangeName;
- public static String RenameResourceChange_rename_resource_reference_change;
- public static String XSDRenameResourceChange_name;
- public static String RenameResourceRefactoring_Internal_Error;
- public static String RenameResourceRefactoring_alread_exists;
- public static String RenameResourceRefactoring_invalidName;
- public static String RenameResourceProcessor_name;
- public static String MakeAnonymousTypeGlobalAction_text;
- public static String MakeLocalElementGlobalAction_text;
- public static String XSDComponentRenameParticipant_Component_Refactoring_updates;
- public static String WSDLComponentRenameParticipant_Component_Refactoring_updates;
- public static String RenameComponentProcessor_Component_Refactoring_updates;
- public static String RenameComponentProcessor_Component_Refactoring_update_declatation;
- public static String RenameComponentProcessor_Component_Refactoring_update_reference;
- public static String XSDComponentRenameParticipant_xsd_component_rename_participant;
- public static String WSDLComponentRenameParticipant_wsdl_component_rename_participant;
- public static String ResourceRenameParticipant_File_Rename_update_reference;
-
-
- private RefactoringWizardMessages() {
- // Do not instantiate
- }
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, RefactoringWizardMessages.class);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java
deleted file mode 100644
index 10bf304d09..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.refactor.wizard;
-
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.refactor.IReferenceUpdating;
-import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
-
-/**
- * @author ebelisar
- *
- */
-public class RenameInputWizardPage extends UserInputWizardPage{
- private String fInitialValue;
- private Text fTextField;
- private Button fUpdateReferences;
- /**
- * Creates a new text input page.
- * @param isLastUserPage <code>true</code> if this page is the wizard's last
- * user input page. Otherwise <code>false</code>.
- */
- public RenameInputWizardPage(String description, boolean isLastUserPage) {
- this(description, isLastUserPage, ""); //$NON-NLS-1$
- }
-
- /**
- * Creates a new text input page.
- * @param isLastUserPage <code>true</code> if this page is the wizard's last
- * user input page. Otherwise <code>false</code>
- * @param initialValue the initial value
- */
- public RenameInputWizardPage(String description, boolean isLastUserPage, String initialValue) {
- super("RenameInputWizardPage");
- Assert.isNotNull(initialValue);
- setDescription(description);
- fInitialValue= initialValue;
- }
-
- /**
- * Returns whether the initial input is valid. Typically it is not, because the
- * user is required to provide some information e.g. a new type name etc.
- *
- * @return <code>true</code> iff the input provided at initialization is valid
- */
- protected boolean isInitialInputValid(){
- return false;
- }
-
- /**
- * Returns whether an empty string is a valid input. Typically it is not, because
- * the user is required to provide some information e.g. a new type name etc.
- *
- * @return <code>true</code> iff an empty string is valid
- */
- protected boolean isEmptyInputValid(){
- return false;
- }
-
- /**
- * Returns the content of the text input field.
- *
- * @return the content of the text input field. Returns <code>null</code> if
- * not text input field has been created
- */
- protected String getText() {
- if (fTextField == null)
- return null;
- return fTextField.getText();
- }
-
- /**
- * Sets the new text for the text field. Does nothing if the text field has not been created.
- * @param text the new value
- */
- protected void setText(String text) {
- if (fTextField == null)
- return;
- fTextField.setText(text);
- }
-
- /**
- * Performs input validation. Returns a <code>RefactoringStatus</code> which
- * describes the result of input validation. <code>Null<code> is interpreted
- * as no error.
- */
- protected RefactoringStatus validateTextField(String text){
- return null;
- }
-
- protected Text createTextInputField(Composite parent) {
- return createTextInputField(parent, SWT.BORDER);
- }
-
- protected Text createTextInputField(Composite parent, int style) {
- fTextField= new Text(parent, style);
- fTextField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- textModified(getText());
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextField, XSDEditorCSHelpIds.RENAME_NEW_NAME);
- fTextField.setText(fInitialValue);
- return fTextField;
- }
-
- /**
- * Checks the page's state and issues a corresponding error message. The page validation
- * is computed by calling <code>validatePage</code>.
- */
- protected void textModified(String text) {
- if (! isEmptyInputValid() && text.equals("")){ //$NON-NLS-1$
- setPageComplete(false);
- setErrorMessage(null);
- restoreMessage();
- return;
- }
- if ((! isInitialInputValid()) && text.equals(fInitialValue)){
- setPageComplete(false);
- setErrorMessage(null);
- restoreMessage();
- return;
- }
-
- setPageComplete(validateTextField(text));
-
-// TODO: enable preview in M4
- getRefactoringWizard().setForcePreviewReview(false);
- getContainer().updateButtons();
-
- }
-
- /**
- * Subclasses can override if they want to restore the message differently.
- * This implementation calls <code>setMessage(null)</code>, which clears the message
- * thus exposing the description.
- */
- protected void restoreMessage(){
- setMessage(null);
- }
-
- /* (non-Javadoc)
- * Method declared in IDialogPage
- */
- public void dispose() {
- fTextField= null;
- }
-
- /* (non-Javadoc)
- * Method declared in WizardPage
- */
- public void setVisible(boolean visible) {
- if (visible) {
- textModified(getText());
- }
- super.setVisible(visible);
- if (visible && fTextField != null) {
- fTextField.setFocus();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite superComposite= new Composite(parent, SWT.NONE);
- setControl(superComposite);
- initializeDialogUnits(superComposite);
-
- superComposite.setLayout(new GridLayout());
- Composite composite= new Composite(superComposite, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- layout.verticalSpacing= 8;
- composite.setLayout(layout);
-
-
- Label label= new Label(composite, SWT.NONE);
- label.setText(getLabelText());
-
- Text text= createTextInputField(composite);
- text.selectAll();
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint= convertWidthInCharsToPixels(25);
- text.setLayoutData(gd);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(text, XSDEditorCSHelpIds.RENAME_NEW_NAME);
-
- addOptionalUpdateReferencesCheckbox(superComposite);
- gd= new GridData(GridData.FILL_HORIZONTAL);
- text.setLayoutData(gd);
-
- getRefactoringWizard().setForcePreviewReview(false);
-
- Dialog.applyDialogFont(superComposite);
- //WorkbenchHelp.setHelp(getControl(), fHelpContextID);
-
- }
-
- private static Button createCheckbox(Composite parent, String title, boolean value) {
- Button checkBox= new Button(parent, SWT.CHECK);
- checkBox.setText(title);
- checkBox.setSelection(value);
- return checkBox;
- }
-
- private void addOptionalUpdateReferencesCheckbox(Composite result) {
-
- final IReferenceUpdating ref= (IReferenceUpdating)getRefactoring().getAdapter(IReferenceUpdating.class);
- if (ref == null || !ref.canEnableUpdateReferences())
- return;
- String title= RefactoringMessages.getString("RenameInputWizardPage.update_references"); //$NON-NLS-1$
- boolean defaultValue= true;
- fUpdateReferences= createCheckbox(result, title, defaultValue);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateReferences, XSDEditorCSHelpIds.RENAME_UPDATE_REFERENCES);
- ref.setUpdateReferences(fUpdateReferences.getSelection());
- fUpdateReferences.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- ref.setUpdateReferences(fUpdateReferences.getSelection());
- }
- });
- fUpdateReferences.setEnabled(true);
- }
-
- protected String getLabelText() {
- return RefactoringMessages.getString("RenameInputWizardPage.new_name"); //$NON-NLS-1$
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java
deleted file mode 100644
index e24977b91d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.refactor.wizard;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
-import org.eclipse.wst.xsd.ui.internal.refactor.INameUpdating;
-
-public class RenameRefactoringWizard extends RefactoringWizard {
-
- private final String fInputPageDescription;
-
- private final ImageDescriptor fInputPageImageDescriptor;
-
- public RenameRefactoringWizard(Refactoring refactoring, String defaultPageTitle, String inputPageDescription,
- ImageDescriptor inputPageImageDescriptor) {
- super(refactoring, DIALOG_BASED_USER_INTERFACE);
- setDefaultPageTitle(defaultPageTitle);
- fInputPageDescription= inputPageDescription;
- fInputPageImageDescriptor= inputPageImageDescriptor;
-
- }
-
- /* non java-doc
- * @see RefactoringWizard#addUserInputPages
- */
- protected void addUserInputPages() {
- String initialSetting= getProcessor().getCurrentElementName();
- RenameInputWizardPage inputPage= createInputPage(fInputPageDescription, initialSetting);
- inputPage.setImageDescriptor(fInputPageImageDescriptor);
- addPage(inputPage);
- }
-
- protected INameUpdating getProcessor() {
-
- return (INameUpdating)getRefactoring().getAdapter(INameUpdating.class);
- }
-
-
- protected RenameInputWizardPage createInputPage(String message, String initialSetting) {
- return new RenameInputWizardPage(message, true, initialSetting) {
- protected RefactoringStatus validateTextField(String text) {
- return validateNewName(text);
- }
- };
- }
-
- protected RefactoringStatus validateNewName(String newName) {
- INameUpdating ref= getProcessor();
- ref.setNewElementName(newName);
-// try{
- return ref.checkNewElementName(newName);
-// } catch (CoreException e){
-// //XXX: should log the exception
-// String msg= e.getMessage() == null ? "": e.getMessage(); //$NON-NLS-1$
-// return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getFormattedString("RenameRefactoringWizard.internal_error", msg));//$NON-NLS-1$
-// }
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties
deleted file mode 100644
index 246f29f422..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties
+++ /dev/null
@@ -1,55 +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
-###############################################################################
-
-RefactorMenu_label=Refactor
-RefactorActionGroup_no_refactoring_available=<no refactoring available>
-
-RenameAction_rename=Rename
-RenameAction_unavailable=Operation unavailable on the current selection.\nSelect a ....
-RenameAction_text=Re&name...
-
-RenameInputWizardPage_new_name= &New name:
-RenameRefactoringWizard_internal_error= Internal error during name checking: {0}
-
-
-RenameXSDElementAction_exception=Unexpected exception occurred. See log for details
-RenameXSDElementAction_not_available=Operation unavailable on the current selection.\nSelect a XSD project, folder, resource, file, attribute declarations, attribute group definitions, complex type definitions, element declarations, identity constraint definitions, model groups definitions, notation declarations, or simple type definitions.
-RenameXSDElementAction_name=Rename
-
-
-RenameSupport_dialog_title=Rename
-RenameSupport_not_available=Rename support not available
-
-RenameComponentWizard_defaultPageTitle=Rename wizard
-RenameComponentWizard_inputPage_description=Rename XML Schema component
-
-RenameInputWizardPage_update_references=Update references
-XSDComponentRenameChange_name=XML Schema component renaming in {0}: {1} to {2}
-XSDComponentRenameChange_Renaming=Renaming...
-ResourceRenameParticipant_compositeChangeName=XSD file rename references updating changes
-RenameResourceChange_rename_resource_reference_change=Renaming resource name references
-XSDRenameResourceChange_name=Resource rename: {0} to {1}
-RenameResourceRefactoring_Internal_Error=Internal error
-RenameResourceRefactoring_alread_exists=Resource already exist
-RenameResourceRefactoring_invalidName=Invalid resource name
-RenameResourceProcessor_name=Resource renaming
-MakeAnonymousTypeGlobalAction_text=Make Anonymous Type Global
-MakeLocalElementGlobalAction_text=Make Local Element Global
-XSDComponentRenameParticipant_Component_Refactoring_updates=XML Schema refactoring changes
-WSDLComponentRenameParticipant_Component_Refactoring_updates=WSDL Schema refactoring changes
-RenameComponentProcessor_Component_Refactoring_updates=Component name refactoring changes
-RenameComponentProcessor_Component_Refactoring_update_declatation=Update component declaration/definition
-RenameComponentProcessor_Component_Refactoring_update_reference=Update component reference
-XSDComponentRenameParticipant_xsd_component_rename_participant=XSD component rename participant
-WSDLComponentRenameParticipant_wsdl_component_rename_participant=WSDL component rename participant
-ResourceRenameParticipant_File_Rename_update_reference=File rename refactoring changes
-
-RenameTargetNamespace_text=Rename Target Namespace

Back to the top