diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java index d83c937c1dd1..4e80e946cc11 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/FacetStructureConfigurable.java @@ -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); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java index 4fc52aea677a..b275bcb66544 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java @@ -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)); } } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java index 46cf5bbf7c6e..b44ab87d8ae9 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java @@ -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(); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java index b3467cf3c9a1..659473c9047c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java @@ -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) { diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java index 6c1f9220644d..99a45d55fc54 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java @@ -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 list, PsiElement elementToFold, Document document, boolean allowOneLiners) { diff --git a/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java b/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java index 89966b56a7e6..b13c603009ca 100644 --- a/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java +++ b/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java @@ -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 { 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= 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); } diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java index 8e6d81444213..ed7ec70859e1 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java @@ -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(); } diff --git a/java/java-impl/src/com/intellij/refactoring/migration/MigrationProcessor.java b/java/java-impl/src/com/intellij/refactoring/migration/MigrationProcessor.java index ed031a4bfc94..97597bb99e4d 100644 --- a/java/java-impl/src/com/intellij/refactoring/migration/MigrationProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/migration/MigrationProcessor.java @@ -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 usagesVector = new ArrayList(); diff --git a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java index 9e224433f9d1..ca963ae53b93 100644 --- a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java +++ b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java @@ -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()}; } diff --git a/jps/model/src/org/jetbrains/ether/dependencyView/Mappings.java b/jps/model/src/org/jetbrains/ether/dependencyView/Mappings.java index 704c08443492..8dbe8210cfc7 100644 --- a/jps/model/src/org/jetbrains/ether/dependencyView/Mappings.java +++ b/jps/model/src/org/jetbrains/ether/dependencyView/Mappings.java @@ -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"); diff --git a/jps/model/src/org/jetbrains/ether/dependencyView/UsageRepr.java b/jps/model/src/org/jetbrains/ether/dependencyView/UsageRepr.java index d6c33ee78483..4c16f0a5504b 100644 --- a/jps/model/src/org/jetbrains/ether/dependencyView/UsageRepr.java +++ b/jps/model/src/org/jetbrains/ether/dependencyView/UsageRepr.java @@ -32,8 +32,7 @@ class UsageRepr { } public static class Cluster implements RW.Savable { - final Set usages = new HashSet(); - final Map> residentialMap = new HashMap>(); + private final Map> myUsageToDependenciesMap = new HashMap>(); public Cluster() { } @@ -44,11 +43,8 @@ class UsageRepr { for (int i = 0; i < size; i++) { final Usage u = externalizer(context).read(in); - final Set s = - (Set)RW.read(DependencyContext.descriptorS, new HashSet(), in); - - usages.add(u); - residentialMap.put(u, s); + final Set s = (Set)RW.read(DependencyContext.descriptorS, new HashSet(), 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> entry : myUsageToDependenciesMap.entrySet()) { + final Usage u = entry.getKey(); u.save(out); - RW.save(residentialMap.get(u), DependencyContext.descriptorS, out); + final Set 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 s = residentialMap.get(usage); + Set s = myUsageToDependenciesMap.get(usage); if (s == null) { s = new HashSet(); - residentialMap.put(usage, s); + myUsageToDependenciesMap.put(usage, s); } s.add(residence); - usages.add(usage); } public Set getUsages() { - return usages; + return Collections.unmodifiableSet(myUsageToDependenciesMap.keySet()); } public Set getResidence(final Usage usage) { - return residentialMap.get(usage); + return myUsageToDependenciesMap.get(usage); } public boolean isEmpty() { - return usages.isEmpty(); + return myUsageToDependenciesMap.isEmpty(); } public static DataExternalizer 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(); } } diff --git a/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy b/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy index 35b6e5b9a947..74bcf6bb13a6 100644 --- a/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy +++ b/jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy @@ -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) { diff --git a/platform/core-api/src/com/intellij/ui/LayeredIcon.java b/platform/core-api/src/com/intellij/ui/LayeredIcon.java index c637d8a29d9f..2f09cdfcd652 100644 --- a/platform/core-api/src/com/intellij/ui/LayeredIcon.java +++ b/platform/core-api/src/com/intellij/ui/LayeredIcon.java @@ -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; diff --git a/platform/lang-api/src/com/intellij/diagnostic/logging/LogConsolePreferences.java b/platform/lang-api/src/com/intellij/diagnostic/logging/LogConsolePreferences.java index 22fb96f49210..029e5dee2808 100644 --- a/platform/lang-api/src/com/intellij/diagnostic/logging/LogConsolePreferences.java +++ b/platform/lang-api/src/com/intellij/diagnostic/logging/LogConsolePreferences.java @@ -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; } diff --git a/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilterModel.java b/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilterModel.java index df96407e916f..4c053579585a 100644 --- a/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilterModel.java +++ b/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilterModel.java @@ -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; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java index 4dc667d4693a..ae7e2513784b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java @@ -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 = " + if (StringUtilRt.toUpperCase(read).contains(H2) && !read.toUpperCase().contains("H2")) { // read=class name in

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, "
    ") && !StringUtil.containsIgnoreCase(read, "
  • ")) { appendLine(data, read); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/InspectionDescriptionLinkHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/InspectionDescriptionLinkHandler.java index 8060c299ac1f..63cb09bf1a43 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/InspectionDescriptionLinkHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/InspectionDescriptionLinkHandler.java @@ -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; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index 978dbe22d15d..2ef8fc58e5ed 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -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; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeAndUnderscoreMacro.java b/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeAndUnderscoreMacro.java index 5ce313359b04..298772882b60 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeAndUnderscoreMacro.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeAndUnderscoreMacro.java @@ -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()); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeMacro.java b/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeMacro.java index aca630eb3862..c28603a629ac 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeMacro.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/macro/CapitalizeMacro.java @@ -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); } diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindManagerImpl.java b/platform/lang-impl/src/com/intellij/find/impl/FindManagerImpl.java index 1ded870bba9c..478d74b99228 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindManagerImpl.java @@ -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; } -} \ No newline at end of file +} diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CreateFileFromTemplateDialog.java b/platform/lang-impl/src/com/intellij/ide/actions/CreateFileFromTemplateDialog.java index 13e20762bd11..3606eca876d8 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/CreateFileFromTemplateDialog.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/CreateFileFromTemplateDialog.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java index 5de6e92ed7b6..bfa8e5f75c24 100644 --- a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java +++ b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java @@ -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 result = new THashSet(); 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)); diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java index 90cbd8c1747a..cf7b9a6040d1 100644 --- a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java +++ b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java @@ -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)); } } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java index 1a565dc95af4..415bd600254e 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java @@ -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)); + } } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java index b1f4a4ec9428..659eb6bad0ee 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java @@ -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(); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java index 63d81832f492..5a1379b16642 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java @@ -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() { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java index c7d0dcbacf19..35e81d39e964 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java @@ -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 myListners = new ArrayList(); + private final ArrayList myListeners = new ArrayList(); private final Set myInitializedConfigurables = new HashSet(); 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; } diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/NameFilteringListModel.java b/platform/platform-api/src/com/intellij/ui/speedSearch/NameFilteringListModel.java index bcd9e0beb805..b9bb77a9b28e 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/NameFilteringListModel.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/NameFilteringListModel.java @@ -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 extends FilteringListModel { 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)) { diff --git a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java index 7bfa6c2caeb8..97930bafdabf 100644 --- a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java +++ b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java @@ -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() { diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileTextFieldImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileTextFieldImpl.java index 3be3559d7a2f..82514bf36ed2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileTextFieldImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileTextFieldImpl.java @@ -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 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 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; diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java index 0513afa4175e..f635b72d0156 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java @@ -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 { diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyStokeMap.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyStokeMap.java index 3ef546a7d14e..138fd0e03159 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyStokeMap.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyStokeMap.java @@ -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; } -} \ No newline at end of file +} diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/CheckForUpdateAction.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/CheckForUpdateAction.java index 089338910882..d1785b240db5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/CheckForUpdateAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/CheckForUpdateAction.java @@ -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); } }); diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java index d3098820dceb..ea3561fff091 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java @@ -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()); } diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java index 48c96c609a21..7bf980933b34 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettings.java @@ -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, 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, 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; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java index 997e85a14001..dbe2db47eacc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java @@ -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() { diff --git a/platform/platform-impl/src/com/intellij/ui/ColorPicker.java b/platform/platform-impl/src/com/intellij/ui/ColorPicker.java index 5108bb9229cf..2117aab05475 100644 --- a/platform/platform-impl/src/com/intellij/ui/ColorPicker.java +++ b/platform/platform-impl/src/com/intellij/ui/ColorPicker.java @@ -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) { diff --git a/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupModel.java b/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupModel.java index a5ea41a9d016..73ad9989609e 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupModel.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupModel.java @@ -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)) { diff --git a/platform/platform-impl/src/com/intellij/ui/popup/util/MnemonicsSearch.java b/platform/platform-impl/src/com/intellij/ui/popup/util/MnemonicsSearch.java index 92005e006a2f..f20e1eeb8e66 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/util/MnemonicsSearch.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/util/MnemonicsSearch.java @@ -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 { 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); } } diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 0f55be1bebfc..385e6447be7d 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -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} diff --git a/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java b/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java index cd4fad48a19e..e0a44c6759a2 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java +++ b/platform/util-rt/src/com/intellij/openapi/util/text/StringUtilRt.java @@ -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; diff --git a/platform/util/src/com/intellij/openapi/util/IconLoader.java b/platform/util/src/com/intellij/openapi/util/IconLoader.java index 9b9144c6ad0a..55e9486dde94 100644 --- a/platform/util/src/com/intellij/openapi/util/IconLoader.java +++ b/platform/util/src/com/intellij/openapi/util/IconLoader.java @@ -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 ourIcon2DisabledIcon = new WeakHashMap(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(); diff --git a/platform/util/src/com/intellij/openapi/util/JDOMUtil.java b/platform/util/src/com/intellij/openapi/util/JDOMUtil.java index fd7d45bf4797..4c2f350679c1 100644 --- a/platform/util/src/com/intellij/openapi/util/JDOMUtil.java +++ b/platform/util/src/com/intellij/openapi/util/JDOMUtil.java @@ -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) { diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index cc4a6340f6ac..80cdd2788289 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -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); } diff --git a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java index 3993118425a1..3689ff9025eb 100644 --- a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java +++ b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java @@ -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; diff --git a/platform/util/src/com/intellij/util/cls/ClsUtil.java b/platform/util/src/com/intellij/util/cls/ClsUtil.java index e651452622eb..361f960534cb 100644 --- a/platform/util/src/com/intellij/util/cls/ClsUtil.java +++ b/platform/util/src/com/intellij/util/cls/ClsUtil.java @@ -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) { diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java index 9289166d010f..8f36673d2417 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java @@ -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 selectFilePathsToProcess(List 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); + }; } diff --git a/platform/vcs-api/src/com/intellij/util/ui/ConfirmationDialog.java b/platform/vcs-api/src/com/intellij/util/ui/ConfirmationDialog.java index e86759e6057e..4fa80ba3b28c 100644 --- a/platform/vcs-api/src/com/intellij/util/ui/ConfirmationDialog.java +++ b/platform/vcs-api/src/com/intellij/util/ui/ConfirmationDialog.java @@ -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() { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java index 4da219207c27..2cab2ce6f96a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java @@ -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; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/SelectFilePathsDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/SelectFilePathsDialog.java index e7568b018145..69d6da0b52a9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/SelectFilePathsDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/SelectFilePathsDialog.java @@ -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 { - private ChangesTreeList myFileList; + private final ChangesTreeList myFileList; public SelectFilePathsDialog(final Project project, List 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(project, originalFiles, true, true, null, null) { protected DefaultTreeModel buildTreeModel(final List changes, ChangeNodeDecorator changeNodeDecorator) { @@ -54,6 +56,12 @@ public class SelectFilePathsDialog extends AbstractSelectFilesDialog { return null; } }; + if (okActionName != null) { + getOKAction().putValue(Action.NAME, okActionName); + } + if (cancelActionName != null) { + getCancelAction().putValue(Action.NAME, cancelActionName); + } myFileList.setChangesToDisplay(originalFiles); init(); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkout/CompositeCheckoutListener.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkout/CompositeCheckoutListener.java index edecdddffe2b..751bac7bba33 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkout/CompositeCheckoutListener.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkout/CompositeCheckoutListener.java @@ -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); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java index 7657356372da..1ae8907d3b65 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java @@ -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 selectFilePathsToProcess(final List files, - final String title, - @Nullable final String prompt, - final String singleFileTitle, - final String singleFilePromptTemplate, - final VcsShowConfirmationOption confirmationOption) { + public Collection selectFilePathsToProcess(List 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 selectFilePathsToProcess(final List 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 abstractVcsExceptions, @NotNull final String tabDisplayName) { showErrorsImpl(abstractVcsExceptions.isEmpty(), new Getter() { public VcsException get() { diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java index b9ea3469de69..08a18efde45a 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java @@ -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 diff --git a/plugins/android/src/org/jetbrains/android/uipreview/RenderService.java b/plugins/android/src/org/jetbrains/android/uipreview/RenderService.java index c6d4927931da..8c25d058a983 100644 --- a/plugins/android/src/org/jetbrains/android/uipreview/RenderService.java +++ b/plugins/android/src/org/jetbrains/android/uipreview/RenderService.java @@ -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); diff --git a/plugins/android/src/org/jetbrains/android/uipreview/RenderUtil.java b/plugins/android/src/org/jetbrains/android/uipreview/RenderUtil.java index dc67b71849e8..c3efd25dc0d1 100644 --- a/plugins/android/src/org/jetbrains/android/uipreview/RenderUtil.java +++ b/plugins/android/src/org/jetbrains/android/uipreview/RenderUtil.java @@ -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); diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java index 0bd159c2614c..fb23687d8a56 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java @@ -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 filesToRemove, final boolean showDialog) { - ArrayList files = new ArrayList(); + final ArrayList files = new ArrayList(); 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 filesToFilePaths(final ArrayList files) { - List result = new ArrayList(); + final List result = new ArrayList(); for(File f: files) { result.add(VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(f, false)); } @@ -103,8 +105,8 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement } protected Collection getFilesToRemove(CvsContext context) { - Collection deletedFileNames = context.getDeletedFileNames(); - ArrayList result = new ArrayList(); + final Collection deletedFileNames = context.getDeletedFileNames(); + final ArrayList result = new ArrayList(); for (final String deletedFileName : deletedFileNames) { result.add(new File(deletedFileName)); } diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryUpdater.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryUpdater.java index b495b534a295..4a31f78873cf 100644 --- a/plugins/git4idea/src/git4idea/repo/GitRepositoryUpdater.java +++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryUpdater.java @@ -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 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(new Updater(myRepository), myRepository.getProject().getDisposed()); + myUpdateQueue = new QueueProcessor(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(); } diff --git a/plugins/groovy/rt/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java b/plugins/groovy/rt/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java index 2e8aa639441b..fb5ff10fc80d 100644 --- a/plugins/groovy/rt/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java +++ b/plugins/groovy/rt/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java @@ -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 outs = srcToOut.getState(src); if (outs != null) { for (String out : outs) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java index e62afa172b81..00532b3fcf86 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java @@ -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()); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ArgumentInstruction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ArgumentInstruction.java index 3471561d016f..9f3d4f24510c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ArgumentInstruction.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ArgumentInstruction.java @@ -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; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java index cfe842b2e42c..45058043b22a 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java @@ -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++)); } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java index 426bc7760f18..c18d68533059 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java @@ -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 getSuperClassesWithCache(@NotNull PsiClass aClass) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/types/GrClosureSignatureUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/types/GrClosureSignatureUtil.java index b22bff737a58..1ab1ea08ceae 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/types/GrClosureSignatureUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/types/GrClosureSignatureUtil.java @@ -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 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 arg, PsiManager manager, GlobalSearchScope resolveScope) { if (arg.isMultiArg) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java index df8ac872bf12..a6a832255035 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java @@ -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) { diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy index 66347b045072..23da98301178 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy @@ -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 } } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java index 4fda6b0eae81..886cd49ee7e9 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java @@ -236,6 +236,15 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC }); } + protected List rebuild() { + return runCompiler(new Consumer() { + @Override + public void consume(ErrorReportingCallback callback) { + CompilerManager.getInstance(getProject()).rebuild(callback); + } + }); + } + protected List compileModule(final Module module) { return runCompiler(new Consumer() { @Override diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy index 575ad2e4d3c1..3fffb9539d8f 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.groovy @@ -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()); } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/spock/SpockTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/spock/SpockTest.groovy index 526c9ba3825c..c0709e8e3860 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/spock/SpockTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/spock/SpockTest.groovy @@ -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 = Mock() - then: (0.._) * subscriber.concat(_) - subscriber.concat(asdasdasd) - subscriber.concat(23) + String subscriber = Mock() + then: (0.._) * subscriber.concat(_) + subscriber.concat(asdasdasd) + subscriber.concat(23) } } """) diff --git a/plugins/groovy/testdata/highlighting/ImplicitEnumCoercion.groovy b/plugins/groovy/testdata/highlighting/ImplicitEnumCoercion.groovy index a1bc879d0237..98f3189a8815 100644 --- a/plugins/groovy/testdata/highlighting/ImplicitEnumCoercion.groovy +++ b/plugins/groovy/testdata/highlighting/ImplicitEnumCoercion.groovy @@ -5,5 +5,5 @@ enum My { My var = 'foo' var = 'fail' -var = "fo"+"o" -var="fo${'o'}" +var = "fo"+"o" +var="fo${'o'}" diff --git a/plugins/groovy/testdata/highlighting/SpreadArguments.groovy b/plugins/groovy/testdata/highlighting/SpreadArguments.groovy index bcfecaae36fc..529191225a34 100644 --- a/plugins/groovy/testdata/highlighting/SpreadArguments.groovy +++ b/plugins/groovy/testdata/highlighting/SpreadArguments.groovy @@ -4,5 +4,4 @@ foo(1, 2, '3') foo(1, *[2, '3']) foo(1, *[2, 3]) def list = new ArrayList() -foo(1, *list) - +foo(1, *list) diff --git a/plugins/groovy/testdata/highlighting/UnknownVarInArgList.groovy b/plugins/groovy/testdata/highlighting/UnknownVarInArgList.groovy index 4ed8ca33a0dc..028b03609637 100644 --- a/plugins/groovy/testdata/highlighting/UnknownVarInArgList.groovy +++ b/plugins/groovy/testdata/highlighting/UnknownVarInArgList.groovy @@ -1,7 +1,7 @@ def foo(Date d) {} def a = unknown -foo(a) +foo(a) foo(1) @@ -10,4 +10,4 @@ def abc(Date d){} def abc(int i) {} def x = unknown2 -abc(x) \ No newline at end of file +abc(x) \ No newline at end of file diff --git a/plugins/spellchecker/src/com/intellij/spellchecker/english.dic b/plugins/spellchecker/src/com/intellij/spellchecker/english.dic index 59e03e6c3ef0..788f32996ce3 100644 --- a/plugins/spellchecker/src/com/intellij/spellchecker/english.dic +++ b/plugins/spellchecker/src/com/intellij/spellchecker/english.dic @@ -103846,6 +103846,8 @@ preseason's preseasons preselect preselected +preselection +preselective preselects presence presence's diff --git a/plugins/svn4idea/src/META-INF/plugin.xml b/plugins/svn4idea/src/META-INF/plugin.xml index 77b5ce9b7ab4..a902b4339eba 100644 --- a/plugins/svn4idea/src/META-INF/plugin.xml +++ b/plugins/svn4idea/src/META-INF/plugin.xml @@ -3,7 +3,6 @@ Subversion 1.1 VCS Integration - For Subversion 1.7 and older versions com.intellij.modules.vcs JetBrains diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties index 77dccb5ac9af..e113fad95cc5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties @@ -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 diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java index 841c7d6d9272..661a0a647234 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java @@ -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()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java index 110329c8c78b..ad8ae4a82460 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java @@ -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)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java index 53b7aba3fda1..5ae57d8d5877 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java @@ -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 } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java index 1e2d66ab3a9e..8666df90b99f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java @@ -145,6 +145,7 @@ public class SvnChangeList implements CommittedChangeList { final boolean supportsReplaced) throws IOException { myVcs = vcs; myLocation = location; + myKnownAsDirectories = new HashSet(); 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(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 map) throws IOException { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java index 4806ac16747f..141858d4d11b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java @@ -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 ref = new Ref(); + 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 diff --git a/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java b/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java index 53b7aba3fda1..31eeabcb6930 100644 --- a/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java +++ b/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java @@ -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 } diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java index 332760a30f9c..f57123d366f1 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java +++ b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java @@ -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 = ""; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java index 7cc7c543029c..2706ad1f8f06 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java @@ -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); }