From 7ce6991683b20d7bedd28543ab7bbc274d4f9c22 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 11 Feb 2010 13:20:19 +0300 Subject: [PATCH] cleanup --- .../canBeFinal/CanBeFinalAnnotator.java | 2 +- .../reference/RefJavaElementImpl.java | 44 +++++------- .../reference/RefJavaElement.java | 2 +- .../com/intellij/psi/PsiDocumentManager.java | 5 +- .../psi/PsiRecursiveElementVisitor.java | 12 +--- .../reference/RefEntityImpl.java | 7 +- .../ui/SingleInspectionProfilePanel.java | 70 ++++++++++--------- .../psi/impl/PsiDocumentManagerImpl.java | 5 +- .../com/intellij/psi/impl/PsiManagerImpl.java | 15 ++-- .../components/impl/ComponentManagerImpl.java | 15 ++-- .../com/intellij/util/ConcurrencyUtil.java | 14 ++-- .../inject/InjectLanguageAction.java | 10 +-- 12 files changed, 98 insertions(+), 103 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalAnnotator.java b/java/java-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalAnnotator.java index 481cd9b2ce9a..bb820f68ed2e 100644 --- a/java/java-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalAnnotator.java +++ b/java/java-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalAnnotator.java @@ -41,7 +41,7 @@ class CanBeFinalAnnotator extends RefGraphAnnotatorEx { public void onInitialize(RefElement refElement) { ((RefElementImpl)refElement).setFlag(true, CAN_BE_FINAL_MASK); if (refElement instanceof RefClass) { - final RefClass refClass = ((RefClass)refElement); + final RefClass refClass = (RefClass)refElement; final PsiClass psiClass = refClass.getElement(); if (RefUtil.isEntryPoint(refClass)) { ((RefClassImpl)refClass).setFlag(false, CAN_BE_FINAL_MASK); diff --git a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java index 2bb889145a50..f31d782b96c9 100644 --- a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java +++ b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java @@ -32,12 +32,12 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.Collection; -import java.util.HashSet; +import java.util.Collections; +import java.util.Set; import java.util.Stack; public abstract class RefJavaElementImpl extends RefElementImpl implements RefJavaElement { - private static final HashSet EMPTY_TYPE_REFERENCES_LIST = new HashSet(0); - private THashSet myOutTypeReferences; + private Set myOutTypeReferences; private static final int ACCESS_MODIFIER_MASK = 0x03; private static final int ACCESS_PRIVATE = 0x00; private static final int ACCESS_PROTECTED = 0x01; @@ -51,22 +51,7 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa protected RefJavaElementImpl(String name, RefJavaElement owner) { super(name, owner); String am = owner.getAccessModifier(); - final int access_id; - - if (PsiModifier.PRIVATE.equals(am)) { - access_id = ACCESS_PRIVATE; - } - else if (PsiModifier.PUBLIC.equals(am)) { - access_id = ACCESS_PUBLIC; - } - else if (PsiModifier.PACKAGE_LOCAL.equals(am)) { - access_id = ACCESS_PACKAGE; - } - else { - access_id = ACCESS_PROTECTED; - } - - myFlags = ((myFlags >> 2) << 2) | access_id; + doSetAccessModifier(am); final boolean synthOwner = owner.isSyntheticJSP(); if (synthOwner) { @@ -102,7 +87,7 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa @NotNull public Collection getOutTypeReferences() { if (myOutTypeReferences == null){ - return EMPTY_TYPE_REFERENCES_LIST; + return Collections.emptySet(); } return myOutTypeReferences; } @@ -118,7 +103,7 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa if (element instanceof PsiAnonymousClass) { PsiAnonymousClass psiAnonymousClass = (PsiAnonymousClass)element; PsiClass psiBaseClass = psiAnonymousClass.getBaseClassType().resolve(); - return InspectionsBundle.message("inspection.reference.anonymous.name", (psiBaseClass != null ? psiBaseClass.getQualifiedName() : "")); + return InspectionsBundle.message("inspection.reference.anonymous.name", psiBaseClass == null ? "" : psiBaseClass.getQualifiedName()); } if (element instanceof JspClass) { @@ -175,6 +160,7 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa setFlag(b, IS_SYNTHETIC_JSP_ELEMENT); } + @Modifier @Nullable public String getAccessModifier() { long access_id = myFlags & ACCESS_MODIFIER_MASK; @@ -185,6 +171,10 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa } public void setAccessModifier(String am) { + doSetAccessModifier(am); + } + + private void doSetAccessModifier(String am) { final int access_id; if (PsiModifier.PRIVATE.equals(am)) { @@ -200,7 +190,7 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa access_id = ACCESS_PROTECTED; } - myFlags = ((myFlags >> 2) << 2) | access_id; + myFlags = myFlags & ~0x3 | access_id; } public boolean isSuspiciousRecursive() { @@ -209,12 +199,12 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa private boolean isCalledOnlyFrom(RefJavaElement refElement, Stack callStack) { if (callStack.contains(this)) return refElement == this; - if (getInReferences().size() == 0) return false; + if (getInReferences().isEmpty()) return false; if (refElement instanceof RefMethod) { RefMethod refMethod = (RefMethod) refElement; for (RefMethod refSuper : refMethod.getSuperMethods()) { - if (refSuper.getInReferences().size() > 0) return false; + if (!refSuper.getInReferences().isEmpty()) return false; } if (refMethod.isConstructor()){ boolean unreachable = true; @@ -241,10 +231,10 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa if (refWhat != null) { if (refWhat instanceof RefParameter) { if (forWriting) { - ((RefParameterImpl)refWhat).parameterReferenced(true); + ((RefParameter)refWhat).parameterReferenced(true); } if (forReading) { - ((RefParameterImpl)refWhat).parameterReferenced(false); + ((RefParameter)refWhat).parameterReferenced(false); } } addOutReference(refWhat); @@ -278,4 +268,4 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa } return super.getIcon(expanded); } -} \ No newline at end of file +} diff --git a/java/openapi/src/com/intellij/codeInspection/reference/RefJavaElement.java b/java/openapi/src/com/intellij/codeInspection/reference/RefJavaElement.java index 7093c716fc54..edd8d634f669 100644 --- a/java/openapi/src/com/intellij/codeInspection/reference/RefJavaElement.java +++ b/java/openapi/src/com/intellij/codeInspection/reference/RefJavaElement.java @@ -71,5 +71,5 @@ public interface RefJavaElement extends RefElement { */ @Nullable @Modifier - String getAccessModifier(); + String getAccessModifier(); } \ No newline at end of file diff --git a/platform/lang-api/src/com/intellij/psi/PsiDocumentManager.java b/platform/lang-api/src/com/intellij/psi/PsiDocumentManager.java index e210f3731f61..294bd1fc66fd 100644 --- a/platform/lang-api/src/com/intellij/psi/PsiDocumentManager.java +++ b/platform/lang-api/src/com/intellij/psi/PsiDocumentManager.java @@ -94,7 +94,7 @@ public abstract class PsiDocumentManager { * * @param document the document to commit. */ - public abstract void commitDocument(Document document); + public abstract void commitDocument(@NotNull Document document); /** * Returns the list of documents which have been modified but not committed. @@ -102,6 +102,7 @@ public abstract class PsiDocumentManager { * @return the list of uncommitted documents. * @see #commitDocument(com.intellij.openapi.editor.Document) */ + @NotNull public abstract Document[] getUncommittedDocuments(); /** @@ -111,7 +112,7 @@ public abstract class PsiDocumentManager { * @return true if the document was modified but not committed, false otherwise * @see #commitDocument(com.intellij.openapi.editor.Document) */ - public abstract boolean isUncommited(Document document); + public abstract boolean isUncommited(@NotNull Document document); /** * Checks if any modified documents have not been committed. diff --git a/platform/lang-api/src/com/intellij/psi/PsiRecursiveElementVisitor.java b/platform/lang-api/src/com/intellij/psi/PsiRecursiveElementVisitor.java index 0c3c610c9445..6ec50dd49f4f 100644 --- a/platform/lang-api/src/com/intellij/psi/PsiRecursiveElementVisitor.java +++ b/platform/lang-api/src/com/intellij/psi/PsiRecursiveElementVisitor.java @@ -25,8 +25,6 @@ import java.util.List; */ public abstract class PsiRecursiveElementVisitor extends PsiElementVisitor { private final boolean myVisitAllFileRoots; - private int level = 0; - private static final int MAX_LEVEL_DEPTH = 200; // all elements beneath this level are ignored to avoid stack overflow protected PsiRecursiveElementVisitor() { this(false); @@ -37,13 +35,8 @@ public abstract class PsiRecursiveElementVisitor extends PsiElementVisitor { } public void visitElement(final PsiElement element) { - level++; - if (level < MAX_LEVEL_DEPTH) { - ProgressManager.checkCanceled(); - - element.acceptChildren(this); - } - level--; + ProgressManager.checkCanceled(); + element.acceptChildren(this); } @Override @@ -54,6 +47,7 @@ public abstract class PsiRecursiveElementVisitor extends PsiElementVisitor { if (allFiles.size() > 1) { if (file == viewProvider.getPsi(viewProvider.getBaseLanguage())) { for (PsiFile lFile : allFiles) { + ProgressManager.checkCanceled(); lFile.acceptChildren(this); } return; diff --git a/platform/lang-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java index 60cae39f7dde..1f5492eb9c23 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java @@ -39,7 +39,7 @@ public abstract class RefEntityImpl implements RefEntity { protected ArrayList myChildren; private final String myName; private THashMap myUserMap = null; - protected long myFlags = 0; + protected int myFlags = 0; protected final RefManagerImpl myManager; protected RefEntityImpl(String name, final RefManager manager) { @@ -118,7 +118,7 @@ public abstract class RefEntityImpl implements RefEntity { } else{ myUserMap.remove(key); - if (myUserMap.size() == 0){ + if (myUserMap.isEmpty()){ myUserMap = null; } } @@ -132,7 +132,8 @@ public abstract class RefEntityImpl implements RefEntity { public void setFlag(boolean b, int mask) { if (b) { myFlags |= mask; - } else { + } + else { myFlags &= ~mask; } } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java index b4d4afdab825..de48efbb8eed 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java @@ -47,7 +47,6 @@ import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.WriteExternalException; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.packageDependencies.ui.TreeExpansionMonitor; import com.intellij.profile.ProfileManager; import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; @@ -72,7 +71,10 @@ import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeExpansionListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.*; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.DefaultTreeSelectionModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -95,7 +97,6 @@ public class SingleInspectionProfilePanel extends JPanel { private InspectionProfileImpl mySelectedProfile; private JEditorPane myBrowser; private JPanel myOptionsPanel; - private final UserActivityWatcher myUserActivityWatcher = new UserActivityWatcher(); private final JPanel myInspectionProfilePanel = new JPanel(new BorderLayout()); private FilterComponent myProfileFilter; private final InspectionConfigTreeNode myRoot = @@ -121,7 +122,8 @@ public class SingleInspectionProfilePanel extends JPanel { mySelectedProfile = (InspectionProfileImpl)profile; myInitialProfile = inspectionProfileName; add(createInspectionProfileSettingsPanel(), BorderLayout.CENTER); - myUserActivityWatcher.addUserActivityListener(new UserActivityListener() { + UserActivityWatcher userActivityWatcher = new UserActivityWatcher(); + userActivityWatcher.addUserActivityListener(new UserActivityListener() { public void stateChanged() { //invoke after all other listeners SwingUtilities.invokeLater(new Runnable() { @@ -133,7 +135,7 @@ public class SingleInspectionProfilePanel extends JPanel { }); } }); - myUserActivityWatcher.register(myOptionsPanel); + userActivityWatcher.register(myOptionsPanel); updateSelectedProfileState(); } @@ -150,9 +152,11 @@ public class SingleInspectionProfilePanel extends JPanel { private void wereToolSettingsModified() { - for (Descriptor defaultDescriptor : myDescriptors.keySet()) { - if (wereToolSettingsModified(defaultDescriptor)) return; - for (Descriptor descriptor : myDescriptors.get(defaultDescriptor)) { + for (Map.Entry> entry : myDescriptors.entrySet()) { + Descriptor desc = entry.getKey(); + if (wereToolSettingsModified(desc)) return; + List descriptors = entry.getValue(); + for (Descriptor descriptor : descriptors) { if (wereToolSettingsModified(descriptor)) return; } } @@ -161,27 +165,26 @@ public class SingleInspectionProfilePanel extends JPanel { private boolean wereToolSettingsModified(Descriptor descriptor) { InspectionProfileEntry tool = descriptor.getTool(); - if (tool != null) { - if (mySelectedProfile.isToolEnabled(descriptor.getKey())) { - Element oldConfig = descriptor.getConfig(); - @NonNls Element newConfig = new Element("options"); - try { - tool.writeSettings(newConfig); + if (tool == null || !mySelectedProfile.isToolEnabled(descriptor.getKey())) { + return false; + } + Element oldConfig = descriptor.getConfig(); + @NonNls Element newConfig = new Element("options"); + try { + tool.writeSettings(newConfig); + } + catch (WriteExternalException e) { + LOG.error(e); + } + if (!JDOMUtil.areElementsEqual(oldConfig, newConfig)) { + myAlarm.cancelAllRequests(); + myAlarm.addRequest(new Runnable() { + public void run() { + myTree.repaint(); } - catch (WriteExternalException e) { - LOG.error(e); - } - if (!JDOMUtil.areElementsEqual(oldConfig, newConfig)) { - myAlarm.cancelAllRequests(); - myAlarm.addRequest(new Runnable() { - public void run() { - myTree.repaint(); - } - }, 300); - myModified = true; - return true; - } - } + }, 300); + myModified = true; + return true; } return false; } @@ -976,14 +979,15 @@ public class SingleInspectionProfilePanel extends JPanel { } private boolean descriptorsAreChanged() { - for (Descriptor defaultDescriptor : myDescriptors.keySet()) { - if (mySelectedProfile.isToolEnabled(defaultDescriptor.getKey(), (NamedScope)null) != defaultDescriptor.isEnabled()){ + for (Map.Entry> entry : myDescriptors.entrySet()) { + Descriptor desc = entry.getKey(); + if (mySelectedProfile.isToolEnabled(desc.getKey(), (NamedScope)null) != desc.isEnabled()){ return true; } - if (mySelectedProfile.getErrorLevel(defaultDescriptor.getKey(), defaultDescriptor.getScope()) != defaultDescriptor.getLevel()) { + if (mySelectedProfile.getErrorLevel(desc.getKey(), desc.getScope()) != desc.getLevel()) { return true; } - final List descriptors = myDescriptors.get(defaultDescriptor); + final List descriptors = entry.getValue(); for (Descriptor descriptor : descriptors) { if (mySelectedProfile.isToolEnabled(descriptor.getKey(), descriptor.getScope()) != descriptor.isEnabled()) { return true; @@ -993,7 +997,7 @@ public class SingleInspectionProfilePanel extends JPanel { } } - final List tools = mySelectedProfile.getNonDefaultTools(defaultDescriptor.getKey().toString()); + final List tools = mySelectedProfile.getNonDefaultTools(desc.getKey().toString()); if (tools.size() != descriptors.size()) { return true; } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java index 232a81a7acad..a4c463c9b29d 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java @@ -220,7 +220,7 @@ public class PsiDocumentManagerImpl extends PsiDocumentManager implements Projec } } - public void commitDocument(final Document doc) { + public void commitDocument(@NotNull final Document doc) { final Document document = doc instanceof DocumentWindow ? ((DocumentWindow)doc).getDelegate() : doc; if (isUncommited(document)) { doCommit(document, null); @@ -459,11 +459,12 @@ public class PsiDocumentManagerImpl extends PsiDocumentManager implements Projec return true; } + @NotNull public Document[] getUncommittedDocuments() { return myUncommittedDocuments.toArray(new Document[myUncommittedDocuments.size()]); } - public boolean isUncommited(Document document) { + public boolean isUncommited(@NotNull Document document) { if(getSynchronizer().isInSynchronization(document)) return false; return ((DocumentEx)document).isInEventsHandling() || myUncommittedDocuments.contains(document); } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java index eda0f1dffcad..e18a95c0f9da 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java @@ -107,7 +107,6 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent { private static final Key CACHED_PSI_FILE_COPY_IN_FILECONTENT = Key.create("CACHED_PSI_FILE_COPY_IN_FILECONTENT"); private final List myLanguageInjectors = ContainerUtil.createEmptyCOWList(); - private final ProgressManager myProgressManager; public PsiManagerImpl(Project project, final ProjectRootManagerEx projectRootManagerEx, @@ -144,7 +143,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent { myResolveCache = new ResolveCache(this); if (startupManager != null) { - ((StartupManagerEx)startupManager).registerPreStartupActivity( + startupManager.registerPreStartupActivity( new Runnable() { public void run() { runPreStartupActivity(); @@ -152,8 +151,6 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent { } ); } - - myProgressManager = ProgressManager.getInstance(); } public void initComponent() { @@ -226,7 +223,15 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent { try { ((FormatterImpl)FormatterEx.getInstance()).disableFormatting(); component.disablePostprocessFormattingInside(new Computable() { - public Object compute() { try { r.run(); } catch (Throwable t) { throwable[0] = t; } return null; } + public Object compute() { + try { + r.run(); + } + catch (Throwable t) { + throwable[0] = t; + } + return null; + } }); } finally { diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java index f28547bbd5f9..0e880e77a4ae 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java @@ -17,22 +17,19 @@ package com.intellij.openapi.components.impl; import com.intellij.diagnostic.PluginException; import com.intellij.ide.plugins.IdeaPluginDescriptor; -import com.intellij.notification.Notification; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.PathMacros; import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.BaseComponent; +import com.intellij.openapi.components.ComponentConfig; +import com.intellij.openapi.components.ComponentManager; +import com.intellij.openapi.components.StateStorage; import com.intellij.openapi.components.ex.ComponentManagerEx; import com.intellij.openapi.components.impl.stores.IComponentStore; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ex.ProjectManagerEx; -import com.intellij.openapi.project.impl.ProjectMacrosUtil; -import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.UserDataHolderBase; import com.intellij.util.ArrayUtil; @@ -52,7 +49,9 @@ import org.picocontainer.defaults.ConstructorInjectionComponentAdapter; import java.io.IOException; import java.lang.reflect.Array; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * @author mike diff --git a/platform/util/src/com/intellij/util/ConcurrencyUtil.java b/platform/util/src/com/intellij/util/ConcurrencyUtil.java index c24ada093846..bc5c24d23e00 100644 --- a/platform/util/src/com/intellij/util/ConcurrencyUtil.java +++ b/platform/util/src/com/intellij/util/ConcurrencyUtil.java @@ -80,16 +80,18 @@ public class ConcurrencyUtil { * @return defaultValue if there is no entry in the map (in that case defaultValue is placed into the map), or corresponding value if entry already exists */ @NotNull - public static V cacheOrGet(ConcurrentMap map, @NotNull final K key, @NotNull final V defaultValue) { + public static V cacheOrGet(@NotNull ConcurrentMap map, @NotNull final K key, @NotNull final V defaultValue) { V prev = map.putIfAbsent(key, defaultValue); return prev == null ? defaultValue : prev; } - public static ThreadPoolExecutor newSingleThreadExecutor(@NonNls final String threadFactoryName) { + @NotNull + public static ThreadPoolExecutor newSingleThreadExecutor(@NotNull @NonNls final String threadFactoryName) { return newSingleThreadExecutor(threadFactoryName, Thread.NORM_PRIORITY); } - public static ThreadPoolExecutor newSingleThreadExecutor(final String threadFactoryName, final int threadPriority) { + @NotNull + public static ThreadPoolExecutor newSingleThreadExecutor(@NotNull final String threadFactoryName, final int threadPriority) { return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), new ThreadFactory() { @@ -101,11 +103,13 @@ public class ConcurrencyUtil { }); } - public static ScheduledThreadPoolExecutor newSingleScheduledThreadExecutor(@NonNls final String threadFactoryName) { + @NotNull + public static ScheduledThreadPoolExecutor newSingleScheduledThreadExecutor(@NotNull @NonNls final String threadFactoryName) { return newSingleScheduledThreadExecutor(threadFactoryName, Thread.NORM_PRIORITY); } - public static ScheduledThreadPoolExecutor newSingleScheduledThreadExecutor(final String threadFactoryName, final int threadPriority) { + @NotNull + public static ScheduledThreadPoolExecutor newSingleScheduledThreadExecutor(@NotNull final String threadFactoryName, final int threadPriority) { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, new ThreadFactory() { public Thread newThread(final Runnable r) { final Thread thread = new Thread(r, threadFactoryName); diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java index 5464a9d0d37c..7c0f68f891e6 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java @@ -19,17 +19,12 @@ import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.ide.DataManager; import com.intellij.injected.editor.EditorWindow; import com.intellij.lang.Language; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.popup.JBPopupFactory; -import com.intellij.openapi.ui.popup.ListPopup; import com.intellij.openapi.ui.popup.PopupChooserBuilder; -import com.intellij.openapi.ui.popup.PopupStep; -import com.intellij.openapi.ui.popup.util.BaseListPopupStep; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; @@ -41,14 +36,15 @@ import com.intellij.util.Function; import com.intellij.util.IncorrectOperationException; import com.intellij.util.Processor; import com.intellij.util.ui.EmptyIcon; +import org.intellij.plugins.intelliLang.Configuration; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.intellij.plugins.intelliLang.Configuration; import javax.swing.*; import java.awt.*; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; import java.util.List; public class InjectLanguageAction implements IntentionAction {