From 1adf63f97db83cc3bfb745f9c52c64485ddfe62f Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Fri, 13 Mar 2015 14:18:53 +0300 Subject: [PATCH 01/27] IDEA-135417 Add an "Uninstall Feedback" page to the IntelliJ IDEA uninstaller for Windows --- build/conf/nsis/idea.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/conf/nsis/idea.nsi b/build/conf/nsis/idea.nsi index 46c084bffd08..c706790bd73c 100644 --- a/build/conf/nsis/idea.nsi +++ b/build/conf/nsis/idea.nsi @@ -1183,7 +1183,7 @@ done: ; UNCOMMENT THIS IN RELEASE BUILD !insertmacro INSTALLOPTIONS_READ $R3 "DeleteSettings.ini" "Field 6" "State" StrCmp "$R3" "0" end_of_uninstall - StrCmp "${UNINSTALL_WEB_PAGE}" "NotRequired" end_of_uninstall + StrCmp "${UNINSTALL_WEB_PAGE}" "feedback_web_page" end_of_uninstall ExecShell "" "${UNINSTALL_WEB_PAGE}" end_of_uninstall: SectionEnd From 28921aeb16dcb04b0a81ff33897336f7adc58f4b Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 13 Mar 2015 12:55:01 +0100 Subject: [PATCH 02/27] Cleanup (minor test fix) --- .../com/intellij/util/io/HttpRequestsTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/platform-tests/testSrc/com/intellij/util/io/HttpRequestsTest.java b/platform/platform-tests/testSrc/com/intellij/util/io/HttpRequestsTest.java index f35948816f1d..e450a3edefe1 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/io/HttpRequestsTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/io/HttpRequestsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,18 @@ package com.intellij.util.io; import com.intellij.ide.IdeBundle; import org.jetbrains.annotations.NotNull; +import org.junit.Before; import org.junit.Test; import java.io.IOException; +import java.net.Inet4Address; +import java.net.InetAddress; import java.net.SocketTimeoutException; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.*; +import static org.junit.Assume.assumeThat; public class HttpRequestsTest { private final HttpRequests.RequestProcessor myProcessor = new HttpRequests.RequestProcessor() { @@ -35,6 +40,12 @@ public class HttpRequestsTest { } }; + @Before + public void setUp() throws Exception { + InetAddress addr = InetAddress.getByName("openjdk.java.net"); + assumeThat(addr, instanceOf(Inet4Address.class)); + } + @Test public void testLimit() { try { From a2127ea189d8fd85459f57cc4facc2282b3ccf18 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 13 Mar 2015 12:55:20 +0100 Subject: [PATCH 03/27] IDEA-134631 (progress dialogs should change modality state) --- .../ui/impl/DialogWrapperPeerImpl.java | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java index 902a11e579ce..5fed8076f49f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java @@ -214,7 +214,8 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra @Deprecated public DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper,final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) { - this(wrapper, owner, canBeParent, applicationModalIfPossible ? DialogWrapper.IdeModalityType.IDE : DialogWrapper.IdeModalityType.PROJECT); + this(wrapper, owner, canBeParent, + applicationModalIfPossible ? DialogWrapper.IdeModalityType.IDE : DialogWrapper.IdeModalityType.PROJECT); } @Override @@ -301,10 +302,6 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra } } - private boolean isProgressDialog() { - return myWrapper.isModalProgress(); - } - @Override @Nullable public Container getContentPane() { @@ -452,11 +449,9 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra ApplicationManager.getApplication() != null ? (CommandProcessorEx)CommandProcessor.getInstance() : null; final boolean appStarted = commandProcessor != null; - if (myDialog.isModal() && !isProgressDialog()) { - if (appStarted) { - commandProcessor.enterModal(); - LaterInvocator.enterModal(myDialog); - } + if (myDialog.isModal() && appStarted) { + commandProcessor.enterModal(); + LaterInvocator.enterModal(myDialog); } if (appStarted) { @@ -467,11 +462,9 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra myDialog.show(); } finally { - if (myDialog.isModal() && !isProgressDialog()) { - if (appStarted) { - commandProcessor.leaveModal(); - LaterInvocator.leaveModal(myDialog); - } + if (myDialog.isModal() && appStarted) { + commandProcessor.leaveModal(); + LaterInvocator.leaveModal(myDialog); } myDialog.getFocusManager().doWhenFocusSettlesDown(result.createSetDoneRunnable()); From 1dcec839f5dcc9b5fd113404ab432e0da3f22305 Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Fri, 13 Mar 2015 15:12:04 +0300 Subject: [PATCH 04/27] updated uninstaller main page. --- build/conf/nsis/idea.nsi | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/conf/nsis/idea.nsi b/build/conf/nsis/idea.nsi index c706790bd73c..c2a38147e157 100644 --- a/build/conf/nsis/idea.nsi +++ b/build/conf/nsis/idea.nsi @@ -973,6 +973,15 @@ Function un.ConfirmDeleteSettings !insertmacro INSTALLOPTIONS_WRITE "DeleteSettings.ini" "Field 3" "Text" "$(text_delete_settings)" !insertmacro INSTALLOPTIONS_WRITE "DeleteSettings.ini" "Field 4" "Text" "$(confirm_delete_caches)" !insertmacro INSTALLOPTIONS_WRITE "DeleteSettings.ini" "Field 5" "Text" "$(confirm_delete_settings)" + StrCmp "${UNINSTALL_WEB_PAGE}" "feedback_web_page" hide_feedback_checkbox done +hide_feedback_checkbox: + ; show feedback web page checkbox through uninstall of products which is need. + push $R1 + !insertmacro INSTALLOPTIONS_READ $R1 "DeleteSettings.ini" "Settings" "NumFields" + IntOp $R1 $R1 - 1 + !insertmacro INSTALLOPTIONS_WRITE "DeleteSettings.ini" "Settings" "NumFields" "$R1" + pop $R1 +done: !insertmacro INSTALLOPTIONS_DISPLAY "DeleteSettings.ini" FunctionEnd @@ -1181,9 +1190,9 @@ remove_IntelliJIdeaProjectFile: done: DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" ; UNCOMMENT THIS IN RELEASE BUILD + StrCmp "${UNINSTALL_WEB_PAGE}" "feedback_web_page" end_of_uninstall !insertmacro INSTALLOPTIONS_READ $R3 "DeleteSettings.ini" "Field 6" "State" StrCmp "$R3" "0" end_of_uninstall - StrCmp "${UNINSTALL_WEB_PAGE}" "feedback_web_page" end_of_uninstall ExecShell "" "${UNINSTALL_WEB_PAGE}" end_of_uninstall: SectionEnd From dfbb17f60a69d594a1d1bd299a384516ad15c0b7 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Fri, 13 Mar 2015 15:06:29 +0300 Subject: [PATCH 05/27] maven: honor maven-compiler-plugin default source and target settings, it's 1.5, independently of the JDK you run maven with; related issue - https://youtrack.jetbrains.com/issue/IDEA-135877 --- .../jetbrains/idea/maven/importing/MavenModuleImporter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java index acae99f054f9..a10ef9750eea 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java @@ -341,6 +341,11 @@ public class MavenModuleImporter { level = LanguageLevel.parse(myMavenProject.getSourceLevel()); } + // default source and target settings of maven-compiler-plugin is 1.5, see details at http://maven.apache.org/plugins/maven-compiler-plugin + if (level == null) { + level = LanguageLevel.JDK_1_5; + } + myRootModelAdapter.setLanguageLevel(level); } } From 89eb617831a3bbe94d47d9f8d8fbca3b0057503a Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Fri, 13 Mar 2015 15:31:46 +0300 Subject: [PATCH 06/27] PSI based on Grammar-Kit created for command line language in order to implement PY-11855 * GrammarKit instead of custom parsing * ToolWindow instead of popup * Inspection and help added --- .../CommandLineElementTypes.java | 36 ++ .../gnuCommandLine/CommandLineParser.java | 167 ++++++ .../gnuCommandLine/_CommandLineLexer.flex | 42 ++ .../gnuCommandLine/_CommandLineLexer.java | 554 ++++++++++++++++++ .../psi/CommandLineArgument.java | 16 + .../psi/CommandLineCommand.java | 13 + .../gnuCommandLine/psi/CommandLineOption.java | 22 + .../psi/CommandLineVisitor.java | 26 + .../psi/impl/CommandLineArgumentImpl.java | 37 ++ .../psi/impl/CommandLineCommandImpl.java | 31 + .../psi/impl/CommandLineOptionImpl.java | 47 ++ .../provider.py | 2 +- .../CommandLineInspection.html | 9 + python/src/META-INF/gnu-command-line.xml | 26 + python/src/META-INF/python-core.xml | 5 +- .../commandInterface/command/Argument.java | 154 +++++ .../command/ArgumentType.java} | 6 +- .../command/ArgumentsInfo.java | 2 +- .../commandInterface/command/Command.java | 9 +- .../command/KnownArgumentsInfo.java | 2 +- .../command/NoArgumentsInfo.java | 2 +- .../commandInterface/command/Option.java | 11 +- .../command/UnknownArgumentsInfo.java | 2 +- .../command/package-info.java} | 23 +- .../console/CommandExecutor.java | 70 +++ .../console/CommandLineConsole.java | 118 ++++ .../console/package-info.java} | 13 +- .../CommandLineArgumentReference.java | 74 +++ .../CommandLineCommandReference.java | 76 +++ .../CommandLineDocumentationProvider.java | 67 +++ .../gnuCommandLine/CommandLineElement.java} | 28 +- .../CommandLineElementManipulator.java} | 25 +- .../CommandLineElementReference.java | 69 +++ .../CommandLineElementType.java} | 22 +- .../gnuCommandLine/CommandLineFileType.java | 63 ++ .../CommandLineFileTypeFactory.java} | 20 +- .../gnuCommandLine/CommandLineInspection.java | 130 ++++ .../gnuCommandLine/CommandLineLanguage.java} | 19 +- .../CommandLineOptionReference.java | 60 ++ .../CommandLineParserDefinition.java | 90 +++ .../gnuCommandLine/CommandLineParserUtil.java | 54 ++ .../CommandLineReferenceContributor.java | 56 ++ .../CommandLineSyntaxHighlighterFactory.java | 78 +++ .../gnuCommandLine/ValidationResult.java | 62 ++ .../gnuCommandLine/command_line.bnf | 44 ++ .../gnuCommandLine/package-info.java | 40 ++ .../gnuCommandLine/psi/CommandLineFile.java | 130 ++++ .../psi/ValidationResultImpl.java | 215 +++++++ .../psi/impl/CommandLinePsiImplUtils.java | 64 ++ .../psi/impl}/package-info.java | 9 +- .../gnuCommandLine/psi}/package-info.java | 7 +- .../commandInterface/package-info.java | 55 ++ .../com/jetbrains/python/PyBundle.properties | 19 +- .../jetbrains/python/WordWithPosition.java | 158 ----- .../CommandInterfacePresenter.java | 50 -- .../CommandInterfacePresenterAdapter.java | 38 -- .../CommandInterfaceView.java | 121 ---- .../commandInterface/command/Argument.java | 78 --- .../command/OptionArgumentInfo.java | 42 -- .../OptionChoiceBasedArgumentInfo.java | 51 -- .../command/OptionTypedArgumentInfo.java | 61 -- .../CommandBasedRangeInfoDriver.java | 204 ------- .../CommandExecutor.java | 62 -- .../RangeInfoCollector.java | 250 -------- .../UnusedOptionsCollector.java | 97 --- .../commandBasedRangeDriver/package-info.java | 29 - .../python/commandInterface/package-info.java | 46 -- .../RangeBasedPresenter.java | 246 -------- .../rangeBasedPresenter/RangeInfo.java | 122 ---- .../rangeBasedPresenter/RangeInfoDriver.java | 39 -- .../rangeBasedPresenter/SuggestionInfo.java | 79 --- .../rangeBasedPresenter/package-info.java | 32 - .../CommandInterfaceViewSwingImpl.form | 58 -- .../CommandInterfaceViewSwingImpl.java | 434 -------------- .../swingView/CompletionKeyStrokeAction.java | 34 -- .../swingView/KeyStrokeAction.java | 72 --- .../swingView/KeyStrokeInfo.java | 99 ---- .../swingView/SmartTextField.java | 170 ------ .../swingView/SuggestionKeyStrokeAction.java | 34 -- .../swingView/package-info.java | 21 - .../python/commandLineParser/CommandLine.java | 78 --- .../commandLineParser/CommandLineOption.java | 69 --- .../commandLineParser/CommandLineParser.java | 34 -- .../commandLineParser/CommandLinePart.java | 51 -- .../optParse/OptParseCommandLineParser.java | 110 ---- .../optParse/OptionParser.java | 34 -- .../optParse/OptionParserRegexBased.java | 60 -- .../commandLineParser/package-info.java | 29 - .../badCommandLineNoCommand.cmdline | 1 + .../badCommandLineWithCommand.cmdline | 1 + .../testData/commandLine/commandLine.cmdline | 1 + python/testData/commandLine/commandLine.txt | 32 + .../commandLine/goodCommandLine.cmdline | 1 + python/testData/commandLine/junk.cmdline | 1 + python/testData/commandLine/junk.txt | 3 + .../commandLine/optionNoValueJunk.cmdline | 1 + .../commandLine/optionNoValueJunk.txt | 9 + .../CommandLineInspectionTest.java | 75 +++ .../gnuCommandLine/CommandLineParserTest.java | 60 ++ .../CommandLineSuggestionTest.java | 70 +++ .../gnuCommandLine/CommandTestTools.java | 91 +++ 101 files changed, 3236 insertions(+), 3323 deletions(-) create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineElementTypes.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineParser.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/_CommandLineLexer.flex create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/_CommandLineLexer.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/psi/CommandLineArgument.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/psi/CommandLineCommand.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/psi/CommandLineOption.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/psi/CommandLineVisitor.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/psi/impl/CommandLineArgumentImpl.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/psi/impl/CommandLineCommandImpl.java create mode 100644 python/gen/com/jetbrains/commandInterface/gnuCommandLine/psi/impl/CommandLineOptionImpl.java create mode 100644 python/resources/inspectionDescriptions/CommandLineInspection.html create mode 100644 python/src/META-INF/gnu-command-line.xml create mode 100644 python/src/com/jetbrains/commandInterface/command/Argument.java rename python/src/com/jetbrains/{python/commandInterface/command/OptionArgumentType.java => commandInterface/command/ArgumentType.java} (82%) rename python/src/com/jetbrains/{python => }/commandInterface/command/ArgumentsInfo.java (96%) rename python/src/com/jetbrains/{python => }/commandInterface/command/Command.java (76%) rename python/src/com/jetbrains/{python => }/commandInterface/command/KnownArgumentsInfo.java (98%) rename python/src/com/jetbrains/{python => }/commandInterface/command/NoArgumentsInfo.java (95%) rename python/src/com/jetbrains/{python => }/commandInterface/command/Option.java (89%) rename python/src/com/jetbrains/{python => }/commandInterface/command/UnknownArgumentsInfo.java (96%) rename python/src/com/jetbrains/{python/commandInterface/rangeBasedPresenter/Executor.java => commandInterface/command/package-info.java} (58%) create mode 100644 python/src/com/jetbrains/commandInterface/console/CommandExecutor.java create mode 100644 python/src/com/jetbrains/commandInterface/console/CommandLineConsole.java rename python/src/com/jetbrains/{python/commandLineParser/MalformedCommandLineException.java => commandInterface/console/package-info.java} (65%) create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineArgumentReference.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineCommandReference.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineDocumentationProvider.java rename python/src/com/jetbrains/{python/commandLineParser/optParse/ShortOptionParser.java => commandInterface/gnuCommandLine/CommandLineElement.java} (51%) rename python/src/com/jetbrains/{python/commandLineParser/optParse/LongOptionParser.java => commandInterface/gnuCommandLine/CommandLineElementManipulator.java} (54%) create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineElementReference.java rename python/src/com/jetbrains/{python/commandLineParser/CommandLinePartVisitor.java => commandInterface/gnuCommandLine/CommandLineElementType.java} (62%) create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineFileType.java rename python/src/com/jetbrains/{python/commandLineParser/CommandLineArgument.java => commandInterface/gnuCommandLine/CommandLineFileTypeFactory.java} (61%) create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineInspection.java rename python/src/com/jetbrains/{python/commandInterface/swingView/ExecutionKeyStrokeAction.java => commandInterface/gnuCommandLine/CommandLineLanguage.java} (63%) create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineOptionReference.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineParserDefinition.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineParserUtil.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineReferenceContributor.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/CommandLineSyntaxHighlighterFactory.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/ValidationResult.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/command_line.bnf create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/package-info.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/psi/CommandLineFile.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/psi/ValidationResultImpl.java create mode 100644 python/src/com/jetbrains/commandInterface/gnuCommandLine/psi/impl/CommandLinePsiImplUtils.java rename python/src/com/jetbrains/{python/commandInterface/command => commandInterface/gnuCommandLine/psi/impl}/package-info.java (64%) rename python/src/com/jetbrains/{python/commandLineParser/optParse => commandInterface/gnuCommandLine/psi}/package-info.java (68%) create mode 100644 python/src/com/jetbrains/commandInterface/package-info.java delete mode 100644 python/src/com/jetbrains/python/WordWithPosition.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/CommandInterfacePresenter.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/CommandInterfacePresenterAdapter.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/CommandInterfaceView.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/command/Argument.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/command/OptionArgumentInfo.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/command/OptionChoiceBasedArgumentInfo.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/command/OptionTypedArgumentInfo.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/commandBasedRangeDriver/CommandBasedRangeInfoDriver.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/commandBasedRangeDriver/CommandExecutor.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/commandBasedRangeDriver/RangeInfoCollector.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/commandBasedRangeDriver/UnusedOptionsCollector.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/commandBasedRangeDriver/package-info.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/package-info.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/rangeBasedPresenter/RangeBasedPresenter.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/rangeBasedPresenter/RangeInfo.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/rangeBasedPresenter/RangeInfoDriver.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/rangeBasedPresenter/SuggestionInfo.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/rangeBasedPresenter/package-info.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/CommandInterfaceViewSwingImpl.form delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/CommandInterfaceViewSwingImpl.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/CompletionKeyStrokeAction.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/KeyStrokeAction.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/KeyStrokeInfo.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/SmartTextField.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/SuggestionKeyStrokeAction.java delete mode 100644 python/src/com/jetbrains/python/commandInterface/swingView/package-info.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/CommandLine.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/CommandLineOption.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/CommandLineParser.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/CommandLinePart.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/optParse/OptParseCommandLineParser.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/optParse/OptionParser.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/optParse/OptionParserRegexBased.java delete mode 100644 python/src/com/jetbrains/python/commandLineParser/package-info.java create mode 100644 python/testData/commandLine/badCommandLineNoCommand.cmdline create mode 100644 python/testData/commandLine/badCommandLineWithCommand.cmdline create mode 100644 python/testData/commandLine/commandLine.cmdline create mode 100644 python/testData/commandLine/commandLine.txt create mode 100644 python/testData/commandLine/goodCommandLine.cmdline create mode 100644 python/testData/commandLine/junk.cmdline create mode 100644 python/testData/commandLine/junk.txt create mode 100644 python/testData/commandLine/optionNoValueJunk.cmdline create mode 100644 python/testData/commandLine/optionNoValueJunk.txt create mode 100644 python/testSrc/com/jetbrains/commandInterface/gnuCommandLine/CommandLineInspectionTest.java create mode 100644 python/testSrc/com/jetbrains/commandInterface/gnuCommandLine/CommandLineParserTest.java create mode 100644 python/testSrc/com/jetbrains/commandInterface/gnuCommandLine/CommandLineSuggestionTest.java create mode 100644 python/testSrc/com/jetbrains/commandInterface/gnuCommandLine/CommandTestTools.java diff --git a/python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineElementTypes.java b/python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineElementTypes.java new file mode 100644 index 000000000000..d54609b4a048 --- /dev/null +++ b/python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineElementTypes.java @@ -0,0 +1,36 @@ +// This is a generated file. Not intended for manual editing. +package com.jetbrains.commandInterface.gnuCommandLine; + +import com.intellij.psi.tree.IElementType; +import com.intellij.psi.PsiElement; +import com.intellij.lang.ASTNode; +import com.jetbrains.commandInterface.gnuCommandLine.psi.impl.*; + +public interface CommandLineElementTypes { + + IElementType ARGUMENT = new CommandLineElementType("ARGUMENT"); + IElementType COMMAND = new CommandLineElementType("COMMAND"); + IElementType OPTION = new CommandLineElementType("OPTION"); + + IElementType EQ = new IElementType("=", null); + IElementType LITERAL_STARTS_FROM_DIGIT = new IElementType("LITERAL_STARTS_FROM_DIGIT", null); + IElementType LITERAL_STARTS_FROM_LETTER = new IElementType("LITERAL_STARTS_FROM_LETTER", null); + IElementType LONG_OPTION_NAME_TOKEN = new IElementType("LONG_OPTION_NAME_TOKEN", null); + IElementType SHORT_OPTION_NAME_TOKEN = new IElementType("SHORT_OPTION_NAME_TOKEN", null); + + class Factory { + public static PsiElement createElement(ASTNode node) { + IElementType type = node.getElementType(); + if (type == ARGUMENT) { + return new CommandLineArgumentImpl(node); + } + else if (type == COMMAND) { + return new CommandLineCommandImpl(node); + } + else if (type == OPTION) { + return new CommandLineOptionImpl(node); + } + throw new AssertionError("Unknown element type: " + type); + } + } +} diff --git a/python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineParser.java b/python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineParser.java new file mode 100644 index 000000000000..157d84db3c92 --- /dev/null +++ b/python/gen/com/jetbrains/commandInterface/gnuCommandLine/CommandLineParser.java @@ -0,0 +1,167 @@ +// This is a generated file. Not intended for manual editing. +package com.jetbrains.commandInterface.gnuCommandLine; + +import com.intellij.lang.PsiBuilder; +import com.intellij.lang.PsiBuilder.Marker; +import static com.jetbrains.commandInterface.gnuCommandLine.CommandLineElementTypes.*; +import static com.jetbrains.commandInterface.gnuCommandLine.CommandLineParserUtil.*; +import com.intellij.psi.tree.IElementType; +import com.intellij.lang.ASTNode; +import com.intellij.psi.tree.TokenSet; +import com.intellij.lang.PsiParser; + +@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"}) +public class CommandLineParser implements PsiParser { + + public ASTNode parse(IElementType t, PsiBuilder b) { + parseLight(t, b); + return b.getTreeBuilt(); + } + + public void parseLight(IElementType t, PsiBuilder b) { + boolean r; + b = adapt_builder_(t, b, this, null); + Marker m = enter_section_(b, 0, _COLLAPSE_, null); + if (t == ARGUMENT) { + r = argument(b, 0); + } + else if (t == COMMAND) { + r = command(b, 0); + } + else if (t == OPTION) { + r = option(b, 0); + } + else { + r = parse_root_(t, b, 0); + } + exit_section_(b, 0, m, t, r, true, TRUE_CONDITION); + } + + protected boolean parse_root_(IElementType t, PsiBuilder b, int l) { + return root(b, l + 1); + } + + /* ********************************************************** */ + // LITERAL_STARTS_FROM_LETTER | LITERAL_STARTS_FROM_DIGIT + public static boolean argument(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "argument")) return false; + if (!nextTokenIs(b, "", LITERAL_STARTS_FROM_DIGIT, LITERAL_STARTS_FROM_LETTER)) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, ""); + r = consumeToken(b, LITERAL_STARTS_FROM_LETTER); + if (!r) r = consumeToken(b, LITERAL_STARTS_FROM_DIGIT); + exit_section_(b, l, m, ARGUMENT, r, false, null); + return r; + } + + /* ********************************************************** */ + // LITERAL_STARTS_FROM_LETTER + public static boolean command(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "command")) return false; + if (!nextTokenIs(b, LITERAL_STARTS_FROM_LETTER)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, LITERAL_STARTS_FROM_LETTER); + exit_section_(b, m, COMMAND, r); + return r; + } + + /* ********************************************************** */ + // LONG_OPTION_NAME_TOKEN + static boolean long_option_name(PsiBuilder b, int l) { + return consumeToken(b, LONG_OPTION_NAME_TOKEN); + } + + /* ********************************************************** */ + // short_option_name <> ? | long_option_name <> ? + public static boolean option(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "option")) return false; + if (!nextTokenIs(b, "