diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java index 47c6833455bd..506bd4f5c3a2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java @@ -396,6 +396,9 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { return info; } } + else if (isImplicitUsage(field, progress)) { + return null; + } else if (!myRefCountHolder.isReferenced(field) && weAreSureThereAreNoUsages(field, progress)) { return formatUnusedSymbolHighlightInfo("field.is.not.used", field, "fields", myDeadCodeKey, myDeadCodeInfoType); } diff --git a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java index 81b7dc25baf5..4dd8694e3f57 100644 --- a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java @@ -336,18 +336,23 @@ public class ClsMethodImpl extends ClsRepositoryPsiElement implem } @NotNull - public PsiElement getNavigationElement() { + public PsiMethod getSourceMirrorMethod() { PsiClass sourceClassMirror = ((ClsClassImpl)getParent()).getSourceMirrorClass(); if (sourceClassMirror == null) return this; - final PsiMethod[] methodsByName = sourceClassMirror.findMethodsByName(getName(), false); - for (PsiMethod sourceMethod : methodsByName) { - if (MethodSignatureUtil.areParametersErasureEqual(this, sourceMethod) && sourceMethod != this) { - return sourceMethod.getNavigationElement(); + for (PsiMethod sourceMethod : sourceClassMirror.findMethodsByName(getName(), false)) { + if (MethodSignatureUtil.areParametersErasureEqual(this, sourceMethod)) { + return sourceMethod; } } return this; } + @NotNull + public PsiElement getNavigationElement() { + final PsiMethod method = getSourceMirrorMethod(); + return method != this ? method.getNavigationElement() : this; + } + public PsiTypeParameterList getTypeParameterList() { return getStub().findChildStubByType(JavaStubElementTypes.TYPE_PARAMETER_LIST).getPsi(); } diff --git a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java index da8235e5e427..63dbd4fbd8f3 100644 --- a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java @@ -63,7 +63,7 @@ public class ClsParameterImpl extends ClsRepositoryPsiElement } ClsMethodImpl method = (ClsMethodImpl)getDeclarationScope(); - PsiMethod sourceMethod = (PsiMethod)method.getNavigationElement(); + PsiMethod sourceMethod = method.getSourceMirrorMethod(); if (sourceMethod == method) { final PsiParameterStubImpl parameterStub = (PsiParameterStubImpl) getStub(); if (!parameterStub.isAutoGeneratedName()) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/SelfManagingCommenter.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/SelfManagingCommenter.java index dd3cb376b879..23b51e1137a6 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/generation/SelfManagingCommenter.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/SelfManagingCommenter.java @@ -26,8 +26,6 @@ import org.jetbrains.annotations.Nullable; * @author Maxim.Mossienko */ public interface SelfManagingCommenter { - ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.selfManagingCommenter"); - @Nullable T createLineCommentingState(int startLine, int endLine, @NotNull Document document, @NotNull PsiFile file); @Nullable T createBlockCommentingState(int selectionStart, int selectionEnd, @NotNull Document document, @NotNull PsiFile file); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/PositionPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/PositionPanel.java index 797dbc916eef..0deea4849100 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/PositionPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/PositionPanel.java @@ -141,7 +141,8 @@ public class PositionPanel implements StatusBarWidget, StatusBarWidget.TextPrese public void caretPositionChanged(final CaretEvent e) { final Editor editor = e.getEditor(); - if (FileEditorManager.getInstance(editor.getProject()).getSelectedTextEditor() == e.getEditor()) { + Project project = editor.getProject(); + if (project != null && FileEditorManager.getInstance(project).getSelectedTextEditor() == e.getEditor()) { updatePosition(editor); } } diff --git a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml index 2dbbf4bd0f05..90f4aceaf5ed 100644 --- a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml @@ -121,8 +121,6 @@ - diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index 8e5615c056df..5b56c0fc7a03 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -491,7 +491,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec } } - List getUnversionedFiles() { + public List getUnversionedFiles() { return myComposite.getVFHolder(FileHolder.HolderType.UNVERSIONED).getFiles(); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ScheduleForAdditionAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ScheduleForAdditionAction.java index 472fe16d5f3f..092713985c9e 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ScheduleForAdditionAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ScheduleForAdditionAction.java @@ -24,7 +24,6 @@ package com.intellij.openapi.vcs.changes.actions; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; @@ -36,7 +35,7 @@ import com.intellij.openapi.vcs.changes.ui.ChangesListView; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nullable; -import java.util.Collections; +import java.util.ArrayList; import java.util.List; public class ScheduleForAdditionAction extends AnAction implements DumbAware { @@ -45,46 +44,44 @@ public class ScheduleForAdditionAction extends AnAction implements DumbAware { } public void update(AnActionEvent e) { - List files = e.getData(ChangesListView.UNVERSIONED_FILES_DATA_KEY); - boolean enabled = files != null && !files.isEmpty(); - if (!enabled) { - final DataContext dataContext = e.getDataContext(); - enabled = getUnversionedFile(dataContext) != null; - } + final boolean enabled = e.getData(PlatformDataKeys.PROJECT) != null && (getUnversionedFiles(e) != null); e.getPresentation().setEnabled(enabled); e.getPresentation().setVisible(enabled); } public void actionPerformed(AnActionEvent e) { - Project project = e.getData(PlatformDataKeys.PROJECT); - - final List files; - final List unversionedFiles = e.getData(ChangesListView.UNVERSIONED_FILES_DATA_KEY); - if (unversionedFiles == null || unversionedFiles.isEmpty()) { - final VirtualFile unversionedFile = getUnversionedFile(e.getDataContext()); - if (unversionedFile == null) { - return; - } - files = Collections.singletonList(unversionedFile); - } else { - files = unversionedFiles; + final List unversionedFiles = getUnversionedFiles(e); + if (unversionedFiles == null) { + return; } - - final ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project); - changeListManager.addUnversionedFiles(changeListManager.getDefaultChangeList(), files); + final ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(e.getData(PlatformDataKeys.PROJECT)); + changeListManager.addUnversionedFiles(changeListManager.getDefaultChangeList(), unversionedFiles); } @Nullable - private VirtualFile getUnversionedFile(final DataContext dataContext) { - if (dataContext == null) { + private static List getUnversionedFiles(final AnActionEvent e) { + // first get from the ChangeListView + List unversionedFiles = e.getData(ChangesListView.UNVERSIONED_FILES_DATA_KEY); + if (unversionedFiles != null && !unversionedFiles.isEmpty()) { + return unversionedFiles; + } + + // then get from selection + final VirtualFile[] files = PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext()); + if (files == null) { return null; } - final Project project = PlatformDataKeys.PROJECT.getData(dataContext); - final VirtualFile file = project == null ? null : PlatformDataKeys.VIRTUAL_FILE.getData(dataContext); - if (file != null && FileStatusManager.getInstance(project).getStatus(file) == FileStatus.UNKNOWN) { - return file; + final Project project = e.getData(PlatformDataKeys.PROJECT); + if (project == null) { + return null; } - return null; + unversionedFiles = new ArrayList(files.length); + for (VirtualFile file : files) { + if (file != null && FileStatusManager.getInstance(project).getStatus(file) == FileStatus.UNKNOWN) { + unversionedFiles.add(file); + } + } + return unversionedFiles.isEmpty() ? null : unversionedFiles; } } \ No newline at end of file diff --git a/plugins/git4idea/src/git4idea/config/GitVcsApplicationSettings.java b/plugins/git4idea/src/git4idea/config/GitVcsApplicationSettings.java index b360b3050052..6935852252b9 100644 --- a/plugins/git4idea/src/git4idea/config/GitVcsApplicationSettings.java +++ b/plugins/git4idea/src/git4idea/config/GitVcsApplicationSettings.java @@ -27,9 +27,9 @@ import java.io.File; * The application wide settings for the git */ @State( - name = "PasswordSafe", + name = "Git.Application.Settings", storages = {@Storage( - id = "PasswordSafe", + id = "Git.Application.Settings", file = "$APP_CONFIG$/vcs.xml")}) public class GitVcsApplicationSettings implements PersistentStateComponent { /** diff --git a/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java b/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java index 57865443cb40..d7635078decd 100644 --- a/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java +++ b/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java @@ -24,6 +24,8 @@ import org.codehaus.groovy.tools.javac.JavaAwareResolveVisitor; import org.codehaus.groovy.tools.javac.JavaStubGenerator; import java.io.*; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; @@ -341,10 +343,17 @@ public class GroovycRunner { final Enumeration resources = super.getResources(name); final ArrayList list = Collections.list(resources); for (Iterator iterator = list.iterator(); iterator.hasNext();) { - String file = ((URL)iterator.next()).getFile(); - System.out.println("Enumerated:" + file); - if (file.startsWith(finalOutput) || file.startsWith("/" + finalOutput)) { - iterator.remove(); + final URL url = (URL)iterator.next(); + if ("file".equals(url.getProtocol())) { + try { + final String file = new File(new URI(url.toString())).getCanonicalPath(); + System.out.println("Enumerated:" + file); + if (file.startsWith(finalOutput) || file.startsWith("/" + finalOutput)) { + iterator.remove(); + } + } + catch (URISyntaxException ignored) { + } } } return Collections.enumeration(list); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java index 8e74963b88ee..50a5991ce0bc 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java @@ -71,7 +71,6 @@ import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase; import org.jetbrains.plugins.groovy.util.GroovyUtils; import java.io.*; -import java.net.URL; import java.nio.charset.Charset; import java.util.*; @@ -304,9 +303,7 @@ public abstract class GroovyCompilerBase implements TranslatingCompiler { printer.println(PathUtil.getLocalPath(outputDir)); printer.println(GroovycRunner.FINAL_OUTPUTPATH); - final URL finalUrl = VfsUtil.convertToURL(finalOutputDir.getUrl()); - LOG.assertTrue(finalUrl != null, finalOutputDir.getPath()); - printer.println(finalUrl.getFile()); + printer.println(FileUtil.toSystemDependentName(finalOutputDir.getPath())); printer.close(); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java index d775d7fbec7c..ce8e3aeabff0 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java @@ -12,41 +12,59 @@ // limitations under the License. package org.zmlx.hg4idea; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import com.intellij.ui.GuiUtils; import org.zmlx.hg4idea.command.HgVersionCommand; import org.zmlx.hg4idea.ui.HgSetExecutableDialog; +import java.lang.reflect.InvocationTargetException; + public class HgExecutableValidator { + private static final Logger LOG = Logger.getInstance(HgExecutableValidator.class.getName()); private final Project project; + private boolean myValidHgExecutable; public HgExecutableValidator(Project project) { this.project = project; } - public boolean check(HgGlobalSettings globalSettings) { - HgVersionCommand command = new HgVersionCommand(); + public boolean check(final HgGlobalSettings globalSettings) { + final HgVersionCommand command = new HgVersionCommand(); if (command.isValid(globalSettings.getHgExecutable())) { return true; } - String previousHgPath = globalSettings.getHgExecutable(); - boolean validHgExecutable; - HgSetExecutableDialog dialog; - do { - dialog = new HgSetExecutableDialog(project); - dialog.setBadHgPath(previousHgPath); - dialog.show(); - validHgExecutable = dialog.isOK() && command.isValid(dialog.getNewHgPath()); - previousHgPath = dialog.getNewHgPath(); - } while (!validHgExecutable && dialog.isOK()); - - if (validHgExecutable) { - globalSettings.setHgExecutable(dialog.getNewHgPath()); - return true; + if (ApplicationManager.getApplication().isUnitTestMode()) { + return false; } + myValidHgExecutable = false; - return false; + try { + GuiUtils.runOrInvokeAndWait(new Runnable() { + public void run() { + String previousHgPath = globalSettings.getHgExecutable(); + HgSetExecutableDialog dialog; + do { + dialog = new HgSetExecutableDialog(project); + dialog.setBadHgPath(previousHgPath); + dialog.show(); + myValidHgExecutable = dialog.isOK() && command.isValid(dialog.getNewHgPath()); + previousHgPath = dialog.getNewHgPath(); + } while (!myValidHgExecutable && dialog.isOK()); + if (myValidHgExecutable) { + globalSettings.setHgExecutable(dialog.getNewHgPath()); + } + } + }); + } catch (InvocationTargetException e) { + LOG.error(e); + } catch (InterruptedException e) { + LOG.error(e); + } + return myValidHgExecutable; } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgGlobalSettings.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgGlobalSettings.java index 236ff41bf2e8..897a027919a5 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgGlobalSettings.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgGlobalSettings.java @@ -22,7 +22,7 @@ import com.intellij.openapi.components.Storage; ) public class HgGlobalSettings implements PersistentStateComponent { - private static final String HG = "hg"; + private static final String HG = HgVcs.HG_EXECUTABLE_FILE_NAME; private static final int FIVE_MINUTES = 300; private String hgExecutable = HG; @@ -47,7 +47,7 @@ public class HgGlobalSettings implements PersistentStateComponent filesToDelete = new ArrayList(myDeletedWithoutConfirmFiles); + final List deletedFiles = new ArrayList(myDeletedFiles); + myDeletedWithoutConfirmFiles.clear(); + myDeletedFiles.clear(); + + // skip unversioned files + final List unversionedFilePaths = new ArrayList(); + for (VirtualFile vf : ChangeListManagerImpl.getInstanceImpl(myProject).getUnversionedFiles()) { + unversionedFilePaths.add(VcsUtil.getFilePath(vf.getPath())); + } + for (Iterator iter = filesToDelete.iterator(); iter.hasNext(); ) { + if (unversionedFilePaths.contains(iter.next())) { + iter.remove(); + } + } + for (Iterator iter = deletedFiles.iterator(); iter.hasNext(); ) { + if (unversionedFilePaths.contains(iter.next())) { + iter.remove(); + } + } + + // confirm removal from the VCS if needed + if (myRemoveOption.getValue() != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) { + if (myRemoveOption.getValue() == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY || deletedFiles.isEmpty()) { + filesToDelete.addAll(deletedFiles); + } + else { + Collection filePaths = selectFilePathsToDelete(deletedFiles); + if (filePaths != null) { + filesToDelete.addAll(filePaths); + } + } + } + + performDeletion(filesToDelete); + } + @Override protected void performDeletion(List filesToDelete) { (new VcsBackgroundTask(myProject, diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgIdentifyCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgIdentifyCommand.java index fb1b8f6a0c32..8ff3a68e2a42 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgIdentifyCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgIdentifyCommand.java @@ -1,6 +1,7 @@ package org.zmlx.hg4idea.command; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.Nullable; import java.nio.charset.Charset; import java.util.Collections; @@ -24,6 +25,7 @@ public class HgIdentifyCommand { this.source = source; } + @Nullable public HgCommandResult execute() { List arguments = new LinkedList(); arguments.add(source); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCloneDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCloneDialog.java index e420d5ca923e..d7f3702e36d3 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCloneDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCloneDialog.java @@ -20,9 +20,6 @@ import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.*; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import org.zmlx.hg4idea.HgVcsMessages; import org.zmlx.hg4idea.command.HgCommandResult; import org.zmlx.hg4idea.command.HgIdentifyCommand; @@ -30,13 +27,11 @@ import org.zmlx.hg4idea.command.HgIdentifyCommand; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.net.URI; import java.net.URISyntaxException; -import java.util.ResourceBundle; /** * A dialog for the mercurial clone options @@ -346,11 +341,10 @@ public class HgCloneDialog extends DialogWrapper { } private static boolean testRepository(Project project, final String repositoryUrl) { - HgIdentifyCommand identifyCommand = new HgIdentifyCommand(project); + final HgIdentifyCommand identifyCommand = new HgIdentifyCommand(project); identifyCommand.setSource(repositoryUrl); - HgCommandResult result = identifyCommand.execute(); - - return result.getExitValue() == 0; + final HgCommandResult result = identifyCommand.execute(); + return result != null && result.getExitValue() == 0; } } diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/AbstractHgTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/AbstractHgTestCase.java index 55e6eb518761..23e1d5586630 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/AbstractHgTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/AbstractHgTestCase.java @@ -14,7 +14,6 @@ package org.zmlx.hg4idea; import com.intellij.execution.process.ProcessOutput; import com.intellij.openapi.application.PluginPathManager; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.openapi.vcs.VcsShowConfirmationOption; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; @@ -136,8 +135,7 @@ public abstract class AbstractHgTestCase extends AbstractVcsTestCase { } protected ProcessOutput runHg(File aHgRepository, String... commandLine) throws IOException { - String exe = SystemInfo.isWindows ? "hg.exe" : "hg"; - return runClient(exe, null, aHgRepository, commandLine); + return runClient(HgVcs.HG_EXECUTABLE_FILE_NAME, null, aHgRepository, commandLine); } protected File fillFile(File aParentDir, String[] filePath, String fileContents) throws FileNotFoundException { diff --git a/plugins/testng/src/com/theoryinpractice/testng/inspection/JUnitConvertTool.java b/plugins/testng/src/com/theoryinpractice/testng/inspection/JUnitConvertTool.java index bf0c2636550b..8717dd343e04 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/inspection/JUnitConvertTool.java +++ b/plugins/testng/src/com/theoryinpractice/testng/inspection/JUnitConvertTool.java @@ -16,7 +16,6 @@ package com.theoryinpractice.testng.inspection; import com.intellij.codeInsight.CodeInsightUtilBase; -import com.intellij.codeInsight.actions.OptimizeImportsProcessor; import com.intellij.codeInspection.*; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -196,7 +195,7 @@ public class JUnitConvertTool extends BaseJavaLocalInspectionTool { element.delete(); } } - new OptimizeImportsProcessor(project, javaFile).run(); //delete unused imports + JavaCodeStyleManager.getInstance(project).optimizeImports(javaFile);//delete unused imports } catch (IncorrectOperationException e) { LOG.error("Error converting testcase", e);