mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
made fields final, cleanup
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class JavadocWhiteSpaceFormattingStrategy extends WhiteSpaceFormattingStrategyAdapter {
|
||||
@Override
|
||||
public boolean containsWhitespacesOnly(@NotNull final ASTNode node) {
|
||||
return node.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA && node.textContains('\n') && node.getText().trim().length() == 0;
|
||||
return node.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA && node.textContains('\n') && node.getText().trim().isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,9 +38,9 @@ public class BlockContainingJavaBlock extends AbstractJavaBlock{
|
||||
JavaElementType.IF_STATEMENT, JavaElementType.WHILE_STATEMENT, JavaElementType.FOR_STATEMENT
|
||||
);
|
||||
|
||||
private final static int BEFORE_FIRST = 0;
|
||||
private final static int BEFORE_BLOCK = 1;
|
||||
private final static int AFTER_ELSE = 2;
|
||||
private static final int BEFORE_FIRST = 0;
|
||||
private static final int BEFORE_BLOCK = 1;
|
||||
private static final int AFTER_ELSE = 2;
|
||||
|
||||
private final List<Indent> myIndentsBefore = new ArrayList<Indent>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,9 +36,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CodeBlockBlock extends AbstractJavaBlock {
|
||||
private final static int BEFORE_FIRST = 0;
|
||||
private final static int BEFORE_LBRACE = 1;
|
||||
private final static int INSIDE_BODY = 2;
|
||||
private static final int BEFORE_FIRST = 0;
|
||||
private static final int BEFORE_LBRACE = 1;
|
||||
private static final int INSIDE_BODY = 2;
|
||||
|
||||
private final int myChildrenIndent;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
* @author nik
|
||||
*/
|
||||
public class CommentWithInjectionBlock extends AbstractJavaBlock {
|
||||
private InjectedLanguageBlockBuilder myInjectedBlockBuilder;
|
||||
private final InjectedLanguageBlockBuilder myInjectedBlockBuilder;
|
||||
|
||||
public CommentWithInjectionBlock(ASTNode node, Wrap wrap, Alignment alignment, Indent indent, CommonCodeStyleSettings settings) {
|
||||
super(node, wrap, alignment, indent, settings);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class DocCommentBlock extends AbstractJavaBlock{
|
||||
while (child != null) {
|
||||
if (child.getElementType() == JavaDocTokenType.DOC_COMMENT_START) {
|
||||
result.add(createJavaBlock(child, mySettings, Indent.getNoneIndent(), null, AlignmentStrategy.getNullStrategy()));
|
||||
} else if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getText().trim().length() > 0){
|
||||
} else if (!FormatterUtil.containsWhiteSpacesOnly(child) && !child.getText().trim().isEmpty()){
|
||||
result.add(createJavaBlock(child, mySettings, Indent.getSpaceIndent(1), null, AlignmentStrategy.getNullStrategy()));
|
||||
}
|
||||
child = child.getTreeNext();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public abstract class CreateBeanPropertyFix implements LocalQuickFix, IntentionAction {
|
||||
|
||||
private final static Logger LOG = Logger.getInstance("#com.intellij.psi.impl.beanProperties.CreateBeanPropertyFix");
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.beanProperties.CreateBeanPropertyFix");
|
||||
private static final CreateBeanPropertyFix[] NO_FIXES = new CreateBeanPropertyFix[0];
|
||||
|
||||
protected final String myPropertyName;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,7 @@ public class PsiJavaDirectoryFactory extends PsiDirectoryFactory {
|
||||
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
|
||||
if (aPackage != null) {
|
||||
final String qualifiedName = aPackage.getQualifiedName();
|
||||
if (qualifiedName.length() > 0) return qualifiedName;
|
||||
if (!qualifiedName.isEmpty()) return qualifiedName;
|
||||
if (presentable) {
|
||||
return PsiBundle.message("default.package.presentation") + " (" + directory.getVirtualFile().getPresentableUrl() + ")";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,9 +46,9 @@ public class LightMethodBuilder extends LightElement implements PsiMethod, Origi
|
||||
private final String myName;
|
||||
private Computable<PsiType> myReturnType;
|
||||
private final PsiModifierList myModifierList;
|
||||
private PsiParameterList myParameterList;
|
||||
private PsiTypeParameterList myTypeParameterList;
|
||||
private PsiReferenceList myThrowsList;
|
||||
private final PsiParameterList myParameterList;
|
||||
private final PsiTypeParameterList myTypeParameterList;
|
||||
private final PsiReferenceList myThrowsList;
|
||||
private Icon myBaseIcon;
|
||||
private PsiClass myContainingClass;
|
||||
private boolean myConstructor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,8 +39,8 @@ public class ImportsFormatter extends XmlRecursiveElementVisitor {
|
||||
|
||||
private final FormattingDocumentModelImpl myDocumentModel;
|
||||
private final CommonCodeStyleSettings.IndentOptions myIndentOptions;
|
||||
private static final @NonNls String PAGE_DIRECTIVE = "page";
|
||||
private static final @NonNls String IMPORT_ATT = "import";
|
||||
@NonNls private static final String PAGE_DIRECTIVE = "page";
|
||||
@NonNls private static final String IMPORT_ATT = "import";
|
||||
|
||||
private final PostFormatProcessorHelper myPostProcessor;
|
||||
|
||||
|
||||
+1
-1
@@ -779,7 +779,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
|
||||
String prefix = getPrefixByVariableKind(variableKind);
|
||||
String name = propertyName;
|
||||
if (name.length() > 0 && prefix.length() > 0 && !StringUtil.endsWithChar(prefix, '_')) {
|
||||
if (!name.isEmpty() && !prefix.isEmpty() && !StringUtil.endsWithChar(prefix, '_')) {
|
||||
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
|
||||
}
|
||||
name = prefix + name + getSuffixByVariableKind(variableKind);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -84,7 +84,7 @@ public class PsiBasedFormatterModelWithShiftIndentInside extends PsiBasedFormatt
|
||||
if(type == TokenType.WHITE_SPACE) {
|
||||
final String text = prevNode.getText();
|
||||
|
||||
final @NonNls String cdataStartMarker = "<![CDATA[";
|
||||
@NonNls final String cdataStartMarker = "<![CDATA[";
|
||||
final int cdataPos = text.indexOf(cdataStartMarker);
|
||||
if (cdataPos != -1 && whiteSpace.indexOf(cdataStartMarker) == -1) {
|
||||
whiteSpace = DocumentBasedFormattingModel.mergeWsWithCdataMarker(whiteSpace, text, cdataPos);
|
||||
@@ -95,7 +95,7 @@ public class PsiBasedFormatterModelWithShiftIndentInside extends PsiBasedFormatt
|
||||
type = prevNode != null ? prevNode.getElementType():null;
|
||||
}
|
||||
|
||||
final @NonNls String cdataEndMarker = "]]>";
|
||||
@NonNls final String cdataEndMarker = "]]>";
|
||||
if(type == XmlElementType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) {
|
||||
final ASTNode at = findElementAt(prevNode.getStartOffset());
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -113,7 +113,7 @@ public class ShiftIndentInsideHelper {
|
||||
leafOffset = getStartOffset(element, leaf);
|
||||
}
|
||||
else {
|
||||
if (newSpace.length() > 0) {
|
||||
if (!newSpace.isEmpty()) {
|
||||
LeafElement newLeaf = ASTFactory.whitespace(newSpace);
|
||||
next.getTreeParent().addChild(newLeaf, next);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class ShiftIndentInsideHelper {
|
||||
}
|
||||
String leafText = leaf.getText();
|
||||
String newLeafText = leafText.substring(0, startOffset) + newSpace + leafText.substring(endOffset);
|
||||
if (newLeafText.length() > 0) {
|
||||
if (!newLeafText.isEmpty()) {
|
||||
LeafElement newLeaf = Factory.createSingleLeafElement(leaf.getElementType(), newLeafText,charTableByTree, SharedImplUtil.getManagerByTree(leaf));
|
||||
if (leaf.getTreeParent() != null) {
|
||||
leaf.getTreeParent().replaceChild(leaf, newLeaf);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,11 +43,11 @@ public class JDComment {
|
||||
}
|
||||
|
||||
protected static boolean isNull(@Nullable String s) {
|
||||
return s == null || s.trim().length() == 0;
|
||||
return s == null || s.trim().isEmpty();
|
||||
}
|
||||
|
||||
protected static boolean isNull(@Nullable List<?> l) {
|
||||
return l == null || l.size() == 0;
|
||||
return l == null || l.isEmpty();
|
||||
}
|
||||
|
||||
public void setMultiLine(boolean value) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class JDMethodComment extends JDParamListOwnerComment {
|
||||
super.generateSpecial(prefix, sb);
|
||||
|
||||
if (myReturnTag != null) {
|
||||
if (myFormatter.getSettings().JD_KEEP_EMPTY_RETURN || myReturnTag.trim().length() != 0) {
|
||||
if (myFormatter.getSettings().JD_KEEP_EMPTY_RETURN || !myReturnTag.trim().isEmpty()) {
|
||||
JDTag tag = JDTag.RETURN;
|
||||
sb.append(prefix);
|
||||
sb.append(tag.getWithEndWhitespace());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class JDParser {
|
||||
for (int i = 0; i < size; i++) {
|
||||
String line = l.get(i);
|
||||
line = line.trim();
|
||||
if (line.length() > 0) {
|
||||
if (!line.isEmpty()) {
|
||||
if (line.charAt(0) == '*') {
|
||||
if ((markers.get(i)).booleanValue()) {
|
||||
if (line.length() > 1 && line.charAt(1) == ' ') {
|
||||
@@ -95,7 +95,7 @@ public class JDParser {
|
||||
String tag = null;
|
||||
for (int i = 0; i <= size; i++) {
|
||||
String line = i == size ? null : l.get(i);
|
||||
if (i == size || line.length() > 0) {
|
||||
if (i == size || !line.isEmpty()) {
|
||||
if (i == size || line.charAt(0) == '@') {
|
||||
if (tag == null) {
|
||||
comment.setDescription(sb.toString());
|
||||
@@ -157,7 +157,7 @@ public class JDParser {
|
||||
private List<String> toArray(@Nullable String s, @NotNull String separators, @Nullable List<Boolean> markers) {
|
||||
if (s == null) return null;
|
||||
s = s.trim();
|
||||
if (s.length() == 0) return null;
|
||||
if (s.isEmpty()) return null;
|
||||
boolean p2nl = markers != null && mySettings.JD_P_AT_EMPTY_LINES;
|
||||
List<String> list = new ArrayList<String>();
|
||||
StringTokenizer st = new StringTokenizer(s, separators, true);
|
||||
@@ -232,7 +232,7 @@ public class JDParser {
|
||||
String seq = pair.getFirst();
|
||||
boolean isMarked = pair.getSecond();
|
||||
|
||||
if (seq.length() == 0) {
|
||||
if (seq.isEmpty()) {
|
||||
// keep empty lines
|
||||
list.add("");
|
||||
continue;
|
||||
@@ -514,9 +514,9 @@ public class JDParser {
|
||||
boolean insidePreTag = false;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String line = list.get(i);
|
||||
if (line.length() == 0 && !mySettings.JD_KEEP_EMPTY_LINES) continue;
|
||||
if (line.isEmpty() && !mySettings.JD_KEEP_EMPTY_LINES) continue;
|
||||
if (i != 0) sb.append(prefix);
|
||||
if (line.length() == 0 && mySettings.JD_P_AT_EMPTY_LINES && !insidePreTag) {
|
||||
if (line.isEmpty() && mySettings.JD_P_AT_EMPTY_LINES && !insidePreTag) {
|
||||
if (myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
|
||||
//Self-closing elements are not allowed for javadoc tool from JDK8
|
||||
sb.append(P_START_TAG);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ public class FilePathReferenceProvider extends PsiReferenceProvider {
|
||||
String text,
|
||||
int offset,
|
||||
final boolean soft,
|
||||
final @NotNull Module... forModules) {
|
||||
@NotNull final Module... forModules) {
|
||||
return new FileReferenceSet(text, element, offset, this, true, myEndingSlashNotAllowed) {
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class FilePathReferenceProvider extends PsiReferenceProvider {
|
||||
@Override
|
||||
public boolean absoluteUrlNeedsStartSlash() {
|
||||
final String s = getPathString();
|
||||
return s != null && s.length() > 0 && s.charAt(0) == '/';
|
||||
return s != null && !s.isEmpty() && s.charAt(0) == '/';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public class JavaClassReferenceProvider extends GenericReferenceProvider impleme
|
||||
|
||||
private boolean myAllowEmpty;
|
||||
|
||||
private ParameterizedCachedValueProvider<List<PsiElement>, Project> myProvider = new ParameterizedCachedValueProvider<List<PsiElement>, Project>() {
|
||||
private final ParameterizedCachedValueProvider<List<PsiElement>, Project> myProvider = new ParameterizedCachedValueProvider<List<PsiElement>, Project>() {
|
||||
@Override
|
||||
public CachedValueProvider.Result<List<PsiElement>> compute(Project project) {
|
||||
final List<PsiElement> psiPackages = new ArrayList<PsiElement>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -293,7 +293,7 @@ public class MyTestInjector {
|
||||
if (!method.hasModifierProperty(PsiModifier.NATIVE) || !method.hasModifierProperty(PsiModifier.PUBLIC)) return;
|
||||
String paramList = "";
|
||||
for (PsiParameter parameter : method.getParameterList().getParameters()) {
|
||||
if (paramList.length()!=0) paramList += ",";
|
||||
if (!paramList.isEmpty()) paramList += ",";
|
||||
paramList += parameter.getName();
|
||||
}
|
||||
@NonNls String header = "function " + method.getName() + "("+paramList+") {";
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ public class PatternPackageSetParserExtension implements PackageSetParserExtensi
|
||||
scope = PatternPackageSet.SCOPE_PROBLEM;
|
||||
} else if (PatternPackageSet.SCOPE_LIBRARY.equals(id)) {
|
||||
scope = PatternPackageSet.SCOPE_LIBRARY;
|
||||
} else if (id.trim().length() > 0) {
|
||||
} else if (!id.trim().isEmpty()) {
|
||||
scope = null;
|
||||
}
|
||||
final CharSequence buf = lexer.getBufferSequence();
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PsiDisjunctionType extends PsiType {
|
||||
|
||||
@NotNull
|
||||
public static PsiType createDisjunction(@NotNull List<PsiType> types, @NotNull PsiManager psiManager) {
|
||||
assert types.size() > 0;
|
||||
assert !types.isEmpty();
|
||||
return types.size() == 1 ? types.get(0) : new PsiDisjunctionType(types, psiManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ public class ClassUtil {
|
||||
if (className == null){
|
||||
return null;
|
||||
}
|
||||
if (qualifiedName == null || qualifiedName.length() == 0){
|
||||
if (qualifiedName == null || qualifiedName.isEmpty()){
|
||||
return className;
|
||||
}
|
||||
return qualifiedName + "." + extractClassName(className);
|
||||
@@ -120,7 +120,7 @@ public class ClassUtil {
|
||||
public static PsiClass findNonQualifiedClassByIndex(final String indexName, @NotNull final PsiClass containingClass,
|
||||
final boolean jvmCompatible) {
|
||||
String prefix = getDigitPrefix(indexName);
|
||||
final int idx = prefix.length() > 0 ? Integer.parseInt(prefix) : -1;
|
||||
final int idx = !prefix.isEmpty() ? Integer.parseInt(prefix) : -1;
|
||||
final String name = prefix.length() < indexName.length() ? indexName.substring(prefix.length()) : null;
|
||||
final PsiClass[] result = new PsiClass[1];
|
||||
containingClass.accept(new JavaRecursiveElementVisitor() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ public class ConditionalGoToInstruction extends ConditionalBranchingInstruction
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final @NonNls String sRole = "["+role.toString()+"]";
|
||||
@NonNls final String sRole = "["+role.toString()+"]";
|
||||
return "COND_GOTO " + sRole + " " + offset;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1249,7 +1249,7 @@ public class ControlFlowUtil {
|
||||
// map of variable->PsiReferenceExpressions for all read before written variables for this point and below in control flow
|
||||
private final CopyOnWriteList[] readVariables;
|
||||
private final ControlFlow myFlow;
|
||||
private boolean localVariablesOnly;
|
||||
private final boolean localVariablesOnly;
|
||||
|
||||
public ReadBeforeWriteClientVisitor(ControlFlow flow, boolean localVariablesOnly) {
|
||||
myFlow = flow;
|
||||
|
||||
@@ -336,7 +336,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
|
||||
List<PsiMethod> methods = getOwnMethods();
|
||||
List<PsiClass> classes = getOwnInnerClasses();
|
||||
|
||||
if (fields.size() > 0) {
|
||||
if (!fields.isEmpty()) {
|
||||
goNextLine(newIndentLevel, buffer);
|
||||
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
@@ -365,8 +365,8 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
|
||||
buffer.append(";");
|
||||
}
|
||||
|
||||
if (methods.size() > 0) {
|
||||
if (isEnum() || fields.size() > 0) {
|
||||
if (!methods.isEmpty()) {
|
||||
if (isEnum() || !fields.isEmpty()) {
|
||||
buffer.append('\n');
|
||||
}
|
||||
goNextLine(newIndentLevel, buffer);
|
||||
@@ -381,7 +381,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
|
||||
}
|
||||
}
|
||||
|
||||
if (classes.size() > 0) {
|
||||
if (!classes.isEmpty()) {
|
||||
if (fields.size() + methods.size() > 0) {
|
||||
buffer.append('\n');
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public class ClsFileImpl extends ClsRepositoryPsiElement<PsiClassHolderFileStub>
|
||||
@NotNull
|
||||
public LanguageLevel getSourceLanguageLevel() {
|
||||
final List stubs = getStub().getChildrenStubs();
|
||||
return stubs.size() > 0 ? ((PsiClassStub<?>)stubs.get(0)).getLanguageLevel() : LanguageLevel.HIGHEST;
|
||||
return !stubs.isEmpty() ? ((PsiClassStub<?>)stubs.get(0)).getLanguageLevel() : LanguageLevel.HIGHEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -120,7 +120,7 @@ public abstract class JavaClassElementType extends JavaStubElementType<PsiClassS
|
||||
if (name != null) {
|
||||
if (parentStub instanceof PsiJavaFileStub) {
|
||||
final String pkg = ((PsiJavaFileStub)parentStub).getPackageName();
|
||||
if (pkg.length() > 0) qualifiedName = pkg + '.' + name; else qualifiedName = name;
|
||||
if (!pkg.isEmpty()) qualifiedName = pkg + '.' + name; else qualifiedName = name;
|
||||
}
|
||||
else if (parentStub instanceof PsiClassStub) {
|
||||
final String parentFqn = ((PsiClassStub)parentStub).getQualifiedName();
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
|
||||
}
|
||||
else if (type == JavaElementType.PARAMETER_LIST) {
|
||||
final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
|
||||
if (params.size() > 0) {
|
||||
if (!params.isEmpty()) {
|
||||
final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
|
||||
if (pType != null) {
|
||||
isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
|
||||
|
||||
+2
-2
@@ -38,8 +38,8 @@ public class PsiImportStatementStubImpl extends StubBase<PsiImportStatementBase>
|
||||
private final StringRef myText;
|
||||
private SoftReference<PsiJavaCodeReferenceElement> myReference = null;
|
||||
|
||||
private final static int ON_DEMAND = 0x01;
|
||||
private final static int STATIC = 0x02;
|
||||
private static final int ON_DEMAND = 0x01;
|
||||
private static final int STATIC = 0x02;
|
||||
|
||||
public PsiImportStatementStubImpl(final StubElement parent, final String text, final byte flags) {
|
||||
this(parent, StringRef.fromString(text), flags);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ public class LightTypeParameterListBuilder extends LightElement implements PsiTy
|
||||
@Override
|
||||
public PsiTypeParameter[] getTypeParameters() {
|
||||
if (cached == null) {
|
||||
if (myParameters.size() == 0) {
|
||||
if (myParameters.isEmpty()) {
|
||||
cached = PsiTypeParameter.EMPTY_ARRAY;
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -584,7 +584,7 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
|
||||
PsiModifierList modifierList = PsiImplUtil.findNeighbourModifierList(this);
|
||||
if (modifierList != null) {
|
||||
List<PsiAnnotation> typeAnnotations = PsiImplUtil.getTypeUseAnnotations(modifierList);
|
||||
if (typeAnnotations != null && typeAnnotations.size() > 0) {
|
||||
if (typeAnnotations != null && !typeAnnotations.isEmpty()) {
|
||||
annotations.addAll(typeAnnotations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class PsiJavaFileBaseImpl extends PsiFileImpl implements PsiJava
|
||||
final PsiPackageStatement packageStatement = getPackageStatement();
|
||||
final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
|
||||
if (packageStatement != null) {
|
||||
if (packageName.length() > 0) {
|
||||
if (!packageName.isEmpty()) {
|
||||
final PsiJavaCodeReferenceElement reference = packageStatement.getPackageReference();
|
||||
reference.replace(factory.createReferenceFromText(packageName, packageStatement));
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public abstract class PsiJavaFileBaseImpl extends PsiFileImpl implements PsiJava
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (packageName.length() > 0) {
|
||||
if (!packageName.isEmpty()) {
|
||||
addBefore(factory.createPackageStatement(packageName), getFirstChild());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,14 +138,14 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
|
||||
|
||||
if (PsiUtil.isJavaToken(child, JavaTokenType.AND)) {
|
||||
List<PsiType> types = collectTypes();
|
||||
assert types.size() > 0 : this;
|
||||
assert !types.isEmpty() : this;
|
||||
type = PsiIntersectionType.createIntersection(types);
|
||||
break;
|
||||
}
|
||||
|
||||
if (PsiUtil.isJavaToken(child, JavaTokenType.OR)) {
|
||||
List<PsiType> types = collectTypes();
|
||||
assert types.size() > 0 : this;
|
||||
assert !types.isEmpty() : this;
|
||||
type = PsiDisjunctionType.createDisjunction(types, getManager());
|
||||
break;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
|
||||
|
||||
if (left instanceof PsiModifierList) {
|
||||
List<PsiAnnotation> annotations = PsiImplUtil.getTypeUseAnnotations((PsiModifierList)left);
|
||||
if (annotations != null && annotations.size() > 0) {
|
||||
if (annotations != null && !annotations.isEmpty()) {
|
||||
list.addAll(annotations);
|
||||
}
|
||||
break;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -176,7 +176,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
final String[] typeStrings = child.getText().split("[, ]"); //avoid param types list parsing hmm method(paramType1, paramType2, ...) -> typeElement1, identifier2, ...
|
||||
if (typeStrings != null) {
|
||||
for (String type : typeStrings) {
|
||||
if (type.length() > 0) {
|
||||
if (!type.isEmpty()) {
|
||||
types.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.List;
|
||||
class SeeDocTagInfo implements JavadocTagInfo {
|
||||
private final String myName;
|
||||
private final boolean myInline;
|
||||
private static final @NonNls String LINKPLAIN_TAG = "linkplain";
|
||||
@NonNls private static final String LINKPLAIN_TAG = "linkplain";
|
||||
|
||||
public SeeDocTagInfo(@NonNls String name, boolean isInline) {
|
||||
myName = name;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class StaticImportResolveProcessor extends BaseScopeProcessor implements
|
||||
}
|
||||
|
||||
private static boolean checkDomination(final PsiMember candidate, final List<JavaResolveResult> results) {
|
||||
if (results.size() > 0) {
|
||||
if (!results.isEmpty()) {
|
||||
for (ListIterator<JavaResolveResult> i = results.listIterator(results.size()); i.hasPrevious();) {
|
||||
final Domination domination = dominates(candidate, (PsiMember)i.previous().getElement());
|
||||
if (domination == Domination.DOMINATED_BY) {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
* User: anna
|
||||
*/
|
||||
public class InferenceIncorporationPhase {
|
||||
private InferenceSession mySession;
|
||||
private final InferenceSession mySession;
|
||||
|
||||
public InferenceIncorporationPhase(InferenceSession session) {
|
||||
mySession = session;
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ import java.util.*;
|
||||
public class InferenceSession {
|
||||
private static final Logger LOG = Logger.getInstance("#" + InferenceSession.class.getName());
|
||||
|
||||
private Map<PsiTypeParameter, InferenceVariable> myInferenceVariables = new LinkedHashMap<PsiTypeParameter, InferenceVariable>();
|
||||
private final Map<PsiTypeParameter, InferenceVariable> myInferenceVariables = new LinkedHashMap<PsiTypeParameter, InferenceVariable>();
|
||||
private final List<ConstraintFormula> myConstraints = new ArrayList<ConstraintFormula>();
|
||||
|
||||
private PsiSubstitutor mySiteSubstitutor;
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@ public class InferenceVariable {
|
||||
return myParameter;
|
||||
}
|
||||
|
||||
private Map<InferenceBound, List<PsiType>> myBounds = new HashMap<InferenceBound, List<PsiType>>();
|
||||
private PsiTypeParameter myParameter;
|
||||
private final Map<InferenceBound, List<PsiType>> myBounds = new HashMap<InferenceBound, List<PsiType>>();
|
||||
private final PsiTypeParameter myParameter;
|
||||
|
||||
private PsiType myInstantiation = PsiType.NULL;
|
||||
public InferenceVariable(PsiTypeParameter parameter) {
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class InferenceVariablesOrder {
|
||||
|
||||
public static class InferenceGraphNode<T> {
|
||||
private final List<T> myValue = new ArrayList<T>();
|
||||
private Set<InferenceGraphNode<T>> myDependencies = new HashSet<InferenceGraphNode<T>>();
|
||||
private final Set<InferenceGraphNode<T>> myDependencies = new HashSet<InferenceGraphNode<T>>();
|
||||
|
||||
private int index = -1;
|
||||
private int lowlink;
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class PsiPolyExpressionUtil {
|
||||
if (isInAssignmentOrInvocationContext(expression) && ((PsiCallExpression)expression).getTypeArguments().length == 0) {
|
||||
if (method != null) {
|
||||
final Set<PsiTypeParameter> typeParameters = new HashSet<PsiTypeParameter>(Arrays.asList(method.getTypeParameters()));
|
||||
if (typeParameters.size() > 0) {
|
||||
if (!typeParameters.isEmpty()) {
|
||||
final PsiType returnType = method.getReturnType();
|
||||
if (returnType != null) {
|
||||
return mentionsTypeParameters(returnType, typeParameters);
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.*;
|
||||
* User: anna
|
||||
*/
|
||||
public class ExpressionCompatibilityConstraint extends InputOutputConstraintFormula {
|
||||
private PsiExpression myExpression;
|
||||
private final PsiExpression myExpression;
|
||||
private PsiType myT;
|
||||
|
||||
public ExpressionCompatibilityConstraint(@NotNull PsiExpression expression, @NotNull PsiType type) {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import java.util.List;
|
||||
public class SubtypingConstraint implements ConstraintFormula {
|
||||
private PsiType myS;
|
||||
private PsiType myT;
|
||||
private boolean myIsRefTypes;
|
||||
private final boolean myIsRefTypes;
|
||||
|
||||
public SubtypingConstraint(PsiType t, PsiType s, boolean isRefTypes) {
|
||||
myT = t;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SourceUtil {
|
||||
public void visitLeaf(LeafElement leaf) {
|
||||
if (!REF_FILTER.contains(leaf.getElementType())) {
|
||||
String leafText = leaf.getText();
|
||||
if (buffer.length() > 0 && leafText.length() > 0 && Character.isJavaIdentifierPart(leafText.charAt(0))) {
|
||||
if (buffer.length() > 0 && !leafText.isEmpty() && Character.isJavaIdentifierPart(leafText.charAt(0))) {
|
||||
char lastInBuffer = buffer.charAt(buffer.length() - 1);
|
||||
if (lastInBuffer == '?' || Character.isJavaIdentifierPart(lastInBuffer)) {
|
||||
buffer.append(" ");
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ public class ClassPresentationProvider implements ItemPresentationProvider<PsiCl
|
||||
if (file instanceof PsiClassOwner) {
|
||||
PsiClassOwner classOwner = (PsiClassOwner)file;
|
||||
String packageName = classOwner.getPackageName();
|
||||
if (packageName.length() == 0) return null;
|
||||
if (packageName.isEmpty()) return null;
|
||||
return "(" + packageName + ")";
|
||||
}
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -381,7 +381,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
|
||||
boolean toFilter = false;
|
||||
for (CandidateInfo conflict : conflicts) {
|
||||
ProgressManager.checkCanceled();
|
||||
final @MethodCandidateInfo.ApplicabilityLevelConstant int level = preferVarargs((MethodCandidateInfo)conflict);
|
||||
@MethodCandidateInfo.ApplicabilityLevelConstant final int level = preferVarargs((MethodCandidateInfo)conflict);
|
||||
if (maxApplicabilityLevel > 0 && maxApplicabilityLevel != level) {
|
||||
toFilter = true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,12 +37,15 @@ public abstract class JspContextManager {
|
||||
|
||||
public abstract void setContextFile(@NotNull PsiFile file, @Nullable BaseJspFile contextFile);
|
||||
|
||||
public abstract @Nullable
|
||||
@Nullable
|
||||
public abstract
|
||||
BaseJspFile getContextFile(@NotNull PsiFile file);
|
||||
|
||||
public abstract @Nullable JspFile getConfiguredContextFile(@NotNull PsiFile file);
|
||||
@Nullable
|
||||
public abstract JspFile getConfiguredContextFile(@NotNull PsiFile file);
|
||||
|
||||
public @NotNull
|
||||
@NotNull
|
||||
public
|
||||
BaseJspFile getRootContextFile(@NotNull BaseJspFile file) {
|
||||
BaseJspFile rootContext = file;
|
||||
HashSet<BaseJspFile> recursionPreventer = new HashSet<BaseJspFile>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,7 +59,7 @@ public abstract class JspManager implements IBaseJspManager {
|
||||
public abstract List<Pair<String,String>> getAvailableFunctions(@NotNull final JspFile context);
|
||||
|
||||
@Nullable
|
||||
public abstract String getPrefixForNamespace(@NotNull String namespaceUri, final @NotNull JspFile context);
|
||||
public abstract String getPrefixForNamespace(@NotNull String namespaceUri, @NotNull final JspFile context);
|
||||
|
||||
@Nullable
|
||||
public abstract String getDefaultPrefix(@NotNull XmlFile taglibFile);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ public class PatternPackageSet extends PatternBasedPackageSet {
|
||||
myModulePatternText = modulePattern;
|
||||
Pattern mmgp = null;
|
||||
Pattern mmp = null;
|
||||
if (modulePattern == null || modulePattern.length() == 0) {
|
||||
if (modulePattern == null || modulePattern.isEmpty()) {
|
||||
mmp = null;
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -200,8 +200,8 @@ public class FileReference implements PsiFileReference, FileReferenceOwner, PsiP
|
||||
return decode(getCanonicalText());
|
||||
}
|
||||
|
||||
public
|
||||
@Nullable
|
||||
public
|
||||
String getNewFileTemplateName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,8 +77,8 @@ public class FileReferenceSet {
|
||||
private Collection<PsiFileSystemItem> myDefaultContexts;
|
||||
private final boolean myEndingSlashNotAllowed;
|
||||
private boolean myEmptyPathAllowed;
|
||||
private @Nullable Map<CustomizableReferenceProvider.CustomizationKey, Object> myOptions;
|
||||
private @Nullable FileType[] mySuitableFileTypes;
|
||||
@Nullable private Map<CustomizableReferenceProvider.CustomizationKey, Object> myOptions;
|
||||
@Nullable private FileType[] mySuitableFileTypes;
|
||||
|
||||
public FileReferenceSet(String str,
|
||||
PsiElement element,
|
||||
@@ -174,7 +174,7 @@ public class FileReferenceSet {
|
||||
this(str, element, startInElement, provider, isCaseSensitive, endingSlashNotAllowed, null);
|
||||
}
|
||||
|
||||
public FileReferenceSet(final @NotNull PsiElement element) {
|
||||
public FileReferenceSet(@NotNull final PsiElement element) {
|
||||
|
||||
myElement = element;
|
||||
TextRange range = ElementManipulators.getValueTextRange(element);
|
||||
@@ -350,13 +350,13 @@ public class FileReferenceSet {
|
||||
final Project project = file.getProject();
|
||||
for (FileReferenceHelper helper : helpers) {
|
||||
if (helper.isMine(project, virtualFile)) {
|
||||
if (list.size() > 0 && helper.isFallback()) {
|
||||
if (!list.isEmpty() && helper.isFallback()) {
|
||||
continue;
|
||||
}
|
||||
list.addAll(helper.getContexts(project, virtualFile));
|
||||
}
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
return list;
|
||||
}
|
||||
final VirtualFile parent = virtualFile.getParent();
|
||||
@@ -394,7 +394,7 @@ public class FileReferenceSet {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<PsiFileSystemItem> getAbsoluteTopLevelDirLocations(final @NotNull PsiFile file) {
|
||||
public static Collection<PsiFileSystemItem> getAbsoluteTopLevelDirLocations(@NotNull final PsiFile file) {
|
||||
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile == null) {
|
||||
@@ -410,7 +410,7 @@ public class FileReferenceSet {
|
||||
final ArrayList<PsiFileSystemItem> list = new ArrayList<PsiFileSystemItem>();
|
||||
for (FileReferenceHelper helper : helpers) {
|
||||
if (helper.isMine(project, virtualFile)) {
|
||||
if (helper.isFallback() && list.size() > 0) {
|
||||
if (helper.isFallback() && !list.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
final Collection<PsiFileSystemItem> roots = helper.getRoots(module);
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ public class NullFileReferenceHelper extends FileReferenceHelper {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<PsiFileSystemItem> getContexts(final Project project, final @NotNull VirtualFile file) {
|
||||
public Collection<PsiFileSystemItem> getContexts(final Project project, @NotNull final VirtualFile file) {
|
||||
final PsiFileSystemItem item = getPsiFileSystemItem(project, file);
|
||||
if (item != null) {
|
||||
final PsiFileSystemItem parent = item.getParent();
|
||||
@@ -67,7 +67,7 @@ public class NullFileReferenceHelper extends FileReferenceHelper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMine(final Project project, final @NotNull VirtualFile file) {
|
||||
public boolean isMine(final Project project, @NotNull final VirtualFile file) {
|
||||
return ProjectRootManager.getInstance(project).getFileIndex().isInContent(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,10 +28,10 @@ import java.util.Collection;
|
||||
*/
|
||||
public abstract class FileContextProvider {
|
||||
|
||||
public final static ExtensionPointName<FileContextProvider> EP_NAME = new ExtensionPointName<FileContextProvider>("com.intellij.fileContextProvider");
|
||||
public static final ExtensionPointName<FileContextProvider> EP_NAME = new ExtensionPointName<FileContextProvider>("com.intellij.fileContextProvider");
|
||||
|
||||
@Nullable
|
||||
public static FileContextProvider getProvider(final @NotNull PsiFile file) {
|
||||
public static FileContextProvider getProvider(@NotNull final PsiFile file) {
|
||||
for (FileContextProvider provider: Extensions.getExtensions(EP_NAME, file.getProject())) {
|
||||
if (provider.isAvailable(file)) {
|
||||
return provider;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -149,7 +149,7 @@ public abstract class PsiReferenceBase<T extends PsiElement> implements PsiRefer
|
||||
return mySoft;
|
||||
}
|
||||
|
||||
public static abstract class Poly<T extends PsiElement> extends PsiReferenceBase<T> implements PsiPolyVariantReference {
|
||||
public abstract static class Poly<T extends PsiElement> extends PsiReferenceBase<T> implements PsiPolyVariantReference {
|
||||
|
||||
public Poly(final T psiElement) {
|
||||
super(psiElement);
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.util;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -59,7 +74,7 @@ public class QualifiedName {
|
||||
int size = myComponents.size();
|
||||
QualifiedName result = new QualifiedName(size);
|
||||
result.myComponents.addAll(myComponents);
|
||||
for (int i = 0; i < count && result.myComponents.size() > 0; i++) {
|
||||
for (int i = 0; i < count && !result.myComponents.isEmpty(); i++) {
|
||||
result.myComponents.remove(result.myComponents.size()-1);
|
||||
}
|
||||
return result;
|
||||
@@ -70,7 +85,7 @@ public class QualifiedName {
|
||||
int size = myComponents.size();
|
||||
QualifiedName result = new QualifiedName(size);
|
||||
result.myComponents.addAll(myComponents);
|
||||
for (int i = 0; i < count && result.myComponents.size() > 0; i++) {
|
||||
for (int i = 0; i < count && !result.myComponents.isEmpty(); i++) {
|
||||
result.myComponents.remove(0);
|
||||
}
|
||||
return result;
|
||||
@@ -145,7 +160,7 @@ public class QualifiedName {
|
||||
|
||||
@Nullable
|
||||
public String getFirstComponent() {
|
||||
if (myComponents.size() == 0) {
|
||||
if (myComponents.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return myComponents.get(0);
|
||||
@@ -153,7 +168,7 @@ public class QualifiedName {
|
||||
|
||||
@Nullable
|
||||
public String getLastComponent() {
|
||||
if (myComponents.size() == 0) {
|
||||
if (myComponents.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return myComponents.get(myComponents.size()-1);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* To change this template use Options | File Templates.
|
||||
*/
|
||||
public abstract class ReferenceProvidersRegistry {
|
||||
public final static PsiReferenceProvider NULL_REFERENCE_PROVIDER = new PsiReferenceProvider() {
|
||||
public static final PsiReferenceProvider NULL_REFERENCE_PROVIDER = new PsiReferenceProvider() {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,7 +26,7 @@ import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ForeignLeafPsiElement extends LeafPsiElement {
|
||||
private ForeignLeafType myForeignType;
|
||||
private final ForeignLeafType myForeignType;
|
||||
|
||||
public ForeignLeafPsiElement(ForeignLeafType type, CharSequence text) {
|
||||
super(dereferenceElementType(type.getDelegate()), text);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -92,7 +92,7 @@ public class FilenameIndex extends ScalarIndexExtension<String> {
|
||||
return (PsiFile[])getFilesByName(project, name, scope, false);
|
||||
}
|
||||
|
||||
public static boolean processFilesByName(final @NotNull String name,
|
||||
public static boolean processFilesByName(@NotNull final String name,
|
||||
boolean includeDirs,
|
||||
@NotNull Processor<? super PsiFileSystemItem> processor,
|
||||
@NotNull GlobalSearchScope scope,
|
||||
@@ -134,7 +134,7 @@ public class FilenameIndex extends ScalarIndexExtension<String> {
|
||||
|
||||
public static PsiFileSystemItem[] getFilesByName(final Project project,
|
||||
final String name,
|
||||
final @NotNull GlobalSearchScope scope,
|
||||
@NotNull final GlobalSearchScope scope,
|
||||
boolean includeDirs) {
|
||||
SmartList<PsiFileSystemItem> result = new SmartList<PsiFileSystemItem>();
|
||||
processFilesByName(name, includeDirs, new CommonProcessors.CollectProcessor<PsiFileSystemItem>(result), scope, project, null);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -120,7 +120,7 @@ public class PackageEntryTable implements JDOMExternalizable, Cloneable {
|
||||
throw new InvalidDataException();
|
||||
}
|
||||
PackageEntry entry;
|
||||
if (packageName.length() == 0) {
|
||||
if (packageName.isEmpty()) {
|
||||
entry = isStatic ? PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY : PackageEntry.ALL_OTHER_IMPORTS_ENTRY;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,7 @@ public abstract class PredefinedCodeStyle {
|
||||
public static final ExtensionPointName<PredefinedCodeStyle> EP_NAME =
|
||||
ExtensionPointName.create("com.intellij.predefinedCodeStyle");
|
||||
|
||||
public final static PredefinedCodeStyle[] EMPTY_ARRAY = new PredefinedCodeStyle[]{};
|
||||
public static final PredefinedCodeStyle[] EMPTY_ARRAY = new PredefinedCodeStyle[]{};
|
||||
private final String myName;
|
||||
private final Language myLanguage;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public abstract class ReferenceInjector extends Injectable {
|
||||
|
||||
public final static ExtensionPointName<ReferenceInjector> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.referenceInjector");
|
||||
public static final ExtensionPointName<ReferenceInjector> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.referenceInjector");
|
||||
|
||||
@Override
|
||||
public final Language getLanguage() {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -129,7 +129,7 @@ public class DefaultArrangementEntryMatcherSerializerTest {
|
||||
List children1 = expected.getChildren();
|
||||
List children2 = actual.getChildren();
|
||||
assertEquals(children1.size(), children2.size());
|
||||
if (children1.size() == 0) {
|
||||
if (children1.isEmpty()) {
|
||||
assertTrue(
|
||||
String.format("Content mismatch - expected: '%s', actual: '%s'", expected.getText(), actual.getText()),
|
||||
Comparing.equal(expected.getText(), actual.getText())
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -89,7 +89,7 @@ public abstract class AbstractWhiteSpaceFormattingStrategy implements WhiteSpace
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiElement next(final @NotNull PsiElement element) {
|
||||
private static PsiElement next(@NotNull final PsiElement element) {
|
||||
for (PsiElement anchor = element; anchor != null; anchor = anchor.getParent()) {
|
||||
final PsiElement result = element.getNextSibling();
|
||||
if (result != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -291,7 +291,7 @@ public class FormatterUtil {
|
||||
public static void replaceWhiteSpace(final String whiteSpace,
|
||||
final ASTNode leafElement,
|
||||
final IElementType whiteSpaceToken,
|
||||
final @Nullable TextRange textRange) {
|
||||
@Nullable final TextRange textRange) {
|
||||
final CharTable charTable = SharedImplUtil.findCharTableByTree(leafElement);
|
||||
|
||||
ASTNode treePrev = findPreviousWhiteSpace(leafElement, whiteSpaceToken);
|
||||
@@ -300,11 +300,10 @@ public class FormatterUtil {
|
||||
}
|
||||
|
||||
if (treePrev != null &&
|
||||
treePrev.getText().trim().length() == 0 &&
|
||||
treePrev.getText().trim().isEmpty() &&
|
||||
treePrev.getElementType() != whiteSpaceToken &&
|
||||
treePrev.getTextLength() > 0 &&
|
||||
whiteSpace.length() >
|
||||
0) {
|
||||
!whiteSpace.isEmpty()) {
|
||||
LeafElement whiteSpaceElement =
|
||||
Factory.createSingleLeafElement(treePrev.getElementType(), whiteSpace, charTable, SharedImplUtil.getManagerByTree(leafElement));
|
||||
|
||||
@@ -316,20 +315,20 @@ public class FormatterUtil {
|
||||
Factory.createSingleLeafElement(whiteSpaceToken, whiteSpace, charTable, SharedImplUtil.getManagerByTree(leafElement));
|
||||
|
||||
if (treePrev == null) {
|
||||
if (whiteSpace.length() > 0) {
|
||||
if (!whiteSpace.isEmpty()) {
|
||||
addWhiteSpace(leafElement, whiteSpaceElement);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(treePrev.getElementType() == whiteSpaceToken)) {
|
||||
if (whiteSpace.length() > 0) {
|
||||
if (!whiteSpace.isEmpty()) {
|
||||
addWhiteSpace(treePrev, whiteSpaceElement);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (treePrev.getElementType() == whiteSpaceToken) {
|
||||
final CompositeElement treeParent = (CompositeElement)treePrev.getTreeParent();
|
||||
if (whiteSpace.length() > 0) {
|
||||
if (!whiteSpace.isEmpty()) {
|
||||
// LOG.assertTrue(textRange == null || treeParent.getTextRange().equals(textRange));
|
||||
treeParent.replaceChild(treePrev, whiteSpaceElement);
|
||||
}
|
||||
@@ -438,10 +437,10 @@ public class FormatterUtil {
|
||||
if (lastWS != null && !lastWS.getTextRange().equals(textRange)) {
|
||||
return;
|
||||
}
|
||||
if (whiteSpace.length() == 0 && lastWS == null) {
|
||||
if (whiteSpace.isEmpty() && lastWS == null) {
|
||||
return;
|
||||
}
|
||||
if (lastWS != null && whiteSpace.length() == 0) {
|
||||
if (lastWS != null && whiteSpace.isEmpty()) {
|
||||
lastWS.getTreeParent().removeRange(lastWS, null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public abstract class AbstractBlock implements ASTBlock {
|
||||
if (list.isEmpty()) {
|
||||
list = buildInjectedBlocks();
|
||||
}
|
||||
mySubBlocks = list.size() > 0 ? list : EMPTY;
|
||||
mySubBlocks = !list.isEmpty() ? list : EMPTY;
|
||||
}
|
||||
return mySubBlocks;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -157,7 +157,7 @@ public abstract class InjectedLanguageBlockBuilder {
|
||||
final FormattingModel childModel = builder.createModel(childPsi, getSettings());
|
||||
Block original = childModel.getRootBlock();
|
||||
|
||||
if ((original.isLeaf() && injectedNode.getText().trim().length() > 0) || original.getSubBlocks().size() != 0) {
|
||||
if ((original.isLeaf() && !injectedNode.getText().trim().isEmpty()) || !original.getSubBlocks().isEmpty()) {
|
||||
result.add(createInjectedBlock(injectedNode, original, indent, offset, range, childLanguage));
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,11 +45,11 @@ public final class InjectedLanguageBlockWrapper implements BlockEx {
|
||||
* @param range range of code inside injected document which is really placed in the main document
|
||||
* @param indent
|
||||
*/
|
||||
public InjectedLanguageBlockWrapper(final @NotNull Block original, final int offset, @Nullable TextRange range, @Nullable Indent indent) {
|
||||
public InjectedLanguageBlockWrapper(@NotNull final Block original, final int offset, @Nullable TextRange range, @Nullable Indent indent) {
|
||||
this(original, offset, range, indent, null);
|
||||
}
|
||||
|
||||
public InjectedLanguageBlockWrapper(final @NotNull Block original,
|
||||
public InjectedLanguageBlockWrapper(@NotNull final Block original,
|
||||
final int offset,
|
||||
@Nullable TextRange range,
|
||||
@Nullable Indent indent,
|
||||
@@ -102,7 +102,7 @@ public final class InjectedLanguageBlockWrapper implements BlockEx {
|
||||
|
||||
private List<Block> buildBlocks() {
|
||||
final List<Block> list = myOriginal.getSubBlocks();
|
||||
if (list.size() == 0) return AbstractBlock.EMPTY;
|
||||
if (list.isEmpty()) return AbstractBlock.EMPTY;
|
||||
if (myOffset == 0 && myRange == null) return list;
|
||||
|
||||
final ArrayList<Block> result = new ArrayList<Block>(list.size());
|
||||
@@ -117,7 +117,7 @@ public final class InjectedLanguageBlockWrapper implements BlockEx {
|
||||
return result;
|
||||
}
|
||||
|
||||
private void collectBlocksIntersectingRange(final List<Block> list, final List<Block> result, final @NotNull TextRange range) {
|
||||
private void collectBlocksIntersectingRange(final List<Block> list, final List<Block> result, @NotNull final TextRange range) {
|
||||
for (Block block : list) {
|
||||
final TextRange textRange = block.getTextRange();
|
||||
if (range.contains(textRange)) {
|
||||
|
||||
+2
-1
@@ -49,7 +49,8 @@ public class LexerEditorHighlighterLexer extends LexerBase {
|
||||
myAlreadyInitializedHighlighter = alreadyInitializedHighlighter;
|
||||
}
|
||||
|
||||
public static @Nullable Lexer getLexerBasedOnLexerHighlighter(CharSequence text, VirtualFile virtualFile, Project project) {
|
||||
@Nullable
|
||||
public static Lexer getLexerBasedOnLexerHighlighter(CharSequence text, VirtualFile virtualFile, Project project) {
|
||||
EditorHighlighter highlighter = null;
|
||||
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class CustomizingReferenceProvider extends PsiReferenceProvider implements CustomizableReferenceProvider {
|
||||
private final CustomizableReferenceProvider myProvider;
|
||||
private @Nullable Map<CustomizationKey, Object> myOptions;
|
||||
@Nullable private Map<CustomizationKey, Object> myOptions;
|
||||
|
||||
public CustomizingReferenceProvider(@NotNull CustomizableReferenceProvider provider) {
|
||||
myProvider = provider;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -92,7 +92,7 @@ public class PsiFileReferenceHelper extends FileReferenceHelper {
|
||||
for (SourceFolder sf : e.getSourceFolders(JavaModuleSourceRootTypes.SOURCES)) {
|
||||
if (root.equals(sf.getFile())) {
|
||||
String s = sf.getPackagePrefix();
|
||||
if (s.length() > 0) {
|
||||
if (!s.isEmpty()) {
|
||||
path = s + "." + path;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,7 +36,7 @@ public class MinusculeMatcher implements Matcher {
|
||||
* Need either an explicit uppercase letter or the same separator character in prefix
|
||||
*/
|
||||
private static final String HARD_SEPARATORS = " ()";
|
||||
private ThreadLocal<MatchingState> myMatchingState = new ThreadLocal<MatchingState>() {
|
||||
private final ThreadLocal<MatchingState> myMatchingState = new ThreadLocal<MatchingState>() {
|
||||
@Override
|
||||
protected MatchingState initialValue() {
|
||||
return new MatchingState();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -115,5 +115,5 @@ public class XmlElementFactoryImpl extends XmlElementFactory {
|
||||
return document;
|
||||
}
|
||||
|
||||
private final static Logger LOG = Logger.getInstance(XmlElementFactoryImpl.class);
|
||||
private static final Logger LOG = Logger.getInstance(XmlElementFactoryImpl.class);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
public abstract class AbstractXmlBlock extends AbstractBlock {
|
||||
protected XmlFormattingPolicy myXmlFormattingPolicy;
|
||||
protected XmlInjectedLanguageBlockBuilder myInjectedBlockBuilder;
|
||||
private boolean myPreserveSpace;
|
||||
private final boolean myPreserveSpace;
|
||||
|
||||
protected AbstractXmlBlock(final ASTNode node,
|
||||
final Wrap wrap,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -215,7 +215,8 @@ public class XmlBlock extends AbstractXmlBlock {
|
||||
}
|
||||
}
|
||||
|
||||
protected @Nullable Wrap getDefaultWrap(ASTNode node) {
|
||||
@Nullable
|
||||
protected Wrap getDefaultWrap(ASTNode node) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,9 +25,9 @@ import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
|
||||
*/
|
||||
public class XmlCodeStyleSettings extends CustomCodeStyleSettings {
|
||||
|
||||
public final static int WS_AROUND_CDATA_PRESERVE = 0;
|
||||
public final static int WS_AROUND_CDATA_NONE = 1;
|
||||
public final static int WS_AROUND_CDATA_NEW_LINES = 2;
|
||||
public static final int WS_AROUND_CDATA_PRESERVE = 0;
|
||||
public static final int WS_AROUND_CDATA_NONE = 1;
|
||||
public static final int WS_AROUND_CDATA_NEW_LINES = 2;
|
||||
|
||||
public boolean XML_KEEP_WHITESPACES = false;
|
||||
public int XML_ATTRIBUTE_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ public class XmlInjectedLanguageBlockBuilder extends InjectedLanguageBlockBuilde
|
||||
return true;
|
||||
}
|
||||
|
||||
return text.length() == 0;
|
||||
return text.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -134,8 +134,8 @@ public class XmlTagBlock extends AbstractXmlBlock{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected
|
||||
@Nullable
|
||||
protected
|
||||
ASTNode processChild(List<Block> result, final ASTNode child, final Wrap wrap, final Alignment alignment, final Indent indent) {
|
||||
IElementType type = child.getElementType();
|
||||
if (type == XmlElementType.XML_TEXT) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
*/
|
||||
public class XmlAttributeManipulator extends AbstractElementManipulator<XmlAttribute> {
|
||||
|
||||
private final static Logger LOG = Logger.getInstance(XmlAttributeManipulator.class);
|
||||
private static final Logger LOG = Logger.getInstance(XmlAttributeManipulator.class);
|
||||
|
||||
public XmlAttribute handleContentChange(XmlAttribute attribute, TextRange range, String newContent) throws IncorrectOperationException {
|
||||
String attr = attribute.getText();
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,10 +66,11 @@ public class XmlTagManipulator extends AbstractElementManipulator<XmlTag> {
|
||||
final String trimmed = value.trim();
|
||||
final int i = value.indexOf(trimmed);
|
||||
final int start = xmlText.displayToPhysical(i) + offset;
|
||||
return trimmed.length() == 0 ? new TextRange(start, start) : new TextRange(start, xmlText.displayToPhysical(i + trimmed.length() - 1) + offset + 1);
|
||||
return trimmed.isEmpty()
|
||||
? new TextRange(start, start) : new TextRange(start, xmlText.displayToPhysical(i + trimmed.length() - 1) + offset + 1);
|
||||
}
|
||||
|
||||
public static TextRange[] getValueRanges(final @NotNull XmlTag tag) {
|
||||
public static TextRange[] getValueRanges(@NotNull final XmlTag tag) {
|
||||
final XmlTagValue value = tag.getValue();
|
||||
final XmlText[] texts = value.getTextElements();
|
||||
if (texts.length == 0) {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,7 @@ public class XmlTextManipulator extends AbstractElementManipulator<XmlText> {
|
||||
newValue = replacement.toString();
|
||||
}
|
||||
if (Comparing.equal(value, newValue)) return text;
|
||||
if (newValue.length() > 0) {
|
||||
if (!newValue.isEmpty()) {
|
||||
text.setValue(newValue);
|
||||
}
|
||||
else {
|
||||
@@ -60,6 +60,6 @@ public class XmlTextManipulator extends AbstractElementManipulator<XmlText> {
|
||||
final String value = xmlText.getValue();
|
||||
final int i = value.indexOf(value);
|
||||
final int start = xmlText.displayToPhysical(i);
|
||||
return value.length() == 0 ? new TextRange(start, start) : new TextRange(start, xmlText.displayToPhysical(i + value.length() - 1) + 1);
|
||||
return value.isEmpty() ? new TextRange(start, start) : new TextRange(start, xmlText.displayToPhysical(i + value.length() - 1) + 1);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -101,7 +101,7 @@ class CreateXmlElementIntentionAction implements IntentionAction {
|
||||
|
||||
protected void addTextTo(Template template, XmlTag rootTag) {
|
||||
String schemaPrefix = rootTag.getPrefixByNamespace(XmlUtil.XML_SCHEMA_URI);
|
||||
if (schemaPrefix.length() > 0) schemaPrefix += ":";
|
||||
if (!schemaPrefix.isEmpty()) schemaPrefix += ":";
|
||||
|
||||
template.addTextSegment(
|
||||
"<" + schemaPrefix + myDeclarationTagName + " name=\"" + XmlUtil.findLocalNameByQualifiedName(myRef.getCanonicalText()) + "\">"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -131,7 +131,7 @@ class XsContentDFA extends XmlContentDFA {
|
||||
return new QName(tag.getNamespacePrefix().intern(),
|
||||
tag.getLocalName().intern(),
|
||||
tag.getName().intern(),
|
||||
namespace.length() == 0 ? null : namespace.intern());
|
||||
namespace.isEmpty() ? null : namespace.intern());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@ public class EncodeEachSymbolPolicy extends DefaultXmlPsiPolicy{
|
||||
while (offset < displayText.length()) {
|
||||
if (toCode(displayText.charAt(offset))) {
|
||||
final String plainSection = displayText.substring(sectionStartOffset, offset);
|
||||
if (plainSection.length() > 0) {
|
||||
if (!plainSection.isEmpty()) {
|
||||
dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text));
|
||||
}
|
||||
dummyParent.rawAddChildren(createCharEntity(displayText.charAt(offset), dummyParent.getCharTable()));
|
||||
@@ -44,7 +44,7 @@ public class EncodeEachSymbolPolicy extends DefaultXmlPsiPolicy{
|
||||
offset++;
|
||||
}
|
||||
final String plainSection = displayText.substring(sectionStartOffset, offset);
|
||||
if (plainSection.length() > 0) {
|
||||
if (!plainSection.isEmpty()) {
|
||||
dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -89,11 +89,11 @@ public class HtmlTagImpl extends XmlTagImpl implements HtmlTag {
|
||||
public String getNamespace() {
|
||||
final String xmlNamespace = super.getNamespace();
|
||||
|
||||
if (getNamespacePrefix().length() > 0) {
|
||||
if (!getNamespacePrefix().isEmpty()) {
|
||||
return xmlNamespace;
|
||||
}
|
||||
|
||||
if (xmlNamespace.length() == 0 || xmlNamespace.equals(XmlUtil.XHTML_URI)) {
|
||||
if (xmlNamespace.isEmpty() || xmlNamespace.equals(XmlUtil.XHTML_URI)) {
|
||||
return XmlUtil.HTML_URI;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ import java.util.List;
|
||||
public class ScriptSupportUtil {
|
||||
private static final Key<CachedValue<XmlTag[]>> CachedScriptTagsKey = Key.create("script tags");
|
||||
private static final ThreadLocal<String> ProcessingDeclarationsFlag = new ThreadLocal<String>();
|
||||
private static final @NonNls String SCRIPT_TAG = "script";
|
||||
@NonNls private static final String SCRIPT_TAG = "script";
|
||||
|
||||
private ScriptSupportUtil() {
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,9 +36,9 @@ import java.util.Map;
|
||||
* @author Maxim.Mossienko
|
||||
*/
|
||||
public class HtmlNSDescriptorImpl implements XmlNSDescriptor, DumbAware, XmlNSTypeDescriptorProvider {
|
||||
private XmlNSDescriptor myDelegate;
|
||||
private boolean myRelaxed;
|
||||
private boolean myCaseSensitive;
|
||||
private final XmlNSDescriptor myDelegate;
|
||||
private final boolean myRelaxed;
|
||||
private final boolean myCaseSensitive;
|
||||
|
||||
private static final SimpleFieldCache<Map<String, XmlElementDescriptor>, HtmlNSDescriptorImpl> myCachedDeclsCache = new SimpleFieldCache<Map<String, XmlElementDescriptor>, HtmlNSDescriptorImpl>() {
|
||||
protected Map<String, XmlElementDescriptor> compute(final HtmlNSDescriptorImpl htmlNSDescriptor) {
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -212,14 +212,15 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
|
||||
if (element instanceof XmlAttributeValue) {
|
||||
final XmlAttributeValue attributeValue = (XmlAttributeValue)element;
|
||||
final String prefix = XmlUtil.findPrefixByQualifiedName(attributeValue.getValue());
|
||||
if (prefix.length() > 0) {
|
||||
if (!prefix.isEmpty()) {
|
||||
return new SchemaPrefixReference(attributeValue, TextRange.from(1, prefix.length()), prefix, null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static @Nullable XmlNSDescriptorImpl findRedefinedDescriptor(XmlTag tag, String text) {
|
||||
@Nullable
|
||||
public static XmlNSDescriptorImpl findRedefinedDescriptor(XmlTag tag, String text) {
|
||||
final String localName = XmlUtil.findLocalNameByQualifiedName(text);
|
||||
for(XmlTag parentTag = tag.getParentTag(); parentTag != null; parentTag = parentTag.getParentTag()) {
|
||||
|
||||
|
||||
+20
-5
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -48,7 +63,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference {
|
||||
this.nsPrefix = prefix;
|
||||
}
|
||||
|
||||
private final @Nullable ReferenceType myType;
|
||||
@Nullable private final ReferenceType myType;
|
||||
|
||||
protected TypeOrElementOrAttributeReference(PsiElement element, TextRange range, @Nullable ReferenceType type) {
|
||||
myElement = element;
|
||||
@@ -220,7 +235,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference {
|
||||
private static String getNamespace(final XmlTag tag, final String text) {
|
||||
final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(text);
|
||||
final String namespaceByPrefix = tag.getNamespaceByPrefix(namespacePrefix);
|
||||
if (namespaceByPrefix.length() > 0) return namespaceByPrefix;
|
||||
if (!namespaceByPrefix.isEmpty()) return namespaceByPrefix;
|
||||
final XmlTag rootTag = ((XmlFile)tag.getContainingFile()).getRootTag();
|
||||
|
||||
if (rootTag != null &&
|
||||
@@ -232,7 +247,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference {
|
||||
final String targetNsPrefix = rootTag.getPrefixByNamespace(targetNS);
|
||||
|
||||
if (namespacePrefix.equals(targetNsPrefix) ||
|
||||
(namespaceByPrefix.length() == 0 && targetNsPrefix == null)) {
|
||||
(namespaceByPrefix.isEmpty() && targetNsPrefix == null)) {
|
||||
return targetNS;
|
||||
}
|
||||
}
|
||||
@@ -244,7 +259,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference {
|
||||
public String getCanonicalText() {
|
||||
final String text = myElement.getText();
|
||||
String name = myRange.getEndOffset() <= text.length() ? myRange.substring(text) : "";
|
||||
if (name.length() > 0 && nsPrefix != null && nsPrefix.length() > 0) {
|
||||
if (!name.isEmpty() && nsPrefix != null && !nsPrefix.isEmpty()) {
|
||||
name = nsPrefix + ":" + name;
|
||||
}
|
||||
return name;
|
||||
@@ -366,7 +381,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference {
|
||||
public boolean execute(@NotNull final XmlTag element) {
|
||||
String name = element.getAttributeValue(SchemaReferencesProvider.NAME_ATTR_NAME);
|
||||
final String prefixByNamespace = tag.getPrefixByNamespace(namespace);
|
||||
if (prefixByNamespace != null && prefixByNamespace.length() > 0 && prefix == null) {
|
||||
if (prefixByNamespace != null && !prefixByNamespace.isEmpty() && prefix == null) {
|
||||
name = prefixByNamespace + ":" + name;
|
||||
}
|
||||
myElements.add( name );
|
||||
|
||||
+18
-3
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
|
||||
|
||||
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
|
||||
@@ -62,12 +77,12 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider {
|
||||
myIncorrectResourceMapped = false;
|
||||
final String canonicalText = getCanonicalText();
|
||||
|
||||
if (canonicalText.length() == 0) {
|
||||
if (canonicalText.isEmpty()) {
|
||||
final XmlAttribute attr = PsiTreeUtil.getParentOfType(getElement(), XmlAttribute.class);
|
||||
|
||||
if (attr != null &&
|
||||
attr.isNamespaceDeclaration() &&
|
||||
attr.getNamespacePrefix().length() == 0 ||
|
||||
attr.getNamespacePrefix().isEmpty() ||
|
||||
ExternalResourceManagerEx.getInstanceEx().isIgnoredResource(canonicalText)
|
||||
) {
|
||||
// Namespaces in XML 1.0 2nd edition, Section 6.2, last paragraph
|
||||
@@ -219,7 +234,7 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider {
|
||||
public static void processWsdlSchemas(final XmlTag rootTag, Processor<XmlTag> processor) {
|
||||
if ("definitions".equals(rootTag.getLocalName())) {
|
||||
final String nsPrefix = rootTag.getNamespacePrefix();
|
||||
final String types = nsPrefix.length() == 0 ? "types" : nsPrefix + ":types";
|
||||
final String types = nsPrefix.isEmpty() ? "types" : nsPrefix + ":types";
|
||||
final XmlTag subTag = rootTag.findFirstSubTag(types);
|
||||
|
||||
if (subTag != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -132,7 +132,7 @@ public class TagNameReference implements PsiReference {
|
||||
}
|
||||
|
||||
private static String prependNamespacePrefix(String newElementName, String namespacePrefix) {
|
||||
newElementName = (namespacePrefix.length() > 0 ? namespacePrefix + ":":namespacePrefix) + newElementName;
|
||||
newElementName = (!namespacePrefix.isEmpty() ? namespacePrefix + ":":namespacePrefix) + newElementName;
|
||||
return newElementName;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ public class TagNameVariantCollector {
|
||||
// If there are tags from default namespace they will be handled via
|
||||
// their element descriptors (prev if section)
|
||||
if (namespace == null) return;
|
||||
if(namespace.length() == 0 && !visited.isEmpty()) return;
|
||||
if(namespace.isEmpty() && !visited.isEmpty()) return;
|
||||
|
||||
XmlNSDescriptor nsDescriptor = getDescriptor(element, namespace, true, extension);
|
||||
if (nsDescriptor == null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -117,7 +117,7 @@ public class XmlAttributeImpl extends XmlElementImpl implements XmlAttribute {
|
||||
final String name = getName();
|
||||
final String prefixByQualifiedName = XmlUtil.findPrefixByQualifiedName(name);
|
||||
// The namespace name for an unprefixed attribute name always has no value. Namespace recommendation section 6.2, third paragraph
|
||||
if (prefixByQualifiedName.length() == 0) return XmlUtil.EMPTY_URI;
|
||||
if (prefixByQualifiedName.isEmpty()) return XmlUtil.EMPTY_URI;
|
||||
return getParent().getNamespaceByPrefix(prefixByQualifiedName);
|
||||
}
|
||||
|
||||
@@ -325,12 +325,12 @@ public class XmlAttributeImpl extends XmlElementImpl implements XmlAttribute {
|
||||
final String localName = getLocalName();
|
||||
final String prefix = XmlUtil.findPrefixByQualifiedName(getName());
|
||||
final TextRange range =
|
||||
prefix.length() == 0 ? TextRange.from(getName().length(), 0) : TextRange.from(prefix.length() + 1, localName.length());
|
||||
prefix.isEmpty() ? TextRange.from(getName().length(), 0) : TextRange.from(prefix.length() + 1, localName.length());
|
||||
refs[0] = new SchemaPrefixReference(this, range, localName, null);
|
||||
}
|
||||
else {
|
||||
final String prefix = getNamespacePrefix();
|
||||
if (prefix.length() > 0 && getLocalName().length() > 0) {
|
||||
if (!prefix.isEmpty() && !getLocalName().isEmpty()) {
|
||||
refs = new PsiReference[referencesFromProviders.length + 2];
|
||||
refs[0] = new SchemaPrefixReference(this, TextRange.from(0, prefix.length()), prefix, null);
|
||||
refs[1] = new XmlAttributeReference(this);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class XmlAttributeReference implements PsiReference {
|
||||
public TextRange getRangeInElement() {
|
||||
final int parentOffset = myAttribute.getNameElement().getStartOffsetInParent();
|
||||
int nsLen = myAttribute.getNamespacePrefix().length();
|
||||
nsLen += nsLen > 0 && myAttribute.getRealLocalName().length() > 0 ? 1 : -nsLen;
|
||||
nsLen += nsLen > 0 && !myAttribute.getRealLocalName().isEmpty() ? 1 : -nsLen;
|
||||
return new TextRange(parentOffset + nsLen, parentOffset + myAttribute.getNameElement().getTextLength());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut
|
||||
public TextRange getValueTextRange() {
|
||||
final TextRange range = getTextRange();
|
||||
final String value = getValue();
|
||||
if (value.length() == 0) {
|
||||
if (value.isEmpty()) {
|
||||
return range;
|
||||
}
|
||||
final int start = range.getStartOffset() + getText().indexOf(value);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -217,7 +217,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument {
|
||||
|
||||
if (nsDescriptor == null) {
|
||||
String htmlns = ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(getProject());
|
||||
if (htmlns.length() == 0) {
|
||||
if (htmlns.isEmpty()) {
|
||||
htmlns = Html5SchemaProvider.getHtml5SchemaLocation();
|
||||
}
|
||||
nsDescriptor = getDefaultNSDescriptor(htmlns, false);
|
||||
@@ -226,7 +226,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument {
|
||||
}
|
||||
else if (XmlUtil.XHTML_URI.equals(namespace)) {
|
||||
String xhtmlNamespace = XmlUtil.getDefaultXhtmlNamespace(getProject());
|
||||
if (xhtmlNamespace == null || xhtmlNamespace.length() == 0) {
|
||||
if (xhtmlNamespace == null || xhtmlNamespace.isEmpty()) {
|
||||
xhtmlNamespace = Html5SchemaProvider.getXhtml5SchemaLocation();
|
||||
}
|
||||
return getDefaultNSDescriptor(xhtmlNamespace, false);
|
||||
@@ -301,7 +301,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument {
|
||||
final String dtdUri = XmlUtil.getDtdUri(doctype);
|
||||
LOG.debug("DTD url for doctype " + doctype.getText() + " in file " + filePath + " is " + dtdUri);
|
||||
|
||||
if (dtdUri != null && dtdUri.length() > 0){
|
||||
if (dtdUri != null && !dtdUri.isEmpty()){
|
||||
XmlFile xmlFile = XmlUtil.findNamespace(containingFile, dtdUri);
|
||||
if (xmlFile == null) {
|
||||
// try to auto-detect it
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class XmlElementContentGroupImpl extends XmlElementImpl implements XmlElementContentGroup,
|
||||
XmlElementType {
|
||||
|
||||
private NotNullLazyValue<XmlContentParticle[]> myParticles = new NotNullLazyValue<XmlContentParticle[]>() {
|
||||
private final NotNullLazyValue<XmlContentParticle[]> myParticles = new NotNullLazyValue<XmlContentParticle[]>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected XmlContentParticle[] compute() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -155,7 +155,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
if (startTagRef != null) {
|
||||
refs.add(startTagRef);
|
||||
}
|
||||
if (prefix.length() > 0) {
|
||||
if (!prefix.isEmpty()) {
|
||||
refs.add(createPrefixReference(startTagName, prefix, startTagRef));
|
||||
}
|
||||
if (endTagName != null) {
|
||||
@@ -334,7 +334,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Map<String, CachedValue<XmlNSDescriptor>> initializeSchema(final @NotNull String namespace,
|
||||
private Map<String, CachedValue<XmlNSDescriptor>> initializeSchema(@NotNull final String namespace,
|
||||
@Nullable final String version,
|
||||
final String fileLocation,
|
||||
Map<String, CachedValue<XmlNSDescriptor>> map) {
|
||||
@@ -422,7 +422,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PsiMetaOwner retrieveOwner(final XmlFile file, final @NotNull String namespace) {
|
||||
private PsiMetaOwner retrieveOwner(final XmlFile file, @NotNull final String namespace) {
|
||||
if (file == null) {
|
||||
return namespace.equals(XmlUtil.getTargetSchemaNsFromTag(this)) ? this : null;
|
||||
}
|
||||
@@ -634,7 +634,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
if (keysByValue != null && !keysByValue.isEmpty()) {
|
||||
|
||||
for (String prefix : keysByValue) {
|
||||
if (prefix != null && prefix.length() > 0) {
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
final String value = getAttributeValue(prefix + ":" + _name);
|
||||
if (value != null) return value;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
if (namespace.length() == 0 || getNamespace().equals(namespace)) {
|
||||
if (namespace.isEmpty() || getNamespace().equals(namespace)) {
|
||||
return getAttributeValue(_name);
|
||||
}
|
||||
return null;
|
||||
@@ -710,7 +710,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
}
|
||||
|
||||
final String prefix = getPrefixByNamespace(namespace);
|
||||
if (prefix == null || prefix.length() == 0) return null;
|
||||
if (prefix == null || prefix.isEmpty()) return null;
|
||||
return getAttribute(prefix + ":" + name);
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
//The prefix 'xml' is by definition bound to the namespace name http://www.w3.org/XML/1998/namespace. It MAY, but need not, be declared
|
||||
if (XML_NS_PREFIX.equals(prefix)) return XmlUtil.XML_NAMESPACE_URI;
|
||||
|
||||
if (prefix.length() > 0 &&
|
||||
if (!prefix.isEmpty() &&
|
||||
!hasNamespaceDeclarations() &&
|
||||
getNamespacePrefix().equals(prefix)) {
|
||||
// When there is no namespace declarations then qualified names should be just used in dtds
|
||||
@@ -973,7 +973,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
|
||||
public XmlAttribute setAttribute(String name, String namespace, String value) throws IncorrectOperationException {
|
||||
if (!Comparing.equal(namespace, "")) {
|
||||
final String prefix = getPrefixByNamespace(namespace);
|
||||
if (prefix != null && prefix.length() > 0) name = prefix + ":" + name;
|
||||
if (prefix != null && !prefix.isEmpty()) name = prefix + ":" + name;
|
||||
}
|
||||
return setAttribute(name, value);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -227,7 +227,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI
|
||||
}
|
||||
|
||||
public void insertText(String text, int displayOffset) throws IncorrectOperationException {
|
||||
if (text == null || text.length() == 0) return;
|
||||
if (text == null || text.isEmpty()) return;
|
||||
|
||||
final int physicalOffset = displayToPhysical(displayOffset);
|
||||
final PsiElement psiElement = findElementAt(physicalOffset);
|
||||
@@ -296,7 +296,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI
|
||||
public PomModelEvent runInner() throws IncorrectOperationException {
|
||||
final String oldText = getText();
|
||||
|
||||
if (newElementText.length() > 0) {
|
||||
if (!newElementText.isEmpty()) {
|
||||
final ASTNode e =
|
||||
getPolicy().encodeXmlTextContents(newElementText, XmlTextImpl.this);
|
||||
replaceChild(psiElement.getNode(), e);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +33,7 @@ public class CDATAOnAnyEncodedPolicy extends DefaultXmlPsiPolicy{
|
||||
public ASTNode encodeXmlTextContents(String displayText, PsiElement text) {
|
||||
final ASTNode firstChild = text.getNode().getFirstChildNode();
|
||||
boolean textAlreadyHasCDATA = firstChild != null && firstChild.getElementType() == XmlElementType.XML_CDATA;
|
||||
if ((textAlreadyHasCDATA || XmlUtil.toCode(displayText)) && displayText.length() > 0) {
|
||||
if ((textAlreadyHasCDATA || XmlUtil.toCode(displayText)) && !displayText.isEmpty()) {
|
||||
final FileElement dummyParent = createCDATAElement(text.getManager(), SharedImplUtil.findCharTableByTree(text.getNode()), displayText);
|
||||
return dummyParent.getFirstChildNode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user