diff options
Diffstat (limited to 'java/java-impl/src/com/intellij/psi/impl')
5 files changed, 15 insertions, 58 deletions
diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java b/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java index 18be9cd12246..314f55c2f7fe 100644 --- a/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java +++ b/java/java-impl/src/com/intellij/psi/impl/JavaCodeBlockModificationListener.java @@ -16,6 +16,7 @@ package com.intellij.psi.impl; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.psi.*; import com.intellij.psi.impl.source.jsp.jspXml.JspDirective; import com.intellij.psi.util.PsiModificationTracker; @@ -90,7 +91,8 @@ public class JavaCodeBlockModificationListener implements PsiTreeChangePreproces } private static boolean isSourceDir(PsiElement element) { - return element instanceof PsiDirectory && JavaDirectoryService.getInstance().getPackage((PsiDirectory)element) != null; + return element instanceof PsiDirectory && + ProjectFileIndex.SERVICE.getInstance(element.getProject()).isInSource(((PsiDirectory)element).getVirtualFile()); } private static boolean isClassOwner(final PsiElement element) { diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java b/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java index 795e66e01ed4..e87e95f79086 100644 --- a/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java +++ b/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java @@ -15,6 +15,7 @@ */ package com.intellij.psi.impl; +import com.intellij.icons.AllIcons; import com.intellij.ide.IconProvider; import com.intellij.ide.projectView.impl.ProjectRootsUtil; import com.intellij.openapi.module.Module; @@ -24,6 +25,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.roots.SourceFolder; import com.intellij.openapi.roots.ui.configuration.SourceRootPresentation; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.JavaDirectoryService; @@ -68,6 +70,9 @@ public class JavaDirectoryIconProvider extends IconProvider implements DumbAware else if (JavaDirectoryService.getInstance().getPackage(psiDirectory) != null) { symbolIcon = PlatformIcons.PACKAGE_ICON; } + else if (!Registry.is("ide.hide.excluded.files") && ProjectRootManager.getInstance(project).getFileIndex().isExcluded(vFile)) { + symbolIcon = AllIcons.Modules.ExcludeRoot; + } else { symbolIcon = PlatformIcons.DIRECTORY_CLOSED_ICON; } diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java b/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java index 8ea592fd99aa..dce55fd952b5 100644 --- a/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java @@ -178,7 +178,7 @@ public class JavaPsiImplementationHelperImpl extends JavaPsiImplementationHelper } List<OrderEntry> orderEntries = index.getOrderEntriesForFile(virtualFile); if (orderEntries.isEmpty()) { - LOG.error("Inconsistent: " + DirectoryIndex.getInstance(myProject).getInfoForDirectory(folder).toString()); + LOG.error("Inconsistent: " + DirectoryIndex.getInstance(myProject).getInfoForFile(folder).toString()); } final VirtualFile[] files = orderEntries.get(0).getFiles(OrderRootType.CLASSES); for (VirtualFile rootFile : files) { diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java index b424af918851..f6dc9b9697f2 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java @@ -15,6 +15,7 @@ */ package com.intellij.psi.impl.source.codeStyle.javadoc; +import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.pom.java.LanguageLevel; @@ -469,20 +470,21 @@ public class JDParser { boolean firstLineShorter, int firstLinePrefixLength) { + int rightMargin = mySettings.getRightMargin(JavaLanguage.INSTANCE); StringBuilder sb = new StringBuilder(); List<String> list; //If wrap comments selected, comments should be wrapped by the right margin if (mySettings.WRAP_COMMENTS) { - list = toArrayWrapping(str, mySettings.RIGHT_MARGIN - prefix.length()); + list = toArrayWrapping(str, rightMargin - prefix.length()); if (firstLineShorter && list != null && !list.isEmpty() - && list.get(0).length() > mySettings.RIGHT_MARGIN - firstLinePrefixLength) + && list.get(0).length() > rightMargin - firstLinePrefixLength) { list = new ArrayList<String>(); //want the first line to be shorter, according to it's prefix - String firstLine = toArrayWrapping(str, mySettings.RIGHT_MARGIN - firstLinePrefixLength).get(0); + String firstLine = toArrayWrapping(str, rightMargin - firstLinePrefixLength).get(0); //so now first line is exactly same width we need list.add(firstLine); str = str.substring(firstLine.length()); @@ -493,7 +495,7 @@ public class JDParser { } //getting all another lines according to their prefix - List<String> subList = toArrayWrapping(str, mySettings.RIGHT_MARGIN - prefix.length()); + List<String> subList = toArrayWrapping(str, rightMargin - prefix.length()); //removing pre tag if (unclosedPreTag && subList != null && !subList.isEmpty()) { diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaCharsetReferenceContributor.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaCharsetReferenceContributor.java deleted file mode 100644 index db1a385d5137..000000000000 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaCharsetReferenceContributor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.psi.impl.source.resolve.reference.impl; - -import com.intellij.codeInsight.daemon.impl.analysis.encoding.EncodingReference; -import com.intellij.psi.*; -import com.intellij.psi.impl.source.resolve.reference.impl.manipulators.StringLiteralManipulator; -import com.intellij.util.ProcessingContext; -import org.jetbrains.annotations.NotNull; - -import java.nio.charset.Charset; - -import static com.intellij.patterns.PsiJavaPatterns.literalExpression; -import static com.intellij.patterns.PsiJavaPatterns.psiMethod; -import static com.intellij.patterns.StandardPatterns.string; - -/** - * @author peter - */ -public class JavaCharsetReferenceContributor extends PsiReferenceContributor { - @Override - public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) { - registrar.registerReferenceProvider( - literalExpression().methodCallParameter( - 0, psiMethod().withName(string().oneOf("forName", "isSupported")).inClass(Charset.class.getName())), - new PsiReferenceProvider() { - @NotNull - @Override - public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { - PsiLiteralExpression literal = (PsiLiteralExpression)element; - Object value = literal.getValue(); - if (value instanceof String) { - return new PsiReference[]{new EncodingReference(element, (String)value, StringLiteralManipulator.getValueRange(literal))}; - } - return PsiReference.EMPTY_ARRAY; - } - }); - } -} |