Merge remote-tracking branch 'origin/master'

This commit is contained in:
Sergey Evdokimov
2012-04-03 20:01:41 +04:00
83 changed files with 530 additions and 277 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -357,11 +357,11 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable {
}
public String getHelpTopic() {
final Component component = DataKeys.CONTEXT_COMPONENT.getData(DataManager.getInstance().getDataContext());
final Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(DataManager.getInstance().getDataContext());
if (myTree.equals(component)) {
final NamedConfigurable selectedConfugurable = getSelectedConfugurable();
if (selectedConfugurable instanceof FacetTypeConfigurable) {
final FacetType facetType = ((FacetTypeConfigurable)selectedConfugurable).getEditableObject();
final NamedConfigurable selectedConfigurable = getSelectedConfigurable();
if (selectedConfigurable instanceof FacetTypeConfigurable) {
final FacetType facetType = ((FacetTypeConfigurable)selectedConfigurable).getEditableObject();
final String topic = facetType.getHelpTopic();
if (topic != null) {
return topic;
@@ -413,12 +413,12 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable {
}
public void update(final AnActionEvent e) {
NamedConfigurable selected = getSelectedConfugurable();
NamedConfigurable selected = getSelectedConfigurable();
e.getPresentation().setEnabled(selected instanceof FacetConfigurable);
}
public void actionPerformed(final AnActionEvent e) {
NamedConfigurable selected = getSelectedConfugurable();
NamedConfigurable selected = getSelectedConfigurable();
if (selected instanceof FacetConfigurable) {
ProjectStructureConfigurable.getInstance(myProject).select(((FacetConfigurable)selected).getEditableObject(), true);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -818,7 +818,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
}
public void actionPerformed(final AnActionEvent e) {
final NamedConfigurable namedConfigurable = getSelectedConfugurable();
final NamedConfigurable namedConfigurable = getSelectedConfigurable();
if (namedConfigurable instanceof ModuleConfigurable) {
try {
final ModuleEditor moduleEditor = ((ModuleConfigurable)namedConfigurable).getModuleEditor();
@@ -922,7 +922,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
if (selectionPaths == null || selectionPaths.length != 1) {
e.getPresentation().setEnabled(false);
} else {
final NamedConfigurable selectedConfigurable = getSelectedConfugurable();
final NamedConfigurable selectedConfigurable = getSelectedConfigurable();
e.getPresentation().setEnabled(selectedConfigurable instanceof ModuleConfigurable || canBeCopiedByExtension(selectedConfigurable));
}
}
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 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.openapi.roots.ui.configuration.projectRoot.daemon;
import com.intellij.openapi.project.Project;
@@ -180,7 +195,7 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
navigate().doWhenDone(new Runnable() {
@Override
public void run() {
final NamedConfigurable configurable = structureConfigurable.getConfigurableFor(myLibrary).getSelectedConfugurable();
final NamedConfigurable configurable = structureConfigurable.getConfigurableFor(myLibrary).getSelectedConfigurable();
if (configurable instanceof LibraryConfigurable) {
((LibraryConfigurable)configurable).updateComponent();
}
@@ -83,7 +83,7 @@ public class JavaCharFilter extends CharFilter {
return false;
}
return name.length() == 1 && Character.isLowerCase(name.charAt(0));
return name.length() <= 2 && Character.isLowerCase(name.charAt(0));
}
public Result acceptChar(char c, final int prefixLength, final Lookup lookup) {
@@ -26,6 +26,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.FoldingGroup;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
@@ -715,7 +716,12 @@ public class JavaFoldingBuilder extends CustomFoldingBuilder implements DumbAwar
}
}
return !OverrideImplementUtil.getMethodSignaturesToImplement(baseClass).isEmpty();
try {
return !OverrideImplementUtil.getMethodSignaturesToImplement(baseClass).isEmpty();
}
catch (IndexNotReadyException e) {
return false;
}
}
private static boolean addToFold(List<FoldingDescriptor> list, PsiElement elementToFold, Document document, boolean allowOneLiners) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.Map;
*/
public class CreateClassAction extends JavaCreateTemplateInPackageAction<PsiClass> {
public CreateClassAction() {
super(IdeBundle.message("action.create.new.class"), IdeBundle.message("action.create.new.class"), PlatformIcons.CLASS_ICON, true);
super("", IdeBundle.message("action.create.new.class.description"), PlatformIcons.CLASS_ICON, true);
}
@Override
@@ -50,7 +50,7 @@ public class CreateClassAction extends JavaCreateTemplateInPackageAction<PsiClas
.setTitle(IdeBundle.message("action.create.new.class"))
.addKind("Class", PlatformIcons.CLASS_ICON, JavaTemplateUtil.INTERNAL_CLASS_TEMPLATE_NAME)
.addKind("Interface", PlatformIcons.INTERFACE_ICON, JavaTemplateUtil.INTERNAL_INTERFACE_TEMPLATE_NAME);
if (LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().compareTo(LanguageLevel.JDK_1_5) >= 0) {
if (LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) {
builder.addKind("Enum", PlatformIcons.ENUM_ICON, JavaTemplateUtil.INTERNAL_ENUM_TEMPLATE_NAME);
builder.addKind("Annotation", PlatformIcons.ANNOTATION_TYPE_ICON, JavaTemplateUtil.INTERNAL_ANNOTATION_TYPE_TEMPLATE_NAME);
}
@@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.*;
@@ -830,7 +831,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
if (i > 0) {
buffer.append("_");
}
buffer.append(word.toUpperCase());
buffer.append(StringUtilRt.toUpperCase(word));
}
return buffer.toString();
}
@@ -22,6 +22,7 @@ import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMigration;
import com.intellij.psi.impl.migration.PsiMigrationManager;
import com.intellij.refactoring.BaseRefactoringProcessor;
@@ -71,6 +72,11 @@ class MigrationProcessor extends BaseRefactoringProcessor {
}
}
@Override
protected void refreshElements(PsiElement[] elements) {
myPsiMigration = startMigration(myProject);
}
@NotNull
protected UsageInfo[] findUsages() {
ArrayList<UsageInfo> usagesVector = new ArrayList<UsageInfo>();
@@ -16,6 +16,7 @@
package com.intellij.refactoring.rename;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.NameUtil;
@@ -133,7 +134,7 @@ public class JavaNameSuggestionProvider implements NameSuggestionProvider {
for (int i = 0; i < words.length; i++) {
String word = words[i];
if (i > 0) buffer.append('_');
buffer.append(word.toUpperCase());
buffer.append(StringUtilRt.toUpperCase(word));
}
return new String[] {buffer.toString()};
}
@@ -1409,7 +1409,7 @@ public class Mappings {
debug("Processing removed fields:");
for (FieldRepr f : diff.fields().removed()) {
debug("Field: ", it.name);
debug("Field: ", f.name);
if ((f.access & Opcodes.ACC_PRIVATE) == 0 && (f.access & mask) == mask && f.hasValue()) {
debug("Field had value and was (non-private) final static => a switch to non-incremental mode requested");
@@ -32,8 +32,7 @@ class UsageRepr {
}
public static class Cluster implements RW.Savable {
final Set<Usage> usages = new HashSet<Usage>();
final Map<Usage, Set<DependencyContext.S>> residentialMap = new HashMap<Usage, Set<DependencyContext.S>>();
private final Map<Usage, Set<DependencyContext.S>> myUsageToDependenciesMap = new HashMap<Usage, Set<DependencyContext.S>>();
public Cluster() {
}
@@ -44,11 +43,8 @@ class UsageRepr {
for (int i = 0; i < size; i++) {
final Usage u = externalizer(context).read(in);
final Set<DependencyContext.S> s =
(Set<DependencyContext.S>)RW.read(DependencyContext.descriptorS, new HashSet<DependencyContext.S>(), in);
usages.add(u);
residentialMap.put(u, s);
final Set<DependencyContext.S> s = (Set<DependencyContext.S>)RW.read(DependencyContext.descriptorS, new HashSet<DependencyContext.S>(), in);
myUsageToDependenciesMap.put(u, s);
}
}
catch (IOException e) {
@@ -59,10 +55,12 @@ class UsageRepr {
@Override
public void save(final DataOutput out) {
try {
out.writeInt(usages.size());
for (Usage u : usages) {
out.writeInt(myUsageToDependenciesMap.size());
for (Map.Entry<Usage, Set<DependencyContext.S>> entry : myUsageToDependenciesMap.entrySet()) {
final Usage u = entry.getKey();
u.save(out);
RW.save(residentialMap.get(u), DependencyContext.descriptorS, out);
final Set<DependencyContext.S> deps = entry.getValue();
RW.save(deps, DependencyContext.descriptorS, out);
}
}
catch (IOException e) {
@@ -71,27 +69,26 @@ class UsageRepr {
}
public void addUsage(final DependencyContext.S residence, final Usage usage) {
Set<DependencyContext.S> s = residentialMap.get(usage);
Set<DependencyContext.S> s = myUsageToDependenciesMap.get(usage);
if (s == null) {
s = new HashSet<DependencyContext.S>();
residentialMap.put(usage, s);
myUsageToDependenciesMap.put(usage, s);
}
s.add(residence);
usages.add(usage);
}
public Set<Usage> getUsages() {
return usages;
return Collections.unmodifiableSet(myUsageToDependenciesMap.keySet());
}
public Set<DependencyContext.S> getResidence(final Usage usage) {
return residentialMap.get(usage);
return myUsageToDependenciesMap.get(usage);
}
public boolean isEmpty() {
return usages.isEmpty();
return myUsageToDependenciesMap.isEmpty();
}
public static DataExternalizer<Cluster> clusterExternalizer(final DependencyContext context) {
@@ -115,17 +112,14 @@ class UsageRepr {
Cluster cluster = (Cluster)o;
if (!residentialMap.equals(cluster.residentialMap)) return false;
if (!usages.equals(cluster.usages)) return false;
if (!myUsageToDependenciesMap.equals(cluster.myUsageToDependenciesMap)) return false;
return true;
}
@Override
public int hashCode() {
int result = usages.hashCode();
result = 31 * result + residentialMap.hashCode();
return result;
return myUsageToDependenciesMap.hashCode();
}
}
@@ -262,7 +262,7 @@ public class IdeaProjectLoader {
}
private File getFileByUrl(final String url) {
return new File(FileUtil.toSystemDependentName(projectMacroExpander.expandMacros(IdeaProjectLoadingUtil.pathFromUrl(url))))
return new File(FileUtil.toCanonicalPath(projectMacroExpander.expandMacros(IdeaProjectLoadingUtil.pathFromUrl(url))))
}
private static boolean parseBoolean(Object value, boolean defaultValue) {
@@ -116,7 +116,7 @@ public class LayeredIcon implements Icon {
@Override
public int getIconWidth() {
if (myWidth == 0) {
if (myWidth <= 1) { //icon is not loaded yet
recalculateSize();
}
return myWidth;
@@ -124,7 +124,7 @@ public class LayeredIcon implements Icon {
@Override
public int getIconHeight() {
if (myHeight == 0) {
if (myHeight <= 1) { //icon is not loaded yet
recalculateSize();
}
return myHeight;
@@ -27,6 +27,7 @@ import com.intellij.openapi.util.DefaultJDOMExternalizer;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.text.StringUtilRt;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -126,10 +127,11 @@ public class LogConsolePreferences extends LogFilterRegistrar {
@Nullable
public static String getType(@NotNull String text) {
if (ERROR_PATTERN.matcher(text.toUpperCase()).matches()) return ERROR;
if (WARNING_PATTERN.matcher(text.toUpperCase()).matches() || WARN_PATTERN.matcher(text.toUpperCase()).matches()) return WARNING;
if (INFO_PATTERN.matcher(text.toUpperCase()).matches()) return INFO;
if (DEBUG_PATTERN.matcher(text.toUpperCase()).matches()) return DEBUG;
String upcased = StringUtilRt.toUpperCase(text);
if (ERROR_PATTERN.matcher(upcased).matches()) return ERROR;
if (WARNING_PATTERN.matcher(upcased).matches() || WARN_PATTERN.matcher(upcased).matches()) return WARNING;
if (INFO_PATTERN.matcher(upcased).matches()) return INFO;
if (DEBUG_PATTERN.matcher(upcased).matches()) return DEBUG;
return null;
}
@@ -17,11 +17,13 @@
package com.intellij.diagnostic.logging;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.util.StringBuilderSpinAllocator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Locale;
import java.util.regex.Pattern;
/**
@@ -67,7 +69,7 @@ public abstract class LogFilterModel {
public boolean isApplicable(String line) {
if (getCustomFilter() != null) {
final Pattern pattern = getCustomPattern();
if (pattern != null && !pattern.matcher(line.toUpperCase()).matches()) return false;
if (pattern != null && !pattern.matcher(StringUtilRt.toUpperCase(line)).matches()) return false;
}
return true;
}
@@ -24,6 +24,7 @@ import com.intellij.openapi.progress.util.ProgressIndicatorBase;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -37,6 +38,7 @@ import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
import java.util.concurrent.Future;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -83,7 +85,7 @@ public abstract class AbstractExternalFilter {
protected abstract String convertReference(String root, String href);
public String refFilter(final String root, String read) {
String toMatch = read.toUpperCase();
String toMatch = StringUtilRt.toUpperCase(read);
StringBuffer ready = new StringBuffer();
int prev = 0;
Matcher matcher = mySelector.matcher(toMatch);
@@ -225,7 +227,7 @@ public abstract class AbstractExternalFilter {
if (anchorMatcher.find()) {
isClassDoc = false;
startSection = "<A NAME=\"" + anchorMatcher.group(1).toUpperCase() + "\"";
startSection = "<A NAME=\"" + StringUtilRt.toUpperCase(anchorMatcher.group(1)) + "\"";
endSection = "<A NAME=";
}
@@ -257,7 +259,7 @@ public abstract class AbstractExternalFilter {
}
}
}
while (read != null && read.toUpperCase().indexOf(startSection) == -1);
while (read != null && StringUtilRt.toUpperCase(read).indexOf(startSection) == -1);
if (input instanceof MyReader && contentEncoding != null) {
if (contentEncoding != null && !contentEncoding.equals("UTF-8") && !contentEncoding.equals(((MyReader)input).getEncoding())) { //restart page parsing with correct encoding
@@ -284,9 +286,9 @@ public abstract class AbstractExternalFilter {
if (isClassDoc) {
boolean skip = false;
while (((read = buf.readLine()) != null) && !read.toUpperCase().trim().equals(DL) &&
while (((read = buf.readLine()) != null) && !StringUtilRt.toUpperCase(read).trim().equals(DL) &&
!StringUtil.containsIgnoreCase(read, "<div class=\"description\"")) {
if (read.toUpperCase().contains(H2) && !read.toUpperCase().contains("H2")) { // read=class name in <H2>
if (StringUtilRt.toUpperCase(read).contains(H2) && !read.toUpperCase().contains("H2")) { // read=class name in <H2>
data.append(H2);
skip = true;
}
@@ -303,12 +305,12 @@ public abstract class AbstractExternalFilter {
StringBuffer classDetails = new StringBuffer();
while (((read = buf.readLine()) != null) && !read.toUpperCase().equals(HR) && !read.toUpperCase().equals(P)) {
while (((read = buf.readLine()) != null) && !StringUtilRt.toUpperCase(read).equals(HR) && !StringUtilRt.toUpperCase(read).equals(P)) {
if (reachTheEnd(data, read, classDetails)) return;
appendLine(classDetails, read);
}
while (((read = buf.readLine()) != null) && !read.toUpperCase().equals(P) && !read.toUpperCase().equals(HR)) {
while (((read = buf.readLine()) != null) && !StringUtilRt.toUpperCase(read).equals(P) && !StringUtilRt.toUpperCase(read).equals(HR)) {
if (reachTheEnd(data, read, classDetails)) return;
appendLine(data, read.replaceAll(DT, DT + BR));
}
@@ -320,7 +322,7 @@ public abstract class AbstractExternalFilter {
while (((read = buf.readLine()) != null) &&
StringUtil.indexOfIgnoreCase(read, endSection, 0) == -1 &&
StringUtil.indexOfIgnoreCase(read, greatestEndSection, 0) == -1) {
if (read.toUpperCase().indexOf(HR) == -1
if (StringUtilRt.toUpperCase(read).indexOf(HR) == -1
&& !StringUtil.containsIgnoreCase(read, "<ul class=\"blockList\">")
&& !StringUtil.containsIgnoreCase(read, "<li class=\"blockList\">")) {
appendLine(data, read);
@@ -46,7 +46,6 @@ public class InspectionDescriptionLinkHandler extends TooltipLinkHandler {
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
LOG.error(editor.getDocument());
return null;
}
@@ -46,6 +46,7 @@ import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
@@ -875,7 +876,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
}
if (sameCase) return lookupString;
if (isAllLower) return lookupString.toLowerCase();
if (isAllUpper) return lookupString.toUpperCase();
if (isAllUpper) return StringUtilRt.toUpperCase(lookupString);
return lookupString;
}
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.template.Expression;
import com.intellij.codeInsight.template.ExpressionContext;
import com.intellij.codeInsight.template.Result;
import com.intellij.codeInsight.template.TextResult;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.psi.codeStyle.NameUtil;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +45,7 @@ public class CapitalizeAndUnderscoreMacro extends MacroBase {
} else {
insertUnderscore = true;
}
buf.append(word.toUpperCase());
buf.append(StringUtilRt.toUpperCase(word));
}
return new TextResult(buf.toString());
}
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.template.Expression;
import com.intellij.codeInsight.template.ExpressionContext;
import com.intellij.codeInsight.template.Result;
import com.intellij.codeInsight.template.TextResult;
import com.intellij.openapi.util.text.StringUtilRt;
import org.jetbrains.annotations.NotNull;
/**
@@ -36,7 +37,7 @@ public class CapitalizeMacro extends MacroBase {
String text = getTextResult(params, context);
if (text != null) {
if (text.length() > 0) {
text = text.substring(0, 1).toUpperCase() + text.substring(1, text.length());
text = StringUtilRt.toUpperCase(text.substring(0, 1)) + text.substring(1, text.length());
}
return new TextResult(text);
}
@@ -52,6 +52,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
@@ -677,7 +678,7 @@ public class FindManagerImpl extends FindManager implements PersistentStateCompo
}
if (isTailUpper) {
buffer.append(toReplace.substring(1).toUpperCase());
buffer.append(StringUtilRt.toUpperCase(toReplace.substring(1)));
}
else if (isTailLower) {
buffer.append(toReplace.substring(1).toLowerCase());
@@ -891,4 +892,4 @@ public class FindManagerImpl extends FindManager implements PersistentStateCompo
public FindUsagesManager getFindUsagesManager() {
return myFindUsagesManager;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -108,10 +108,8 @@ public class CreateFileFromTemplateDialog extends DialogWrapper {
}
private static class BuilderImpl implements Builder {
private final CreateFileFromTemplateDialog myDialog;
private final Project myProject;
private InputValidator myInputValidator;
public BuilderImpl(CreateFileFromTemplateDialog dialog, Project project) {
myDialog = dialog;
@@ -17,6 +17,7 @@
package com.intellij.ide.highlighter.custom.tokens;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.psi.CustomHighlighterTokenType;
import com.intellij.psi.tree.IElementType;
import gnu.trove.THashSet;
@@ -80,7 +81,7 @@ public class KeywordParser extends TokenParser {
final Set<String> result = new THashSet<String>();
for (String s : keywordSet) {
result.add(s.toUpperCase());
result.add(StringUtilRt.toUpperCase(s));
}
return result;
}
@@ -96,7 +97,7 @@ public class KeywordParser extends TokenParser {
}
String keyword = matcher.group(1);
String testKeyword = myIgnoreCase ? keyword.toUpperCase() : keyword;
String testKeyword = myIgnoreCase ? StringUtilRt.toUpperCase(keyword) : keyword;
for (int i = 0; i < CustomHighlighterTokenType.KEYWORD_TYPE_COUNT; i++) {
if (myKeywordSets.get(i).contains(testKeyword)) {
myTokenInfo.updateData(position, position + keyword.length(), getToken(i));
@@ -16,6 +16,7 @@
package com.intellij.ide.highlighter.custom.tokens;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.psi.CustomHighlighterTokenType;
/**
@@ -30,7 +31,7 @@ public final class NumberParser extends TokenParser {
if (!myIgnoreCase) {
mySuffices = suffices;
} else {
mySuffices = suffices.toLowerCase().concat(suffices.toUpperCase());
mySuffices = suffices.toLowerCase().concat(StringUtilRt.toUpperCase(suffices));
}
}
@@ -101,4 +101,8 @@ public class CommonShortcuts {
public static ShortcutSet getFind() {
return new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_FIND));
}
public static ShortcutSet getContextHelp() {
return new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_CONTEXT_HELP));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -24,7 +24,6 @@ import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -184,7 +183,7 @@ public class DetailsComponent {
}
}
public void setText(@NotNull String... text) {
public void setText(@Nullable String... text) {
myText = text;
update();
}
@@ -20,10 +20,7 @@ import com.intellij.ide.ui.UISettings;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.MnemonicHelper;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.MacOtherAction;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -1416,17 +1413,29 @@ public abstract class DialogWrapper {
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
if (ApplicationInfo.contextHelpAvailable()) {
ShortcutSet help = CommonShortcuts.getContextHelp();
for (Shortcut shortcut : help.getShortcuts()) {
if (shortcut instanceof KeyboardShortcut) {
KeyboardShortcut ks = (KeyboardShortcut)shortcut;
KeyStroke first = ks.getFirstKeyStroke();
KeyStroke second = ks.getSecondKeyStroke();
if (second == null) {
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
}
}, first, JComponent.WHEN_IN_FOCUSED_WINDOW);
}
}
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
if (myButtons != null) {
getRootPane().registerKeyboardAction(new AbstractAction() {
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.ui;
import com.intellij.CommonBundle;
@@ -52,18 +51,18 @@ import java.awt.*;
import java.util.*;
import java.util.List;
/**
* User: anna
* Date: 29-May-2006
* @author anna
* @since 29-May-2006
*/
public abstract class MasterDetailsComponent implements Configurable, DetailsComponent.Facade, MasterDetails {
protected static final Logger LOG = Logger.getInstance("#com.intellij.openapi.ui.MasterDetailsComponent");
protected static final Icon COPY_ICON = PlatformIcons.COPY_ICON;
protected NamedConfigurable myCurrentConfigurable;
private final Splitter mySplitter = new Splitter(false, .2f);
@NonNls public static final String TREE_OBJECT = "treeObject";
@NonNls public static final String TREE_NAME = "treeName";
@@ -72,6 +71,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
myHistory = history;
}
@Nullable
public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) {
return null;
}
@@ -113,14 +113,14 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
protected JPanel myWholePanel;
public JPanel myNorthPanel = new JPanel(new BorderLayout());
private final ArrayList<ItemsChangeListener> myListners = new ArrayList<ItemsChangeListener>();
private final ArrayList<ItemsChangeListener> myListeners = new ArrayList<ItemsChangeListener>();
private final Set<NamedConfigurable> myInitializedConfigurables = new HashSet<NamedConfigurable>();
private boolean myHasDeletedItems;
protected AutoScrollToSourceHandler myAutoScrollHandler;
private boolean myToReinitWholePanel = true;
private boolean myToReInitWholePanel = true;
protected MasterDetailsComponent() {
this(new MasterDetailsState());
@@ -129,11 +129,11 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
protected MasterDetailsComponent(MasterDetailsState state) {
myState = state;
installAutoScroll();
reinintWholePanelIfNeeded();
reInitWholePanelIfNeeded();
}
private void reinintWholePanelIfNeeded() {
if (!myToReinitWholePanel) return;
private void reInitWholePanelIfNeeded() {
if (!myToReInitWholePanel) return;
myWholePanel = new JPanel(new BorderLayout()) {
public void addNotify() {
@@ -175,7 +175,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
GuiUtils.replaceJSplitPaneWithIDEASplitter(myWholePanel);
myToReinitWholePanel = false;
myToReInitWholePanel = false;
}
private void installAutoScroll() {
@@ -242,7 +242,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
}
protected boolean isAutoScrollEnabled() {
return myHistory != null ? !myHistory.isNavigatingNow() : true;
return myHistory == null || !myHistory.isNavigatingNow();
}
private void initToolbar() {
@@ -263,21 +263,27 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
}
public void addItemsChangeListener(ItemsChangeListener l) {
myListners.add(l);
myListeners.add(l);
}
/** @deprecated use {@linkplain #getPanelPreferredSize()} (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration")
protected Dimension getPanelPrefferedSize() {
return getPanelPreferredSize();
}
protected Dimension getPanelPreferredSize() {
return new Dimension(800, 600);
}
public JComponent createComponent() {
reinintWholePanelIfNeeded();
reInitWholePanelIfNeeded();
updateSelectionFromTree();
final JPanel panel = new JPanel(new BorderLayout()) {
public Dimension getPreferredSize() {
return getPanelPrefferedSize();
return getPanelPreferredSize();
}
};
panel.add(myWholePanel, BorderLayout.CENTER);
@@ -500,13 +506,13 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
}
public void fireItemsChangeListener(final Object editableObject) {
for (ItemsChangeListener listener : myListners) {
for (ItemsChangeListener listener : myListeners) {
listener.itemChanged(editableObject);
}
}
private void fireItemsChangedExternally() {
for (ItemsChangeListener listener : myListners) {
for (ItemsChangeListener listener : myListeners) {
listener.itemsExternallyChanged();
}
}
@@ -578,8 +584,15 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
return null;
}
/** @deprecated use {@linkplain #getSelectedConfigurable()} (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration")
@Nullable
public NamedConfigurable getSelectedConfugurable() {
return getSelectedConfigurable();
}
@Nullable
public NamedConfigurable getSelectedConfigurable() {
final TreePath selectionPath = myTree.getSelectionPath();
if (selectionPath != null) {
MyNode node = (MyNode)selectionPath.getLastPathComponent();
@@ -699,7 +712,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
throw new ConfigurationException("Name should contain non-space characters");
}
if (names.contains(name)) {
final NamedConfigurable selectedConfigurable = getSelectedConfugurable();
final NamedConfigurable selectedConfigurable = getSelectedConfigurable();
if (selectedConfigurable == null || !Comparing.strEqual(selectedConfigurable.getDisplayName(), name)) {
selectNodeInTree(node);
}
@@ -938,17 +951,17 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
}
public JComponent getToolbar() {
myToReinitWholePanel = true;
myToReInitWholePanel = true;
return myNorthPanel;
}
public JComponent getMaster() {
myToReinitWholePanel = true;
myToReInitWholePanel = true;
return myMaster;
}
public DetailsComponent getDetails() {
myToReinitWholePanel = true;
myToReInitWholePanel = true;
return myDetails;
}
@@ -20,6 +20,7 @@
package com.intellij.ui.speedSearch;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.util.Function;
import javax.swing.*;
@@ -48,8 +49,8 @@ public class NameFilteringListModel<T> extends FilteringListModel<T> {
super.addToFiltered(elt);
if (myNamer != null) {
String filterString = mySpeedSearch.getFilter().toUpperCase();
String candidateString = myNamer.fun(elt).toUpperCase();
String filterString = StringUtilRt.toUpperCase(mySpeedSearch.getFilter());
String candidateString = StringUtilRt.toUpperCase(myNamer.fun(elt));
int index = getSize() - 1;
if (myFullMatchIndex == -1 && filterString.equals(candidateString)) {
@@ -32,10 +32,12 @@ import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.impl.WindowManagerImpl;
import com.intellij.ui.Splash;
@@ -212,9 +214,14 @@ public class IdeaApplication {
loadProject();
}
if (UpdateChecker.isMyVeryFirstOpening() && UpdateChecker.checkNeeded()) {
UpdateChecker.setMyVeryFirstOpening(false);
UpdateChecker.updateAndShowResult();
final UpdateSettings settings = UpdateSettings.getInstance();
if (settings != null) {
final ApplicationInfo appInfo = ApplicationInfo.getInstance();
if (StringUtil.compareVersionNumbers(settings.LAST_BUILD_CHECKED, appInfo.getBuild().asString()) < 0 ||
(UpdateChecker.isMyVeryFirstOpening() && UpdateChecker.checkNeeded())) {
UpdateChecker.setMyVeryFirstOpening(false);
UpdateChecker.updateAndShowResult();
}
}
SwingUtilities.invokeLater(new Runnable() {
@@ -33,6 +33,7 @@ import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ListScrollingUtil;
import com.intellij.ui.components.JBList;
@@ -482,7 +483,7 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
result.closedPath = typed.endsWith(myFinder.getSeparator()) && typedText.length() > myFinder.getSeparator().length();
final String currentParentText = result.current.getAbsolutePath();
if (!typedText.toUpperCase().startsWith(currentParentText.toUpperCase())) return;
if (!StringUtilRt.toUpperCase(typedText).startsWith(StringUtilRt.toUpperCase(currentParentText))) return;
String prefix = typedText.substring(currentParentText.length());
if (prefix.startsWith(myFinder.getSeparator())) {
@@ -492,18 +493,18 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
prefix = "";
}
result.effectivePrefix = prefix.toUpperCase();
result.effectivePrefix = StringUtilRt.toUpperCase(prefix);
result.currentGrandparent = result.current.getParent();
if (result.currentGrandparent != null && result.currentParentMatch && !result.closedPath) {
final String currentGrandparentText = result.currentGrandparent.getAbsolutePath();
if (StringUtil.startsWithConcatenationOf(typedText, currentGrandparentText, myFinder.getSeparator())) {
result.grandparentPrefix =
currentParentText.substring(currentGrandparentText.length() + myFinder.getSeparator().length()).toUpperCase();
result.grandparentPrefix = StringUtilRt.toUpperCase(
currentParentText.substring(currentGrandparentText.length() + myFinder.getSeparator().length()));
}
}
} else {
result.effectivePrefix = typedText.toUpperCase();
result.effectivePrefix = StringUtilRt.toUpperCase(typedText);
}
@@ -512,7 +513,7 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
if (result.current != null) {
result.myToComplete.addAll(result.current.getChildren(new LookupFilter() {
public boolean isAccepted(final LookupFile file) {
return myFilter.isAccepted(file) && file.getName().toUpperCase().startsWith(result.effectivePrefix);
return myFilter.isAccepted(file) && StringUtilRt.toUpperCase(file.getName()).startsWith(result.effectivePrefix);
}
}));
@@ -523,7 +524,7 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
if (result.grandparentPrefix != null) {
final List<LookupFile> siblings = result.currentGrandparent.getChildren(new LookupFilter() {
public boolean isAccepted(final LookupFile file) {
return !file.equals(result.current) && myFilter.isAccepted(file) && file.getName().toUpperCase().startsWith(result.grandparentPrefix);
return !file.equals(result.current) && myFilter.isAccepted(file) && StringUtilRt.toUpperCase(file.getName()).startsWith(result.grandparentPrefix);
}
});
result.myToComplete.addAll(0, siblings);
@@ -538,7 +539,7 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
boolean toPreselectFixed = false;
if (result.effectivePrefix.length() > 0) {
for (LookupFile each : result.myToComplete) {
String eachName = each.getName().toUpperCase();
String eachName = StringUtilRt.toUpperCase(each.getName());
if (!eachName.startsWith(result.effectivePrefix)) continue;
int diff = result.effectivePrefix.compareTo(eachName);
currentDiff = Math.max(diff, currentDiff);
@@ -588,7 +589,7 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
final Iterator<String> macros = myMacroMap.keySet().iterator();
while (macros.hasNext()) {
String eachMacro = macros.next();
if (eachMacro.toUpperCase().startsWith(typedText.toUpperCase())) {
if (StringUtilRt.toUpperCase(eachMacro).startsWith(StringUtilRt.toUpperCase(typedText))) {
final String eachPath = myMacroMap.get(eachMacro);
if (eachPath != null) {
final LookupFile macroFile = myFinder.find(eachPath);
@@ -715,7 +716,7 @@ public abstract class FileTextFieldImpl implements FileLookup, Disposable, FileT
if (SystemInfo.isFileSystemCaseSensitive) {
toRemoveExistingName = name.startsWith(prefix) && prefix.length() > 0;
} else {
toRemoveExistingName = name.toUpperCase().startsWith(prefix.toUpperCase()) && prefix.length() > 0;
toRemoveExistingName = StringUtilRt.toUpperCase(name).startsWith(StringUtilRt.toUpperCase(prefix)) && prefix.length() > 0;
}
} else {
toRemoveExistingName = true;
@@ -993,13 +993,12 @@ public class EditorWindow {
}
void trimToSize(final int limit, @Nullable final VirtualFile fileToIgnore, final boolean transferFocus) {
if (myTabbedPane == null) {
return;
}
if (myTabbedPane == null) return;
FileEditorManagerEx.getInstanceEx(getManager().getProject()).getReady(this).doWhenDone(new Runnable() {
@Override
public void run() {
if (myTabbedPane == null) return;
final boolean closeNonModifiedFilesFirst = UISettings.getInstance().CLOSE_NON_MODIFIED_FILES_FIRST;
final EditorComposite selectedComposite = getSelectedEditor();
try {
@@ -16,6 +16,7 @@
package com.intellij.openapi.ui.playback.commands;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.util.ReflectionUtil;
import javax.swing.*;
@@ -72,7 +73,8 @@ public class KeyStokeMap {
}
if (symbol.length() > 1) {
final Integer code = (Integer)ReflectionUtil.getField(KeyEvent.class, null, int.class, "VK_" + symbol.toUpperCase());
final Integer code = (Integer)ReflectionUtil.getField(KeyEvent.class, null, int.class, "VK_" + StringUtilRt
.toUpperCase(symbol));
if (code == null) {
return throwUnrecognized(symbol);
}
@@ -187,4 +189,4 @@ public class KeyStokeMap {
return myMap;
}
}
}
@@ -62,7 +62,7 @@ public class CheckForUpdateAction extends AnAction implements DumbAware {
return;
}
instance.LAST_TIME_CHECKED = System.currentTimeMillis();
instance.saveLastCheckedInfo();
UpdateChecker.showUpdateResult(result, updatedPlugins, true, enableLink, true);
}
});
@@ -428,7 +428,7 @@ public final class UpdateChecker {
final CheckForUpdateResult result = doCheckForUpdates(updateSettings);
if (result.getState() == UpdateStrategy.State.LOADED) {
updateSettings.LAST_TIME_CHECKED = System.currentTimeMillis();
updateSettings.saveLastCheckedInfo();
settings.setKnownChannelIds(result.getAllChannelsIds());
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.updateSettings.impl;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
@@ -55,6 +56,7 @@ public class UpdateSettings implements PersistentStateComponent<Element>, UserUp
public boolean CHECK_NEEDED = true;
public long LAST_TIME_CHECKED = 0;
public String LAST_BUILD_CHECKED = "";
public String UPDATE_CHANNEL_TYPE = ChannelStatus.RELEASE_CODE;
public static UpdateSettings getInstance() {
@@ -65,6 +67,12 @@ public class UpdateSettings implements PersistentStateComponent<Element>, UserUp
updateDefaultChannel();
}
public void saveLastCheckedInfo() {
LAST_TIME_CHECKED = System.currentTimeMillis();
ApplicationInfo appInfo = ApplicationInfo.getInstance();
LAST_BUILD_CHECKED = appInfo.getBuild().asString();
}
private void updateDefaultChannel() {
if (ApplicationInfoImpl.getShadowInstance().isEAP()) {
UPDATE_CHANNEL_TYPE = ChannelStatus.EAP_CODE;
@@ -41,7 +41,7 @@ public class ProjectWindowAction extends ToggleAction implements DumbAware {
@NotNull private final String myProjectLocation;
public ProjectWindowAction(@NotNull String projectName, @NotNull String projectLocation, ProjectWindowAction previous) {
super(projectName);
super();
myProjectName = projectName;
myProjectLocation = projectLocation;
if (previous != null) {
@@ -53,6 +53,7 @@ public class ProjectWindowAction extends ToggleAction implements DumbAware {
myPrevious = this;
myNext = this;
}
getTemplatePresentation().setText(projectName, false);
}
public void dispose() {
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.util.Alarm;
import com.intellij.util.Consumer;
@@ -658,7 +659,7 @@ public class ColorPicker extends JPanel implements ColorListener, DocumentListen
Toolkit.getDefaultToolkit().beep();
}
}
final String toInsert = new String(result, 0, j).toUpperCase();
final String toInsert = StringUtilRt.toUpperCase(new String(result, 0, j));
final String res = new StringBuilder(mySrc.getText()).insert(offs, toInsert).toString();
try {
if (!myHex) {
@@ -17,6 +17,7 @@ package com.intellij.ui.popup.list;
import com.intellij.openapi.ui.popup.ListPopupStep;
import com.intellij.openapi.ui.popup.ListSeparator;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.ui.speedSearch.ElementFilter;
import com.intellij.ui.speedSearch.SpeedSearch;
import org.jetbrains.annotations.Nullable;
@@ -77,8 +78,8 @@ public class ListPopupModel extends AbstractListModel {
private void addToFiltered(Object each) {
myFilteredList.add(each);
String filterString = mySpeedSearch.getFilter().toUpperCase();
String candidateString = myStep.getTextFor(each).toUpperCase();
String filterString = StringUtilRt.toUpperCase(mySpeedSearch.getFilter());
String candidateString = StringUtilRt.toUpperCase(myStep.getTextFor(each));
int index = myFilteredList.size() - 1;
if (myFullMatchIndex == -1 && filterString.equals(candidateString)) {
@@ -17,6 +17,7 @@ package com.intellij.ui.popup.util;
import com.intellij.openapi.ui.popup.MnemonicNavigationFilter;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.ui.popup.WizardPopup;
import java.awt.event.KeyEvent;
@@ -40,7 +41,7 @@ public abstract class MnemonicsSearch<T> {
if (pos != -1) {
final String text = filter.getTextFor(each);
final String charText = text.substring(pos + 1, pos + 2);
myChar2ValueMap.put(charText.toUpperCase(), each);
myChar2ValueMap.put(StringUtilRt.toUpperCase(charText), each);
myChar2ValueMap.put(charText.toLowerCase(), each);
}
}
@@ -321,6 +321,7 @@ prompt.enter.annotation.type.name=Enter a new @interface name:
title.new.annotation.type=New @interface
title.cannot.create.annotation.type=Cannot Create @interface
action.create.new.class=Create New Class
action.create.new.class.description=Create new Java class
prompt.enter.new.class.name=Enter a new class name:
title.new.class=New Class
progress.creating.class=Creating class {0}.{1}
@@ -30,6 +30,25 @@ public class StringUtilRt {
return a == b || toUpperCase(a) == toUpperCase(b) || toLowerCase(a) == toLowerCase(b);
}
public static String toUpperCase(String s) {
StringBuilder answer = null;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
char upcased = toUpperCase(c);
if (answer == null && upcased != c) {
answer = new StringBuilder(s.length());
answer.append(s.substring(0, i));
}
if (answer != null) {
answer.append(upcased);
}
}
return answer == null ? s : answer.toString();
}
public static char toUpperCase(char a) {
if (a < 'a') {
return a;
@@ -21,7 +21,6 @@ import com.intellij.reference.SoftReference;
import com.intellij.util.ImageLoader;
import com.intellij.util.containers.ConcurrentHashMap;
import com.intellij.util.containers.WeakHashMap;
import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -46,7 +45,7 @@ public final class IconLoader {
*/
private static final Map<Icon, Icon> ourIcon2DisabledIcon = new WeakHashMap<Icon, Icon>(200);
private static final Icon EMPTY_ICON = new EmptyIcon(0,0) {
private static final ImageIcon EMPTY_ICON = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_3BYTE_BGR)) {
@NonNls
public String toString() {
return "Empty icon " + super.toString();
@@ -16,6 +16,7 @@
package com.intellij.openapi.util;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.StringInterner;
import com.intellij.util.io.URLUtil;
@@ -229,7 +230,7 @@ public class JDOMUtil {
if (Verifier.isXMLCharacter(each)) {
result.append((char)each);
} else {
result.append("0x").append(Long.toHexString(each).toUpperCase());
result.append("0x").append(StringUtilRt.toUpperCase(Long.toHexString(each)));
}
}
catch (IOException e) {
@@ -151,7 +151,7 @@ public class StringUtil extends StringUtilRt {
i = i1 + oldS.length();
}
}
return newText!= null ? newText.toString():"";
return newText != null ? newText.toString() : "";
}
/**
@@ -479,7 +479,7 @@ public class StringUtil extends StringUtilRt {
buffer.append("\\").append(ch);
}
else if (Character.isISOControl(ch)) {
String hexCode = Integer.toHexString(ch).toUpperCase();
String hexCode = StringUtilRt.toUpperCase(Integer.toHexString(ch));
buffer.append("\\u");
int paddingCount = 4 - hexCode.length();
while (paddingCount-- > 0) {
@@ -691,7 +691,7 @@ public class StringUtil extends StringUtilRt {
@NotNull
public static String capitalize(@NotNull String s) {
if (s.length() == 0) return s;
if (s.length() == 1) return s.toUpperCase();
if (s.length() == 1) return StringUtilRt.toUpperCase(s);
// Optimization
if (Character.isUpperCase(s.charAt(0))) return s;
@@ -1917,13 +1917,14 @@ public class StringUtil extends StringUtilRt {
int slashRIndex = -1;
if (chars != null) {
for(int i = 0, len = s.length(); i < len; ++i) {
for (int i = 0, len = s.length(); i < len; ++i) {
if (chars[i] == '\r') {
slashRIndex = i;
break;
}
}
} else {
}
else {
for (int i = 0, len = s.length(); i < len; i++) {
if (s.charAt(i) == '\r') {
slashRIndex = i;
@@ -1933,7 +1934,8 @@ public class StringUtil extends StringUtilRt {
}
if (slashRIndex != -1) {
String context = String.valueOf(last(s.subSequence(0, slashRIndex), 10, true)) + first(s.subSequence(slashRIndex, s.length()), 10, true);
String context =
String.valueOf(last(s.subSequence(0, slashRIndex), 10, true)) + first(s.subSequence(slashRIndex, s.length()), 10, true);
context = escapeStringCharacters(context);
LOG.error("Wrong line separators: '" + context + "' at offset " + slashRIndex);
}
@@ -17,6 +17,7 @@ package com.intellij.psi.codeStyle;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
@@ -283,7 +284,7 @@ public class NameUtil {
buffer.append(prefix);
if (upperCaseStyle) {
startWord = startWord.toUpperCase();
startWord = StringUtilRt.toUpperCase(startWord);
}
else {
if (prefix.length() == 0 || StringUtil.endsWithChar(prefix, '_')) {
@@ -299,7 +300,7 @@ public class NameUtil {
String word = words[i];
String prevWord = words[i - 1];
if (upperCaseStyle) {
word = word.toUpperCase();
word = StringUtilRt.toUpperCase(word);
if (prevWord.charAt(prevWord.length() - 1) != '_' && word.charAt(0) != '_') {
word = "_" + word;
}
@@ -323,7 +324,7 @@ public class NameUtil {
if (isArray) {
suggestion = StringUtil.pluralize(suggestion);
if (upperCaseStyle) {
suggestion = suggestion.toUpperCase();
suggestion = StringUtilRt.toUpperCase(suggestion);
}
}
return suggestion;
@@ -15,6 +15,7 @@
*/
package com.intellij.util.cls;
import com.intellij.openapi.util.text.StringUtilRt;
import org.jetbrains.annotations.NonNls;
@@ -406,7 +407,7 @@ public class ClsUtil {
buffer.append("\\").append(quote);
}
else if (Character.isISOControl(c)) {
String hexCode = Integer.toHexString(c).toUpperCase();
String hexCode = StringUtilRt.toUpperCase(Integer.toHexString(c));
buffer.append("\\u");
int paddingCount = 4 - hexCode.length();
while (paddingCount-- > 0) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -150,4 +150,16 @@ public abstract class AbstractVcsHelper {
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption);
@Nullable
public Collection<FilePath> selectFilePathsToProcess(List<FilePath> files,
final String title,
@Nullable final String prompt,
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption,
@Nullable String okActionName,
@Nullable String cancelActionName) {
return selectFilePathsToProcess(files, title, prompt, singleFileTitle, singleFilePromptTemplate, confirmationOption);
};
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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,14 +27,26 @@ public class ConfirmationDialog extends OptionsMessageDialog{
private final VcsShowConfirmationOption myOption;
private String myDoNotShowAgainMessage;
private final String myOkActionName;
private final String myCancelActionName;
public static boolean requestForConfirmation(@NotNull VcsShowConfirmationOption option,
@NotNull Project project,
@NotNull String message,
@NotNull String title,
@Nullable Icon icon) {
return requestForConfirmation(option, project, message, title, icon, null, null);
}
public static boolean requestForConfirmation(@NotNull VcsShowConfirmationOption option,
@NotNull Project project,
@NotNull String message,
@NotNull String title,
@Nullable Icon icon,
@Nullable String okActionName,
@Nullable String cancelActionName) {
if (option.getValue() == VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) return false;
final ConfirmationDialog dialog = new ConfirmationDialog(project, message, title, icon, option);
final ConfirmationDialog dialog = new ConfirmationDialog(project, message, title, icon, option, okActionName, cancelActionName);
if (! option.isPersistent()) {
dialog.setDoNotAskOption(null);
} else {
@@ -45,9 +57,16 @@ public class ConfirmationDialog extends OptionsMessageDialog{
}
public ConfirmationDialog(Project project, final String message, String title, final Icon icon, final VcsShowConfirmationOption option) {
this(project, message, title, icon, option, null, null);
}
public ConfirmationDialog(Project project, final String message, String title, final Icon icon, final VcsShowConfirmationOption option,
@Nullable String okActionName, @Nullable String cancelActionName) {
super(project, message, title, icon);
myOption = option;
init();
myOkActionName = okActionName != null ? okActionName : CommonBundle.getYesButtonText();
myCancelActionName = cancelActionName != null ? cancelActionName : CommonBundle.getNoButtonText();
init();
}
public void setDoNotShowAgainMessage(final String doNotShowAgainMessage) {
@@ -61,11 +80,11 @@ public class ConfirmationDialog extends OptionsMessageDialog{
}
protected String getOkActionName() {
return CommonBundle.message("button.yes");
return myOkActionName;
}
protected String getCancelActionName() {
return CommonBundle.message("button.no");
return myCancelActionName;
}
protected boolean isToBeShown() {
@@ -41,7 +41,7 @@ import java.util.*;
*/
public class ChangesCacheFile {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.committed.ChangesCacheFile");
private static final int VERSION = 6;
private static final int VERSION = 7;
private final File myPath;
private final File myIndexPath;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -22,6 +22,7 @@ import com.intellij.openapi.vcs.VcsShowConfirmationOption;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.tree.DefaultTreeModel;
import java.util.Collection;
import java.util.List;
@@ -31,10 +32,11 @@ import java.util.List;
*/
public class SelectFilePathsDialog extends AbstractSelectFilesDialog<FilePath> {
private ChangesTreeList<FilePath> myFileList;
private final ChangesTreeList<FilePath> myFileList;
public SelectFilePathsDialog(final Project project, List<FilePath> originalFiles, final String prompt,
final VcsShowConfirmationOption confirmationOption) {
final VcsShowConfirmationOption confirmationOption,
@Nullable String okActionName, @Nullable String cancelActionName) {
super(project, false, confirmationOption, prompt, true);
myFileList = new ChangesTreeList<FilePath>(project, originalFiles, true, true, null, null) {
protected DefaultTreeModel buildTreeModel(final List<FilePath> changes, ChangeNodeDecorator changeNodeDecorator) {
@@ -54,6 +56,12 @@ public class SelectFilePathsDialog extends AbstractSelectFilesDialog<FilePath> {
return null;
}
};
if (okActionName != null) {
getOKAction().putValue(Action.NAME, okActionName);
}
if (cancelActionName != null) {
getCancelAction().putValue(Action.NAME, cancelActionName);
}
myFileList.setChangesToDisplay(originalFiles);
init();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -81,7 +81,7 @@ public class CompositeCheckoutListener implements CheckoutProvider.Listener {
myFoundProject = listener.processCheckedOutDirectory(myProject, directory);
if (myFoundProject) break;
}
if (!myFoundProject) {
if (!myFoundProject && !epName.equals(CheckoutListener.COMPLETED_EP_NAME)) {
final VcsAwareCheckoutListener[] vcsAwareExtensions = Extensions.getExtensions(VcsAwareCheckoutListener.EP_NAME);
for (VcsAwareCheckoutListener extension : vcsAwareExtensions) {
myFoundProject = extension.processCheckedOutDirectory(myProject, directory, myVcsKey);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -170,22 +170,25 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper {
}
@Nullable
public Collection<FilePath> selectFilePathsToProcess(final List<FilePath> files,
final String title,
@Nullable final String prompt,
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption) {
public Collection<FilePath> selectFilePathsToProcess(List<FilePath> files,
String title,
@Nullable String prompt,
String singleFileTitle,
String singleFilePromptTemplate,
VcsShowConfirmationOption confirmationOption,
@Nullable String okActionName,
@Nullable String cancelActionName) {
if (files.size() == 1 && singleFilePromptTemplate != null) {
String filePrompt = MessageFormat.format(singleFilePromptTemplate, files.get(0).getPresentableUrl());
if (ConfirmationDialog
.requestForConfirmation(confirmationOption, myProject, filePrompt, singleFileTitle, Messages.getQuestionIcon())) {
final String filePrompt = MessageFormat.format(singleFilePromptTemplate, files.get(0).getPresentableUrl());
if (ConfirmationDialog.requestForConfirmation(confirmationOption, myProject, filePrompt, singleFileTitle,
Messages.getQuestionIcon(), okActionName, cancelActionName)) {
return files;
}
return null;
}
SelectFilePathsDialog dlg = new SelectFilePathsDialog(myProject, files, prompt, confirmationOption);
final SelectFilePathsDialog dlg =
new SelectFilePathsDialog(myProject, files, prompt, confirmationOption, okActionName, cancelActionName);
dlg.setTitle(title);
if (! confirmationOption.isPersistent()) {
dlg.setDoNotAskOption(null);
@@ -194,6 +197,16 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper {
return dlg.isOK() ? dlg.getSelectedFiles() : null;
}
@Nullable
public Collection<FilePath> selectFilePathsToProcess(final List<FilePath> files,
final String title,
@Nullable final String prompt,
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption) {
return selectFilePathsToProcess(files, title, prompt, singleFileTitle, singleFilePromptTemplate, confirmationOption, null, null);
}
public void showErrors(final List<VcsException> abstractVcsExceptions, @NotNull final String tabDisplayName) {
showErrorsImpl(abstractVcsExceptions.isEmpty(), new Getter<VcsException>() {
public VcsException get() {
@@ -320,9 +320,14 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
float xdpi = deviceConfiguration.getDevice().getXDpi();
float ydpi = deviceConfiguration.getDevice().getYDpi();
mySession = RenderUtil
.createRenderSession(getProject(), layoutXmlText, myFile, manager.getSelectedTarget(), facet, config, xdpi, ydpi,
manager.getSelectedTheme());
while (true) {
mySession = RenderUtil
.createRenderSession(getProject(), layoutXmlText, myFile, manager.getSelectedTarget(), facet, config, xdpi, ydpi,
manager.getSelectedTheme(), 10000);
if (mySession.getResult().getStatus() != Result.Status.ERROR_TIMEOUT) {
break;
}
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
@@ -69,7 +69,7 @@ class RenderService {
@Nullable
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
public RenderSession createRenderSession(@NotNull String layoutXmlText, @NotNull String appLabel)
public RenderSession createRenderSession(@NotNull String layoutXmlText, @NotNull String appLabel, long timeout)
throws FileNotFoundException, XmlPullParserException {
final ILayoutPullParser parser = new XmlParser();
@@ -102,6 +102,7 @@ class RenderService {
params.setExtendedViewInfoMode(false);
params.setAppLabel(appLabel);
params.setTimeout(timeout);
final ScreenSizeQualifier screenSizeQualifier = myConfig.getScreenSizeQualifier();
params.setConfigScreenSize(screenSizeQualifier != null ? screenSizeQualifier.getValue() : ScreenSize.NORMAL);
@@ -1,8 +1,6 @@
package org.jetbrains.android.uipreview;
import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.common.rendering.api.Result;
import com.android.ide.common.rendering.api.*;
import com.android.ide.common.resources.ResourceDeltaKind;
import com.android.ide.common.resources.ResourceFolder;
import com.android.ide.common.resources.ResourceRepository;
@@ -73,7 +71,8 @@ public class RenderUtil {
@NotNull FolderConfiguration config,
float xdpi,
float ydpi,
@NotNull ThemeData theme)
@NotNull ThemeData theme,
long timeout)
throws RenderingException, IOException, AndroidSdkNotConfiguredException {
final Sdk sdk = ModuleRootManager.getInstance(facet.getModule()).getSdk();
if (sdk == null || !(sdk.getSdkType() instanceof AndroidSdkType)) {
@@ -121,7 +120,7 @@ public class RenderUtil {
final RenderService renderService = factory.createService(pair.getFirst(), pair.getSecond(), config, xdpi, ydpi, callback, minSdkVersion);
try {
return renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet));
return renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet), timeout);
}
catch (XmlPullParserException e) {
throw new RenderingException(e);
@@ -198,7 +197,7 @@ public class RenderUtil {
final RenderSession session;
try {
session = renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet));
session = renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet), RenderParams.DEFAULT_TIMEOUT);
}
catch (XmlPullParserException e) {
throw new RenderingException(e);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -15,6 +15,7 @@
*/
package com.intellij.cvsSupport2.actions;
import com.intellij.CommonBundle;
import com.intellij.CvsBundle;
import com.intellij.cvsSupport2.CvsUtil;
import com.intellij.cvsSupport2.CvsVcs2;
@@ -55,9 +56,8 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
}
protected CvsHandler getCvsHandler(CvsContext context) {
Project project = context.getProject();
final Project project = context.getProject();
final boolean showDialog = myOptions.isToBeShown(project) || OptionsDialog.shiftIsPressed(context.getModifiers());
return getCvsHandler(project, getFilesToRemove(context), showDialog);
}
@@ -68,7 +68,7 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
private static CvsHandler getCvsHandler(final Project project,
final Collection<File> filesToRemove,
final boolean showDialog) {
ArrayList<File> files = new ArrayList<File>();
final ArrayList<File> files = new ArrayList<File>();
for (final File file : filesToRemove) {
if (CvsUtil.fileIsLocallyAdded(file)) {
@@ -88,14 +88,16 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
null,
CvsBundle.message("dialog.title.delete.file.from.cvs"),
CvsBundle.message("confirmation.text.delete.file.from.cvs"),
CvsVcs2.getInstance(project).getRemoveConfirmation());
CvsVcs2.getInstance(project).getRemoveConfirmation(),
CvsBundle.message("button.text.delete.from.cvs"),
CommonBundle.getCancelButtonText());
if (filesToBeRemoved == null || filesToBeRemoved.isEmpty()) return CvsHandler.NULL;
}
return CommandCvsHandler.createRemoveFilesHandler(project, ChangesUtil.filePathsToFiles(filesToBeRemoved));
}
private static List<FilePath> filesToFilePaths(final ArrayList<File> files) {
List<FilePath> result = new ArrayList<FilePath>();
final List<FilePath> result = new ArrayList<FilePath>();
for(File f: files) {
result.add(VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(f, false));
}
@@ -103,8 +105,8 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
}
protected Collection<File> getFilesToRemove(CvsContext context) {
Collection<String> deletedFileNames = context.getDeletedFileNames();
ArrayList<File> result = new ArrayList<File>();
final Collection<String> deletedFileNames = context.getDeletedFileNames();
final ArrayList<File> result = new ArrayList<File>();
for (final String deletedFileName : deletedFileNames) {
result.add(new File(deletedFileName));
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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,27 +38,23 @@ import java.util.List;
* @author Kirill Likhodedov
*/
final class GitRepositoryUpdater implements Disposable, BulkFileListener {
private final GitRepository myRepository;
private final GitRepositoryFiles myRepositoryFiles;
private final MessageBusConnection myMessageBusConnection;
private final QueueProcessor<GitRepository.TrackedTopic> myUpdateQueue;
private final VirtualFile myRemotesDir;
private final VirtualFile myHeadsDir;
private final LocalFileSystem.WatchRequest myWatchRequest;
GitRepositoryUpdater(GitRepository repository) {
myRepository = repository;
VirtualFile root = repository.getRoot();
VirtualFile gitDir = repository.getGitDir();
LocalFileSystem.getInstance().addRootToWatch(gitDir.getPath(), true);
myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(gitDir.getPath(), true);
myRepositoryFiles = GitRepositoryFiles.getInstance(gitDir);
visitGitDirVfs(gitDir);
myHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsHeadsPath());
myRemotesDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsRemotesPath());
myUpdateQueue = new QueueProcessor<GitRepository.TrackedTopic>(new Updater(myRepository), myRepository.getProject().getDisposed());
myUpdateQueue = new QueueProcessor<GitRepository.TrackedTopic>(new Updater(repository), repository.getProject().getDisposed());
myMessageBusConnection = repository.getProject().getMessageBus().connect();
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
}
@@ -86,6 +82,9 @@ final class GitRepositoryUpdater implements Disposable, BulkFileListener {
@Override
public void dispose() {
if (myWatchRequest != null) {
LocalFileSystem.getInstance().removeWatchedRoot(myWatchRequest);
}
myMessageBusConnection.disconnect();
}
@@ -89,7 +89,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
}
});
if (handler.shouldRetry()) {
if (!context.isProjectRebuild() && handler.shouldRetry()) {
if (CHUNK_REBUILD_ORDERED.get(context) != null) {
CHUNK_REBUILD_ORDERED.set(context, null);
} else {
@@ -207,7 +207,8 @@ public class GroovyBuilder extends ModuleLevelBuilder {
final String moduleName = module.getName().toLowerCase(Locale.US);
final SourceToOutputMapping srcToOut = context.getDataManager().getSourceToOutputMap(moduleName, context.isCompilingTests());
for (String src : srcToOut.getKeys()) {
if (!toCompilePaths.contains(src) && isGroovyFile(src)) {
if (!toCompilePaths.contains(src) && isGroovyFile(src) &&
!context.getProject().getCompilerConfiguration().getExcludes().isExcluded(new File(src))) {
final Collection<String> outs = srcToOut.getState(src);
if (outs != null) {
for (String out : outs) {
@@ -264,7 +264,8 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
final PsiElement constructor = constructorResolveResult.getElement();
if (constructor != null) {
checkConstructorApplicability(constructorResolveResult, refElement);
if (!checkConstructorApplicability(constructorResolveResult, refElement)) return;
if (!checkUnknownParams(refElement)) return;
}
else {
final GroovyResolveResult[] results = constructorCall.multiResolveConstructor();
@@ -275,7 +276,7 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
if (!checkConstructorApplicability(result, refElement)) return;
}
}
if (!checkUnknownParams(refElement)) return;
registerError(getElementToHighlight(refElement, argList), GroovyBundle.message("constructor.call.is.ambiguous"));
}
else {
@@ -419,12 +420,12 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
final PsiType type = referenceExpression.getType();
if (resolved != null ) {
if (resolved instanceof PsiMethod && !resolveResult.isInvokedOnProperty()) {
checkMethodApplicability(resolveResult, referenceExpression);
if (!checkMethodApplicability(resolveResult, referenceExpression)) return;
}
else {
checkCallApplicability(type, referenceExpression);
if (!checkCallApplicability(type, referenceExpression)) return;
}
if (!checkUnknownParams(referenceExpression)) return;
}
else if (results.length > 0) {
for (GroovyResolveResult result : results) {
@@ -436,6 +437,7 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
if (!checkCallApplicability(type, referenceExpression)) return;
}
}
if (!checkUnknownParams(referenceExpression)) return;
registerError(getElementToHighlight(referenceExpression, PsiUtil.getArgumentsList(referenceExpression)),
GroovyBundle.message("method.call.is.ambiguous"));
@@ -443,6 +445,20 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
}
}
private boolean checkUnknownParams(PsiElement place) {
PsiType[] args = PsiUtil.getArgumentTypes(place, true);
if (args == null) return true;
for (PsiType arg : args) {
if (arg == null) {
registerError(getElementToHighlight(place, PsiUtil.getArgumentsList(place)), GroovyBundle.message("cannot.infer.argument.types"),
LocalQuickFix.EMPTY_ARRAY, ProblemHighlightType.WEAK_WARNING);
return false;
}
}
return true;
}
private boolean checkCannotInferArgumentTypes(PsiElement referenceExpression) {
if (PsiUtil.getArgumentTypes(referenceExpression, true) != null) return false;
@@ -553,10 +569,12 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
PsiElement resolved = result.getElement();
if (resolved instanceof PsiMethod && !result.isInvokedOnProperty()) {
if (!checkMethodApplicability(result, invokedExpr)) return false;
if (!checkUnknownParams(invokedExpr)) return false;
}
else if (resolved instanceof PsiField) {
if (!checkCallApplicability(((PsiField)resolved).getType(), invokedExpr)) return false;
}
if (!checkUnknownParams(invokedExpr)) return false;
}
if (calls.length == 0 && !(invokedExpr instanceof GrString)) {
registerCannotApplyError(invokedExpr, argumentTypes, invokedExpr.getText());
@@ -52,8 +52,8 @@ public class ArgumentInstruction extends InstructionImpl implements MixinTypeIns
PsiElement parent = element.getParent().getParent();
LOG.assertTrue(parent instanceof GrCall, "elemText: " + element.getText() +
"\n elemParent = " + (element.getParent() == null ? "null" : element.getParent().getClass()) +
"\n elemPParent" + (parent == null ? "null" : parent.getClass()));
"\nParent = " + (element.getParent() == null ? "null" : element.getParent().getClass()) +
"\nPParent" + (parent == null ? "null" : parent.getClass()));
GrCall call = (GrCall)parent;
@@ -437,7 +437,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
else {
boolean isWrite = !myAssertionsOnly && PsiUtil.isLValue(refExpr);
addNodeAndCheckPending(new ReadWriteVariableInstruction(name, refExpr, myInstructionNumber++, isWrite ? WRITE : READ));
if (refExpr.getParent() instanceof GrArgumentList) {
if (refExpr.getParent() instanceof GrArgumentList && refExpr.getParent().getParent() instanceof GrCall) {
addNodeAndCheckPending(new ArgumentInstruction(refExpr, myInstructionNumber++));
}
}
@@ -299,7 +299,7 @@ public class TypesUtil {
}
}
if (isClassType(rType, GroovyCommonClassNames.GROOVY_LANG_GSTRING)) {
if (isClassType(rType, GROOVY_LANG_GSTRING)) {
if (isAssignable(lType, GroovyPsiManager.getInstance(manager.getProject()).createTypeByFQClassName(JAVA_LANG_STRING, scope), manager, scope)) {
return true;
}
@@ -584,9 +584,9 @@ public class TypesUtil {
public static PsiClassType createListType(@NotNull PsiClass elements) {
JavaPsiFacade facade = JavaPsiFacade.getInstance(elements.getProject());
GlobalSearchScope resolveScope = elements.getResolveScope();
PsiClass listClass = facade.findClass(CommonClassNames.JAVA_UTIL_LIST, resolveScope);
PsiClass listClass = facade.findClass(JAVA_UTIL_LIST, resolveScope);
if (listClass == null) {
return facade.getElementFactory().createTypeByFQClassName(CommonClassNames.JAVA_UTIL_LIST, resolveScope);
return facade.getElementFactory().createTypeByFQClassName(JAVA_UTIL_LIST, resolveScope);
}
return facade.getElementFactory().createType(listClass, facade.getElementFactory().createType(elements));
}
@@ -596,12 +596,12 @@ public class TypesUtil {
JavaPsiFacade facade = JavaPsiFacade.getInstance(context.getProject());
GlobalSearchScope resolveScope = context.getResolveScope();
PsiClass setClass = facade.findClass(CommonClassNames.JAVA_UTIL_SET, resolveScope);
PsiClass setClass = facade.findClass(JAVA_UTIL_SET, resolveScope);
if (setClass != null) {
return facade.getElementFactory().createType(setClass, type);
}
return facade.getElementFactory().createTypeByFQClassName(CommonClassNames.JAVA_UTIL_SET, resolveScope);
return facade.getElementFactory().createTypeByFQClassName(JAVA_UTIL_SET, resolveScope);
}
public static Map<String, PsiClass> getSuperClassesWithCache(@NotNull PsiClass aClass) {
@@ -52,6 +52,7 @@ import java.util.*;
/**
* @author Maxim.Medvedev
*/
@SuppressWarnings("unchecked")
public class GrClosureSignatureUtil {
private GrClosureSignatureUtil() {
}
@@ -549,7 +550,7 @@ public class GrClosureSignatureUtil {
for (GrExpression expression : expressionArgs) {
PsiType type = expression.getType();
if (expression instanceof GrNewExpression && com.intellij.psi.util.PsiUtil.resolveClassInType(type) == null) {
if (partial && expression instanceof GrNewExpression && com.intellij.psi.util.PsiUtil.resolveClassInType(type) == null) {
type = null;
}
if (eraseArgs) {
@@ -649,24 +650,6 @@ public class GrClosureSignatureUtil {
return generateAllMethodSignaturesByClosureSignature(name, signature, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
}
@Nullable
public static PsiType getTypeByTypeArg(ArgInfo<PsiType> arg, PsiManager manager, GlobalSearchScope resolveScope) {
if (arg.isMultiArg) {
if (arg.args.size() == 0) return PsiType.getJavaLangObject(manager, resolveScope).createArrayType();
PsiType leastUpperBound = null;
for (PsiType type : arg.args) {
leastUpperBound = TypesUtil.getLeastUpperBoundNullable(leastUpperBound, type, manager);
}
if (leastUpperBound == null) return null;
return leastUpperBound.createArrayType();
}
else {
if (arg.args.size() > 0) return arg.args.get(0);
return null;
}
}
@Nullable
public static PsiType getTypeByArg(ArgInfo<PsiElement> arg, PsiManager manager, GlobalSearchScope resolveScope) {
if (arg.isMultiArg) {
@@ -251,7 +251,7 @@ public class PsiUtil {
}
else {
if (type == null) {
result.add(nullAsBottom ? PsiType.NULL : TypesUtil.getJavaLangObject(expression));
result.add(nullAsBottom ? null : TypesUtil.getJavaLangObject(expression));
}
else {
if (stopAt == expression) {
@@ -23,6 +23,10 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFile
import junit.framework.AssertionFailedError
import com.intellij.testFramework.PsiTestUtil
import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration
import com.intellij.compiler.CompilerConfigurationImpl
import com.intellij.openapi.compiler.options.ExcludeEntryDescription
import com.intellij.compiler.CompileServerManager
/**
* @author peter
@@ -66,16 +70,16 @@ public abstract class GroovyCompilerTest extends GroovyCompilerTestCase {
assertOutput("Foo", "239");
setFileText(file, "class Bar {}");
makeShouldFail()
shouldFail { make() }
setFileText(file, barText);
make();
assertOutput("Foo", "239");
}
private void makeShouldFail() {
private void shouldFail(Closure action) {
try {
make();
action()
fail("Make should fail");
}
catch (RuntimeException e) {
@@ -513,7 +517,7 @@ class Indirect {
assertEmpty compileModule(myModule)
setFileText(used, 'class Used2 {}')
makeShouldFail()
shouldFail { make() }
assert findClassFile('Used') == null
setFileText(used, 'class Used3 {}')
@@ -581,6 +585,35 @@ public class Main {
assertOutput 'Main', 'Hello, truetrue239'
}
public void "test reporting rebuild errors caused by missing files excluded from compilation"() {
def foo = myFixture.addFileToProject('Foo.groovy', 'class Foo {}')
myFixture.addFileToProject 'Bar.groovy', 'class Bar extends Foo {}'
make()
excludeFromCompilation(foo)
shouldFail { rebuild() }
}
private void excludeFromCompilation(PsiFile foo) {
final ExcludedEntriesConfiguration configuration =
((CompilerConfigurationImpl)CompilerConfiguration.getInstance(project)).getExcludedEntriesConfiguration()
configuration.addExcludeEntryDescription(new ExcludeEntryDescription(foo.virtualFile, false, true, testRootDisposable))
CompileServerManager.instance.shutdownServer()
}
public void "_test reporting module compile errors caused by missing files excluded from compilation"() {
def foo = myFixture.addFileToProject('Foo.groovy', 'class Foo {}')
myFixture.addFileToProject('Bar.groovy', 'class Bar extends Foo {}')
make()
excludeFromCompilation(foo)
shouldFail { compileModule(myModule) }
}
public static class IdeaModeTest extends GroovyCompilerTest {
@Override protected boolean useJps() { false }
}
@@ -236,6 +236,15 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
});
}
protected List<String> rebuild() {
return runCompiler(new Consumer<ErrorReportingCallback>() {
@Override
public void consume(ErrorReportingCallback callback) {
CompilerManager.getInstance(getProject()).rebuild(callback);
}
});
}
protected List<String> compileModule(final Module module) {
return runCompiler(new Consumer<ErrorReportingCallback>() {
@Override
@@ -84,7 +84,7 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
private void doTest(InspectionProfileEntry... tools) {
myFixture.enableInspections(tools);
myFixture.testHighlighting(true, false, false, getTestName(false) + ".groovy");
myFixture.testHighlighting(true, false, true, getTestName(false) + ".groovy");
}
public void testCircularInheritance() throws Throwable {
@@ -477,11 +477,11 @@ class A {
doTest(new GroovyUnresolvedAccessInspection());
}
public void testUnknownVarInArgList() {
public void testImplicitEnumCoercion() {
doTest(new GroovyAssignabilityCheckInspection());
}
public void testImplicitEnumCoercion() {
public void testUnknownVarInArgList() {
doTest(new GroovyAssignabilityCheckInspection());
}
@@ -1,12 +1,11 @@
package org.jetbrains.plugins.groovy.spock
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import com.intellij.codeInsight.lookup.LookupElement
import com.intellij.util.containers.CollectionFactory
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiVariable
import com.intellij.psi.CommonClassNames
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiVariable
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import com.intellij.util.containers.CollectionFactory
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection
import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUnresolvedAccessInspection
@@ -203,13 +202,13 @@ class FooSpec extends spock.lang.Specification {
public void testVariable_resolved() {
myFixture.enableInspections(GroovyAssignabilityCheckInspection, GroovyUnresolvedAccessInspection)
myFixture.configureByText("FooSpec.groovy", """
myFixture.configureByText("FooSpec.groovy", """\
class FooSpec extends spock.lang.Specification {
def "foo test"() {
String subscriber = <warning>Mock</warning>()
then: (0.._) * subscriber.concat(_)
subscriber.concat(<warning>asdasdasd</warning>)
subscriber.concat<warning>(23)</warning>
String subscriber = <warning descr="Can not resolve symbol 'Mock'">Mock</warning>()
then: (0.._) * subscriber.concat<weak_warning descr="Cannot infer argument types">(_)</weak_warning>
subscriber.concat<weak_warning descr="Cannot infer argument types">(<warning descr="Can not resolve symbol 'asdasdasd'">asdasdasd</warning>)</weak_warning>
subscriber.concat<warning descr="'concat' in 'java.lang.String' cannot be applied to '(java.lang.Integer)'">(23)</warning>
}
}
""")
@@ -5,5 +5,5 @@ enum My {
My var = 'foo'
var = <warning descr="Cannot find enum constant 'fail' in enum 'My'">'fail'</warning>
var = "fo"+"o"
var="fo${'o'}"
var = <weak_warning descr="Cannot assign string to enum 'My'">"fo"+"o"</weak_warning>
var=<weak_warning descr="Cannot assign string to enum 'My'">"fo${'o'}"</weak_warning>
@@ -4,5 +4,4 @@ foo(1, 2, '3')
foo(1, *[2, '3'])
foo<warning descr="'foo' in 'SpreadArguments' cannot be applied to '(java.lang.Integer, java.lang.Integer, java.lang.Integer)'">(1, *[2, 3])</warning>
def list = new ArrayList()
foo(1, *list)
foo<weak_warning descr="Cannot infer argument types">(1, *list)</weak_warning>
@@ -1,7 +1,7 @@
def foo(Date d) {}
def a = unknown
foo(a)
foo<weak_warning descr="Cannot infer argument types">(a)</weak_warning>
foo<warning descr="'foo' in 'UnknownVarInArgList' cannot be applied to '(java.lang.Integer)'">(1)</warning>
@@ -10,4 +10,4 @@ def abc(Date d){}
def abc(int i) {}
def x = unknown2
abc<warning descr="'abc' in 'UnknownVarInArgList' cannot be applied to '(null)'">(x)</warning>
abc<weak_warning descr="Cannot infer argument types">(x)</weak_warning>
@@ -103846,6 +103846,8 @@ preseason's
preseasons
preselect
preselected
preselection
preselective
preselects
presence
presence's
-1
View File
@@ -3,7 +3,6 @@
<id>Subversion</id>
<version>1.1</version>
<category>VCS Integration</category>
<idea-version since-build="111.275"/>
<description>For Subversion 1.7 and older versions</description>
<depends>com.intellij.modules.vcs</depends>
<vendor logo="/general/ijLogo.png">JetBrains</vendor>
@@ -220,6 +220,7 @@ label.working.copy.root.outside.text=Working copy root is outside the directory
progress.text.loading.contents=Loading contents of ''{0}''
progress.text2.revision.information=Revision {0}
progress.title.loading.file.content=Loading Remote File Content
progress.title.loading.file.properties=Loading Remote File Properties
exception.text.file.miss.svn=File ''{0}'' is readonly, but miss svn:needs-lock property
confirmation.text.edit.file=File(s) you're are going to edit needs to be locked before editing
@@ -46,7 +46,8 @@ public class SvnDiffProvider implements DiffProvider, DiffMixin {
final SVNStatusClient client = myVcs.createStatusClient();
try {
final SVNStatus svnStatus = client.doStatus(new File(file.getPresentableUrl()), false, false);
if (svnStatus.getCommittedRevision().equals(SVNRevision.UNDEFINED) && svnStatus.isCopied()) {
if (svnStatus == null) return null;
if (SVNRevision.UNDEFINED.equals(svnStatus.getCommittedRevision()) && svnStatus.isCopied()) {
return new SvnRevisionNumber(svnStatus.getCopyFromRevision());
}
return new SvnRevisionNumber(svnStatus.getRevision());
@@ -17,6 +17,7 @@ package org.jetbrains.idea.svn;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.vcsUtil.VcsUtil;
@@ -205,9 +206,17 @@ public class SvnRecursiveStatusWalker {
if ((vFile != null) && myPartner.isExcluded(vFile)) return;
if ((vFile != null) && (SvnVcs.svnStatusIsUnversioned(status))) {
myReceiver.processUnversioned(vFile);
if (vFile.isDirectory()) {
processRecursively(vFile, myCurrentItem.getDepth());
if (myCurrentItem.getPath().getIOFile().equals(ioFile)) {
myReceiver.processUnversioned(vFile);
processRecursively(vFile, myCurrentItem.getDepth());
} else {
final MyItem childItem = new MyItem(myProject, new FilePathImpl(vFile), SVNDepth.INFINITY,
myPartner.createStatusClient(), true);
myQueue.add(childItem);
}
} else {
myReceiver.processUnversioned(vFile);
}
} else {
final FilePath path = VcsUtil.getFilePath(ioFile, status.getKind().equals(SVNNodeKind.DIR));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -198,7 +198,7 @@ public class SvnConfigureProxiesComponent extends MasterDetailsComponent {
public void actionPerformed(AnActionEvent event) {
// apply - for update of editable object
try {
getSelectedConfugurable().apply();
getSelectedConfigurable().apply();
} catch (ConfigurationException e) {
// suppress & wait for OK
}
@@ -145,6 +145,7 @@ public class SvnChangeList implements CommittedChangeList {
final boolean supportsReplaced) throws IOException {
myVcs = vcs;
myLocation = location;
myKnownAsDirectories = new HashSet<String>();
readFromStream(stream, supportsCopyFromInfo, supportsReplaced);
myCommonPathSearcher = new CommonPathSearcher();
for (String path : myAddedPaths) {
@@ -156,7 +157,6 @@ public class SvnChangeList implements CommittedChangeList {
for (String path : myChangedPaths) {
myCommonPathSearcher.next(path);
}
myKnownAsDirectories = new HashSet<String>(0);
}
public Change getByPath(final String path) {
@@ -632,6 +632,11 @@ public class SvnChangeList implements CommittedChangeList {
writeFiles(stream, myDeletedPaths);
writeMap(stream, myCopiedAddedPaths);
writeFiles(stream, myReplacedPaths);
stream.writeInt(myKnownAsDirectories.size());
for (String directory : myKnownAsDirectories) {
stream.writeUTF(directory);
}
}
// to be able to update plugin only
@@ -670,6 +675,11 @@ public class SvnChangeList implements CommittedChangeList {
if (supportsReplaced) {
readFiles(stream, myReplacedPaths);
}
final int size = stream.readInt();
for (int i = 0; i < size; i++) {
myKnownAsDirectories.add(stream.readUTF());
}
}
private static void writeMap(final DataOutput stream, final Map<String, String> map) throws IOException {
@@ -15,12 +15,17 @@
*/
package org.jetbrains.idea.svn.history;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.actions.AbstractShowPropertiesDiffAction;
@@ -59,18 +64,30 @@ public class SvnLazyPropertyContentRevision implements ContentRevision {
private String loadContent() {
final SvnVcs vcs = SvnVcs.getInstance(myProject);
final SVNWCClient client = vcs.createWCClient();
String list;
try {
list = AbstractShowPropertiesDiffAction.getPropertyList(myUrl, ((SvnRevisionNumber) myNumber).getRevision(), client);
final Ref<String> ref = new Ref<String>();
final Runnable runnable = new Runnable() {
@Override
public void run() {
try {
ref.set(AbstractShowPropertiesDiffAction.getPropertyList(myUrl, ((SvnRevisionNumber) myNumber).getRevision(), client));
}
catch (SVNException e) {
// unknown node kind (node deleted)
/*if (e.getErrorMessage().getErrorCode().getCode() == 145000) {
return "";
}*/
ref.set("Can not get properties: " + e.getMessage());
}
}
};
if (ApplicationManager.getApplication().isDispatchThread()) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, SvnBundle.message("progress.title.loading.file.properties"),
false, myProject);
}
catch (SVNException e) {
// unknown node kind (node deleted)
/*if (e.getErrorMessage().getErrorCode().getCode() == 145000) {
return "";
}*/
list = "Can not get properties: " + e.getMessage();
else {
runnable.run();
}
return list;
return ref.get();
}
@NotNull
@@ -198,7 +198,7 @@ public class SvnConfigureProxiesComponent extends MasterDetailsComponent {
public void actionPerformed(AnActionEvent event) {
// apply - for update of editable object
try {
getSelectedConfugurable().apply();
getSelectedConfigurable().apply();
} catch (ConfigurationException e) {
// suppress & wait for OK
}
@@ -227,9 +227,9 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
ElementReference, AttributeReference, GroupReference, AttributeGroupReference, TypeReference
}
private final ReferenceType myType;
private final @Nullable ReferenceType myType;
protected TypeOrElementOrAttributeReference(PsiElement element, TextRange range, ReferenceType type) {
protected TypeOrElementOrAttributeReference(PsiElement element, TextRange range, @Nullable ReferenceType type) {
myElement = element;
myRange = range;
@@ -245,6 +245,9 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
@Nullable
private static ReferenceType determineReferenceType(PsiElement element) {
final XmlAttribute attribute = PsiTreeUtil.getParentOfType(element, XmlAttribute.class);
if (attribute == null) {
return null;
}
final XmlTag tag = attribute.getParent();
final String localName = tag.getLocalName();
final String attributeLocalName = attribute.getLocalName();
@@ -463,7 +466,7 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
@NotNull
public Object[] getVariants() {
final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, true);
if (tag == null) return null;
if (tag == null || myType == null) return ArrayUtil.EMPTY_OBJECT_ARRAY;
String[] tagNames = null;
@@ -488,7 +491,14 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
CompletionProcessor processor = new CompletionProcessor();
processor.tag = tag;
XmlDocument document = ((XmlFile)PsiTreeUtil.getContextOfType(myElement, XmlElement.class, false).getContainingFile()).getDocument();
final XmlElement context = PsiTreeUtil.getContextOfType(myElement, XmlElement.class, false);
if (context == null) {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
final XmlDocument document = ((XmlFile)context.getContainingFile()).getDocument();
if (document == null) {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
final XmlTag rootTag = document.getRootTag();
String ourNamespace = rootTag != null ? rootTag.getAttributeValue(TARGET_NAMESPACE) : "";
if (ourNamespace == null) ourNamespace = "";
@@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
import org.kohsuke.rngom.parse.compact.CompactSyntaxConstants;
import java.lang.reflect.Field;
import java.util.Locale;
/**
* Created by IntelliJ IDEA.
@@ -52,7 +53,7 @@ public class RncTokenTypes {
for (int i = 0; i < tokens.length; i++) {
String token = tokens[i];
if (token.matches("\"\\w*\"")) {
token = "KEYWORD_" + token.substring(1, token.length() - 1).toUpperCase();
token = "KEYWORD_" + token.substring(1, token.length() - 1).toUpperCase(Locale.US);
} else if (token.matches("\".*\"")) {
token = token.substring(1, token.length() - 1);
}