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:
@@ -30,7 +30,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.*;
|
||||
import com.intellij.codeInsight.intention.EmptyIntentionAction;
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.deadCode.DeadCodeInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.ex.InspectionManagerEx;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection;
|
||||
@@ -97,7 +97,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
private int myCurentEntryIndex;
|
||||
private boolean myHasMissortedImports;
|
||||
private final ImplicitUsageProvider[] myImplicitUsageProviders;
|
||||
private DeadCodeInspection myDeadCodeInspection;
|
||||
private UnusedDeclarationInspection myDeadCodeInspection;
|
||||
private UnusedSymbolLocalInspection myUnusedSymbolInspection;
|
||||
private HighlightDisplayKey myUnusedSymbolKey;
|
||||
private boolean myDeadCodeEnabled;
|
||||
@@ -220,8 +220,8 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
myUnusedSymbolInspection = unusedSymbolTool == null ? null : (UnusedSymbolLocalInspection)unusedSymbolTool.getTool();
|
||||
LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || myUnusedSymbolInspection != null);
|
||||
|
||||
myDeadCodeKey = HighlightDisplayKey.find(DeadCodeInspection.SHORT_NAME);
|
||||
myDeadCodeInspection = (DeadCodeInspection)profile.getInspectionTool(DeadCodeInspection.SHORT_NAME, myFile);
|
||||
myDeadCodeKey = HighlightDisplayKey.find(UnusedDeclarationInspection.SHORT_NAME);
|
||||
myDeadCodeInspection = (UnusedDeclarationInspection)profile.getInspectionTool(UnusedDeclarationInspection.SHORT_NAME, myFile);
|
||||
myDeadCodeEnabled = profile.isToolEnabled(myDeadCodeKey, myFile);
|
||||
if (unusedImportEnabled && JspPsiUtil.isInJspFile(myFile)) {
|
||||
final JspFile jspFile = JspPsiUtil.getJspFile(myFile);
|
||||
@@ -542,7 +542,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
if (count[0] == 0 && !canbeReferencedViaWeirdNames(member)) return true;
|
||||
|
||||
Query<PsiReference> query = member instanceof PsiMethod
|
||||
? MethodReferencesSearch.search((PsiMethod)member, scope, false)
|
||||
? MethodReferencesSearch.search((PsiMethod)member, scope, true)
|
||||
: ReferencesSearch.search(member, scope, true);
|
||||
return query.findFirst() == null;
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class DummyEntryPointsTool extends FilteringInspectionTool {
|
||||
private RefEntryPointFilter myFilter;
|
||||
private final DeadCodeInspection myOwner;
|
||||
private final UnusedDeclarationInspection myOwner;
|
||||
private QuickFixAction[] myQuickFixActions;
|
||||
|
||||
public DummyEntryPointsTool(DeadCodeInspection owner) {
|
||||
public DummyEntryPointsTool(UnusedDeclarationInspection owner) {
|
||||
myOwner = owner;
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -75,7 +75,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
public class UnusedDeclarationInspection extends FilteringInspectionTool {
|
||||
public boolean ADD_MAINS_TO_ENTRIES = true;
|
||||
|
||||
public boolean ADD_APPLET_TO_ENTRIES = true;
|
||||
@@ -83,7 +83,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
public boolean ADD_NONJAVA_TO_ENTRIES = true;
|
||||
|
||||
public JDOMExternalizableStringList ADDITIONAL_ANNOTATIONS = new JDOMExternalizableStringList();
|
||||
private static final String[] ADDITIONAL_ANNOS = {
|
||||
@NonNls private static final String[] ADDITIONAL_ANNOS = {
|
||||
"javax.ws.rs.*"
|
||||
};
|
||||
|
||||
@@ -104,7 +104,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
|
||||
public final UnusedCodeExtension[] myExtensions;
|
||||
|
||||
public DeadCodeInspection() {
|
||||
public UnusedDeclarationInspection() {
|
||||
ADDITIONAL_ANNOTATIONS.addAll(Arrays.asList(ADDITIONAL_ANNOS));
|
||||
myQuickFixActions = new QuickFixAction[]{new PermanentDeleteAction(), new CommentOutBin(), new MoveToEntries()};
|
||||
ExtensionPoint<UnusedCodeExtension> point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.DEAD_CODE_TOOL);
|
||||
@@ -317,8 +317,8 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
final RefElementImpl refElement = (RefElementImpl)refEntity;
|
||||
final PsiElement element = refElement.getElement();
|
||||
if (element == null) return;
|
||||
final boolean isSuppressed = ((RefElementImpl)refElement).isSuppressed(getShortName());
|
||||
if (!getContext().isToCheckMember(element, DeadCodeInspection.this) || isSuppressed) {
|
||||
final boolean isSuppressed = refElement.isSuppressed(getShortName());
|
||||
if (!getContext().isToCheckMember(element, UnusedDeclarationInspection.this) || isSuppressed) {
|
||||
if (isSuppressed || !scope.contains(element)) {
|
||||
getEntryPointsManager().addEntryPoint(refElement, false);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
checkForReachables();
|
||||
ProgressManager.getInstance().runProcess(new Runnable() {
|
||||
public void run() {
|
||||
final RefFilter filter = new StrictUnreferencedFilter(DeadCodeInspection.this);
|
||||
final RefFilter filter = new StrictUnreferencedFilter(UnusedDeclarationInspection.this);
|
||||
final PsiSearchHelper helper = PsiManager.getInstance(getRefManager().getProject()).getSearchHelper();
|
||||
getRefManager().iterate(new RefJavaVisitor() {
|
||||
@Override public void visitElement(final RefEntity refEntity) {
|
||||
@@ -529,7 +529,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
if (isSerializablePatternMethod(psiMethod)) {
|
||||
getEntryPointsManager().addEntryPoint(refMethod, false);
|
||||
}
|
||||
else if (!refMethod.isExternalOverride() && refMethod.getAccessModifier() != PsiModifier.PRIVATE) {
|
||||
else if (!refMethod.isExternalOverride() && !PsiModifier.PRIVATE.equals(refMethod.getAccessModifier())) {
|
||||
for (final RefMethod derivedMethod : refMethod.getDerivedMethods()) {
|
||||
myProcessedSuspicious.add(derivedMethod);
|
||||
}
|
||||
@@ -721,7 +721,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
|
||||
private class PermanentDeleteAction extends QuickFixAction {
|
||||
private PermanentDeleteAction() {
|
||||
super(DELETE_QUICK_FIX, IconLoader.getIcon("/actions/cancel.png"), KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DeadCodeInspection.this);
|
||||
super(DELETE_QUICK_FIX, IconLoader.getIcon("/actions/cancel.png"), KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), UnusedDeclarationInspection.this);
|
||||
}
|
||||
|
||||
protected boolean applyFix(final RefElement[] refElements) {
|
||||
@@ -739,7 +739,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
final Project project = getContext().getProject();
|
||||
SafeDeleteHandler.invoke(project, psiElements.toArray(new PsiElement[psiElements.size()]), false, new Runnable(){
|
||||
public void run() {
|
||||
removeElements(refElements, project, DeadCodeInspection.this);
|
||||
removeElements(refElements, project, UnusedDeclarationInspection.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -789,7 +789,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
private class CommentOutBin extends QuickFixAction {
|
||||
private CommentOutBin() {
|
||||
super(COMMENT_OUT_QUICK_FIX, null, KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK),
|
||||
DeadCodeInspection.this);
|
||||
UnusedDeclarationInspection.this);
|
||||
}
|
||||
|
||||
protected boolean applyFix(RefElement[] refElements) {
|
||||
@@ -846,7 +846,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
|
||||
private class MoveToEntries extends QuickFixAction {
|
||||
private MoveToEntries() {
|
||||
super(InspectionsBundle.message("inspection.dead.code.entry.point.quickfix"), null, KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), DeadCodeInspection.this);
|
||||
super(InspectionsBundle.message("inspection.dead.code.entry.point.quickfix"), null, KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), UnusedDeclarationInspection.this);
|
||||
}
|
||||
|
||||
protected boolean applyFix(RefElement[] refElements) {
|
||||
@@ -871,7 +871,7 @@ public class DeadCodeInspection extends FilteringInspectionTool {
|
||||
final RefJavaElementImpl refElement = (RefJavaElementImpl)refEntity;
|
||||
final PsiElement element = refElement.getElement();
|
||||
if (element == null) return;
|
||||
if (!getContext().isToCheckMember(refElement, DeadCodeInspection.this)) return;
|
||||
if (!getContext().isToCheckMember(refElement, UnusedDeclarationInspection.this)) return;
|
||||
refElement.setReachable(false);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -26,7 +26,7 @@ import com.intellij.codeInspection.GlobalInspectionContext;
|
||||
import com.intellij.codeInspection.GlobalJavaInspectionContext;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.deadCode.DeadCodeInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.reference.*;
|
||||
import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -393,8 +393,8 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
|
||||
getEntryPointsManager(context.getRefManager()).resolveEntryPoints(context.getRefManager());
|
||||
ContainerUtil.quickSort(globalTools, new Comparator<Tools>() {
|
||||
public int compare(Tools o1, Tools o2) {
|
||||
if (o1.getTool() instanceof DeadCodeInspection) return -1;
|
||||
if (o2.getTool() instanceof DeadCodeInspection) return 1;
|
||||
if (o1.getTool() instanceof UnusedDeclarationInspection) return -1;
|
||||
if (o2.getTool() instanceof UnusedDeclarationInspection) return 1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstan
|
||||
import com.intellij.codeInspection.canBeFinal.CanBeFinalInspection;
|
||||
import com.intellij.codeInspection.concurrencyAnnotations.*;
|
||||
import com.intellij.codeInspection.dataFlow.DataFlowInspection;
|
||||
import com.intellij.codeInspection.deadCode.DeadCodeInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.defUse.DefUseInspection;
|
||||
import com.intellij.codeInspection.defaultFileTemplateUsage.DefaultFileTemplateUsageInspection;
|
||||
import com.intellij.codeInspection.dependencyViolation.DependencyInspection;
|
||||
@@ -66,7 +66,7 @@ public class StandardInspectionToolsProvider implements InspectionToolProvider {
|
||||
|
||||
public Class[] getInspectionClasses() {
|
||||
return new Class[] {
|
||||
DeadCodeInspection.class,
|
||||
UnusedDeclarationInspection.class,
|
||||
UnusedLibrariesInspection.class,
|
||||
InconsistentLanguageLevelInspection.class,
|
||||
VisibilityInspection.class,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.ui;
|
||||
|
||||
import com.intellij.codeInspection.deadCode.DeadCodeInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.deadCode.DummyEntryPointsTool;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.swing.*;
|
||||
*/
|
||||
public class EntryPointsNode extends InspectionNode {
|
||||
private static final Icon ENTRY_POINTS = IconLoader.getIcon("/nodes/entryPoints.png");
|
||||
public EntryPointsNode(DeadCodeInspection tool) {
|
||||
public EntryPointsNode(UnusedDeclarationInspection tool) {
|
||||
super(new DummyEntryPointsTool(tool));
|
||||
getTool().updateContent();
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.deadCode.DeadCodeInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
@@ -10,8 +10,8 @@ import com.intellij.testFramework.InspectionTestCase;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class DeadCodeTest extends InspectionTestCase {
|
||||
private DeadCodeInspection myTool;
|
||||
public class UnusedDeclarationTest extends InspectionTestCase {
|
||||
private UnusedDeclarationInspection myTool;
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
@@ -20,7 +20,7 @@ public class DeadCodeTest extends InspectionTestCase {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myTool = new DeadCodeInspection();
|
||||
myTool = new UnusedDeclarationInspection();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_3);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.intellij.analysis.AnalysisScope;
|
||||
import com.intellij.codeInspection.GlobalInspectionTool;
|
||||
import com.intellij.codeInspection.InspectionManager;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.deadCode.DeadCodeInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.ex.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
@@ -114,7 +114,7 @@ public abstract class InspectionTestCase extends PsiTestCase {
|
||||
globalContext.setCurrentScope(scope);
|
||||
|
||||
if (runDeadCodeFirst) {
|
||||
runTool(new DeadCodeInspection(), scope, globalContext, inspectionManager);
|
||||
runTool(new UnusedDeclarationInspection(), scope, globalContext, inspectionManager);
|
||||
}
|
||||
runTool(tool, scope, globalContext, inspectionManager);
|
||||
}
|
||||
|
||||
@@ -1188,11 +1188,14 @@ public abstract class ChooseByNameBase{
|
||||
}
|
||||
|
||||
private List<String> split(String s) {
|
||||
for (String separator : myModel.getSeparators()) {
|
||||
final List<String> result = StringUtil.split(s, separator);
|
||||
if (!result.isEmpty()) return result;
|
||||
List<String> answer = new ArrayList<String>();
|
||||
for (String token : StringUtil.tokenize(s, StringUtil.join(myModel.getSeparators(), ""))) {
|
||||
if (token.length() > 0) {
|
||||
answer.add(token);
|
||||
}
|
||||
}
|
||||
return Collections.singletonList(s);
|
||||
|
||||
return answer.isEmpty() ? Collections.singletonList(s) : answer;
|
||||
}
|
||||
|
||||
private boolean matchesQualifier(final Object element, final String qualifierPattern) {
|
||||
|
||||
@@ -398,7 +398,13 @@ public class PluginManager {
|
||||
}
|
||||
|
||||
public static boolean isIncompatible(final IdeaPluginDescriptor descriptor) {
|
||||
BuildNumber buildNumber = getBuildNumber();
|
||||
BuildNumber buildNumber = null;
|
||||
try {
|
||||
buildNumber = getBuildNumber();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(descriptor.getSinceBuild())) {
|
||||
BuildNumber sinceBuild = BuildNumber.fromString(descriptor.getSinceBuild());
|
||||
|
||||
@@ -328,6 +328,9 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
try {
|
||||
action.run();
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
// ignore
|
||||
}
|
||||
catch (Throwable t) {
|
||||
LOG.error(t);
|
||||
}
|
||||
|
||||
+6
-5
@@ -102,10 +102,12 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
|
||||
private boolean myFilterFocumentWasChanged;
|
||||
//[back/forward] private ActionToolbar myToolbar;
|
||||
private Window myWindow;
|
||||
private PropertiesComponent myProperties;
|
||||
|
||||
public OptionsEditor(Project project, ConfigurableGroup[] groups, Configurable preselectedConfigurable) {
|
||||
myProject = project;
|
||||
myGroups = groups;
|
||||
myProperties = PropertiesComponent.getInstance(project);
|
||||
|
||||
myFilter = new Filter();
|
||||
myContext = new OptionsEditorContext(myFilter);
|
||||
@@ -244,7 +246,7 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
|
||||
private float readPropertion(final float defaultValue, final String propertyName) {
|
||||
float proportion = defaultValue;
|
||||
try {
|
||||
final String p = PropertiesComponent.getInstance(myProject).getValue(propertyName);
|
||||
final String p = myProperties.getValue(propertyName);
|
||||
if (p != null) {
|
||||
proportion = Float.valueOf(p);
|
||||
}
|
||||
@@ -829,10 +831,9 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
final PropertiesComponent props = PropertiesComponent.getInstance(myProject);
|
||||
props.setValue(MAIN_SPLITTER_PROPORTION, String.valueOf(myMainSplitter.getProportion()));
|
||||
props.setValue(DETAILS_SPLITTER_PROPORTION, String.valueOf(myContentWrapper.myLastSplitterProproprtion));
|
||||
props.setValue(SEARCH_VISIBLE, Boolean.valueOf(isFilterFieldVisible()).toString());
|
||||
myProperties.setValue(MAIN_SPLITTER_PROPORTION, String.valueOf(myMainSplitter.getProportion()));
|
||||
myProperties.setValue(DETAILS_SPLITTER_PROPORTION, String.valueOf(myContentWrapper.myLastSplitterProproprtion));
|
||||
myProperties.setValue(SEARCH_VISIBLE, Boolean.valueOf(isFilterFieldVisible()).toString());
|
||||
|
||||
Toolkit.getDefaultToolkit().removeAWTEventListener(this);
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.command.undo.DocumentReference;
|
||||
import com.intellij.openapi.command.undo.UndoManager;
|
||||
import com.intellij.openapi.command.undo.UndoableAction;
|
||||
import com.intellij.openapi.command.undo.UnexpectedUndoException;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -277,7 +276,7 @@ public final class Configuration implements PersistentStateComponent<Element> {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Configuration load(final InputStream is) throws IOException, JDOMException, InvalidDataException {
|
||||
public static Configuration load(final InputStream is) throws IOException, JDOMException {
|
||||
try {
|
||||
final Document document = JDOMUtil.loadDocument(is);
|
||||
final ArrayList<Element> elements = new ArrayList<Element>();
|
||||
@@ -465,11 +464,11 @@ public final class Configuration implements PersistentStateComponent<Element> {
|
||||
final List<? extends PsiElement> psiElementsToRemove,
|
||||
final PairProcessor<T, T> actualProcessor) {
|
||||
final UndoableAction action = new UndoableAction() {
|
||||
public void undo() throws UnexpectedUndoException {
|
||||
public void undo() {
|
||||
actualProcessor.process(remove, add);
|
||||
}
|
||||
|
||||
public void redo() throws UnexpectedUndoException {
|
||||
public void redo() {
|
||||
actualProcessor.process(add, remove);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user