Author: dazarov
Date: 2009-11-24 12:48:49 -0500 (Tue, 24 Nov 2009)
New Revision: 18810
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableRefactoring.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java
Removed:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Messages.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/CallRule.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/ExpressionRule.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/OperationRule.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/JavaNameTokenDescription.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/StringTokenDescription.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/WhiteSpaceTokenDescription.java
trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4990
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-11-24
17:22:25 UTC (rev 18809)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-11-24
17:48:49 UTC (rev 18810)
@@ -21,5 +21,6 @@
org.jboss.tools.common.model,
org.jboss.tools.common.resref.core;visibility:=reexport,
org.eclipse.ui,
- org.eclipse.jdt.ui;bundle-version="3.5.0"
+ org.eclipse.jdt.ui;bundle-version="3.5.0",
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Copied:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java
(from rev 18564,
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Messages.java)
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -0,0 +1,40 @@
+package org.jboss.tools.common.el.core;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ElCoreMessages extends NLS {
+ private static final String BUNDLE_NAME =
"org.jboss.tools.common.el.core.messages"; //$NON-NLS-1$
+ public static String CallRule_ExpectingCommaOrRParen;
+ public static String CallRule_ExpectingRBrace;
+ public static String CallRule_ExpectingRBracket;
+ public static String CallRule_ExpectingRParen;
+ public static String CallRule_UnexpectedLParen;
+ public static String ExpressionRule_CannotStartWithBinaryOp;
+ public static String ExpressionRule_CannotStartWithInstanceof;
+ public static String ExpressionRule_ExpectingExpression;
+ public static String ExpressionRule_ExpectingJavaName;
+ public static String JavaNameTokenDescription_Name;
+ public static String OperationRule_ExpectingRBrace;
+ public static String OperationRule_ExpectingRBracket;
+ public static String OperationRule_ExpectingRParen;
+ public static String OperationTokenDescription_Name;
+ public static String PrimitiveValueTokenDescription_ArgMustResolveToIntegerOrString;
+ public static String PrimitiveValueTokenDescription_Name;
+ public static String StringTokenDescription_Name;
+ public static String WhiteSpaceTokenDescription_Name;
+
+ public static String EL_RENAME_PROCESSOR_LOCATION_NOT_FOUND;
+ public static String EL_RENAME_PROCESSOR_OUT_OF_SYNC_FILE;
+ public static String EL_RENAME_PROCESSOR_ERROR_PHANTOM_FILE;
+ public static String EL_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE;
+ public static String RENAME_EL_VARIABLE_PROCESSOR_TITLE;
+ public static String RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_CONTEXT_VARIABLE;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, ElCoreMessages.class);
+ }
+
+ private ElCoreMessages() {
+ }
+}
Deleted:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Messages.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Messages.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Messages.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -1,32 +0,0 @@
-package org.jboss.tools.common.el.core;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME =
"org.jboss.tools.common.el.core.messages"; //$NON-NLS-1$
- public static String CallRule_ExpectingCommaOrRParen;
- public static String CallRule_ExpectingRBrace;
- public static String CallRule_ExpectingRBracket;
- public static String CallRule_ExpectingRParen;
- public static String CallRule_UnexpectedLParen;
- public static String ExpressionRule_CannotStartWithBinaryOp;
- public static String ExpressionRule_CannotStartWithInstanceof;
- public static String ExpressionRule_ExpectingExpression;
- public static String ExpressionRule_ExpectingJavaName;
- public static String JavaNameTokenDescription_Name;
- public static String OperationRule_ExpectingRBrace;
- public static String OperationRule_ExpectingRBracket;
- public static String OperationRule_ExpectingRParen;
- public static String OperationTokenDescription_Name;
- public static String PrimitiveValueTokenDescription_ArgMustResolveToIntegerOrString;
- public static String PrimitiveValueTokenDescription_Name;
- public static String StringTokenDescription_Name;
- public static String WhiteSpaceTokenDescription_Name;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core.refactoring;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.jboss.tools.common.el.core.ELCorePlugin;
+import org.jboss.tools.common.el.core.ElCoreMessages;
+import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.common.util.FileUtil;
+
+/**
+ * @author Daniel Azarov
+ */
+public abstract class ELRenameProcessor extends RenameProcessor {
+ protected static final String JAVA_EXT = "java"; //$NON-NLS-1$
+ protected static final String XML_EXT = "xml"; //$NON-NLS-1$
+ protected static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
+ protected static final String JSP_EXT = "jsp"; //$NON-NLS-1$
+ protected static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
+
+ protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new
RefactoringParticipant[0];
+
+ protected static final String SEAM_PROPERTIES_FILE = "seam.properties";
//$NON-NLS-1$
+
+ protected RefactoringStatus status;
+
+ protected CompositeChange rootChange;
+ protected TextFileChange lastChange;
+ protected IFile declarationFile=null;
+
+ private ArrayList<String> keys = new ArrayList<String>();
+
+ private String newName;
+ private String oldName;
+
+ private ELSearcher searcher = null;
+
+
+ protected RefactorSearcher getSearcher(){
+ return searcher;
+ }
+
+ public void setNewName(String newName){
+ this.newName = newName;
+ }
+
+ protected String getNewName(){
+ return newName;
+ }
+
+ protected void setOldName(String oldName){
+ this.oldName = oldName;
+ }
+
+ public String getOldName(){
+ return oldName;
+ }
+
+ // lets collect all changes for the same files in one MultiTextEdit
+ protected TextFileChange getChange(IFile file){
+ if(lastChange != null && lastChange.getFile().equals(file))
+ return lastChange;
+
+ for(int i=0; i < rootChange.getChildren().length; i++){
+ TextFileChange change = (TextFileChange)rootChange.getChildren()[i];
+ if(change.getFile().equals(file)){
+ lastChange = change;
+ return lastChange;
+ }
+ }
+ lastChange = new TextFileChange(file.getName(), file);
+ MultiTextEdit root = new MultiTextEdit();
+ lastChange.setEdit(root);
+ rootChange.add(lastChange);
+
+ return lastChange;
+ }
+
+ private boolean isBadLocation(ITextSourceReference location, IFile file){
+ boolean flag;
+ if(location == null)
+ flag = true;
+ else
+ flag = location.getStartPosition() == 0 && location.getLength() == 0;
+
+ if(flag)
+ status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_LOCATION_NOT_FOUND,
file.getFullPath().toString()));
+ return flag;
+ }
+
+ private void changeXMLNode(ITextSourceReference location, IFile file){
+ if(isBadLocation(location, file))
+ return;
+
+ if(!isFileCorrect(file))
+ return;
+
+ String content = null;
+ try {
+ content = FileUtil.readStream(file);
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+
+ String text = content.substring(location.getStartPosition(),
location.getStartPosition()+location.getLength());
+ if(text.startsWith("<")){ //$NON-NLS-1$
+ int position = text.lastIndexOf("/>"); //$NON-NLS-1$
+ if(position < 0){
+ position = text.lastIndexOf(">"); //$NON-NLS-1$
+ }
+ change(file, location.getStartPosition()+position, 0, "
name=\""+getNewName()+"\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }else{
+ change(file, location.getStartPosition(), location.getLength(), getNewName());
+ }
+ }
+
+ private void changeAnnotation(ITextSourceReference location, IFile file){
+ if(isBadLocation(location, file))
+ return;
+
+ if(!isFileCorrect(file))
+ return;
+
+ String content = null;
+ try {
+ content = FileUtil.readStream(file);
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+
+ String text = content.substring(location.getStartPosition(),
location.getStartPosition()+location.getLength());
+ int openBracket = text.indexOf("("); //$NON-NLS-1$
+ int openQuote = text.indexOf("\""); //$NON-NLS-1$
+ if(openBracket >= 0){
+ int closeBracket = text.indexOf(")", openBracket); //$NON-NLS-1$
+
+ int equals = text.indexOf("=", openBracket); //$NON-NLS-1$
+ int value = text.indexOf("value", openBracket); //$NON-NLS-1$
+
+ if(closeBracket == openBracket+1){ // empty brackets
+ String newText = "\""+getNewName()+"\""; //$NON-NLS-1$
//$NON-NLS-2$
+ change(file, location.getStartPosition()+openBracket+1, 0, newText);
+ }else if(value > 0){ // construction value="name" found so change name
+ String newText = text.replace(getOldName(), getNewName());
+ change(file, location.getStartPosition(), location.getLength(), newText);
+ }else if(equals > 0){ // other parameters are found
+ String newText = "value=\""+getNewName()+"\",";
//$NON-NLS-1$ //$NON-NLS-2$
+ change(file, location.getStartPosition()+openBracket+1, 0, newText);
+ }else{ // other cases
+ String newText = text.replace(getOldName(), getNewName());
+ change(file, location.getStartPosition(), location.getLength(), newText);
+ }
+ }else if(openQuote >= 0){
+ int closeQuota = text.indexOf("\"", openQuote); //$NON-NLS-1$
+
+ if(closeQuota == openQuote+1){ // empty quotas
+ String newText = "\""+getNewName()+"\""; //$NON-NLS-1$
//$NON-NLS-2$
+ change(file, location.getStartPosition()+openQuote+1, 0, newText);
+ }else{ // the other cases
+ String newText = text.replace(getOldName(), getNewName());
+ change(file, location.getStartPosition(), location.getLength(), newText);
+ }
+ }else{
+ String newText = "(\""+getNewName()+"\")"; //$NON-NLS-1$
//$NON-NLS-2$
+ change(file, location.getStartPosition()+location.getLength(), 0, newText);
+ }
+ }
+
+ private void clearChanges(){
+ keys.clear();
+ }
+
+ private void change(IFile file, int offset, int length, String text){
+ //System.out.println("change file - "+file.getFullPath()+" offset -
"+offset+" len - "+length+" text"+text);
+ String key = file.getFullPath().toString()+" "+offset;
+ if(!keys.contains(key)){
+ TextFileChange change = getChange(file);
+ TextEdit edit = new ReplaceEdit(offset, length, text);
+ change.addEdit(edit);
+ keys.add(key);
+ }
+ }
+
+ protected boolean isFileCorrect(IFile file){
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_OUT_OF_SYNC_FILE,
file.getFullPath().toString()));
+ return false;
+ }else if(file.isPhantom()){
+ status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_ERROR_PHANTOM_FILE,
file.getFullPath().toString()));
+ return false;
+ }else if(file.isReadOnly()){
+ status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE,
file.getFullPath().toString()));
+ return false;
+ }
+ return true;
+ }
+
+
+ public class ELSearcher extends RefactorSearcher{
+
+ public ELSearcher(IFile file, String oldName){
+ super(file, oldName);
+ }
+
+
+ private boolean checkFolder(IResource resource, IResource[] sources, IPath output){
+ for(IResource folder : sources){
+ if(resource.equals(folder))
+ return false;
+ }
+
+ if(resource.getFullPath().equals(output))
+ return false;
+
+ return true;
+ }
+
+
+ ArrayList<String> keys = new ArrayList<String>();
+
+ @Override
+ protected IProject[] getProjects() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ @Override
+ protected IContainer getViewFolder(IProject project) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ @Override
+ protected void match(IFile file, int offset, int length) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ protected boolean isFileCorrect(IFile file) {
+ return isFileCorrect(file);
+ }
+
+ }
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -0,0 +1,143 @@
+ /*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core.refactoring;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
+
+/**
+ * @author Daniel Azarov
+ */
+public class RenameELVariableProcessor extends ELRenameProcessor {
+ IFile file;
+
+ /**
+ * @param file where refactor was called
+ */
+ public RenameELVariableProcessor(IFile file, String oldName) {
+ super();
+ this.file = file;
+ setOldName(oldName);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor,
org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+ */
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException,
+ OperationCanceledException {
+ status = new RefactoringStatus();
+
+ rootChange = new CompositeChange(ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_TITLE);
+
+ //renameELContextVariable(pm, file);
+
+ return status;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+ throws CoreException, OperationCanceledException {
+ RefactoringStatus result = new RefactoringStatus();
+ boolean status = false;
+
+ status = checkELContextVariable();
+
+ if(!status)
+ result.addFatalError(Messages.format(ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_CONTEXT_VARIABLE,
getOldName()));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#createChange(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+
+ return rootChange;
+ }
+
+
+ private boolean checkELContextVariable(){
+ boolean status = false;
+
+ IProject[] projects = getSearcher().getProjects();
+ for (IProject project : projects) {
+ // TODO:
+ }
+ return status;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getElements()
+ */
+ @Override
+ public Object[] getElements() {
+ return new String[]{getNewName()};
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getIdentifier()
+ */
+ @Override
+ public String getIdentifier() {
+ return getClass().getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getProcessorName()
+ */
+ @Override
+ public String getProcessorName() {
+ return ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_TITLE;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#isApplicable()
+ */
+ @Override
+ public boolean isApplicable() throws CoreException {
+ return getNewName()!=null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#loadParticipants(org.eclipse.ltk.core.refactoring.RefactoringStatus,
org.eclipse.ltk.core.refactoring.participants.SharableParticipants)
+ */
+ @Override
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ SharableParticipants sharedParticipants) throws CoreException {
+ return EMPTY_REF_PARTICIPANT;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableRefactoring.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableRefactoring.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableRefactoring.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -0,0 +1,24 @@
+ /*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core.refactoring;
+
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class RenameELVariableRefactoring extends RenameRefactoring {
+
+ public RenameELVariableRefactoring(RenameProcessor processor) {
+ super(processor);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableRefactoring.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/CallRule.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/CallRule.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/CallRule.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.rule;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.IRule;
import org.jboss.tools.common.el.core.parser.Tokenizer;
import org.jboss.tools.common.el.internal.core.parser.token.ArgEndTokenDescription;
@@ -99,18 +99,18 @@
public String getProblem(int state, Tokenizer tokenizer) {
if(ParamUtil.isMethodParamContext(tokenizer.getContext())) {
- return Messages.CallRule_ExpectingCommaOrRParen;
+ return ElCoreMessages.CallRule_ExpectingCommaOrRParen;
} else if(ParamUtil.isComplexExpressionContext(tokenizer.getContext())) {
- return Messages.CallRule_ExpectingRParen;
+ return ElCoreMessages.CallRule_ExpectingRParen;
} else if(ParamUtil.isArgContext(tokenizer.getContext())) {
- return Messages.CallRule_ExpectingRBracket;
+ return ElCoreMessages.CallRule_ExpectingRBracket;
}
if(state == STATE_EXPECTING_CALL_AFTER_METHOD) {
if(ParamStartTokenDescription.INSTANCE.isStart(tokenizer,
tokenizer.getCurrentIndex())) {
- return Messages.CallRule_UnexpectedLParen;
+ return ElCoreMessages.CallRule_UnexpectedLParen;
}
}
- return Messages.CallRule_ExpectingRBrace;
+ return ElCoreMessages.CallRule_ExpectingRBrace;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/ExpressionRule.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/ExpressionRule.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/ExpressionRule.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.rule;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.IRule;
import org.jboss.tools.common.el.core.parser.Tokenizer;
import org.jboss.tools.common.el.internal.core.parser.token.ArgEndTokenDescription;
@@ -128,15 +128,15 @@
public String getProblem(int state, Tokenizer tokenizer) {
if(state == STATE_EXPECTING_NAME) {
- return Messages.ExpressionRule_ExpectingJavaName;
+ return ElCoreMessages.ExpressionRule_ExpectingJavaName;
} else {
if(OperationTokenDescription.INSTANCE.isStart(tokenizer, tokenizer.getCurrentIndex()))
{
- return Messages.ExpressionRule_CannotStartWithBinaryOp;
+ return ElCoreMessages.ExpressionRule_CannotStartWithBinaryOp;
}
if(JavaNameTokenDescription.INSTANCEOF_INSTANCE.isStart(tokenizer,
tokenizer.getCurrentIndex())) {
- return Messages.ExpressionRule_CannotStartWithInstanceof;
+ return ElCoreMessages.ExpressionRule_CannotStartWithInstanceof;
}
- return Messages.ExpressionRule_ExpectingExpression;
+ return ElCoreMessages.ExpressionRule_ExpectingExpression;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/OperationRule.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/OperationRule.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/rule/OperationRule.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.rule;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.IRule;
import org.jboss.tools.common.el.core.parser.Tokenizer;
import org.jboss.tools.common.el.internal.core.parser.token.ArgEndTokenDescription;
@@ -73,13 +73,13 @@
public String getProblem(int state, Tokenizer tokenizer) {
if(ParamUtil.isMethodParamContext(tokenizer.getContext())) {
- return Messages.OperationRule_ExpectingRParen;
+ return ElCoreMessages.OperationRule_ExpectingRParen;
} else if(ParamUtil.isComplexExpressionContext(tokenizer.getContext())) {
- return Messages.OperationRule_ExpectingRParen;
+ return ElCoreMessages.OperationRule_ExpectingRParen;
} else if(ParamUtil.isArgContext(tokenizer.getContext())) {
- return Messages.OperationRule_ExpectingRBracket;
+ return ElCoreMessages.OperationRule_ExpectingRBracket;
}
- return Messages.OperationRule_ExpectingRBrace;
+ return ElCoreMessages.OperationRule_ExpectingRBrace;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/JavaNameTokenDescription.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/JavaNameTokenDescription.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/JavaNameTokenDescription.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.token;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.ITokenDescription;
import org.jboss.tools.common.el.core.parser.Tokenizer;
@@ -27,7 +27,7 @@
public static ConstantTokenDescription INSTANCEOF_INSTANCE =
InstanceofTokenDescription.INSTANCE;
public String getName() {
- return Messages.JavaNameTokenDescription_Name;
+ return ElCoreMessages.JavaNameTokenDescription_Name;
}
public int getType() {
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.token;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.ITokenDescription;
import org.jboss.tools.common.el.core.parser.Tokenizer;
@@ -34,7 +34,7 @@
public static OperationTokenDescription INSTANCE = new OperationTokenDescription();
public String getName() {
- return Messages.OperationTokenDescription_Name;
+ return ElCoreMessages.OperationTokenDescription_Name;
}
public int getType() {
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.token;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.ITokenDescription;
import org.jboss.tools.common.el.core.parser.SyntaxError;
import org.jboss.tools.common.el.core.parser.Tokenizer;
@@ -30,7 +30,7 @@
"null", "true", "false",
//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
};
public String getName() {
- return Messages.PrimitiveValueTokenDescription_Name;
+ return ElCoreMessages.PrimitiveValueTokenDescription_Name;
}
public int getType() {
@@ -141,7 +141,7 @@
&& tokenizer.getLastToken().getType() == ArgStartTokenDescription.ARG_START
&& dotCount < 1) {
SyntaxError error = new SyntaxError(dotOffset, BasicStates.STATE_EXPECTING_ARG);
- error.setProblem(Messages.PrimitiveValueTokenDescription_ArgMustResolveToIntegerOrString);
+ error.setProblem(ElCoreMessages.PrimitiveValueTokenDescription_ArgMustResolveToIntegerOrString);
tokenizer.addSyntaxError(error);
}
tokenizer.addToken(getType(), offset, i);
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/StringTokenDescription.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/StringTokenDescription.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/StringTokenDescription.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.token;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.ITokenDescription;
import org.jboss.tools.common.el.core.parser.Tokenizer;
@@ -25,7 +25,7 @@
public static StringTokenDescription INSTANCE = new StringTokenDescription();
public String getName() {
- return Messages.StringTokenDescription_Name;
+ return ElCoreMessages.StringTokenDescription_Name;
}
public int getType() {
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/WhiteSpaceTokenDescription.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/WhiteSpaceTokenDescription.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/WhiteSpaceTokenDescription.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.parser.token;
-import org.jboss.tools.common.el.core.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.ITokenDescription;
import org.jboss.tools.common.el.core.parser.Tokenizer;
@@ -25,7 +25,7 @@
public static WhiteSpaceTokenDescription INSTANCE = new WhiteSpaceTokenDescription();
public String getName() {
- return Messages.WhiteSpaceTokenDescription_Name;
+ return ElCoreMessages.WhiteSpaceTokenDescription_Name;
}
public int getType() {
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2009-11-24 17:22:25 UTC
(rev 18809)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2009-11-24 17:48:49 UTC
(rev 18810)
@@ -33,5 +33,14 @@
</enablement>
</renameParticipant>
</extension>
+
+ <!-- Refactorng -->
+ <!--extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+
class="org.jboss.tools.common.el.ui.refactoring.ELRefactorContributionFactory"
+ locationURI="popup:org.eclipse.ui.popup.any?after=save">
+ </menuContribution>
+ </extension-->
</plugin>
Modified:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -19,4 +19,5 @@
public static String REFACTOR_CONTRIBUTOR_MAIN_MENU;
public static String REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE;
+ public static String EL_REFACTOR_RENAME_HANDLER_ERROR;
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java 2009-11-24
17:22:25 UTC (rev 18809)
+++
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -19,12 +19,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
import org.eclipse.jdt.ui.text.IJavaPartitions;
@@ -38,6 +36,7 @@
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.internal.services.IWorkbenchLocationService;
@@ -61,10 +60,11 @@
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
import org.jboss.tools.common.el.core.parser.ELParser;
import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.el.ui.ElUiPlugin;
+import org.jboss.tools.common.el.core.refactoring.RenameELVariableProcessor;
+import org.jboss.tools.common.el.core.refactoring.RenameELVariableRefactoring;
import org.jboss.tools.common.el.ui.ElUIMessages;
+import org.jboss.tools.common.el.ui.ElUiPlugin;
import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.propertieseditor.PropertiesCompoundEditor;
import org.jboss.tools.common.util.FileUtil;
@@ -76,7 +76,7 @@
* @author Daniel Azarov
*/
public class ELRefactorContributionFactory extends AbstractContributionFactory {
- private static final String ANNOTATION_NAME =
"org.jboss.seam.annotations.Name"; //$NON-NLS-1$
+ //private static final String ANNOTATION_NAME =
"org.jboss.seam.annotations.Name"; //$NON-NLS-1$
private static final String JAVA_EXT = "java"; //$NON-NLS-1$
private static final String XML_EXT = "xml"; //$NON-NLS-1$
private static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
@@ -168,7 +168,7 @@
status = checkContextVariableInProperties(editorFile, fileContent, selection);
if(status){
- mm.add(new RenameSeamContextVariableAction());
+ mm.add(new RenameELVariableAction());
if(!separatorIsAdded)
additions.addContributionItem(new Separator(), null);
@@ -210,7 +210,7 @@
ELModel model = parser.parse(string);
for (ELInstance instance : model.getInstances()) {
for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
- ELPropertyInvocation pi = findSeamContextVariable(ie);
+ ELPropertyInvocation pi = findELVariable(ie);
if(pi != null){
if(offset+pi.getStartPosition() == selection.getOffset() && pi.getLength()
== selection.getLength())
return true;
@@ -221,7 +221,7 @@
return false;
}
- private ELPropertyInvocation findSeamContextVariable(ELInvocationExpression
invocationExpression){
+ private ELPropertyInvocation findELVariable(ELInvocationExpression
invocationExpression){
ELInvocationExpression invExp = invocationExpression;
while(invExp != null){
if(invExp instanceof ELPropertyInvocation){
@@ -305,36 +305,6 @@
return scanString(file, content, 0, selection);
}
- private IAnnotation getNameAnnotation(IFile file){
- try{
- ICompilationUnit unit = getCompilationUnit(file);
- for(IType type : unit.getAllTypes()){
- for(IAnnotation annotation : type.getAnnotations()){
- if(EclipseJavaUtil.resolveType(type,
annotation.getElementName()).equals(ANNOTATION_NAME))
- return annotation;
- }
- }
- }catch(CoreException ex){
- ElUiPlugin.getDefault().logError(ex);
- }
- return null;
- }
-
- private ICompilationUnit getCompilationUnit(IFile file) throws CoreException {
- IProject project = file.getProject();
- IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
- for (IResource resource : EclipseResourceUtil.getJavaSourceRoots(project)) {
- if(resource.getFullPath().isPrefixOf(file.getFullPath())) {
- IPath path =
file.getFullPath().removeFirstSegments(resource.getFullPath().segmentCount());
- IJavaElement element = javaProject.findElement(path);
- if(element instanceof ICompilationUnit) {
- return (ICompilationUnit)element;
- }
- }
- }
- return null;
- }
-
private String getPropertyName(IMethod method){
String name = method.getElementName();
@@ -358,29 +328,29 @@
}
}
- public static void invokeRenameSeamContextVariableWizard(String oldName, Shell
activeShell) {
-// saveAndBuild();
-//
-// RenameSeamContextVariableProcessor processor = new
RenameSeamContextVariableProcessor(editorFile, selectedText);
-// RenameComponentRefactoring refactoring = new RenameComponentRefactoring(processor);
-// RenameSeamContextVariableWizard wizard = new
RenameSeamContextVariableWizard(refactoring, editorFile);
+ public static void invokeRenameELVariableWizard(String oldName, Shell activeShell) {
+ saveAndBuild();
+
+ RenameELVariableProcessor processor = new RenameELVariableProcessor(editorFile,
selectedText);
+ RenameELVariableRefactoring refactoring = new RenameELVariableRefactoring(processor);
+ //RenameELVariableWizard wizard = new RenameELVariableWizard(refactoring, editorFile);
// RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
// try {
-// String titleForFailedChecks = ElUIMessages.SEAM_COMPONENT_RENAME_HANDLER_ERROR;
+// String titleForFailedChecks = ElUIMessages.EL_REFACTOR_RENAME_HANDLER_ERROR;
// op.run(activeShell, titleForFailedChecks);
// } catch (final InterruptedException irex) {
// // operation was canceled
// }
}
- class RenameSeamContextVariableAction extends Action{
- public RenameSeamContextVariableAction(){
+ class RenameELVariableAction extends Action{
+ public RenameELVariableAction(){
super(ElUIMessages.REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE);
}
public void run(){
saveAndBuild();
- invokeRenameSeamContextVariableWizard(selectedText, shell);
+ invokeRenameELVariableWizard(selectedText, shell);
}
}
Added:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java 2009-11-24
17:48:49 UTC (rev 18810)
@@ -0,0 +1,109 @@
+ /*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.ui.refactoring;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.el.core.refactoring.RenameELVariableProcessor;
+import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
+
+/**
+ * @author Daniel Azarov
+ */
+public class RenameELVariableWizard extends RefactoringWizard {
+
+ private String componentName;
+ private IFieldEditor editor;
+
+ public RenameELVariableWizard(Refactoring refactoring) {
+ super(refactoring, WIZARD_BASED_USER_INTERFACE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ltk.ui.refactoring.RefactoringWizard#addUserInputPages()
+ */
+ @Override
+ protected void addUserInputPages() {
+ setDefaultPageTitle(getRefactoring().getName());
+ RenameELVariableProcessor processor= (RenameELVariableProcessor)
getRefactoring().getAdapter(RenameELVariableProcessor.class);
+ addPage(new RenameELVariableWizardPage(processor));
+ }
+
+ class RenameELVariableWizardPage extends UserInputWizardPage{
+ private RenameELVariableProcessor processor;
+
+ public RenameELVariableWizardPage(RenameELVariableProcessor processor){
+ super("");
+ this.processor = processor;
+ }
+
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 2;
+
+// String defaultName = component.getName();
+// editor = IFieldEditorFactory.INSTANCE.createTextEditor(componentName,
SeamUIMessages.SEAM_WIZARD_FACTORY_SEAM_COMPONENT_NAME, defaultName);
+// editor.doFillIntoGrid(container);
+//
+// ((CompositeEditor)editor).addPropertyChangeListener(new
PropertyChangeListener(){
+// public void propertyChange(PropertyChangeEvent evt){
+// validatePage();
+// }
+// });
+ setControl(container);
+ setPageComplete(false);
+ }
+
+ protected final void validatePage() {
+ RefactoringStatus status= new RefactoringStatus();
+ setPageComplete(status);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ltk.ui.refactoring.UserInputWizardPage#performFinish()
+ */
+ protected boolean performFinish() {
+
+ initializeRefactoring();
+ return super.performFinish();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ltk.ui.refactoring.UserInputWizardPage#getNextPage()
+ */
+ public IWizardPage getNextPage() {
+ initializeRefactoring();
+ return super.getNextPage();
+ }
+
+ private void initializeRefactoring() {
+ //processor.setNewName(editor.getValueAsString());
+ }
+
+ }
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain