mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
@@ -61,12 +61,8 @@ public class JavaIndentOptionsEditor extends SmartIndentOptionsEditor {
|
||||
|
||||
public void apply(final CodeStyleSettings settings, final CodeStyleSettings.IndentOptions options) {
|
||||
super.apply(settings, options);
|
||||
try {
|
||||
options.LABEL_INDENT_SIZE = Integer.parseInt(myLabelIndent.getText());
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
//stay with default
|
||||
}
|
||||
options.LABEL_INDENT_SIZE = getFieldValue(myLabelIndent, 0, options.LABEL_INDENT_SIZE);
|
||||
|
||||
options.LABEL_INDENT_ABSOLUTE = myLabelIndentAbsolute.isSelected();
|
||||
settings.DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS = myCbDontIndentTopLevelMembers.isSelected();
|
||||
options.USE_RELATIVE_INDENTS = myCbUseRelativeIndent.isSelected();
|
||||
|
||||
+8
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -29,6 +29,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.jsp.jspJava.JspClass;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.refactoring.util.RefactoringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -109,11 +110,16 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction {
|
||||
expressions[i] = factory.createExpressionFromText(value, parameter);
|
||||
}
|
||||
expressions[parameters.length] = factory.createExpressionFromText(getField().getName(), constructor);
|
||||
if (constructor.isVarArgs()) {
|
||||
ArrayUtil.swap(expressions, expressions.length - 1, expressions.length - 2);
|
||||
}
|
||||
final SmartPointerManager manager = SmartPointerManager.getInstance(getField().getProject());
|
||||
final SmartPsiElementPointer constructorPointer = manager.createSmartPsiElementPointer(constructor);
|
||||
|
||||
final ChangeMethodSignatureFromUsageFix addParamFix = new ChangeMethodSignatureFromUsageFix(constructor, expressions, PsiSubstitutor.EMPTY, constructor, true, 1);
|
||||
addParamFix.invoke(project, editor, file);
|
||||
if (addParamFix.isAvailable(project, editor, file)) {
|
||||
addParamFix.invoke(project, editor, file);
|
||||
}
|
||||
return ApplicationManager.getApplication().runWriteAction(new Computable<Boolean>() {
|
||||
public Boolean compute() {
|
||||
return doCreate(project, editor, parameters, constructorPointer, addParamFix);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -46,7 +46,7 @@ public class PsiGenerationInfo<T extends PsiMember> extends GenerationInfo {
|
||||
return myMember;
|
||||
}
|
||||
|
||||
public void insert(PsiClass aClass, PsiElement anchor, boolean before) throws IncorrectOperationException {
|
||||
public void insert(final PsiClass aClass, PsiElement anchor, boolean before) throws IncorrectOperationException {
|
||||
final PsiMember existingMember;
|
||||
if (myMember instanceof PsiField) {
|
||||
existingMember = aClass.findFieldByName(myMember.getName(), false);
|
||||
|
||||
+3
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -37,21 +37,20 @@ public class EqualsAndHashcode extends BaseJavaLocalInspectionTool {
|
||||
|
||||
private PsiMethod myHashCode;
|
||||
private PsiMethod myEquals;
|
||||
private JavaPsiFacade myPsiFacade;
|
||||
private final AtomicBoolean myInitialized = new AtomicBoolean();
|
||||
|
||||
public void projectOpened(Project project) {
|
||||
myPsiFacade = JavaPsiFacade.getInstance(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
|
||||
if (!myInitialized.getAndSet(true)) {
|
||||
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(holder.getProject());
|
||||
final PsiClass psiObjectClass = ApplicationManager.getApplication().runReadAction(
|
||||
new Computable<PsiClass>() {
|
||||
@Nullable
|
||||
public PsiClass compute() {
|
||||
return myPsiFacade.findClass("java.lang.Object");
|
||||
return psiFacade.findClass("java.lang.Object");
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -124,6 +123,5 @@ public class EqualsAndHashcode extends BaseJavaLocalInspectionTool {
|
||||
public void projectClosed(Project project) {
|
||||
myEquals = null;
|
||||
myHashCode = null;
|
||||
myPsiFacade = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInspection.javaDoc;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.CodeInsightUtilBase;
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
@@ -327,6 +328,7 @@ public class JavaDocReferenceInspection extends BaseLocalInspectionTool {
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final PsiDocTag myTag = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiDocTag.class);
|
||||
if (myTag == null) return;
|
||||
if (!CodeInsightUtilBase.preparePsiElementForWrite(myTag)) return;
|
||||
myTag.delete();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -27,6 +27,7 @@ import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.jsp.JspFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -43,7 +44,7 @@ public class ClassesTreeStructureProvider implements SelectableTreeStructureProv
|
||||
ArrayList<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
|
||||
for (final AbstractTreeNode child : children) {
|
||||
Object o = child.getValue();
|
||||
if (o instanceof PsiClassOwner) {
|
||||
if (o instanceof PsiClassOwner && !(o instanceof JspFile)) {
|
||||
final ViewSettings settings1 = ((ProjectViewNode)parent).getSettings();
|
||||
final PsiClassOwner classOwner = (PsiClassOwner)o;
|
||||
final VirtualFile file = classOwner.getVirtualFile();
|
||||
@@ -64,8 +65,8 @@ public class ClassesTreeStructureProvider implements SelectableTreeStructureProv
|
||||
}
|
||||
}
|
||||
|
||||
PsiClass[] classes = classOwner.getClasses();
|
||||
if (fileInRoots(file)) {
|
||||
PsiClass[] classes = classOwner.getClasses();
|
||||
if (classes.length == 1 && !(classes[0] instanceof SyntheticElement) &&
|
||||
(file == null || file.getNameWithoutExtension().equals(classes[0].getName()))) {
|
||||
result.add(new ClassTreeNode(myProject, classes[0], settings1));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -158,7 +158,7 @@ public class CopyClassesHandler implements CopyHandlerDelegate {
|
||||
public void doClone(PsiElement element) {
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed("refactoring.copyClass");
|
||||
PsiClass[] classes = getTopLevelClasses(element);
|
||||
LOG.assertTrue(classes != null && classes.length == 1);
|
||||
LOG.assertTrue(classes != null && classes.length == 1, Arrays.toString(classes));
|
||||
Project project = element.getProject();
|
||||
|
||||
CopyClassDialog dialog = new CopyClassDialog(classes[0], null, project, true);
|
||||
|
||||
+11
-6
@@ -566,12 +566,17 @@ public class InplaceIntroduceConstantPopup {
|
||||
myReplaceAllCb.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
if (templateState != null) {
|
||||
templateState.gotoEnd(true);
|
||||
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myDefaultParameterTypePointer.getType(), null, myExpr, myOccurrences);
|
||||
startIntroduceTemplate(isReplaceAllOccurrences(), myFieldTypePointer.getType());
|
||||
}
|
||||
Runnable restartTemplateRunnable = new Runnable() {
|
||||
public void run() {
|
||||
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
if (templateState != null) {
|
||||
templateState.gotoEnd(true);
|
||||
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myDefaultParameterTypePointer.getType(), null, myExpr, myOccurrences);
|
||||
startIntroduceTemplate(isReplaceAllOccurrences(), myFieldTypePointer.getType());
|
||||
}
|
||||
}
|
||||
};
|
||||
CommandProcessor.getInstance().executeCommand(myProject, restartTemplateRunnable, IntroduceConstantHandler.REFACTORING_NAME, IntroduceConstantHandler.REFACTORING_NAME);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+18
-6
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package com.intellij.refactoring.introduceField;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.intention.impl.TypeExpression;
|
||||
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
|
||||
import com.intellij.codeInsight.template.impl.TemplateState;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.RangeMarker;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
@@ -309,12 +312,21 @@ public class InplaceIntroduceFieldPopup {
|
||||
myIntroduceFieldPanel.addOccurrenceListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
if (templateState != null) {
|
||||
templateState.gotoEnd(true);
|
||||
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myDefaultParameterTypePointer.getType(), null, myInitializerExpression, myOccurrences);
|
||||
startTemplate(myIntroduceFieldPanel.isReplaceAllOccurrences(), myFieldTypePointer.getType());
|
||||
}
|
||||
final Runnable restartTemplate = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final TemplateState templateState =
|
||||
TemplateManagerImpl.getTemplateState(myEditor);
|
||||
if (templateState != null) {
|
||||
templateState.gotoEnd(true);
|
||||
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myDefaultParameterTypePointer.getType(), null, myInitializerExpression, myOccurrences);
|
||||
startTemplate(myIntroduceFieldPanel.isReplaceAllOccurrences(), myFieldTypePointer.getType());
|
||||
}
|
||||
}
|
||||
};
|
||||
CommandProcessor.getInstance().executeCommand(myProject, restartTemplate,
|
||||
IntroduceFieldHandler.REFACTORING_NAME,
|
||||
IntroduceFieldHandler.REFACTORING_NAME);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
-7
@@ -52,13 +52,6 @@ public class IntroduceFieldPopupPanel extends IntroduceFieldCentralPanel {
|
||||
occurrences, allowInitInMethod, allowInitInMethodIfAll, typeSelectorManager);
|
||||
}
|
||||
|
||||
protected void initializeControls(PsiExpression initializerExpression, BaseExpressionToFieldHandler.InitializationPlace ourLastInitializerPlace) {
|
||||
super.initializeControls(initializerExpression, ourLastInitializerPlace);
|
||||
|
||||
String ourLastVisibility = JavaRefactoringSettings.getInstance().INTRODUCE_FIELD_VISIBILITY;
|
||||
setVisibility(ourLastVisibility);
|
||||
}
|
||||
|
||||
protected void initializeInitializerPlace(PsiExpression initializerExpression,
|
||||
BaseExpressionToFieldHandler.InitializationPlace ourLastInitializerPlace) {
|
||||
if (initializerExpression != null) {
|
||||
|
||||
+22
-15
@@ -257,12 +257,14 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
|
||||
protected JComponent getComponent() {
|
||||
if (!myInitialized) {
|
||||
myInitialized = true;
|
||||
myWholePanel.add(myCanBeFinalCb,
|
||||
new GridBagConstraints(0, myCbReplaceAllOccurences == null ? 2 : 3, 1, 1, 0, 0, GridBagConstraints.NORTHWEST,
|
||||
GridBagConstraints.NONE, new Insets(0, 5, 2, 5), 0, 0));
|
||||
if (myHasWriteAccess) {
|
||||
myCanBeFinalCb.setSelected(false);
|
||||
myCanBeFinalCb.setEnabled(false);
|
||||
if (myCanBeFinalCb != null) {
|
||||
myWholePanel.add(myCanBeFinalCb,
|
||||
new GridBagConstraints(0, myCbReplaceAllOccurences == null ? 2 : 3, 1, 1, 0, 0, GridBagConstraints.NORTHWEST,
|
||||
GridBagConstraints.NONE, new Insets(0, 5, 2, 5), 0, 0));
|
||||
if (myHasWriteAccess) {
|
||||
myCanBeFinalCb.setSelected(false);
|
||||
myCanBeFinalCb.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myWholePanel;
|
||||
@@ -298,7 +300,7 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
|
||||
protected void saveSettings(PsiVariable psiVariable) {
|
||||
final JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();
|
||||
InplaceIntroduceParameterPopup.super.saveSettings(settings);
|
||||
if (myCanBeFinalCb.isEnabled()) {
|
||||
if (myCanBeFinalCb != null && myCanBeFinalCb.isEnabled()) {
|
||||
settings.INTRODUCE_PARAMETER_CREATE_FINALS = psiVariable.hasModifierProperty(PsiModifier.FINAL);
|
||||
}
|
||||
TypeSelectorManagerImpl.typeSelected(psiVariable.getType(), myDefaultParameterTypePointer.getType());
|
||||
@@ -424,14 +426,19 @@ class InplaceIntroduceParameterPopup extends IntroduceParameterSettingsUI {
|
||||
protected void updateControls(JCheckBox[] removeParamsCb) {
|
||||
super.updateControls(removeParamsCb);
|
||||
if (myParameterIndex < 0) return;
|
||||
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
if (templateState != null) {
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
|
||||
final PsiParameter parameter = getParameter();
|
||||
final boolean hasFinalModifier = parameter.hasModifierProperty(PsiModifier.FINAL);
|
||||
templateState.gotoEnd(true);
|
||||
startIntroduceTemplate(isReplaceAllOccurences(), hasFinalModifier);
|
||||
}
|
||||
Runnable restartTemplateRunnable = new Runnable() {
|
||||
public void run() {
|
||||
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
if (templateState != null) {
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
|
||||
final PsiParameter parameter = getParameter();
|
||||
final boolean hasFinalModifier = parameter.hasModifierProperty(PsiModifier.FINAL);
|
||||
templateState.gotoEnd(true);
|
||||
startIntroduceTemplate(isReplaceAllOccurences(), hasFinalModifier);
|
||||
}
|
||||
}
|
||||
};
|
||||
CommandProcessor.getInstance().executeCommand(myProject, restartTemplateRunnable, IntroduceParameterHandler.REFACTORING_NAME, IntroduceParameterHandler.REFACTORING_NAME);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-3
@@ -771,9 +771,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
final String variableName = suggestedName.names[0];
|
||||
final boolean replaceAll =
|
||||
replaceChoice == OccurrencesChooser.ReplaceChoice.ALL || replaceChoice == OccurrencesChooser.ReplaceChoice.NO_WRITE;
|
||||
final boolean declareFinal =
|
||||
!anyAssignmentLHS && (replaceAll &&
|
||||
declareFinalIfAll || createFinals(project));
|
||||
final boolean declareFinal = replaceAll && (declareFinalIfAll || !anyAssignmentLHS) || createFinals(project);
|
||||
final boolean replaceWrite = anyAssignmentLHS && replaceChoice == OccurrencesChooser.ReplaceChoice.ALL;
|
||||
return new IntroduceVariableSettings() {
|
||||
@Override
|
||||
|
||||
+1
-5
@@ -104,11 +104,7 @@ class IntroduceVariableDialog extends DialogWrapper implements IntroduceVariable
|
||||
}
|
||||
|
||||
public boolean isDeclareFinal() {
|
||||
if (myCbFinal.isEnabled()) {
|
||||
return myCbFinalState;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return myCbFinal.isEnabled() && myCbFinalState;
|
||||
}
|
||||
|
||||
public boolean isReplaceLValues() {
|
||||
|
||||
+5
-1
@@ -151,7 +151,11 @@ public class VariableInplaceIntroducer extends VariableInplaceRenamer {
|
||||
@Nullable
|
||||
protected PsiVariable getVariable() {
|
||||
final PsiDeclarationStatement declarationStatement = myPointer.getElement();
|
||||
return declarationStatement != null ? (PsiVariable)declarationStatement.getDeclaredElements()[0] : null;
|
||||
if (declarationStatement != null) {
|
||||
PsiElement[] declaredElements = declarationStatement.getDeclaredElements();
|
||||
return declaredElements.length == 0 ? null : (PsiVariable)declaredElements[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
*/
|
||||
|
||||
// "Add constructor parameter" "true"
|
||||
class A {
|
||||
private final int field;
|
||||
A(int field, String... strs) {
|
||||
this.field = field;<caret>
|
||||
}
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
*/
|
||||
|
||||
// "Add constructor parameter" "true"
|
||||
class A {
|
||||
private final int <caret>field;
|
||||
A(String... strs) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,6 +68,7 @@ public class Extensions {
|
||||
public static void cleanRootArea(@NotNull Disposable parentDisposable) {
|
||||
final ExtensionsAreaImpl oldRootArea = (ExtensionsAreaImpl)getRootArea();
|
||||
final ExtensionsAreaImpl newArea = createRootArea();
|
||||
ourRootArea = newArea;
|
||||
oldRootArea.notifyAreaReplaced();
|
||||
Disposer.register(parentDisposable, new Disposable() {
|
||||
public void dispose() {
|
||||
|
||||
@@ -41,17 +41,21 @@ public class IndentOptionsEditor extends OptionGroup {
|
||||
protected void addComponents() {
|
||||
addTabOptions();
|
||||
|
||||
myTabSizeField = new JTextField(4);
|
||||
myTabSizeField.setMinimumSize(myTabSizeField.getPreferredSize());
|
||||
myTabSizeField = createIndentTextField();
|
||||
myTabSizeLabel = new JLabel(ApplicationBundle.message("editbox.indent.tab.size"));
|
||||
add(myTabSizeLabel, myTabSizeField);
|
||||
|
||||
myIndentField = new JTextField(4);
|
||||
myIndentField.setMinimumSize(myTabSizeField.getPreferredSize());
|
||||
myIndentField = createIndentTextField();
|
||||
myIndentLabel = new JLabel(ApplicationBundle.message("editbox.indent.indent"));
|
||||
add(myIndentLabel, myIndentField);
|
||||
}
|
||||
|
||||
protected JTextField createIndentTextField() {
|
||||
JTextField field = new JTextField(4);
|
||||
field.setMinimumSize(field.getPreferredSize());
|
||||
return field;
|
||||
}
|
||||
|
||||
protected void addTabOptions() {
|
||||
myCbUseTab = new JCheckBox(ApplicationBundle.message("checkbox.indent.use.tab.character"));
|
||||
add(myCbUseTab);
|
||||
@@ -71,6 +75,15 @@ public class IndentOptionsEditor extends OptionGroup {
|
||||
}
|
||||
}
|
||||
|
||||
protected int getFieldValue(JTextField field, int minValue, int defValue) {
|
||||
try {
|
||||
return Math.max(Integer.parseInt(field.getText()), minValue);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return defValue;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isModified(final CodeStyleSettings settings, CodeStyleSettings.IndentOptions options) {
|
||||
boolean isModified;
|
||||
isModified = isFieldModified(myTabSizeField, options.TAB_SIZE);
|
||||
@@ -81,26 +94,11 @@ public class IndentOptionsEditor extends OptionGroup {
|
||||
}
|
||||
|
||||
protected int getUIIndent() {
|
||||
final String indentText = myIndentField.getText();
|
||||
try {
|
||||
return Math.max(Integer.parseInt(indentText), 1);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
//stay with default
|
||||
}
|
||||
|
||||
return 4;
|
||||
return getFieldValue(myIndentField, 1, 4);
|
||||
}
|
||||
|
||||
protected int getUITabSize() {
|
||||
try {
|
||||
return Math.max(Integer.parseInt(myTabSizeField.getText()), 1);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
//stay with default
|
||||
}
|
||||
|
||||
return 4;
|
||||
return getFieldValue(myTabSizeField, 1, 4);
|
||||
}
|
||||
|
||||
public void apply(final CodeStyleSettings settings, CodeStyleSettings.IndentOptions options) {
|
||||
|
||||
+2
-8
@@ -40,8 +40,7 @@ public class SmartIndentOptionsEditor extends IndentOptionsEditor {
|
||||
protected void addComponents() {
|
||||
super.addComponents();
|
||||
|
||||
myContinuationIndentField = new JTextField(4);
|
||||
myContinuationIndentField.setMinimumSize(myContinuationIndentField.getPreferredSize());
|
||||
myContinuationIndentField = createIndentTextField();
|
||||
myContinuationIndentLabel = new JLabel(ApplicationBundle.message("editbox.indent.continuation.indent"));
|
||||
add(myContinuationIndentLabel, myContinuationIndentField);
|
||||
}
|
||||
@@ -55,12 +54,7 @@ public class SmartIndentOptionsEditor extends IndentOptionsEditor {
|
||||
|
||||
public void apply(final CodeStyleSettings settings, final CodeStyleSettings.IndentOptions options) {
|
||||
super.apply(settings, options);
|
||||
try {
|
||||
options.CONTINUATION_INDENT_SIZE = Math.max(Integer.parseInt(myContinuationIndentField.getText()), 0);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
//stay with default
|
||||
}
|
||||
options.CONTINUATION_INDENT_SIZE = getFieldValue(myContinuationIndentField, 0, options.CONTINUATION_INDENT_SIZE);
|
||||
options.SMART_TABS = isSmartTabValid(options.INDENT_SIZE, options.TAB_SIZE) && myCbSmartTabs.isSelected();
|
||||
}
|
||||
|
||||
|
||||
@@ -88,12 +88,12 @@ public abstract class FacetType<F extends Facet, C extends FacetConfiguration> {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final String getPresentableName() {
|
||||
public String getPresentableName() {
|
||||
return myPresentableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default name wich will be used then user creates a facet of this type
|
||||
* Default name which will be used then user creates a facet of this type
|
||||
* @return
|
||||
*/
|
||||
@NotNull @NonNls
|
||||
|
||||
@@ -252,6 +252,21 @@ public abstract class Indent {
|
||||
return myFactory.getIndent(type, relativeToDirectParent, enforceIndentToChildren);
|
||||
}
|
||||
|
||||
/**
|
||||
* Base factory method for {@link Indent} objects construction, i.e. all other methods may be expressed in terms of this method.
|
||||
*
|
||||
* @param type indent type
|
||||
* @param spaces the number of spaces in the indent
|
||||
* @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free
|
||||
* to get more information about that at class-level javadoc)
|
||||
* @param enforceIndentToChildren flag the indicates if current indent object should be enforced for multiline block children
|
||||
* (feel free to get more information about that at class-level javadoc)
|
||||
* @return newly created indent configured in accordance with the given arguments
|
||||
*/
|
||||
public static Indent getIndent(@NotNull Type type, int spaces, boolean relativeToDirectParent, boolean enforceIndentToChildren) {
|
||||
return myFactory.getIndent(type, spaces, relativeToDirectParent, enforceIndentToChildren);
|
||||
}
|
||||
|
||||
public static class Type {
|
||||
private final String myName;
|
||||
|
||||
|
||||
@@ -32,5 +32,6 @@ interface IndentFactory {
|
||||
Indent getContinuationIndent(boolean relativeToDirectParent);
|
||||
Indent getContinuationWithoutFirstIndent(boolean relativeToDirectParent);
|
||||
Indent getSpaceIndent(final int spaces, boolean relativeToDirectParent);
|
||||
Indent getIndent(@NotNull Indent.Type type, boolean relativeToDirectParent, boolean enforceParentIndent);
|
||||
Indent getIndent(@NotNull Indent.Type type, boolean relativeToDirectParent, boolean enforceIndentToChildren);
|
||||
Indent getIndent(@NotNull Indent.Type type, int spaces, boolean relativeToDirectParent, boolean enforceIndentToChildren);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
|
||||
@@ -23,6 +24,7 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
import com.intellij.patterns.ElementPatternBean;
|
||||
import com.intellij.patterns.StandardPatterns;
|
||||
import com.intellij.util.KeyedLazyInstance;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection;
|
||||
@@ -31,13 +33,19 @@ import com.intellij.util.xmlb.annotations.Property;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Registers a {@link PsiReferenceProvider} in plugin.xml
|
||||
*/
|
||||
public class PsiReferenceProviderBean extends AbstractExtensionPointBean {
|
||||
public class PsiReferenceProviderBean extends AbstractExtensionPointBean implements KeyedLazyInstance<PsiReferenceProviderBean> {
|
||||
|
||||
public static final ExtensionPointName<PsiReferenceProviderBean> EP_NAME =
|
||||
new ExtensionPointName<PsiReferenceProviderBean>("com.intellij.psi.referenceProvider");
|
||||
|
||||
@Attribute("language")
|
||||
public String language = Language.ANY.getID();
|
||||
|
||||
@Attribute("providerClass")
|
||||
public String className;
|
||||
|
||||
@@ -74,8 +82,9 @@ public class PsiReferenceProviderBean extends AbstractExtensionPointBean {
|
||||
@Nullable
|
||||
public ElementPattern<PsiElement> createElementPattern() {
|
||||
if (patterns.length > 1) {
|
||||
return StandardPatterns.or(ContainerUtil.mapNotNull(patterns,
|
||||
PATTERN_NULLABLE_FUNCTION).toArray(new ElementPattern[0]));
|
||||
List<ElementPattern<? extends PsiElement>> list = ContainerUtil.mapNotNull(patterns, PATTERN_NULLABLE_FUNCTION);
|
||||
//noinspection unchecked
|
||||
return StandardPatterns.or(list.toArray(new ElementPattern[list.size()]));
|
||||
}
|
||||
else if (patterns.length == 1) {
|
||||
return patterns[0].compilePattern();
|
||||
@@ -85,4 +94,14 @@ public class PsiReferenceProviderBean extends AbstractExtensionPointBean {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return language;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiReferenceProviderBean getInstance() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
|
||||
void appendPrefix(char c) {
|
||||
checkReused();
|
||||
LOG.assertTrue(!myDisposed, disposeTrace);
|
||||
checkValid();
|
||||
myAdditionalPrefix += c;
|
||||
myInitialPrefix = null;
|
||||
myFrozenItems.clear();
|
||||
@@ -378,7 +378,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
}
|
||||
assert !myDisposed : disposeTrace;
|
||||
checkValid();
|
||||
|
||||
final Pair<List<LookupElement>,Iterable<List<LookupElement>>> snapshot = myModel.getModelSnapshot();
|
||||
|
||||
@@ -756,7 +756,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
}
|
||||
|
||||
public void performGuardedChange(Runnable change) {
|
||||
LOG.assertTrue(!myDisposed, disposeTrace);
|
||||
checkValid();
|
||||
assert myLookupStartMarker.isValid();
|
||||
assert !myChangeGuard;
|
||||
|
||||
@@ -770,13 +770,13 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
marker.trackInvalidation(false);
|
||||
myChangeGuard = false;
|
||||
}
|
||||
LOG.assertTrue(!myDisposed, disposeTrace);
|
||||
checkValid();
|
||||
LOG.assertTrue(myLookupStartMarker.isValid(), "invalid lookup start");
|
||||
LOG.assertTrue(marker.isValid(), "invalid marker");
|
||||
if (isVisible()) {
|
||||
updateLookupBounds();
|
||||
}
|
||||
LOG.assertTrue(!myDisposed, disposeTrace);
|
||||
checkValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -791,7 +791,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
|
||||
public void show(){
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
LOG.assertTrue(!myDisposed, disposeTrace);
|
||||
checkValid();
|
||||
LOG.assertTrue(!myShown);
|
||||
myShown = true;
|
||||
myStampShown = System.currentTimeMillis();
|
||||
@@ -1319,11 +1319,16 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
return myDisposed;
|
||||
}
|
||||
|
||||
public void checkValid() {
|
||||
if (myDisposed) {
|
||||
throw new AssertionError("Disposed at: " + disposeTrace);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showItemPopup(JBPopup hint) {
|
||||
final Rectangle bounds = getCurrentItemBounds();
|
||||
hint.show(new RelativePoint(getComponent(), new Point(bounds.x + bounds.width,
|
||||
bounds.y)));
|
||||
hint.show(new RelativePoint(getComponent(), new Point(bounds.x + bounds.width, bounds.y)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -225,6 +225,12 @@ public class LookupManagerImpl extends LookupManager {
|
||||
}
|
||||
|
||||
public LookupEx getActiveLookup() {
|
||||
if (myActiveLookup != null && myActiveLookup.isLookupDisposed()) {
|
||||
LookupImpl lookup = myActiveLookup;
|
||||
myActiveLookup = null;
|
||||
lookup.checkValid();
|
||||
}
|
||||
|
||||
return myActiveLookup;
|
||||
}
|
||||
|
||||
|
||||
@@ -656,12 +656,17 @@ public class FormatterImpl extends FormatterEx
|
||||
}
|
||||
|
||||
public Indent getSpaceIndent(final int spaces, final boolean relative) {
|
||||
return new IndentImpl(Indent.Type.SPACES, false, spaces, relative, false);
|
||||
return getIndent(Indent.Type.SPACES, spaces, relative, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Indent getIndent(@NotNull Indent.Type type, boolean relativeToDirectParent, boolean enforceIndent) {
|
||||
return new IndentImpl(type, false, 0, relativeToDirectParent, enforceIndent);
|
||||
public Indent getIndent(@NotNull Indent.Type type, boolean relativeToDirectParent, boolean enforceIndentToChildren) {
|
||||
return getIndent(type, 0, relativeToDirectParent, enforceIndentToChildren);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Indent getIndent(@NotNull Indent.Type type, int spaces, boolean relativeToDirectParent, boolean enforceIndentToChildren) {
|
||||
return new IndentImpl(type, false, spaces, relativeToDirectParent, enforceIndentToChildren);
|
||||
}
|
||||
|
||||
public Indent getAbsoluteLabelIndent() {
|
||||
|
||||
+27
-31
@@ -44,7 +44,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class ReferenceProvidersRegistry {
|
||||
|
||||
private static final LanguageExtension<PsiReferenceContributor> EXTENSION = new LanguageExtension<PsiReferenceContributor>(PsiReferenceContributor.EP_NAME.getName());
|
||||
private static final LanguageExtension<PsiReferenceContributor> CONTRIBUTOR_EXTENSION = new LanguageExtension<PsiReferenceContributor>(PsiReferenceContributor.EP_NAME.getName());
|
||||
private static final LanguageExtension<PsiReferenceProviderBean> REFERENCE_PROVIDER_EXTENSION = new LanguageExtension<PsiReferenceProviderBean>(PsiReferenceProviderBean.EP_NAME.getName());
|
||||
|
||||
private static final Comparator<Trinity<PsiReferenceProvider, ProcessingContext, Double>> PRIORITY_COMPARATOR =
|
||||
new Comparator<Trinity<PsiReferenceProvider, ProcessingContext, Double>>() {
|
||||
@@ -66,10 +67,33 @@ public class ReferenceProvidersRegistry {
|
||||
@Override
|
||||
protected PsiReferenceRegistrarImpl create(Language language) {
|
||||
PsiReferenceRegistrarImpl registrar = new PsiReferenceRegistrarImpl();
|
||||
List<PsiReferenceContributor> contributors = EXTENSION.allForLanguage(language);
|
||||
for (PsiReferenceContributor contributor : contributors) {
|
||||
for (PsiReferenceContributor contributor : CONTRIBUTOR_EXTENSION.allForLanguage(language)) {
|
||||
contributor.registerReferenceProviders(registrar);
|
||||
}
|
||||
|
||||
List<PsiReferenceProviderBean> referenceProviderBeans = REFERENCE_PROVIDER_EXTENSION.allForLanguage(language);
|
||||
for (final PsiReferenceProviderBean providerBean : referenceProviderBeans) {
|
||||
final ElementPattern<PsiElement> pattern = providerBean.createElementPattern();
|
||||
if (pattern != null) {
|
||||
registrar.registerReferenceProvider(pattern, new PsiReferenceProvider() {
|
||||
|
||||
PsiReferenceProvider myProvider;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
|
||||
if (myProvider == null) {
|
||||
|
||||
myProvider = providerBean.instantiate();
|
||||
if (myProvider == null) {
|
||||
myProvider = NULL_REFERENCE_PROVIDER;
|
||||
}
|
||||
}
|
||||
return myProvider.getReferencesByElement(element, context);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return registrar;
|
||||
}
|
||||
};
|
||||
@@ -78,34 +102,6 @@ public class ReferenceProvidersRegistry {
|
||||
return ServiceManager.getService(ReferenceProvidersRegistry.class);
|
||||
}
|
||||
|
||||
public ReferenceProvidersRegistry() {
|
||||
|
||||
PsiReferenceRegistrarImpl registrar = getRegistrar(Language.ANY);
|
||||
for (final PsiReferenceProviderBean providerBean : PsiReferenceProviderBean.EP_NAME.getExtensions()) {
|
||||
final ElementPattern<PsiElement> pattern = providerBean.createElementPattern();
|
||||
if (pattern != null) {
|
||||
registrar.registerReferenceProvider(pattern, new PsiReferenceProvider() {
|
||||
|
||||
PsiReferenceProvider myProvider;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
|
||||
if (myProvider == null) {
|
||||
|
||||
myProvider = providerBean.instantiate();
|
||||
if (myProvider == null) {
|
||||
myProvider = NULL_REFERENCE_PROVIDER;
|
||||
}
|
||||
}
|
||||
return myProvider.getReferencesByElement(element, context);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PsiReferenceRegistrarImpl getRegistrar(Language language) {
|
||||
return myRegistrars.get(language);
|
||||
}
|
||||
|
||||
+5
-15
@@ -20,9 +20,9 @@ import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.ExportableApplicationComponent;
|
||||
import com.intellij.openapi.components.ExportableComponent;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.keymap.impl.ui.ActionsTreeUtil;
|
||||
import com.intellij.openapi.keymap.impl.ui.Group;
|
||||
@@ -48,7 +48,8 @@ import java.util.List;
|
||||
* User: anna
|
||||
* Date: Jan 20, 2005
|
||||
*/
|
||||
public class CustomActionsSchema implements ExportableApplicationComponent, NamedJDOMExternalizable {
|
||||
public class CustomActionsSchema implements ExportableComponent, NamedJDOMExternalizable {
|
||||
|
||||
@NonNls private static final String ACTIONS_SCHEMA = "custom_actions_schema";
|
||||
@NonNls private static final String ACTIVE = "active";
|
||||
@NonNls private static final String ELEMENT_ACTION = "action";
|
||||
@@ -79,7 +80,7 @@ public class CustomActionsSchema implements ExportableApplicationComponent, Name
|
||||
private static final Logger LOG = Logger.getInstance("#" + CustomActionsSchema.class.getName());
|
||||
|
||||
public static CustomActionsSchema getInstance() {
|
||||
return ApplicationManager.getApplication().getComponent(CustomActionsSchema.class);
|
||||
return ServiceManager.getService(CustomActionsSchema.class);
|
||||
}
|
||||
|
||||
public void addAction(ActionUrl url) {
|
||||
@@ -338,17 +339,6 @@ public void removeIconCustomization(String actionId) {
|
||||
return IdeBundle.message("title.custom.actions.schemas");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "com.intellij.ide.ui.customization.CustomizableActionsSchemas";
|
||||
}
|
||||
|
||||
public void initComponent() {
|
||||
}
|
||||
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
public String getExternalFileName() {
|
||||
return "customization";
|
||||
}
|
||||
|
||||
@@ -103,6 +103,10 @@ public class IdeFrameImpl extends JFrame implements IdeFrame, DataProvider {
|
||||
setFocusableWindowState(false);
|
||||
}
|
||||
|
||||
// to show window thumbnail under Macs
|
||||
// http://lists.apple.com/archives/java-dev/2009/Dec/msg00240.html
|
||||
if (SystemInfo.isMac) setIconImage(null);
|
||||
|
||||
MouseGestureManager.getInstance().add(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,22 @@ public class WaitForProgressToShow {
|
||||
}
|
||||
}
|
||||
|
||||
public static void runOrInvokeAndWaitAboveProgress(final Runnable command, @Nullable final ModalityState modalityState) {
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
if (application.isDispatchThread()) {
|
||||
command.run();
|
||||
} else {
|
||||
final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator();
|
||||
if (pi != null) {
|
||||
execute(pi);
|
||||
application.invokeAndWait(command, pi.getModalityState());
|
||||
} else {
|
||||
final ModalityState notNullModalityState = modalityState == null ? ModalityState.NON_MODAL : modalityState;
|
||||
application.invokeAndWait(command, notNullModalityState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void runOrInvokeLaterAboveProgress(final Runnable command, @Nullable final ModalityState modalityState, @NotNull final Project project) {
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
if (application.isDispatchThread()) {
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
<applicationService serviceInterface="com.intellij.openapi.progress.ProgressManager"
|
||||
serviceImplementation="com.intellij.openapi.progress.impl.ProgressManagerImpl"/>
|
||||
|
||||
<applicationService serviceImplementation="com.intellij.ide.ui.customization.CustomActionsSchema"/>
|
||||
|
||||
<undoProvider implementation="com.intellij.openapi.command.impl.FileUndoProvider"/>
|
||||
<projectUndoProvider implementation="com.intellij.openapi.command.impl.FileUndoProvider"/>
|
||||
|
||||
|
||||
@@ -75,9 +75,6 @@
|
||||
<component>
|
||||
<implementation-class>com.intellij.ide.TipOfTheDayManager</implementation-class>
|
||||
</component>
|
||||
<component>
|
||||
<implementation-class>com.intellij.ide.ui.customization.CustomActionsSchema</implementation-class>
|
||||
</component>
|
||||
<component>
|
||||
<interface-class>com.intellij.ide.ui.LafManager</interface-class>
|
||||
<implementation-class>com.intellij.ide.ui.LafManagerImpl</implementation-class>
|
||||
|
||||
@@ -539,10 +539,12 @@ public class NameUtil {
|
||||
}
|
||||
// there's more in the pattern, but no more words
|
||||
if (nextStart == name.length()) {
|
||||
if (patternIndex + i == myPattern.length - 1 &&
|
||||
' ' == myPattern[patternIndex + i] &&
|
||||
(i == 1 && isWordStart(myPattern[patternIndex]) || i + nameIndex == name.length())) {
|
||||
return FList.<TextRange>emptyList().prepend(TextRange.from(nameIndex, i));
|
||||
if (patternIndex + i == myPattern.length - 1) {
|
||||
char last = myPattern[patternIndex + i];
|
||||
if (' ' == last && (i == 1 && isWordStart(myPattern[patternIndex]) || i + nameIndex == name.length()) ||
|
||||
'*' == last) {
|
||||
return FList.<TextRange>emptyList().prepend(TextRange.from(nameIndex, i));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
+1
-2
@@ -47,8 +47,7 @@ public class ModalityContextImpl implements ModalityContext {
|
||||
action.run();
|
||||
}
|
||||
else {
|
||||
ModalityState modalityState = getCurrentModalityState();
|
||||
WaitForProgressToShow.runOrInvokeLaterAboveProgress(action, modalityState, project);
|
||||
WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(action, getCurrentModalityState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-23
@@ -20,7 +20,6 @@ import com.intellij.cvsSupport2.CvsUtil;
|
||||
import com.intellij.cvsSupport2.application.CvsEntriesManager;
|
||||
import com.intellij.cvsSupport2.changeBrowser.CvsChangeList;
|
||||
import com.intellij.cvsSupport2.connections.CvsConnectionSettings;
|
||||
import com.intellij.cvsSupport2.connections.CvsEnvironment;
|
||||
import com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor;
|
||||
import com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutorCallback;
|
||||
import com.intellij.cvsSupport2.cvsExecution.ModalityContext;
|
||||
@@ -37,7 +36,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.TreeItem;
|
||||
import com.intellij.util.ui.AbstractTableCellEditor;
|
||||
import com.intellij.util.ui.ColumnInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.netbeans.lib.cvsclient.admin.Entry;
|
||||
import org.netbeans.lib.cvsclient.command.log.LogInformation;
|
||||
@@ -216,24 +214,23 @@ public class CvsHistoryProvider implements VcsHistoryProvider {
|
||||
else {
|
||||
return new CvsRevisionNumber(entryFor.getRevision());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<VcsFileRevision> createRevisions(final FilePath filePath) {
|
||||
final ArrayList<VcsFileRevision> result = new ArrayList<VcsFileRevision>();
|
||||
final VirtualFile root = CvsVfsUtil.refreshAndFindFileByIoFile(filePath.getIOFile().getParentFile());
|
||||
final File file = filePath.getIOFile();
|
||||
final VirtualFile root = CvsVfsUtil.refreshAndFindFileByIoFile(file.getParentFile());
|
||||
// check if we have a history pane open for a file in a package which has just been deleted
|
||||
if (root == null) return null;
|
||||
final LocalPathIndifferentLogOperation logOperation =
|
||||
new LocalPathIndifferentLogOperation(filePath.getIOFile());
|
||||
final LocalPathIndifferentLogOperation logOperation = new LocalPathIndifferentLogOperation(file);
|
||||
CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
|
||||
executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file.content"), logOperation),
|
||||
new CvsOperationExecutorCallback() {
|
||||
public void executionFinished(boolean successfully) {
|
||||
}
|
||||
|
||||
public void executeInProgressAfterAction(ModalityContext modaityContext) {
|
||||
public void executeInProgressAfterAction(ModalityContext modalityContext) {
|
||||
}
|
||||
|
||||
public void executionFinishedSuccessfully() {
|
||||
@@ -241,26 +238,15 @@ public class CvsHistoryProvider implements VcsHistoryProvider {
|
||||
.getCvsConnectionSettingsFor(filePath.getVirtualFileParent());
|
||||
final LogInformation firstLogInformation = logOperation.getFirstLogInformation();
|
||||
if (firstLogInformation != null) {
|
||||
result.addAll(createRevisionListOn(CvsUtil.getCvsLightweightFileForFile(filePath.getIOFile()),
|
||||
firstLogInformation, env, myProject));
|
||||
final List<Revision> revisionList = firstLogInformation.getRevisionList();
|
||||
for (Revision revision : revisionList) {
|
||||
result.add(new CvsFileRevisionImpl(revision, CvsUtil.getCvsLightweightFileForFile(file),
|
||||
firstLogInformation, env, myProject));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<VcsFileRevision> createRevisionListOn(File file,
|
||||
@NotNull LogInformation logInformation,
|
||||
CvsEnvironment env,
|
||||
Project project) {
|
||||
List revisionList = logInformation.getRevisionList();
|
||||
ArrayList<VcsFileRevision> result = new ArrayList<VcsFileRevision>();
|
||||
for (final Object aRevisionList : revisionList) {
|
||||
Revision revision = (Revision)aRevisionList;
|
||||
result.add(new CvsFileRevisionImpl(revision, file, logInformation, env, project));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public AnAction[] getAdditionalActions(final Runnable refresher) {
|
||||
|
||||
+2
-1
@@ -69,7 +69,8 @@ public class GroovyResultOfAssignmentUsedInspection extends BaseInspection {
|
||||
//check for method that has void return type. so it does not matter what return statements are.
|
||||
if (flowOwner instanceof GrOpenBlock) {
|
||||
final PsiElement flowParent = flowOwner.getParent();
|
||||
if (flowParent instanceof PsiMethod && ((PsiMethod)flowParent).getReturnType() == PsiType.VOID) {
|
||||
if (flowParent instanceof PsiMethod &&
|
||||
(((PsiMethod)flowParent).getReturnType() == PsiType.VOID || ((PsiMethod)flowParent).isConstructor())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,6 +404,11 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest(new GroovyAssignabilityCheckInspection());
|
||||
}
|
||||
|
||||
public void _testInnerClassConstructorThis() {
|
||||
myFixture.enableInspections(new GroovyResultOfAssignmentUsedInspection());
|
||||
myFixture.testHighlighting(true, true, true, getTestName(false) + ".groovy");
|
||||
}
|
||||
|
||||
public void testCurrying(){
|
||||
doTest(new GroovyAssignabilityCheckInspection());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class <info>A</info> {
|
||||
static private class <info>B</info> {
|
||||
int <info>i</info>
|
||||
B () { this.<info descr="null">i</info> = 42 }
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,7 @@ package com.intellij.execution.junit;
|
||||
|
||||
import com.intellij.execution.CantRunException;
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.configurations.ConfigurationPerRunnerSettings;
|
||||
import com.intellij.execution.configurations.RunnerSettings;
|
||||
import com.intellij.execution.configurations.RuntimeConfigurationException;
|
||||
import com.intellij.execution.configurations.RuntimeConfigurationWarning;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.testframework.SourceScope;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
@@ -93,7 +90,7 @@ class TestDirectory extends TestPackage {
|
||||
}
|
||||
final String dirName = myConfiguration.getPersistentData().getDirName();
|
||||
if (dirName == null || dirName.isEmpty()) {
|
||||
throw new RuntimeConfigurationWarning("Directory is not specified");
|
||||
throw new RuntimeConfigurationError("Directory is not specified");
|
||||
}
|
||||
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
|
||||
if (file == null) {
|
||||
@@ -101,7 +98,7 @@ class TestDirectory extends TestPackage {
|
||||
}
|
||||
final Module module = myConfiguration.getConfigurationModule().getModule();
|
||||
if (module == null) {
|
||||
throw new RuntimeConfigurationWarning("Module to choose classpath from is not specified");
|
||||
throw new RuntimeConfigurationError("Module to choose classpath from is not specified");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user