mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class PlatformFileTypeFactory extends FileTypeFactory {
|
||||
public void createFileTypes(@NotNull final FileTypeConsumer consumer) {
|
||||
consumer.consume(new ArchiveFileType(), "zip;jar;war;ear;swc;egg;apk");
|
||||
consumer.consume(new ArchiveFileType(), "zip;jar;war;ear;swc;ane;egg;apk");
|
||||
consumer.consume(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess");
|
||||
consumer.consume(NativeFileType.INSTANCE, "doc;xls;ppt;mdb;vsd;pdf;hlp;chm;odt");
|
||||
consumer.consume(UnknownFileType.INSTANCE);
|
||||
|
||||
@@ -452,6 +452,10 @@
|
||||
key="multiple.top.level.classes.in.file.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.class.structure" enabledByDefault="false" level="WARNING"
|
||||
implementationClass="com.siyeh.ig.classlayout.MultipleTopLevelClassesInFileInspection"/>
|
||||
<localInspection language="JAVA" shortName="NonFinalFieldInEnum" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="non.final.field.in.enum.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.class.structure" enabledByDefault="false" level="WARNING"
|
||||
implementationClass="com.siyeh.ig.classlayout.NonFinalFieldInEnumInspection"/>
|
||||
<localInspection language="JAVA" shortName="NoopMethodInAbstractClass" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="noop.method.in.abstract.class.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.class.structure" enabledByDefault="false" level="WARNING"
|
||||
|
||||
@@ -1971,4 +1971,6 @@ ambiguous.field.access.hides.field.problem.descriptor=Field <code>#ref</code> fr
|
||||
ambiguous.field.access.quickfix=Qualify field access with 'super.'
|
||||
string.builder.replaceable.by.string.quickfix=Replace 'StringBuilder' with 'String'
|
||||
string.buffer.replaceable.by.string.quickfix=Replace 'StringBuffer' with 'String'
|
||||
add.0.to.ignore.if.annotated.by.list.quickfix=Add ''{0}'' to ''Ignore if annotated by'' list
|
||||
add.0.to.ignore.if.annotated.by.list.quickfix=Add ''{0}'' to ''Ignore if annotated by'' list
|
||||
non.final.field.in.enum.display.name=Non-'final' field in enum
|
||||
non.final.field.in.enum.problem.descriptor=non-''final'' field <code>#ref</code> in enum ''{0}''
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class NonFinalFieldInEnumInspection extends BaseInspection {
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("non.final.field.in.enum.display.name");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String buildErrorString(Object... infos) {
|
||||
final PsiClass enumClass = (PsiClass)infos[0];
|
||||
return InspectionGadgetsBundle.message("non.final.field.in.enum.problem.descriptor", enumClass.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseInspectionVisitor buildVisitor() {
|
||||
return new NonFinalFieldInEnumVisitor();
|
||||
}
|
||||
|
||||
private static class NonFinalFieldInEnumVisitor extends BaseInspectionVisitor {
|
||||
|
||||
@Override
|
||||
public void visitField(PsiField field) {
|
||||
super.visitField(field);
|
||||
final PsiClass containingClass = field.getContainingClass();
|
||||
if (containingClass == null || !containingClass.isEnum()) {
|
||||
return;
|
||||
}
|
||||
if (field.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
return;
|
||||
}
|
||||
registerFieldError(field, containingClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,18 +170,34 @@ public class ClassUtils {
|
||||
|
||||
@Nullable
|
||||
public static PsiClass getContainingStaticClass(PsiElement element) {
|
||||
PsiClass aClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
|
||||
if (aClass == null) {
|
||||
return null;
|
||||
}
|
||||
PsiClass containingClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class);
|
||||
while (containingClass != null && !containingClass.hasModifierProperty(PsiModifier.STATIC) && !containingClass.isInterface()) {
|
||||
aClass = containingClass;
|
||||
containingClass = aClass.getContainingClass();
|
||||
PsiClass aClass = PsiTreeUtil.getParentOfType(element, PsiClass.class, false, PsiFile.class);
|
||||
while (isNonStaticClass(aClass)) {
|
||||
aClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class, true, PsiFile.class);
|
||||
}
|
||||
return aClass;
|
||||
}
|
||||
|
||||
public static boolean isNonStaticClass(@Nullable PsiClass aClass) {
|
||||
if (aClass == null) {
|
||||
return false;
|
||||
}
|
||||
if (aClass.hasModifierProperty(PsiModifier.STATIC) || aClass.isInterface() || aClass.isEnum()) {
|
||||
return false;
|
||||
}
|
||||
if (aClass instanceof PsiAnonymousClass) {
|
||||
return true;
|
||||
}
|
||||
final PsiElement parent = aClass.getParent();
|
||||
if (parent == null || parent instanceof PsiFile) {
|
||||
return false;
|
||||
}
|
||||
if (!(parent instanceof PsiClass)) {
|
||||
return true;
|
||||
}
|
||||
final PsiClass parentClass = (PsiClass)parent;
|
||||
return !parentClass.isInterface();
|
||||
}
|
||||
|
||||
public static boolean isClassVisibleFromClass(PsiClass baseClass,
|
||||
PsiClass referencedClass) {
|
||||
if (referencedClass.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection reports non-<b>final</b> fields in enumeration types. A non-<b>final</b> field in an enum is rarely needed.
|
||||
<p>
|
||||
<small>New in 12, Powered by InspectionGadgets</small>
|
||||
</body>
|
||||
</html>
|
||||
-77
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 org.jetbrains.idea.maven.execution;
|
||||
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import org.jetbrains.idea.maven.MavenImportingTestCase;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
|
||||
public class MavenRunnerSettingsTest extends MavenImportingTestCase {
|
||||
private Sdk[] myOldJdks;
|
||||
|
||||
@Override
|
||||
protected void setUpInWriteAction() throws Exception {
|
||||
super.setUpInWriteAction();
|
||||
myOldJdks = ProjectJdkTable.getInstance().getAllJdks();
|
||||
for (Sdk each : myOldJdks) {
|
||||
ProjectJdkTable.getInstance().removeJdk(each);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Sdk each : myOldJdks) {
|
||||
ProjectJdkTable.getInstance().addJdk(each);
|
||||
}
|
||||
}
|
||||
});
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testUsingLatestAvailableJdk() throws Exception {
|
||||
new WriteCommandAction.Simple(myProject) {
|
||||
@Override
|
||||
protected void run() throws Throwable {
|
||||
Sdk jdk3 = createJdk("Java 1.3");
|
||||
Sdk jdk4 = createJdk("Java 1.4");
|
||||
Sdk jdk5 = createJdk("Java 1.5");
|
||||
ProjectJdkTable.getInstance().addJdk(jdk3);
|
||||
ProjectJdkTable.getInstance().addJdk(jdk5);
|
||||
ProjectJdkTable.getInstance().addJdk(jdk4);
|
||||
|
||||
try {
|
||||
MavenRunnerSettings settings = new MavenRunnerSettings();
|
||||
assertEquals("Java 1.5", settings.getJreName());
|
||||
}
|
||||
finally {
|
||||
ProjectJdkTable.getInstance().removeJdk(jdk3);
|
||||
ProjectJdkTable.getInstance().removeJdk(jdk4);
|
||||
ProjectJdkTable.getInstance().removeJdk(jdk5);
|
||||
}
|
||||
}
|
||||
}.execute().throwException();
|
||||
}
|
||||
|
||||
public void testUsingInternalJdkIfNoOtherIsDefined() throws Exception {
|
||||
MavenRunnerSettings settings = new MavenRunnerSettings();
|
||||
assertEquals(MavenRunnerSettings.USE_INTERNAL_JAVA, settings.getJreName());
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@
|
||||
<action id="tasks.open.in.browser" class="com.intellij.tasks.actions.OpenTaskInBrowserAction" text="Open in _Browser">
|
||||
<keyboard-shortcut keymap="$default" first-keystroke="alt shift B"/>
|
||||
</action>
|
||||
<action id="tasks.analyze.stacktrace" class="com.intellij.tasks.actions.AnalyzeTaskStacktraceAction" text="Analyze _Stacktrace..."/>
|
||||
<action id="tasks.analyze.stacktrace" class="com.intellij.tasks.actions.AnalyzeTaskStacktraceAction" text="Analyze _Stacktrace From Task..."/>
|
||||
</group>
|
||||
|
||||
<group id="working.context">
|
||||
|
||||
Reference in New Issue
Block a user