mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
+1
-1
@@ -544,7 +544,7 @@ public class HighlightMethodUtil {
|
||||
PsiMethod method = methodCandidate.getElement();
|
||||
PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
PsiSubstitutor substitutor = methodCandidate.getSubstitutor();
|
||||
@NonNls String ms = "<td><b>" + method.getName() + "</b></td>";
|
||||
@NonNls @Language("HTML") String ms = "<td><b>" + method.getName() + "</b></td>";
|
||||
|
||||
for (int j = 0; j < parameters.length; j++) {
|
||||
PsiParameter parameter = parameters[j];
|
||||
|
||||
@@ -120,7 +120,7 @@ public class AddMethodFix extends LocalQuickFixAndIntentionActionOnPsiElement {
|
||||
}
|
||||
PsiMethod method = (PsiMethod)myClass.add(myMethodPrototype);
|
||||
method = (PsiMethod)method.replace(reformat(project, method));
|
||||
if (editor != null) {
|
||||
if (editor != null && method.getContainingFile() == file) {
|
||||
GenerateMembersUtil.positionCaret(editor, method, true);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -126,7 +126,9 @@ public class CreateConstructorMatchingSuperFix extends BaseIntentionAction {
|
||||
}
|
||||
}
|
||||
|
||||
derived.getNameIdentifier().replace(targetClass.getNameIdentifier());
|
||||
final PsiIdentifier identifier = targetClass.getNameIdentifier();
|
||||
LOG.assertTrue(identifier != null, targetClass);
|
||||
derived.getNameIdentifier().replace(identifier);
|
||||
@NonNls StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("void foo () {\nsuper(");
|
||||
|
||||
|
||||
+2
-4
@@ -36,7 +36,6 @@ public class SideEffectWarningDialog extends DialogWrapper {
|
||||
private final String myBeforeText;
|
||||
private final String myAfterText;
|
||||
private final boolean myCanCopeWithSideEffects;
|
||||
private AbstractAction myMakeStmtAction;
|
||||
private AbstractAction myRemoveAllAction;
|
||||
private AbstractAction myCancelAllAction;
|
||||
public static final int MAKE_STATEMENT = 1;
|
||||
@@ -71,7 +70,7 @@ public class SideEffectWarningDialog extends DialogWrapper {
|
||||
};
|
||||
actions.add(myRemoveAllAction);
|
||||
if (myCanCopeWithSideEffects) {
|
||||
myMakeStmtAction = new AbstractAction() {
|
||||
AbstractAction makeStmtAction = new AbstractAction() {
|
||||
{
|
||||
UIUtil.setActionNameAndMnemonic(QuickFixBundle.message("side.effect.action.transform"), this);
|
||||
}
|
||||
@@ -80,9 +79,8 @@ public class SideEffectWarningDialog extends DialogWrapper {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
close(MAKE_STATEMENT);
|
||||
}
|
||||
|
||||
};
|
||||
actions.add(myMakeStmtAction);
|
||||
actions.add(makeStmtAction);
|
||||
}
|
||||
myCancelAllAction = new AbstractAction() {
|
||||
{
|
||||
|
||||
@@ -178,9 +178,10 @@ public class VisibilityInspection extends GlobalJavaInspectionTool {
|
||||
}
|
||||
@Modifier String access = getPossibleAccess(refElement);
|
||||
if (access != refElement.getAccessModifier() && access != null) {
|
||||
final PsiElement psiElement = HighlightUsagesHandler.getNameIdentifier(refElement.getElement());
|
||||
if (psiElement != null) {
|
||||
return new ProblemDescriptor[]{manager.createProblemDescriptor(psiElement,
|
||||
final PsiElement element = refElement.getElement();
|
||||
final PsiElement nameIdentifier = element != null ? HighlightUsagesHandler.getNameIdentifier(element) : null;
|
||||
if (nameIdentifier != null) {
|
||||
return new ProblemDescriptor[]{manager.createProblemDescriptor(nameIdentifier,
|
||||
access.equals(PsiModifier.PRIVATE)
|
||||
? CAN_BE_PRIVATE
|
||||
: access.equals(PsiModifier.PACKAGE_LOCAL)
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.util.Set;
|
||||
public class OptimizeImportsRefactoringHelper implements RefactoringHelper<Set<PsiJavaFile>> {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.OptimizeImportsRefactoringHelper");
|
||||
|
||||
@Override
|
||||
public Set<PsiJavaFile> prepareOperation(final UsageInfo[] usages) {
|
||||
Set<PsiJavaFile> javaFiles = new HashSet<PsiJavaFile>();
|
||||
for (UsageInfo usage : usages) {
|
||||
@@ -49,8 +50,10 @@ public class OptimizeImportsRefactoringHelper implements RefactoringHelper<Set<P
|
||||
return javaFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performOperation(final Project project, final Set<PsiJavaFile> javaFiles) {
|
||||
CodeStyleManager.getInstance(project).performActionWithFormatterDisabled(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
}
|
||||
@@ -58,35 +61,42 @@ public class OptimizeImportsRefactoringHelper implements RefactoringHelper<Set<P
|
||||
|
||||
final Set<SmartPsiElementPointer<PsiImportStatementBase>> redundants = new HashSet<SmartPsiElementPointer<PsiImportStatementBase>>();
|
||||
final Runnable findRedundantImports = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project);
|
||||
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
|
||||
final SmartPointerManager pointerManager = SmartPointerManager.getInstance(project);
|
||||
int i = 0;
|
||||
final int fileCount = javaFiles.size();
|
||||
for (PsiJavaFile file : javaFiles) {
|
||||
if (file.isValid()) {
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
if (progressIndicator != null) {
|
||||
progressIndicator.setText2(virtualFile.getPresentableUrl());
|
||||
progressIndicator.setFraction((double)i++/fileCount);
|
||||
}
|
||||
final Collection<PsiImportStatementBase> perFile = styleManager.findRedundantImports(file);
|
||||
if (perFile != null) {
|
||||
for (PsiImportStatementBase redundant : perFile) {
|
||||
redundants.add(pointerManager.createSmartPsiElementPointer(redundant));
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project);
|
||||
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
|
||||
final SmartPointerManager pointerManager = SmartPointerManager.getInstance(project);
|
||||
int i = 0;
|
||||
final int fileCount = javaFiles.size();
|
||||
for (PsiJavaFile file : javaFiles) {
|
||||
if (file.isValid()) {
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
if (progressIndicator != null) {
|
||||
progressIndicator.setText2(virtualFile.getPresentableUrl());
|
||||
progressIndicator.setFraction((double)i++ / fileCount);
|
||||
}
|
||||
final Collection<PsiImportStatementBase> perFile = styleManager.findRedundantImports(file);
|
||||
if (perFile != null) {
|
||||
for (PsiImportStatementBase redundant : perFile) {
|
||||
redundants.add(pointerManager.createSmartPsiElementPointer(redundant));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(findRedundantImports, "Removing redundant imports", false, project)) return;
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
for (final SmartPsiElementPointer<PsiImportStatementBase> pointer : redundants) {
|
||||
|
||||
+2
-1
@@ -37,6 +37,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class TypeMigrationProcessor extends BaseRefactoringProcessor {
|
||||
@@ -132,7 +133,7 @@ public class TypeMigrationProcessor extends BaseRefactoringProcessor {
|
||||
text = "method \'" + ((PsiMethod)myRoot[0]).getName() + "\' return";
|
||||
}
|
||||
else {
|
||||
text = myRoot.toString();
|
||||
text = Arrays.toString(myRoot);
|
||||
}
|
||||
Content content = UsageViewManager.getInstance(myProject)
|
||||
.addContent("Migrate Type of " +
|
||||
|
||||
Reference in New Issue
Block a user