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:
@@ -29,7 +29,10 @@ import com.intellij.psi.xml.XmlText;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class TargetElementUtil extends TargetElementUtilBase {
|
||||
public static final int NEW_AS_CONSTRUCTOR = 0x04;
|
||||
@@ -256,7 +259,8 @@ public class TargetElementUtil extends TargetElementUtilBase {
|
||||
psiClass = PsiTreeUtil.getParentOfType((PsiReferenceExpression)reference, PsiClass.class);
|
||||
}
|
||||
final PsiClass containingClass = ((PsiMember)element).getContainingClass();
|
||||
return psiClass != null && containingClass != null && containingClass.isInheritor(psiClass, true);
|
||||
if (containingClass == psiClass) return true;
|
||||
return psiClass != null && containingClass != null && (containingClass.isInheritor(psiClass, true) || psiClass.isInheritor(containingClass, true));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class JavaCharFilter extends CharFilter {
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
|
||||
if ((c == '[' || c == '<' || c == '.' || c == ' ' || c == '(') &&
|
||||
if ((c == '[' || c == '<' || c == '.' || c == ' ' || c == '(' || c == ',') &&
|
||||
isNonImportedClassEntered((LookupImpl)lookup, c == '.')) {
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
|
||||
+16
-18
@@ -874,23 +874,10 @@ public class GenericsHighlightUtil {
|
||||
@Nullable
|
||||
public static HighlightInfo checkGenericArrayCreation(PsiElement element, PsiType type) {
|
||||
if (type instanceof PsiArrayType) {
|
||||
PsiType componentType = type.getDeepComponentType();
|
||||
if (componentType instanceof PsiClassType) {
|
||||
final PsiClassType classType = (PsiClassType)componentType;
|
||||
PsiType[] parameters = classType.getParameters();
|
||||
for (PsiType parameter : parameters) {
|
||||
if (!(parameter instanceof PsiWildcardType) || ((PsiWildcardType)parameter).getBound() != null) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
|
||||
element,
|
||||
JavaErrorMessages.message("generic.array.creation"));
|
||||
}
|
||||
}
|
||||
final PsiClass resolved = ((PsiClassType)PsiUtil.convertAnonymousToBaseType(classType)).resolve();
|
||||
if (resolved instanceof PsiTypeParameter) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
|
||||
element,
|
||||
JavaErrorMessages.message("generic.array.creation"));
|
||||
}
|
||||
if (!isReifiableType(((PsiArrayType)type).getComponentType())) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
|
||||
element,
|
||||
JavaErrorMessages.message("generic.array.creation"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1179,7 +1166,18 @@ public class GenericsHighlightUtil {
|
||||
if (resolved instanceof PsiTypeParameter) {
|
||||
return false;
|
||||
}
|
||||
return parameters.length == 0;
|
||||
if (parameters.length == 0) {
|
||||
if (resolved != null) {
|
||||
final PsiClass containingClass = resolved.getContainingClass();
|
||||
if (containingClass != null) {
|
||||
final PsiTypeParameter[] containingClassTypeParameters = containingClass.getTypeParameters();
|
||||
if (containingClassTypeParameters.length > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -472,7 +472,7 @@ public class OverrideImplementUtil {
|
||||
if (returnType == null) {
|
||||
returnType = PsiType.VOID;
|
||||
}
|
||||
Properties properties = new Properties();
|
||||
Properties properties = FileTemplateManager.getInstance().getDefaultProperties(targetClass.getProject());
|
||||
properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, returnType.getPresentableText());
|
||||
properties.setProperty(FileTemplate.ATTRIBUTE_DEFAULT_RETURN_VALUE, PsiTypesUtil.getDefaultValueOfType(returnType));
|
||||
properties.setProperty(FileTemplate.ATTRIBUTE_CALL_SUPER, callSuper(originalMethod, result));
|
||||
|
||||
@@ -966,10 +966,15 @@ public final class PsiUtil extends PsiUtilCore {
|
||||
}
|
||||
|
||||
public static boolean isExtensionMethod(@Nullable final PsiMethod method) {
|
||||
if (method == null) return false;
|
||||
return findExtensionMethodMarker(method) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiJavaToken findExtensionMethodMarker(@Nullable final PsiMethod method) {
|
||||
if (method == null) return null;
|
||||
final PsiCodeBlock body = method.getBody();
|
||||
if (body == null) return false;
|
||||
if (body == null) return null;
|
||||
final PsiElement previous = PsiTreeUtil.skipSiblingsBackward(body, PsiComment.class, PsiWhiteSpace.class);
|
||||
return isJavaToken(previous, JavaTokenType.DEFAULT_KEYWORD);
|
||||
return previous instanceof PsiJavaToken && isJavaToken(previous, JavaTokenType.DEFAULT_KEYWORD) ? (PsiJavaToken)previous : null;
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -138,4 +138,10 @@ class ClassLiteral<T> {
|
||||
Object c5 = List[].class;
|
||||
Object c6 = List.class;
|
||||
}
|
||||
}
|
||||
|
||||
class Outer<E> {
|
||||
final Inner[] i = <error descr="Generic array creation">new Inner[10]</error>;
|
||||
class Inner {
|
||||
}
|
||||
}
|
||||
@@ -1331,6 +1331,14 @@ class Foo {
|
||||
myFixture.checkResult('class <caret>')
|
||||
}
|
||||
|
||||
public void "test check for class existing globally when typing comma"() {
|
||||
myFixture.addClass('package p; public class XYZ {}')
|
||||
myFixture.addClass('public class XYZAspect {}')
|
||||
myFixture.configureByText 'a.java', 'class Foo extends Map<caret>'
|
||||
type '<XYZ, XYZ>'
|
||||
myFixture.checkResult 'class Foo extends Map<XYZ, XYZ><caret>'
|
||||
}
|
||||
|
||||
void joinCompletion() {
|
||||
myTester.joinCompletion()
|
||||
}
|
||||
|
||||
+3
@@ -77,6 +77,9 @@ public class AbstractCustomLexer extends LexerBase {
|
||||
for (TokenParser tokenParser : myTokenParsers) {
|
||||
if (tokenParser.hasToken(myPosition)) {
|
||||
tokenParser.getTokenInfo(myCurrentToken);
|
||||
if (myCurrentToken.getEnd() <= myCurrentToken.getStart()) {
|
||||
throw new AssertionError(tokenParser);
|
||||
}
|
||||
tokenFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -575,9 +575,11 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
sink.put(OpenFileDescriptor.NAVIGATE_IN_EDITOR, myConsoleEditor);
|
||||
return;
|
||||
}
|
||||
FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
|
||||
final Object o = ((FileEditorManagerImpl)editorManager).getData(key.getName(), myConsoleEditor, myVirtualFile);
|
||||
sink.put(key, o);
|
||||
else if (getProject().isInitialized()) {
|
||||
FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
|
||||
final Object o = ((FileEditorManagerImpl)editorManager).getData(key.getName(), myConsoleEditor, myVirtualFile);
|
||||
sink.put(key, o);
|
||||
}
|
||||
}
|
||||
|
||||
private void installEditorFactoryListener() {
|
||||
|
||||
@@ -53,6 +53,10 @@ public class ConfigurableEP extends AbstractExtensionPointBean {
|
||||
|
||||
@Attribute("id")
|
||||
public String id;
|
||||
|
||||
@Attribute("nonDefaultProject")
|
||||
public boolean nonDefaultProject;
|
||||
|
||||
/**
|
||||
* @deprecated use '{@link #instanceClass instance}' or '{@link #providerClass provider}' attribute instead
|
||||
*/
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
*/
|
||||
package com.intellij.openapi.options.ex;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurableEP;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.options.*;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
@@ -45,6 +42,11 @@ public class ConfigurableWrapper implements SearchableConfigurable, Configurable
|
||||
(configurable instanceof ConfigurableWrapper && ((ConfigurableWrapper)configurable).getConfigurable() instanceof NoScroll);
|
||||
}
|
||||
|
||||
public static boolean isNonDefaultProject(Configurable configurable) {
|
||||
return configurable instanceof NonDefaultProjectConfigurable ||
|
||||
(configurable instanceof ConfigurableWrapper && ((ConfigurableWrapper)configurable).myEp.nonDefaultProject);
|
||||
}
|
||||
|
||||
private final ConfigurableEP myEp;
|
||||
private final ConfigurableWrapper[] myKids;
|
||||
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.intellij.openapi.options.ex;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurableGroup;
|
||||
import com.intellij.openapi.options.NonDefaultProjectConfigurable;
|
||||
import com.intellij.openapi.options.OptionsBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
@@ -50,7 +49,7 @@ public class ProjectConfigurablesGroup extends ConfigurablesGroupBase implements
|
||||
protected ConfigurableFilter getConfigurableFilter() {
|
||||
return new ConfigurableFilter() {
|
||||
public boolean isIncluded(final Configurable configurable) {
|
||||
return !isDefault() || !(configurable instanceof NonDefaultProjectConfigurable);
|
||||
return !isDefault() || !ConfigurableWrapper.isNonDefaultProject(configurable);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@
|
||||
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.PsiFileReferenceHelper"/>
|
||||
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.JarFileReferenceHelper"/>
|
||||
<projectConfigurable instance="com.intellij.openapi.vfs.encoding.FileEncodingConfigurable"/>
|
||||
<projectConfigurable instance="com.intellij.ui.tabs.FileColorsConfigurable" id="fileColors"/>
|
||||
<projectConfigurable instance="com.intellij.ui.tabs.FileColorsConfigurable" id="fileColors" displayName="File Colors" />
|
||||
|
||||
<uiDebuggerExtension implementation="com.intellij.ui.debugger.extensions.PlaybackDebugger"/>
|
||||
<uiDebuggerExtension implementation="com.intellij.ui.debugger.extensions.ActionTracer"/>
|
||||
|
||||
+1
-2
@@ -149,8 +149,7 @@ public class ChangelistConflictTracker {
|
||||
}
|
||||
|
||||
private void checkOneFile(VirtualFile file, LocalChangeList defaultList) {
|
||||
final LocalChangeList changeList = myChangeListManager.getChangeList(file);
|
||||
if (file == null || Comparing.equal(changeList, defaultList) || ChangesUtil.isInternalOperation(file)) {
|
||||
if (file == null || Comparing.equal(myChangeListManager.getChangeList(file), defaultList) || ChangesUtil.isInternalOperation(file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+25
-25
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 Bas Leijdekkers
|
||||
* Copyright 2010-2012 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package com.siyeh.ig.junit;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
@@ -32,15 +33,13 @@ public class AssertEqualsCalledOnArrayInspection extends BaseInspection {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assertequals.called.on.arrays.display.name");
|
||||
return InspectionGadgetsBundle.message("assertequals.called.on.arrays.display.name");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assertequals.called.on.arrays.problem.descriptor");
|
||||
return InspectionGadgetsBundle.message("assertequals.called.on.arrays.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,30 +50,26 @@ public class AssertEqualsCalledOnArrayInspection extends BaseInspection {
|
||||
private static class AssertEqualsCalledOnArrayFix
|
||||
extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"assertequals.called.on.arrays.quickfix");
|
||||
return InspectionGadgetsBundle.message("assertequals.called.on.arrays.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
|
||||
final PsiElement methodNameIdentifier = descriptor.getPsiElement();
|
||||
final PsiReferenceExpression methodExpression =
|
||||
(PsiReferenceExpression)methodNameIdentifier.getParent();
|
||||
final PsiReferenceExpression methodExpression = (PsiReferenceExpression)methodNameIdentifier.getParent();
|
||||
if (methodExpression == null) {
|
||||
return;
|
||||
}
|
||||
final PsiExpression qualifier =
|
||||
methodExpression.getQualifierExpression();
|
||||
final PsiExpression qualifier = methodExpression.getQualifierExpression();
|
||||
if (qualifier == null) {
|
||||
replaceExpression(methodExpression, "assertArrayEquals");
|
||||
}
|
||||
else {
|
||||
final String qualifierText = qualifier.getText();
|
||||
replaceExpression(methodExpression,
|
||||
qualifierText + ".assertArrayEquals");
|
||||
replaceExpression(methodExpression, qualifierText + ".assertArrayEquals");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,17 +79,13 @@ public class AssertEqualsCalledOnArrayInspection extends BaseInspection {
|
||||
return new AssertEqualsOnArrayVisitor();
|
||||
}
|
||||
|
||||
private static class AssertEqualsOnArrayVisitor
|
||||
extends BaseInspectionVisitor {
|
||||
private static class AssertEqualsOnArrayVisitor extends BaseInspectionVisitor {
|
||||
|
||||
@Override
|
||||
public void visitMethodCallExpression(
|
||||
PsiMethodCallExpression expression) {
|
||||
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
|
||||
super.visitMethodCallExpression(expression);
|
||||
final PsiReferenceExpression methodExpression =
|
||||
expression.getMethodExpression();
|
||||
@NonNls final String methodName =
|
||||
methodExpression.getReferenceName();
|
||||
final PsiReferenceExpression methodExpression = expression.getMethodExpression();
|
||||
@NonNls final String methodName = methodExpression.getReferenceName();
|
||||
if (!"assertEquals".equals(methodName)) {
|
||||
return;
|
||||
}
|
||||
@@ -117,8 +108,17 @@ public class AssertEqualsCalledOnArrayInspection extends BaseInspection {
|
||||
else {
|
||||
return;
|
||||
}
|
||||
if (!(type1 instanceof PsiArrayType) ||
|
||||
!(type2 instanceof PsiArrayType)) {
|
||||
if (!(type1 instanceof PsiArrayType) || !(type2 instanceof PsiArrayType)) {
|
||||
return;
|
||||
}
|
||||
final PsiMethod method = expression.resolveMethod();
|
||||
if (method == null) {
|
||||
return;
|
||||
}
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
if (!InheritanceUtil.isInheritor(containingClass, "junit.framework.Assert") &&
|
||||
!InheritanceUtil.isInheritor(containingClass, "org.junit.Assert") &&
|
||||
!InheritanceUtil.isInheritor(containingClass, "org.testng.AssertJUnit")) {
|
||||
return;
|
||||
}
|
||||
registerMethodCallError(expression);
|
||||
|
||||
+14
-5
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Query;
|
||||
@@ -31,16 +32,14 @@ import java.util.Collection;
|
||||
|
||||
public class ConvertInterfaceToClassIntention extends Intention {
|
||||
|
||||
private static void changeInterfaceToClass(PsiClass anInterface)
|
||||
throws IncorrectOperationException {
|
||||
private static void changeInterfaceToClass(PsiClass anInterface) throws IncorrectOperationException {
|
||||
final PsiIdentifier nameIdentifier = anInterface.getNameIdentifier();
|
||||
assert nameIdentifier != null;
|
||||
final PsiElement whiteSpace = nameIdentifier.getPrevSibling();
|
||||
assert whiteSpace != null;
|
||||
final PsiElement interfaceToken = whiteSpace.getPrevSibling();
|
||||
assert interfaceToken != null;
|
||||
final PsiKeyword interfaceKeyword =
|
||||
(PsiKeyword)interfaceToken.getOriginalElement();
|
||||
final PsiKeyword interfaceKeyword = (PsiKeyword)interfaceToken.getOriginalElement();
|
||||
final Project project = anInterface.getProject();
|
||||
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
|
||||
final PsiElementFactory factory = psiFacade.getElementFactory();
|
||||
@@ -52,16 +51,25 @@ public class ConvertInterfaceToClassIntention extends Intention {
|
||||
return;
|
||||
}
|
||||
classModifierList.setModifierProperty(PsiModifier.ABSTRACT, true);
|
||||
|
||||
final PsiElement parent = anInterface.getParent();
|
||||
if (parent instanceof PsiClass) {
|
||||
classModifierList.setModifierProperty(PsiModifier.STATIC, true);
|
||||
}
|
||||
|
||||
final PsiMethod[] methods = anInterface.getMethods();
|
||||
for (final PsiMethod method : methods) {
|
||||
final PsiJavaToken marker = PsiUtil.findExtensionMethodMarker(method);
|
||||
final PsiModifierList modifierList = method.getModifierList();
|
||||
modifierList.setModifierProperty(PsiModifier.PUBLIC, true);
|
||||
modifierList.setModifierProperty(PsiModifier.ABSTRACT, true);
|
||||
if (marker != null) {
|
||||
marker.delete();
|
||||
}
|
||||
else {
|
||||
modifierList.setModifierProperty(PsiModifier.ABSTRACT, true);
|
||||
}
|
||||
}
|
||||
|
||||
final PsiField[] fields = anInterface.getFields();
|
||||
for (final PsiField field : fields) {
|
||||
final PsiModifierList modifierList = field.getModifierList();
|
||||
@@ -71,6 +79,7 @@ public class ConvertInterfaceToClassIntention extends Intention {
|
||||
modifierList.setModifierProperty(PsiModifier.FINAL, true);
|
||||
}
|
||||
}
|
||||
|
||||
final PsiClass[] innerClasses = anInterface.getInnerClasses();
|
||||
for (PsiClass innerClass : innerClasses) {
|
||||
final PsiModifierList modifierList = innerClass.getModifierList();
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
public interface I<caret> {
|
||||
void m();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
public abstract class I {
|
||||
public abstract void m();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
public interface I<caret> {
|
||||
void m() default {
|
||||
System.out.println("Hi there.");
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
public abstract class I {
|
||||
public void m() {
|
||||
System.out.println("Hi there.");
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
package com.siyeh.ipp.interfacetoclass;
|
||||
|
||||
public interface ConvertInterfaceToClass
|
||||
{
|
||||
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.siyeh.ipp.interfacetoclass;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
// make me readonly
|
||||
public class ConvertInterfaceToClassImpl extends AbstractAction
|
||||
implements ConvertInterfaceToClass
|
||||
{
|
||||
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.ipp.interfacetoclass;
|
||||
|
||||
import com.siyeh.IntentionPowerPackBundle;
|
||||
import com.siyeh.ipp.IPPTestCase;
|
||||
|
||||
public class ConvertInterfaceToClassTest extends IPPTestCase {
|
||||
public void testBasic() { doTest(); }
|
||||
public void testExtensionMethods() { doTest(); }
|
||||
|
||||
@Override
|
||||
protected String getRelativePath() {
|
||||
return "interfaceToClass";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getIntentionName() {
|
||||
return IntentionPowerPackBundle.message("convert.interface.to.class.intention.name");
|
||||
}
|
||||
}
|
||||
+87
-107
@@ -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,30 +15,28 @@
|
||||
*/
|
||||
package com.intellij.cvsSupport2.actions.merge;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import com.intellij.util.containers.Stack;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Stack;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* @author lesya
|
||||
*/
|
||||
public class CvsConflictsParser {
|
||||
private static final String RIGHT = "<<<<<<<";
|
||||
private static final String LEFT = "=======";
|
||||
private static final String END = ">>>>>>>";
|
||||
|
||||
enum State {
|
||||
private static final String LEFT = "<<<<<<< ";
|
||||
private static final String RIGHT = "=======";
|
||||
private static final String END = ">>>>>>> ";
|
||||
private static final int LENGTH = RIGHT.length();
|
||||
|
||||
private enum State {
|
||||
RIGHT, LEFT
|
||||
}
|
||||
|
||||
private final StringBuffer myLeftBuffer = new StringBuffer();
|
||||
private final StringBuffer myCenterBuffer = new StringBuffer();
|
||||
private final StringBuffer myRightBuffer = new StringBuffer();
|
||||
private final Stack<State> myStateStack;
|
||||
private final StringBuilder myLeftBuffer = new StringBuilder();
|
||||
private final StringBuilder myCenterBuffer = new StringBuilder();
|
||||
private final StringBuilder myRightBuffer = new StringBuilder();
|
||||
private final Stack<State> myStateStack = new Stack<State>();
|
||||
|
||||
public String getLeftVersion() {
|
||||
return myLeftBuffer.toString();
|
||||
@@ -52,10 +50,7 @@ public class CvsConflictsParser {
|
||||
return myRightBuffer.toString();
|
||||
}
|
||||
|
||||
private CvsConflictsParser() {
|
||||
|
||||
myStateStack = new Stack<State>();
|
||||
}
|
||||
private CvsConflictsParser() {}
|
||||
|
||||
public static CvsConflictsParser createOn(InputStream merged) throws IOException {
|
||||
final CvsConflictsParser result = new CvsConflictsParser();
|
||||
@@ -64,30 +59,12 @@ public class CvsConflictsParser {
|
||||
}
|
||||
|
||||
private void parseFile(final InputStream merged) throws IOException {
|
||||
final InputStreamReader isr = new InputStreamReader(merged);
|
||||
final BufferedReader br = new BufferedReader(isr);
|
||||
final BufferedReader br = new BufferedReader(new InputStreamReader(merged));
|
||||
try {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
String cutLine = findMarkerAndWriteTail(line, RIGHT);
|
||||
if (cutLine != null) {
|
||||
processRightMarker(cutLine);
|
||||
continue;
|
||||
for (String line; (line = br.readLine()) != null; ) {
|
||||
if (!processLeftMarker(line) && !processRightMarker(line) && !processEndMarker(line)) {
|
||||
appendToMainOrCurrent(line);
|
||||
}
|
||||
|
||||
cutLine = findMarkerAndWriteTail(line, LEFT);
|
||||
if (cutLine != null) {
|
||||
processLeftMarker(cutLine);
|
||||
continue;
|
||||
}
|
||||
|
||||
cutLine = findMarkerAndWriteTail(line, END);
|
||||
if (cutLine != null) {
|
||||
processEndMarker(cutLine);
|
||||
continue;
|
||||
}
|
||||
|
||||
appendToMainOrCurrent(line);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -95,85 +72,88 @@ public class CvsConflictsParser {
|
||||
}
|
||||
}
|
||||
|
||||
private void appendToMainOrCurrent(final String line) {
|
||||
private boolean processLeftMarker(String line) {
|
||||
final int idx = line.lastIndexOf(LEFT);
|
||||
if (idx < 0) {
|
||||
return false;
|
||||
}
|
||||
if (myStateStack.isEmpty()) {
|
||||
appendLine(line);
|
||||
} else {
|
||||
appendToCurrentBuffer(line);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String findMarkerAndWriteTail(final String s, final String marker) {
|
||||
final int idx = s.indexOf(marker);
|
||||
if (idx == -1) {
|
||||
return null;
|
||||
}
|
||||
final String startFragment = s.substring(0, idx);
|
||||
if (startFragment.length() > 0) {
|
||||
appendToMainOrCurrent(startFragment);
|
||||
}
|
||||
return s.substring(idx);
|
||||
}
|
||||
|
||||
private void processEndMarker(final String line) {
|
||||
if (myStateStack.isEmpty()) {
|
||||
appendLine(line);
|
||||
}
|
||||
else {
|
||||
myStateStack.pop();
|
||||
if (!myStateStack.isEmpty()) {
|
||||
appendToCurrentBuffer(line);
|
||||
final String fragment = line.substring(0, idx);
|
||||
if (!fragment.isEmpty()) {
|
||||
appendToMainOrCurrent(fragment);
|
||||
}
|
||||
}
|
||||
else {
|
||||
appendToMainOrCurrent(line);
|
||||
}
|
||||
myStateStack.push(State.LEFT);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void processLeftMarker(final String line) {
|
||||
if (myStateStack.isEmpty()) {
|
||||
appendLine(line);
|
||||
private boolean processRightMarker(String line) {
|
||||
if (!line.endsWith(RIGHT)) {
|
||||
return false;
|
||||
}
|
||||
else if (myStateStack.peek() == State.LEFT) {
|
||||
if (!myStateStack.isEmpty() && myStateStack.peek() == State.LEFT) {
|
||||
if (myStateStack.size() > 1) {
|
||||
appendToMainOrCurrent(line);
|
||||
}
|
||||
else {
|
||||
final String fragment = line.substring(0, line.length() - LENGTH);
|
||||
if (!fragment.isEmpty()) {
|
||||
appendToMainOrCurrent(fragment);
|
||||
}
|
||||
}
|
||||
myStateStack.pop();
|
||||
myStateStack.push(State.RIGHT);
|
||||
}
|
||||
else {
|
||||
appendToMainOrCurrent(line);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean processEndMarker(String line) {
|
||||
final int idx = line.lastIndexOf(END);
|
||||
if (idx < 0) {
|
||||
return false;
|
||||
}
|
||||
if (!myStateStack.isEmpty()) {
|
||||
if (myStateStack.size() > 1) {
|
||||
appendToCurrentBuffer(line);
|
||||
appendToMainOrCurrent(line);
|
||||
}
|
||||
else {
|
||||
final String fragment = line.substring(0, idx);
|
||||
if (!fragment.isEmpty()) {
|
||||
appendToMainOrCurrent(fragment);
|
||||
}
|
||||
}
|
||||
myStateStack.pop();
|
||||
}
|
||||
else {
|
||||
appendToMainOrCurrent(line);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void appendToMainOrCurrent(String line) {
|
||||
if (myStateStack.isEmpty()) {
|
||||
append(line, myLeftBuffer);
|
||||
append(line, myCenterBuffer);
|
||||
append(line, myRightBuffer);
|
||||
} else {
|
||||
if (myStateStack.get(0) == State.RIGHT) {
|
||||
append(line, myRightBuffer);
|
||||
} else {
|
||||
append(line, myLeftBuffer);
|
||||
}
|
||||
}
|
||||
else {
|
||||
appendToCurrentBuffer(line);
|
||||
}
|
||||
}
|
||||
|
||||
private void processRightMarker(final String line) {
|
||||
if (myStateStack.isEmpty()) {
|
||||
myStateStack.push(State.LEFT);
|
||||
}
|
||||
else {
|
||||
myStateStack.push(State.LEFT);
|
||||
appendToCurrentBuffer(line);
|
||||
private static void append(String line, StringBuilder out) {
|
||||
if (out.length() > 0) {
|
||||
out.append("\n");
|
||||
}
|
||||
out.append(line);
|
||||
}
|
||||
|
||||
private void appendToCurrentBuffer(final String line) {
|
||||
if (myStateStack.get(0) == State.RIGHT) {
|
||||
appendLine(line, myRightBuffer);
|
||||
} else {
|
||||
appendLine(line, myLeftBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
private void appendLine(final String line) {
|
||||
appendLine(line, myLeftBuffer);
|
||||
appendLine(line, myCenterBuffer);
|
||||
appendLine(line, myRightBuffer);
|
||||
}
|
||||
|
||||
private static void appendLine(final String line, final StringBuffer buffer) {
|
||||
if (buffer.length() > 0) {
|
||||
buffer.append("\n");
|
||||
}
|
||||
buffer.append(line);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class GroovyReferenceCharFilter extends CharFilter {
|
||||
return Result.ADD_TO_PREFIX;
|
||||
}
|
||||
|
||||
if ((c == '[' || c == '<' || c == '.' || c == ' ' || c == '(') &&
|
||||
if ((c == '[' || c == '<' || c == '.' || c == ' ' || c == '(' || c == ',') &&
|
||||
JavaCharFilter.isNonImportedClassEntered((LookupImpl)lookup, c == '.')) {
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ public class GroovyOverrideImplementUtil {
|
||||
if (returnType != null) {
|
||||
returnTypeText = returnType.getPresentableText();
|
||||
}
|
||||
Properties properties = new Properties();
|
||||
Properties properties = FileTemplateManager.getInstance().getDefaultProperties(project);
|
||||
|
||||
properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, returnTypeText);
|
||||
properties.setProperty(FileTemplate.ATTRIBUTE_DEFAULT_RETURN_VALUE, PsiTypesUtil.getDefaultValueOfType(returnType));
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<projectService serviceInterface="com.intellij.spellchecker.SpellCheckerManager"
|
||||
serviceImplementation="com.intellij.spellchecker.SpellCheckerManager"/>
|
||||
<editorCustomization implementation="com.intellij.spellchecker.ui.SpellCheckingEditorCustomization"/>
|
||||
<projectConfigurable instance="com.intellij.spellchecker.settings.SpellCheckerSettingsManager"/>
|
||||
<projectConfigurable instance="com.intellij.spellchecker.settings.SpellCheckerSettingsManager" id="reference.settings.ide.settings.spelling" key="spelling" bundle="com.intellij.spellchecker.util.SpellCheckerBundle" />
|
||||
|
||||
|
||||
<localInspection shortName="SpellCheckingInspection" bundle="com.intellij.spellchecker.util.SpellCheckerBundle"
|
||||
|
||||
@@ -40,6 +40,14 @@ calling the <b>Code | Implement Method...</b> function (<b><i>Ctrl+I</i></b>).<b
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">non-qualified name of the class where method is implemented</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">All the predefined variables from "File Header" Include template are also available
|
||||
(e.g.
|
||||
<font face="verdana" size="-2" color="#7F0000"><b><i>${USER}</i></b></font>,
|
||||
<font face="verdana" size="-2" color="#7F0000"><b><i>${DATE}</i></b></font>,
|
||||
etc)</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -46,6 +46,14 @@
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">non-qualified name of the class where method is implemented</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">All the predefined variables from "File Header" Include template are also available
|
||||
(e.g.
|
||||
<font face="verdana" size="-2" color="#7F0000"><b><i>${USER}</i></b></font>,
|
||||
<font face="verdana" size="-2" color="#7F0000"><b><i>${DATE}</i></b></font>,
|
||||
etc)</font>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</body>
|
||||
|
||||
@@ -253,10 +253,10 @@
|
||||
<projectConfigurable instance="com.intellij.compiler.options.CompilerConfigurable" order="after project"/>
|
||||
<!-- Compiler -->
|
||||
|
||||
<projectConfigurable instance="com.intellij.psi.templateLanguages.TemplateDataLanguageConfigurable"/>
|
||||
<projectConfigurable instance="com.intellij.psi.templateLanguages.TemplateDataLanguageConfigurable" id="Template Data Languages" key="template.data.language.configurable" bundle="messages.LangBundle" />
|
||||
|
||||
<!-- Scopes -->
|
||||
<projectConfigurable instance="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable"/>
|
||||
<projectConfigurable instance="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" id="project.scopes" key="scopes.display.name" bundle="messages.IdeBundle" />
|
||||
|
||||
<!-- Application Configurables -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user