Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 itemis AG (http://www.itemis.eu) 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 /
  
  package org.eclipse.xtext.ui.refactoring.ui;
  
 import static org.eclipse.xtext.util.Strings.*;
 
 import  org.eclipse.jface.wizard.IWizardPage;
 import  org.eclipse.ltk.core.refactoring.RefactoringStatus;
 import  org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
 import  org.eclipse.ltk.ui.refactoring.RefactoringWizard;
 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.layout.GridData;
 import  org.eclipse.swt.layout.GridLayout;
 import  org.eclipse.swt.widgets.Composite;
 import  org.eclipse.swt.widgets.Label;
 import  org.eclipse.swt.widgets.Text;

Author(s):
Jan Koehnlein - Initial contribution and API
Holger Schill
 
 public class RenameElementWizard extends RefactoringWizard {
 
 	
 
 	public RenameElementWizard(ProcessorBasedRefactoring refactoringIRenameElementContext context) {
 		super(refactoring, DIALOG_BASED_USER_INTERFACE);
 		setWindowTitle("Rename Element");
 		this. = context;
 		 = (AbstractRenameProcessorrefactoring.getProcessor();
 	}
 
 	protected void addUserInputPages() {
 	}
 
 		return ;
 	}
 
 	protected static class UserInputPage extends UserInputWizardPage {
 
 		private Text nameField;
 		private String currentName;
 
 		public UserInputPage(AbstractRenameProcessor renameProcessorIRenameElementContext context) {
 			super("RenameElementResourceRefactoringInputPage"); //$NON-NLS-1$
 			this. = renameProcessor;
 			 = renameProcessor.getNewName() != null ? renameProcessor.getNewName()
 					: renameProcessor.getOriginalName();
 		}
 
 		public void createControl(Composite parent) {
 			Composite composite = new Composite(parent, SWT.NONE);
 			composite.setLayout(new GridLayout(2, false));
 			composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, truetrue));
 			composite.setFont(parent.getFont());
 			Label label = new Label(composite, SWT.NONE);
 			label.setText("New name:");//$NON-NLS-1$
 			label.setLayoutData(new GridData());
 			 = new Text(composite, SWT.BORDER);
 
 			.setFont(composite.getFont());
 			.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, truefalse));
 			.addModifyListener(new ModifyListener() {
 				public void modifyText(ModifyEvent e) {
 				}
 			});
 			.selectAll();
 			setControl(composite);
 		}
 
 		public void setVisible(boolean visible) {
 			if (visible) {
 				.setFocus();
 			}
 			super.setVisible(visible);
 		}
 
		protected final void validatePage() {
			String text = .getText();
			if(Strings.isEmpty(text)) {
else {
				else {
					RefactoringStatus status = .validateNewName(text);
					setPageComplete(status);
				}
			}
		}
		protected boolean performFinish() {
			//saveHelper.saveEditors(context);
			return super.performFinish();
		}
		public IWizardPage getNextPage() {
			return super.getNextPage();
		}
		private void setNewName() {
		}
	}
New to GrepCode? Check out our FAQ X