mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
+2
-14
@@ -38,9 +38,7 @@ import com.intellij.codeInspection.ui.EntryPointsNode;
|
||||
import com.intellij.codeInspection.ui.InspectionNode;
|
||||
import com.intellij.codeInspection.ui.InspectionTreeNode;
|
||||
import com.intellij.codeInspection.util.RefFilter;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -49,7 +47,6 @@ import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiClassImplUtil;
|
||||
@@ -203,15 +200,7 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
|
||||
gc.gridy++;
|
||||
add(myNonJavaCheckbox, gc);
|
||||
|
||||
final JButton configureAnnotations = new JButton("Configure annotations");
|
||||
configureAnnotations.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(OptionsPanel.this));
|
||||
if (project == null) project = ProjectManager.getInstance().getDefaultProject();
|
||||
EntryPointsManagerImpl.getInstance(project).configureAnnotations();
|
||||
}
|
||||
});
|
||||
final JButton configureAnnotations = EntryPointsManagerImpl.createConfigureAnnotationsBtn(this);
|
||||
gc.fill = GridBagConstraints.NONE;
|
||||
gc.gridy++;
|
||||
|
||||
@@ -446,8 +435,7 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
|
||||
if (RefUtil.isImplicitUsage(element)) return true;
|
||||
if (element instanceof PsiModifierListOwner) {
|
||||
final EntryPointsManagerImpl entryPointsManager = EntryPointsManagerImpl.getInstance(element.getProject());
|
||||
if (AnnotationUtil.isAnnotated((PsiModifierListOwner)element, entryPointsManager.ADDITIONAL_ANNOTATIONS) ||
|
||||
AnnotationUtil.isAnnotated((PsiModifierListOwner)element, entryPointsManager.getAdditionalAnnotations())) {
|
||||
if (entryPointsManager.isEntryPoint((PsiModifierListOwner)element)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,11 @@
|
||||
package com.intellij.codeInspection.ex;
|
||||
|
||||
import com.intellij.ExtensionPoints;
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInspection.reference.*;
|
||||
import com.intellij.codeInspection.util.SpecialAnnotationsUtil;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
@@ -37,10 +40,12 @@ import com.intellij.openapi.extensions.ExtensionPointListener;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.PsiModifierListOwner;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jdom.Element;
|
||||
@@ -49,6 +54,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.*;
|
||||
|
||||
@State(
|
||||
@@ -360,6 +367,19 @@ public class EntryPointsManagerImpl implements PersistentStateComponent<Element>
|
||||
}.show();
|
||||
}
|
||||
|
||||
public static JButton createConfigureAnnotationsBtn(final JComponent parent) {
|
||||
final JButton configureAnnotations = new JButton("Configure annotations...");
|
||||
configureAnnotations.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(parent));
|
||||
if (project == null) project = ProjectManager.getInstance().getDefaultProject();
|
||||
EntryPointsManagerImpl.getInstance(project).configureAnnotations();
|
||||
}
|
||||
});
|
||||
return configureAnnotations;
|
||||
}
|
||||
|
||||
public void addAllPersistentEntries(EntryPointsManagerImpl manager) {
|
||||
myPersistentEntryPoints.putAll(manager.myPersistentEntryPoints);
|
||||
}
|
||||
@@ -411,4 +431,9 @@ public class EntryPointsManagerImpl implements PersistentStateComponent<Element>
|
||||
public void setAddNonJavaEntries(final boolean addNonJavaEntries) {
|
||||
myAddNonJavaEntries = addNonJavaEntries;
|
||||
}
|
||||
|
||||
public boolean isEntryPoint(PsiModifierListOwner element) {
|
||||
return AnnotationUtil.isAnnotated(element, ADDITIONAL_ANNOTATIONS) ||
|
||||
AnnotationUtil.isAnnotated(element, getAdditionalAnnotations());
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -28,6 +28,7 @@ import com.intellij.analysis.AnalysisScope;
|
||||
import com.intellij.codeInsight.CodeInsightUtilBase;
|
||||
import com.intellij.codeInsight.daemon.GroupNames;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.ex.EntryPointsManagerImpl;
|
||||
import com.intellij.codeInspection.reference.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -45,6 +46,8 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -71,6 +74,7 @@ public class UnusedParametersInspection extends GlobalJavaInspectionTool {
|
||||
if ((refMethod.isAbstract() || refMethod.getOwnerClass().isInterface()) && refMethod.getDerivedMethods().isEmpty()) return null;
|
||||
|
||||
if (RefUtil.isEntryPoint(refMethod)) return null;
|
||||
if (EntryPointsManagerImpl.getInstance(manager.getProject()).isEntryPoint(refMethod.getElement())) return null;
|
||||
|
||||
if (refMethod.isAppMain()) return null;
|
||||
|
||||
@@ -215,6 +219,18 @@ public class UnusedParametersInspection extends GlobalJavaInspectionTool {
|
||||
return SHORT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
final JPanel panel = new JPanel(new GridBagLayout());
|
||||
final GridBagConstraints gc =
|
||||
new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
|
||||
new Insets(5, 0, 0, 0), 0, 0);
|
||||
panel.add(EntryPointsManagerImpl.createConfigureAnnotationsBtn(panel), gc);
|
||||
gc.weightx = 1;
|
||||
gc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel.add(Box.createHorizontalBox(), gc);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private static class AcceptSuggested implements LocalQuickFix {
|
||||
private final RefManager myManager;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<text resource-bundle="messages/InspectionsBundle" key="inspection.unused.symbol.public.method.parameters"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="a47a5" binding="myAnnos" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<grid id="a47a5" binding="myAnnos" layout-manager="GridBagLayout">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
|
||||
+8
-18
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.codeInspection.unusedSymbol;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.daemon.GroupNames;
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
@@ -25,10 +24,7 @@ import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ex.EntryPointsManagerImpl;
|
||||
import com.intellij.codeInspection.ex.UnfairLocalInspectionTool;
|
||||
import com.intellij.codeInspection.util.SpecialAnnotationsUtil;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.psi.PsiModifierListOwner;
|
||||
import org.intellij.lang.annotations.Pattern;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -128,17 +124,13 @@ public class UnusedSymbolLocalInspection extends BaseJavaLocalInspectionTool imp
|
||||
myCheckClassesCheckBox.addActionListener(listener);
|
||||
myCheckParametersCheckBox.addActionListener(listener);
|
||||
myReportUnusedParametersInPublics.addActionListener(listener);
|
||||
|
||||
final JButton configureAnnotations = new JButton("Configure annotations");
|
||||
configureAnnotations.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel));
|
||||
if (project == null) project = ProjectManager.getInstance().getDefaultProject();
|
||||
EntryPointsManagerImpl.getInstance(project).configureAnnotations();
|
||||
}
|
||||
});
|
||||
myAnnos.add(configureAnnotations, BorderLayout.NORTH);
|
||||
final GridBagConstraints gc =
|
||||
new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0);
|
||||
myAnnos.add(EntryPointsManagerImpl.createConfigureAnnotationsBtn(myPanel), gc);
|
||||
gc.weightx = 1;
|
||||
gc.fill = GridBagConstraints.HORIZONTAL;
|
||||
myAnnos.add(Box.createHorizontalBox(), gc);
|
||||
}
|
||||
|
||||
public JComponent getPanel() {
|
||||
@@ -160,8 +152,6 @@ public class UnusedSymbolLocalInspection extends BaseJavaLocalInspectionTool imp
|
||||
}
|
||||
|
||||
public static boolean isInjected(final PsiModifierListOwner modifierListOwner) {
|
||||
final EntryPointsManagerImpl entryPointsManager = EntryPointsManagerImpl.getInstance(modifierListOwner.getProject());
|
||||
return AnnotationUtil.isAnnotated(modifierListOwner, entryPointsManager.ADDITIONAL_ANNOTATIONS) ||
|
||||
AnnotationUtil.isAnnotated(modifierListOwner, entryPointsManager.getAdditionalAnnotations());
|
||||
return EntryPointsManagerImpl.getInstance(modifierListOwner.getProject()).isEntryPoint(modifierListOwner);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -93,7 +93,7 @@ public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
|
||||
|
||||
|
||||
protected Settings showRefactoringDialog(Project project,
|
||||
Editor editor,
|
||||
final Editor editor,
|
||||
PsiClass parentClass,
|
||||
PsiExpression expr,
|
||||
PsiType type,
|
||||
@@ -150,31 +150,32 @@ public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
|
||||
|
||||
String enteredName = null;
|
||||
boolean replaceAllOccurrences = true;
|
||||
final TypeSelectorManagerImpl typeSelectorManager = new TypeSelectorManagerImpl(project, type, containingMethod, expr, occurrences);
|
||||
if (editor != null && editor.getSettings().isVariableInplaceRenameEnabled() && (expr == null || expr.isPhysical())) {
|
||||
final AbstractInplaceIntroducer activeIntroducer = AbstractInplaceIntroducer.getActiveIntroducer(editor);
|
||||
if (activeIntroducer == null) {
|
||||
myInplaceIntroduceConstantPopup =
|
||||
new InplaceIntroduceConstantPopup(project, editor, parentClass, expr, localVariable, occurrences, typeSelectorManager,
|
||||
new InplaceIntroduceConstantPopup(project, editor, parentClass, expr, localVariable, occurrences,
|
||||
new TypeSelectorManagerImpl(project, type, containingMethod, expr, occurrences),
|
||||
anchorElement, anchorElementIfAll,
|
||||
expr != null ? createOccurrenceManager(expr, parentClass) : null);
|
||||
if (myInplaceIntroduceConstantPopup.startInplaceIntroduceTemplate() ){
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
AbstractInplaceIntroducer.stopIntroduce(editor);
|
||||
activeIntroducer.stopIntroduce(editor);
|
||||
expr = (PsiExpression)activeIntroducer.getExpr();
|
||||
localVariable = (PsiLocalVariable)activeIntroducer.getLocalVariable();
|
||||
occurrences = (PsiExpression[])activeIntroducer.getOccurrences();
|
||||
enteredName = activeIntroducer.getInputName();
|
||||
replaceAllOccurrences = activeIntroducer.isReplaceAllOccurrences();
|
||||
type = ((InplaceIntroduceConstantPopup)activeIntroducer).getType();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final IntroduceConstantDialog dialog =
|
||||
new IntroduceConstantDialog(project, parentClass, expr, localVariable, localVariable != null, occurrences, getParentClass(),
|
||||
typeSelectorManager, enteredName);
|
||||
new TypeSelectorManagerImpl(project, type, containingMethod, expr, occurrences), enteredName);
|
||||
dialog.setReplaceAllOccurrences(replaceAllOccurrences);
|
||||
dialog.show();
|
||||
if (!dialog.isOK()) {
|
||||
|
||||
+8
-7
@@ -25,6 +25,7 @@ import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.refactoring.HelpID;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
|
||||
import com.intellij.refactoring.introduceParameter.AbstractJavaInplaceIntroducer;
|
||||
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.refactoring.util.occurrences.*;
|
||||
@@ -102,7 +103,6 @@ public class IntroduceFieldHandler extends BaseExpressionToFieldHandler {
|
||||
final boolean currentMethodConstructor = containingMethod != null && containingMethod.isConstructor();
|
||||
final boolean allowInitInMethod = (!currentMethodConstructor || !isInSuperOrThis) && (anchorElement instanceof PsiLocalVariable || anchorElement instanceof PsiStatement);
|
||||
final boolean allowInitInMethodIfAll = (!currentMethodConstructor || !isInSuperOrThis) && anchorElementIfAll instanceof PsiStatement;
|
||||
final TypeSelectorManagerImpl typeSelectorManager = new TypeSelectorManagerImpl(project, type, containingMethod, expr, occurrences);
|
||||
|
||||
String enteredName = null;
|
||||
boolean replaceAll = false;
|
||||
@@ -110,20 +110,21 @@ public class IntroduceFieldHandler extends BaseExpressionToFieldHandler {
|
||||
final AbstractInplaceIntroducer activeIntroducer = AbstractInplaceIntroducer.getActiveIntroducer(editor);
|
||||
if (activeIntroducer == null) {
|
||||
myInplaceIntroduceFieldPopup =
|
||||
new InplaceIntroduceFieldPopup(localVariable, parentClass, declareStatic, currentMethodConstructor, occurrences, expr, typeSelectorManager, editor,
|
||||
allowInitInMethod, allowInitInMethodIfAll, anchorElement, anchorElementIfAll, expr != null ? createOccurrenceManager(
|
||||
expr, parentClass) : null,
|
||||
project);
|
||||
new InplaceIntroduceFieldPopup(localVariable, parentClass, declareStatic, currentMethodConstructor, occurrences, expr,
|
||||
new TypeSelectorManagerImpl(project, type, containingMethod, expr, occurrences), editor,
|
||||
allowInitInMethod, allowInitInMethodIfAll, anchorElement, anchorElementIfAll,
|
||||
expr != null ? createOccurrenceManager(expr, parentClass) : null,project);
|
||||
if (myInplaceIntroduceFieldPopup.startInplaceIntroduceTemplate()) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
AbstractInplaceIntroducer.stopIntroduce(editor);
|
||||
activeIntroducer.stopIntroduce(editor);
|
||||
expr = (PsiExpression)activeIntroducer.getExpr();
|
||||
localVariable = (PsiLocalVariable)activeIntroducer.getLocalVariable();
|
||||
occurrences = (PsiExpression[])activeIntroducer.getOccurrences();
|
||||
enteredName = activeIntroducer.getInputName();
|
||||
replaceAll = activeIntroducer.isReplaceAllOccurrences();
|
||||
type = ((AbstractJavaInplaceIntroducer)activeIntroducer).getType();
|
||||
IntroduceFieldDialog.ourLastInitializerPlace = ((InplaceIntroduceFieldPopup)activeIntroducer).getInitializerPlace();
|
||||
}
|
||||
}
|
||||
@@ -133,7 +134,7 @@ public class IntroduceFieldHandler extends BaseExpressionToFieldHandler {
|
||||
currentMethodConstructor,
|
||||
localVariable != null, declareStatic, occurrences,
|
||||
allowInitInMethod, allowInitInMethodIfAll,
|
||||
typeSelectorManager,
|
||||
new TypeSelectorManagerImpl(project, type, containingMethod, expr, occurrences),
|
||||
enteredName
|
||||
);
|
||||
dialog.setReplaceAllOccurrences(replaceAll);
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public abstract class AbstractJavaInplaceIntroducer extends AbstractInplaceIntro
|
||||
TypeSelectorManagerImpl.typeSelected(psiVariable.getType(), getType());//myDefaultType.getType());
|
||||
}
|
||||
|
||||
protected PsiType getType() {
|
||||
public PsiType getType() {
|
||||
return myTypeSelectorManager.getDefaultType();
|
||||
}
|
||||
|
||||
|
||||
+10
-8
@@ -400,11 +400,7 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
|
||||
|
||||
final String propName = myLocalVar != null ? JavaCodeStyleManager
|
||||
.getInstance(myProject).variableNameToPropertyName(myLocalVar.getName(), VariableKind.LOCAL_VARIABLE) : null;
|
||||
final PsiType initializerType = IntroduceParameterProcessor.getInitializerType(null, myExpr, myLocalVar);
|
||||
|
||||
TypeSelectorManagerImpl typeSelectorManager = myExpr != null
|
||||
? new TypeSelectorManagerImpl(myProject, initializerType, myExpr, occurences)
|
||||
: new TypeSelectorManagerImpl(myProject, initializerType, occurences);
|
||||
PsiType initializerType = IntroduceParameterProcessor.getInitializerType(null, myExpr, myLocalVar);
|
||||
|
||||
boolean isInplaceAvailableOnDataContext = myEditor != null && myEditor.getSettings().isVariableInplaceRenameEnabled();
|
||||
|
||||
@@ -421,7 +417,7 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
|
||||
|
||||
myInplaceIntroduceParameterPopup =
|
||||
new InplaceIntroduceParameterPopup(myProject, myEditor, classMemberRefs,
|
||||
typeSelectorManager,
|
||||
createTypeSelectorManager(occurences, initializerType),
|
||||
myExpr, myLocalVar, method, methodToSearchFor, occurences,
|
||||
getParamsToRemove(method, occurences),
|
||||
mustBeFinal);
|
||||
@@ -430,13 +426,14 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
|
||||
}
|
||||
}
|
||||
else {
|
||||
AbstractInplaceIntroducer.stopIntroduce(myEditor);
|
||||
activeIntroducer.stopIntroduce(myEditor);
|
||||
myExpr = (PsiExpression)activeIntroducer.getExpr();
|
||||
myLocalVar = (PsiLocalVariable)activeIntroducer.getLocalVariable();
|
||||
occurences = (PsiExpression[])activeIntroducer.getOccurrences();
|
||||
enteredName = activeIntroducer.getInputName();
|
||||
replaceAllOccurrences = activeIntroducer.isReplaceAllOccurrences();
|
||||
delegate = ((InplaceIntroduceParameterPopup)activeIntroducer).isGenerateDelegate();
|
||||
initializerType = ((AbstractJavaInplaceIntroducer)activeIntroducer).getType();
|
||||
}
|
||||
}
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
@@ -455,7 +452,7 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
|
||||
final IntroduceParameterDialog dialog =
|
||||
new IntroduceParameterDialog(myProject, classMemberRefs, occurences, myLocalVar, myExpr,
|
||||
createNameSuggestionGenerator(myExpr, propName, myProject, enteredName),
|
||||
typeSelectorManager, methodToSearchFor, method, getParamsToRemove(method, occurences), mustBeFinal);
|
||||
createTypeSelectorManager(occurences, initializerType), methodToSearchFor, method, getParamsToRemove(method, occurences), mustBeFinal);
|
||||
dialog.setReplaceAllOccurrences(replaceAllOccurrences);
|
||||
dialog.setGenerateDelegate(delegate);
|
||||
dialog.show();
|
||||
@@ -465,6 +462,11 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
|
||||
}
|
||||
}
|
||||
|
||||
private TypeSelectorManagerImpl createTypeSelectorManager(PsiExpression[] occurences, PsiType initializerType) {
|
||||
return myExpr != null ? new TypeSelectorManagerImpl(myProject, initializerType, myExpr, occurences)
|
||||
: new TypeSelectorManagerImpl(myProject, initializerType, occurences);
|
||||
}
|
||||
|
||||
private TIntArrayList getParamsToRemove(PsiMethod method, PsiExpression[] occurences) {
|
||||
PsiExpression expressionToRemoveParamFrom = myExpr;
|
||||
if (myExpr == null) {
|
||||
|
||||
@@ -33,12 +33,14 @@ public class PackageNameReferenceEditorCombo extends ReferenceEditorComboWithBro
|
||||
super(null, text, project, false, recentsKey);
|
||||
addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PackageChooserDialog chooser = new PackageChooserDialog(chooserTitle, project);
|
||||
final PackageChooserDialog chooser = new PackageChooserDialog(chooserTitle, project);
|
||||
chooser.selectPackage(getText());
|
||||
chooser.show();
|
||||
PsiPackage aPackage = chooser.getSelectedPackage();
|
||||
if (aPackage != null) {
|
||||
setText(aPackage.getQualifiedName());
|
||||
if (chooser.isOK()) {
|
||||
final PsiPackage aPackage = chooser.getSelectedPackage();
|
||||
if (aPackage != null) {
|
||||
setText(aPackage.getQualifiedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+7
-2
@@ -531,10 +531,15 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
return myLocalVariable;
|
||||
}
|
||||
|
||||
public static void stopIntroduce(Editor editor) {
|
||||
public void stopIntroduce(Editor editor) {
|
||||
final TemplateState templateState = TemplateManagerImpl.getTemplateState(editor);
|
||||
if (templateState != null) {
|
||||
templateState.gotoEnd(true);
|
||||
final Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
templateState.gotoEnd(true);
|
||||
}
|
||||
};
|
||||
CommandProcessor.getInstance().executeCommand(myProject, runnable, getCommandName(), getCommandName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -106,15 +106,14 @@ public class TestsOutputConsolePrinter implements Printer, Disposable {
|
||||
scrollToBeginning();
|
||||
}
|
||||
};
|
||||
if (isRoot() && myUnboundOutputRoot != null) {
|
||||
myUnboundOutputRoot.invokeInAlarm(clearRunnable);
|
||||
myUnboundOutputRoot.printOn(this);
|
||||
myUnboundOutputRoot.invokeInAlarm(scrollRunnable);
|
||||
} else {
|
||||
myCurrentTest.invokeInAlarm(clearRunnable);
|
||||
myCurrentTest.printOn(this);
|
||||
myCurrentTest.invokeInAlarm(scrollRunnable);
|
||||
}
|
||||
final AbstractTestProxy currentProxyOrRoot = getCurrentProxyOrRoot();
|
||||
currentProxyOrRoot.invokeInAlarm(clearRunnable);
|
||||
currentProxyOrRoot.printOn(this);
|
||||
currentProxyOrRoot.invokeInAlarm(scrollRunnable);
|
||||
}
|
||||
|
||||
private AbstractTestProxy getCurrentProxyOrRoot() {
|
||||
return isRoot() && myUnboundOutputRoot != null ? myUnboundOutputRoot : myCurrentTest;
|
||||
}
|
||||
|
||||
public boolean isCurrent(CompositePrintable printable) {
|
||||
@@ -145,7 +144,11 @@ public class TestsOutputConsolePrinter implements Printer, Disposable {
|
||||
protected void scrollToBeginning() {
|
||||
myConsole.performWhenNoDeferredOutput(new Runnable() {
|
||||
public void run() {
|
||||
myConsole.scrollTo(myMarkOffset);
|
||||
final AbstractTestProxy currentProxyOrRoot = getCurrentProxyOrRoot();
|
||||
if (!currentProxyOrRoot.isInProgress()) {
|
||||
//do not scroll to any mark during run
|
||||
myConsole.scrollTo(myMarkOffset);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -177,12 +177,18 @@ def find_user_password(self, realm, authuri):
|
||||
else:
|
||||
def read_hgrc_authtoken(ui, authuri):
|
||||
try:
|
||||
# hg 1.8
|
||||
# since hg 1.8
|
||||
from mercurial.url import readauthforuri
|
||||
except ImportError:
|
||||
# hg 1.9: readauthforuri moved to httpconnection
|
||||
from mercurial.httpconnection import readauthforuri
|
||||
res = readauthforuri(self.ui, authuri)
|
||||
from inspect import getargspec
|
||||
args, _, _, _ = getargspec(readauthforuri)
|
||||
if len(args) == 2:
|
||||
res = readauthforuri(self.ui, authuri)
|
||||
else:
|
||||
# since hg 1.9.2 readauthforuri accepts 3 required arguments instead of 2
|
||||
res = readauthforuri(self.ui, authuri, "")
|
||||
if res:
|
||||
group, auth = res
|
||||
return auth
|
||||
@@ -201,4 +207,4 @@ def find_user_password(self, realm, authuri):
|
||||
raise util.Abort(_('http authorization required'))
|
||||
user, passwd = retrievedPass
|
||||
self.add_password(realm, authuri, user, passwd)
|
||||
return retrievedPass
|
||||
return retrievedPass
|
||||
Reference in New Issue
Block a user