List of usage examples for org.eclipse.jdt.core IField getElementName
@Override String getElementName();
From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.contentassist.FXGraphProposalProvider.java
License:Open Source License
private void createEnumPropvalueProposals(IFXEnumProperty prop, EObject model, ContentAssistContext context, EReference typeReference, ICompletionProposalAcceptor acceptor) { IType t = prop.getEnumType();//from ww w .jav a2s .c om if (t != null) { try { for (IField f : t.getFields()) { if (Flags.isEnum(f.getFlags())) { ICompletionProposal p = createCompletionProposal("\"" + f.getElementName() + "\"", new StyledString(f.getElementName()).append(" - " + prop.getEnumTypeAsString(false), StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.ENUM_KEY), getPriorityHelper().getDefaultPriority(), "\"" + context.getPrefix(), context); if (p instanceof ConfigurableCompletionProposal) { ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p; cp.setAdditionalProposalInfo(model); cp.setHover(new HoverImpl(f)); } acceptor.accept(p); } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.contentassist.FXGraphProposalProvider.java
License:Open Source License
@Override public void completeConstValueProperty_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (model instanceof ConstValueProperty) { ConstValueProperty constProp = (ConstValueProperty) model; IJavaProject javaProject = projectProvider.getJavaProject(constProp.eResource().getResourceSet()); try {// www. ja v a 2s . c o m IType type = javaProject.findType(constProp.getType().getQualifiedName()); List<IField> fields = new ArrayList<IField>(); collectStaticFields(fields, type); for (IField f : fields) { StyledString s = new StyledString(f.getElementName() + " : " + Signature.getSimpleName(Signature.toString(f.getTypeSignature()))); String owner = ((IType) f.getAncestor(IJavaElement.TYPE)).getElementName(); s.append(" - " + Signature.getSimpleName(owner), StyledString.QUALIFIER_STYLER); ICompletionProposal prop = createCompletionProposal(f.getElementName(), s, IconKeys.getIcon(IconKeys.FIELD_KEY), context); acceptor.accept(prop); } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.hover.FXHoverProvider.java
License:Open Source License
@Override public IInformationControlCreatorProvider getHoverInfo(EObject object, ITextViewer viewer, IRegion region) { if (object instanceof Element) { Element e = (Element) object; if (e.getType() != null) { IType t = getJDTType(e.getType().getType()); if (t != null) { return createHover(t, object, viewer, region); }//w ww . jav a 2 s. co m } } else if (object instanceof Property) { Property p = (Property) object; if (p.eContainer() instanceof Element) { Element e = (Element) p.eContainer(); if (e.getType() != null) { IType t = getJDTType(e.getType().getType()); if (t != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t); if (fxClass != null) { IFXProperty fxp = fxClass.getProperty(p.getName()); if (fxp != null) { return createHover(fxp.getJavaElement(), object, viewer, region); } } } } } } else if (object instanceof StaticCallValueProperty) { StaticCallValueProperty sp = (StaticCallValueProperty) object; if (sp.getType() != null) { IType t = getJDTType(sp.getType().getType()); if (t != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t); if (fxClass != null) { IFXProperty fxp = fxClass.getStaticProperty(sp.getName()); if (fxp != null) { return createHover(fxp.getJavaElement(), object, viewer, region); } } } } } else if (object instanceof StaticValueProperty) { StaticValueProperty sp = (StaticValueProperty) object; EObject eo = sp.eContainer(); Element target = null; while (eo.eContainer() != null) { if (eo.eContainer() instanceof Element) { target = (Element) eo.eContainer(); break; } eo = eo.eContainer(); } if (target != null) { if (target.getType() != null) { IType t = getJDTType(target.getType().getType()); if (t != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t); if (fxClass != null) { IFXProperty fxp = fxClass.getStaticProperty(sp.getName()); if (fxp != null) { return createHover(fxp.getJavaElement(), object, viewer, region); } } } } } } else if (object instanceof ValueProperty) { if (object instanceof ControllerHandledValueProperty) { ControllerHandledValueProperty cp = (ControllerHandledValueProperty) object; Model m = (Model) object.eResource().getContents().get(0); if (m != null) { ComponentDefinition def = m.getComponentDef(); if (def != null) { if (def.getController() != null && def.getController().getType() != null) { IType t = getJDTType(def.getController().getType()); if (t != null) { IFXCtrlClass fxClass = FXPlugin.getClassmodel().findCtrlClass(t.getJavaProject(), t); if (fxClass != null) { IFXCtrlEventMethod fxp = fxClass.getAllEventMethods().get(cp.getMethodname()); if (fxp != null) { return createHover(fxp.getJavaElement(), object, viewer, region); } } } } } } } else if (object instanceof SimpleValueProperty) { SimpleValueProperty sp = (SimpleValueProperty) object; if (sp.eContainer() instanceof Property && sp.getStringValue() != null) { Property p = (Property) sp.eContainer(); if (p.eContainer() instanceof Element) { Element e = (Element) p.eContainer(); if (e.getType() != null) { IType t = getJDTType(e.getType().getType()); if (t != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t); if (fxClass != null) { IFXProperty fxp = fxClass.getProperty(p.getName()); if (fxp instanceof IFXEnumProperty) { IType enumType = ((IFXEnumProperty) fxp).getEnumType(); try { for (IField f : enumType.getFields()) { if (Flags.isEnum(f.getFlags())) { if (f.getElementName().equals(sp.getStringValue())) { return createHover(f, object, viewer, region); } } } } catch (JavaModelException ex) { // TODO Auto-generated catch block ex.printStackTrace(); } } } } } } } } } return super.getHoverInfo(object, viewer, region); }
From source file:at.bestsolution.efxclipse.tooling.fxml.editors.FXMLCompletionProposalComputer.java
License:Open Source License
@Override protected void addAttributeValueProposals(final ContentAssistRequest contentAssistRequest, final CompletionProposalInvocationContext context) { IDOMNode n = (IDOMNode) contentAssistRequest.getNode(); if (Character.isUpperCase(n.getNodeName().charAt(0))) { NamedNodeMap m = n.getAttributes(); IDOMNode attribute = null;//from w w w .ja va2 s . c o m for (int i = 0; i < m.getLength(); i++) { IDOMNode a = (IDOMNode) m.item(i); if (a.contains(contentAssistRequest.getStartOffset())) { attribute = a; } } if (attribute != null) { if ("http://javafx.com/fxml".equals(attribute.getNamespaceURI())) { if ("constant".equals(attribute.getLocalName())) { IType type = findType(n.getNodeName(), contentAssistRequest, context); if (type != null) { try { List<IField> fields = new ArrayList<IField>(); collectStaticFields(fields, type); for (IField f : fields) { StyledString s = new StyledString(f.getElementName() + " : " + Signature.getSimpleName(Signature.toString(f.getTypeSignature()))); String owner = ((IType) f.getAncestor(IJavaElement.TYPE)).getElementName(); s.append(" - " + Signature.getSimpleName(owner), StyledString.QUALIFIER_STYLER); FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"" + f.getElementName(), s, IconKeys.getIcon(IconKeys.CLASS_KEY), CLASS_ATTRIBUTE_MATCHER); if (cp != null) { contentAssistRequest.addProposal(cp); } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else if ("controller".equals(attribute.getLocalName())) { IJavaProject jproject = findProject(contentAssistRequest); char[] typeName = null; char[] packageName = null; if (!contentAssistRequest.getMatchString().isEmpty()) { if (contentAssistRequest.getMatchString().startsWith("\"")) { typeName = contentAssistRequest.getMatchString().substring(1).toCharArray(); } else { typeName = contentAssistRequest.getMatchString().toCharArray(); } } IJavaSearchScope searchScope = SearchEngine .createJavaSearchScope(new IJavaElement[] { jproject }); SearchEngine searchEngine = new SearchEngine(); try { searchEngine.searchAllTypeNames(packageName, SearchPattern.R_PATTERN_MATCH, typeName, SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CAMELCASE_MATCH, IJavaSearchConstants.TYPE, searchScope, new TypeNameRequestor() { public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { String sPackageName = new String(packageName); int priority = PRIORITY_LOWER_1; if (sPackageName.startsWith("com.sun")) { priority -= 10; } StyledString s = new StyledString(new String(simpleTypeName)); s.append(" - " + sPackageName, StyledString.QUALIFIER_STYLER); FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"" + sPackageName + "." + new String(simpleTypeName), s, IconKeys.getIcon(IconKeys.CLASS_KEY), CLASS_ATTRIBUTE_MATCHER); if (cp != null) { contentAssistRequest.addProposal(cp); } } }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor()); } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else if (attribute.getNodeName().contains(".")) { String[] parts = attribute.getNodeName().split("\\."); IType type = findType(parts[0], contentAssistRequest, context); if (type != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), type); if (fxClass != null) { IFXProperty p = fxClass.getStaticProperty(parts[1]); if (p instanceof IFXPrimitiveProperty) { createAttributeValuePrimitiveProposals(contentAssistRequest, context, (IFXPrimitiveProperty) p); } else if (p instanceof IFXEnumProperty) { createAttributeValueEnumProposals(contentAssistRequest, context, (IFXEnumProperty) p); } else if (p instanceof IFXObjectProperty) { createAttributeValueObjectProposals(contentAssistRequest, context, (IFXObjectProperty) p); } } } } else { IType type = findType(n.getNodeName(), contentAssistRequest, context); if (type != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), type); if (fxClass != null) { IFXProperty p = fxClass.getProperty(attribute.getNodeName()); if (p instanceof IFXPrimitiveProperty) { createAttributeValuePrimitiveProposals(contentAssistRequest, context, (IFXPrimitiveProperty) p); } else if (p instanceof IFXEnumProperty) { createAttributeValueEnumProposals(contentAssistRequest, context, (IFXEnumProperty) p); } else if (p instanceof IFXObjectProperty) { createAttributeValueObjectProposals(contentAssistRequest, context, (IFXObjectProperty) p); } else if (p instanceof IFXEventHandlerProperty) { createAttributeValueEventHandlerProposals(contentAssistRequest, context, (IFXEventHandlerProperty) p); } } } } } } }
From source file:at.bestsolution.efxclipse.tooling.fxml.editors.FXMLCompletionProposalComputer.java
License:Open Source License
private void createAttributeValueEnumProposals(ContentAssistRequest contentAssistRequest, CompletionProposalInvocationContext context, IFXEnumProperty p) { IType t = p.getEnumType();/*from w ww . ja va2 s . c o m*/ if (t != null) { try { for (IField f : t.getFields()) { if (Flags.isEnum(f.getFlags())) { FXMLCompletionProposal cp = createProposal(contentAssistRequest, context, "\"" + f.getElementName(), new StyledString(f.getElementName()).append(" - " + p.getEnumTypeAsString(false), StyledString.QUALIFIER_STYLER), IconKeys.getIcon(IconKeys.ENUM_KEY), ATTRIBUTE_MATCHER); if (cp != null) { cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass()); cp.setHover(new HoverImpl(f)); contentAssistRequest.addProposal(cp); } } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:at.bestsolution.efxclipse.tooling.fxml.editors.FXMLTextHover.java
License:Open Source License
public static IJavaElement computeTagAttValueHelp(IDOMNode xmlnode, int offset) { NamedNodeMap m = xmlnode.getAttributes(); IDOMNode attribute = null;//from www . ja v a 2 s . c o m if (m == null) { return null; } for (int i = 0; i < m.getLength(); i++) { IDOMNode a = (IDOMNode) m.item(i); if (a.contains(offset)) { attribute = a; } } if (attribute != null) { Node parent = xmlnode; IFXProperty p = null; if ("http://javafx.com/fxml".equals(attribute.getNamespaceURI())) { Document d = xmlnode.getOwnerDocument(); return Util.findType(attribute.getNodeValue(), d); } if (attribute.getNodeName().contains(".")) { String[] parts = attribute.getNodeName().split("\\."); IType ownerType = Util.findType(parts[0], parent.getOwnerDocument()); if (ownerType != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType); if (fxClass != null) { p = fxClass.getStaticProperty(parts[1]); } } } else { IType ownerType = Util.findType(parent.getNodeName(), parent.getOwnerDocument()); if (ownerType != null) { IFXClass fxClass = FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType); if (fxClass != null) { p = fxClass.getProperty(attribute.getNodeName()); } } } if (p instanceof IFXEnumProperty) { IType t = ((IFXEnumProperty) p).getEnumType(); try { for (IField f : t.getFields()) { if (Flags.isEnum(f.getFlags())) { if (f.getElementName().equals(attribute.getNodeValue())) { return f; } } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if (p instanceof IFXEventHandlerProperty && attribute.getNodeValue().startsWith("#")) { Document d = xmlnode.getOwnerDocument(); Element e = d.getDocumentElement(); Attr a = e.getAttributeNodeNS("http://javafx.com/fxml", "controller"); if (a != null) { IType t = Util.findType(a.getValue(), d); if (t != null) { IFXCtrlClass cl = FXPlugin.getClassmodel().findCtrlClass(t.getJavaProject(), t); IFXCtrlEventMethod method = cl.getAllEventMethods() .get(attribute.getNodeValue().substring(1)); if (method != null) { return method.getJavaElement(); } } } } } return null; }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.FXBeanJavaCompletionProposalComputer.java
License:Open Source License
@Override public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {//from w w w. j a va2 s . c o m if (context instanceof JavaContentAssistInvocationContext && false) { JavaContentAssistInvocationContext javaContext = (JavaContentAssistInvocationContext) context; CompletionContext completionContext = javaContext.getCoreContext(); IJavaElement enclosingElement = null; if (completionContext.isExtended()) { enclosingElement = completionContext.getEnclosingElement(); } else { try { enclosingElement = javaContext.getCompilationUnit() .getElementAt(context.getInvocationOffset() + 1); } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } List<ICompletionProposal> l = new ArrayList<ICompletionProposal>(); if (enclosingElement != null) { IType type = (IType) enclosingElement.getAncestor(IJavaElement.TYPE); if (type == null) { return l; } try { IField[] fields = type.getFields(); IMethod[] methods = type.getMethods(); int offset = context.getInvocationOffset() - 3; if (offset > 0) { String prefix = context.getDocument().get(offset, 3); IType propType = type.getJavaProject().findType("javafx.beans.property.Property"); IType writableType = type.getJavaProject().findType("javafx.beans.value.WritableValue"); // Primitives IType booleanType = type.getJavaProject() .findType("javafx.beans.property.ReadOnlyBooleanProperty"); IType doubleType = type.getJavaProject() .findType("javafx.beans.property.ReadOnlyDoubleProperty"); IType floatType = type.getJavaProject() .findType("javafx.beans.property.ReadOnlyFloatProperty"); IType intType = type.getJavaProject() .findType("javafx.beans.property.ReadOnlyIntegerProperty"); IType longType = type.getJavaProject() .findType("javafx.beans.property.ReadOnlyLongProperty"); IType stringType = type.getJavaProject() .findType("javafx.beans.property.ReadOnlyStringProperty"); for (int i = 0; i < fields.length; i++) { IField curr = fields[i]; if (!Flags.isEnum(curr.getFlags())) { IType fieldType = toType(type, curr.getTypeSignature()); if (fieldType != null) { if (assignable(fieldType, propType)) { if ("set".equals(prefix)) { if (assignable(fieldType, writableType)) { String setterName = NamingConventions.suggestSetterName( type.getJavaProject(), curr.getElementName(), curr.getFlags(), false, null); if (!hasMethod(methods, setterName)) { StyledString s = new StyledString(setterName + "(" + toValue(fieldType, booleanType, doubleType, floatType, intType, longType, stringType) + ") : void"); s.append(" - Setter for '" + curr.getElementName() + "'", StyledString.QUALIFIER_STYLER); l.add(new CompletionProposalImpl(setterName, s)); } } } else if (Character.isWhitespace(prefix.charAt(0)) && prefix.endsWith("is")) { if (assignable(fieldType, booleanType)) { String getterName = NamingConventions.suggestGetterName( type.getJavaProject(), curr.getElementName(), curr.getFlags(), false, null); getterName = "is" + getterName.substring(3); if (!hasMethod(methods, getterName)) { StyledString s = new StyledString(getterName + "() : boolean"); s.append(" - Getter for '" + curr.getElementName() + "'", StyledString.QUALIFIER_STYLER); l.add(new CompletionProposalImpl(getterName, s)); } } } else if ("get".equals(prefix)) { if (!assignable(fieldType, booleanType)) { String getterName = NamingConventions.suggestGetterName( type.getJavaProject(), curr.getElementName(), curr.getFlags(), false, null); if (!hasMethod(methods, getterName)) { StyledString s = new StyledString(getterName + "() : " + toValue(fieldType, booleanType, doubleType, floatType, intType, longType, stringType)); s.append(" - Getter for '" + curr.getElementName() + "'", StyledString.QUALIFIER_STYLER); l.add(new CompletionProposalImpl(getterName, s)); } } } else if (Character.isWhitespace(prefix.charAt(2))) { String propertyName = curr.getElementName() + "Property"; if (!hasMethod(methods, propertyName)) { StyledString s = new StyledString(propertyName); l.add(new CompletionProposalImpl(propertyName, s)); } } } } } } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return l; } return Collections.emptyList(); }
From source file:at.bestsolution.efxclipse.tooling.model.internal.FXCtrlClass.java
License:Open Source License
private Map<String, IFXCtrlField> getLocalFields() { if (fields == null) { fields = new HashMap<String, IFXCtrlField>(); try {/*from w w w .j a va 2 s. co m*/ for (IField f : type.getFields()) { boolean annotated = false; for (IAnnotation a : f.getAnnotations()) { if (a.getElementName().endsWith("FXML")) { annotated = true; break; } } if (annotated) { String erasedFQNType = Util.getFQNType((IType) f.getParent(), Signature.getTypeErasure(Signature.toString(f.getTypeSignature()))); FXCtrlField field = new FXCtrlField(this, f, erasedFQNType); fields.put(f.getElementName(), field); } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return fields; }
From source file:com.android.ide.eclipse.adt.internal.refactorings.core.AndroidTypeRenameParticipant.java
License:Open Source License
private void addJavaChanges(IProject project, CompositeChange result, IProgressMonitor monitor) { if (!mIsCustomView) { return;//from w w w .j ava2s . com } // Also rename styleables, if any try { // Find R class IJavaProject javaProject = BaseProjectHelper.getJavaProject(project); ManifestInfo info = ManifestInfo.get(project); info.getPackage(); String rFqcn = info.getPackage() + '.' + R_CLASS; IType styleable = javaProject.findType(rFqcn + '.' + ResourceType.STYLEABLE.getName()); if (styleable != null) { IField[] fields = styleable.getFields(); CompositeChange fieldChanges = null; for (IField field : fields) { String name = field.getElementName(); if (name.equals(mOldSimpleName) || name.startsWith(mOldSimpleName) && name.length() > mOldSimpleName.length() && name.charAt(mOldSimpleName.length()) == '_') { // Rename styleable fields String newName = name.equals(mOldSimpleName) ? mNewSimpleName : mNewSimpleName + name.substring(mOldSimpleName.length()); RenameRefactoring refactoring = RenameResourceParticipant.createFieldRefactoring(field, newName, true); try { sIgnore = true; RefactoringStatus status = refactoring.checkAllConditions(monitor); if (status != null && !status.hasError()) { Change fieldChange = refactoring.createChange(monitor); if (fieldChange != null) { if (fieldChanges == null) { fieldChanges = new CompositeChange("Update custom view styleable fields"); // Disable these changes. They sometimes end up // editing the wrong offsets. It looks like Eclipse // doesn't ensure that after applying each change it // also adjusts the other field offsets. I poked around // and couldn't find a way to do this properly, but // at least by listing the diffs here it shows what should // be done. fieldChanges.setEnabled(false); } // Disable change: see comment above. fieldChange.setEnabled(false); fieldChanges.add(fieldChange); } } } catch (CoreException e) { AdtPlugin.log(e, null); } finally { sIgnore = false; } } } if (fieldChanges != null) { result.add(fieldChanges); } } } catch (CoreException e) { AdtPlugin.log(e, null); } }
From source file:com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceParticipant.java
License:Open Source License
@Override protected boolean initialize(Object element) { if (sIgnore) { return false; }// w ww . java2s . c o m if (element instanceof IField) { IField field = (IField) element; IType declaringType = field.getDeclaringType(); if (declaringType != null) { if (R_CLASS.equals(declaringType.getParent().getElementName())) { String typeName = declaringType.getElementName(); mType = ResourceType.getEnum(typeName); if (mType != null) { mUpdateReferences = getArguments().getUpdateReferences(); mFolderType = AdtUtils.getFolderTypeFor(mType); IJavaProject javaProject = (IJavaProject) field.getAncestor(IJavaElement.JAVA_PROJECT); mProject = javaProject.getProject(); mOldName = field.getElementName(); mNewName = getArguments().getNewName(); mFieldRefactoring = null; mRenamedFile = null; createXmlSearchPatterns(); return true; } } } return false; } else if (element instanceof IFile) { IFile file = (IFile) element; mProject = file.getProject(); if (BaseProjectHelper.isAndroidProject(mProject)) { IPath path = file.getFullPath(); int segments = path.segmentCount(); if (segments == 4 && path.segment(1).equals(FD_RES)) { String parentName = file.getParent().getName(); mFolderType = ResourceFolderType.getFolderType(parentName); if (mFolderType != null && mFolderType != ResourceFolderType.VALUES) { mType = AdtUtils.getResourceTypeFor(mFolderType); if (mType != null) { mUpdateReferences = getArguments().getUpdateReferences(); mProject = file.getProject(); mOldName = AdtUtils.stripAllExtensions(file.getName()); mNewName = AdtUtils.stripAllExtensions(getArguments().getNewName()); mRenamedFile = file; createXmlSearchPatterns(); mFieldRefactoring = null; IField field = getResourceField(mProject, mType, mOldName); if (field != null) { mFieldRefactoring = createFieldRefactoring(field); } else { // no corresponding field; aapt has not run yet. Perhaps user has // turned off auto build. mFieldRefactoring = null; } return true; } } } } } else if (element instanceof String) { String uri = (String) element; if (uri.startsWith(PREFIX_RESOURCE_REF) && !uri.startsWith(ANDROID_PREFIX)) { RenameResourceProcessor processor = (RenameResourceProcessor) getProcessor(); mProject = processor.getProject(); mType = processor.getType(); mFolderType = AdtUtils.getFolderTypeFor(mType); mOldName = processor.getCurrentName(); mNewName = processor.getNewName(); assert uri.endsWith(mOldName) && uri.contains(mType.getName()) : uri; mUpdateReferences = getArguments().getUpdateReferences(); if (mNewName.isEmpty()) { mUpdateReferences = false; } mRenamedFile = null; createXmlSearchPatterns(); mFieldRefactoring = null; if (!mNewName.isEmpty()) { IField field = getResourceField(mProject, mType, mOldName); if (field != null) { mFieldRefactoring = createFieldRefactoring(field); } } return true; } } return false; }