From 076a9cbca491016a3052683744c925993e438613 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 21 May 2019 21:35:23 +0200 Subject: [PATCH] expected type: prefer array to boxing primitive (IDEA-212266) GitOrigin-RevId: 93fb01a444f915e91a69c402df6337eb7dc16790 --- .idea/libraries/batik.xml | 10 + .idea/libraries/batik_transcoder.xml | 48 -- .idea/modules.xml | 3 +- .../openapi/intellij.java.compiler.iml | 1 - .../intellij.java.analysis.impl.iml | 1 - .../codeStyle/JavaCodeStyleManagerImpl.java | 9 +- .../rename/JavaNameSuggestionProvider.java | 26 +- .../refactoring/util/RefactoringUtil.java | 3 +- java/java-psi-api/intellij.java.psi.iml | 1 - java/java-psi-impl/intellij.java.psi.impl.iml | 1 - .../intellij.java.structureView.iml | 1 - .../template/JavaLiveTemplateTest.groovy | 29 +- .../template/LiveTemplateTest.groovy | 37 +- .../template/LiveTemplateTestCase.groovy | 4 - .../LightIntroduceVariableTest.java | 13 + java/openapi/intellij.java.iml | 1 - .../intellij.platform.analysis.iml | 1 - .../intellij.platform.analysis.impl.iml | 1 - .../build/CommunityLibraryLicenses.groovy | 4 +- .../build/impl/DistributionJARsBuilder.groovy | 3 +- .../build/impl/MavenArtifactsBuilder.groovy | 10 +- .../build/images/IconsClassGenerator.kt | 6 +- .../build/images/generateIconClasses.kt | 8 +- .../build/images/mappings/generateMappings.kt | 6 +- .../build/images/ImageResourcesTest.kt | 6 +- platform/core-api/intellij.platform.core.iml | 1 - .../intellij/ide/TypePresentationService.java | 20 +- .../core-impl/intellij.platform.core.impl.iml | 1 - platform/diff-api/intellij.platform.diff.iml | 1 - .../intellij.platform.editor.iml | 3 +- .../intellij.platform.editor.ex.iml | 1 - .../intellij.platform.externalSystem.iml | 1 - .../intellij.platform.indexing.iml | 1 - platform/lang-api/intellij.platform.lang.iml | 1 - .../template/impl/TemplateState.java | 16 +- .../macro/ConvertToCamelCaseMacro.java | 20 +- .../codeInspection/InspectionApplication.java | 9 +- .../ui/CommonProgramParametersPanel.java | 12 +- .../searcheverywhere/TopHitSEContributor.java | 42 +- .../codeStyle/CodeStyleManagerImpl.java | 9 +- .../rename/naming/NameSuggester.java | 26 +- .../testIntegration/TestFinderHelper.java | 6 +- .../platform-api/intellij.platform.ide.iml | 3 +- .../src/com/intellij/util/text/Matcher.java | 14 - .../intellij.platform.ide.impl.iml | 1 - .../diagnostic/IdeaFreezeReporter.java | 25 +- .../intellij/ide/gdpr/EndUserAgreement.java | 20 - .../persistence/ToolWindowCollector.java | 40 +- .../project/impl/ProjectManagerImpl.java | 18 +- .../src/com/intellij/ui/AppUIUtil.java | 1 - .../src/com/intellij/ui/SpeedSearchBase.java | 6 +- .../intellij/ui/SpeedSearchComparator.java | 21 +- .../src/META-INF/LangExtensions.xml | 1 - .../intellij.platform.tests.iml | 2 +- .../intellij.platform.projectModel.iml | 3 +- .../intellij.platform.projectModel.impl.iml | 2 +- .../api/intellij.platform.remoteServers.iml | 1 - .../intellij.platform.structureView.impl.iml | 1 - .../core/src/com/intellij/ClassFinder.java | 8 +- ...=> intellij.platform.util.concurrency.iml} | 0 platform/util/intellij.platform.util.iml | 6 + platform/util/intellij.platform.util.ui.iml | 19 - .../src/com/intellij/icons/AllIcons.java | 2 + .../openapi/ui/CheckBoxWithDescription.java | 16 +- .../intellij/openapi/ui/DescriptionLabel.java | 39 + .../src/com/intellij/openapi/ui/Divider.java | 34 + .../intellij/openapi/ui/GraphicsConfig.java | 16 +- .../intellij/openapi/ui/InvariantIcon.java | 1 - .../openapi/ui/NullableComponent.java | 41 ++ .../intellij/openapi/ui/PseudoSplitter.java | 18 +- .../com/intellij/openapi/ui/Splittable.java | 41 ++ .../src/com/intellij/openapi/ui/Splitter.java | 2 +- .../openapi/ui/VerticalFlowLayout.java | 16 +- .../com/intellij/openapi/util/IconLoader.java | 36 +- .../com/intellij/openapi/util/IdRunnable.java | 29 + .../openapi/util/registry/Registry.java | 1 + .../openapi/util/registry/RegistryValue.java | 4 +- .../util/registry/ui/RegistryCheckBox.java | 16 +- .../openapi/util/text/TextWithMnemonic.java | 0 .../com/intellij/openapi/wm/FocusWatcher.java | 20 +- .../psi/codeStyle/AllOccurrencesMatcher.java | 18 +- .../psi/codeStyle/FixingLayoutMatcher.java | 16 +- .../FixingLayoutTypoTolerantMatcher.java | 2 +- .../psi/codeStyle/MatcherWithFallback.java | 0 .../psi/codeStyle/MinusculeMatcher.java | 0 .../psi/codeStyle/MinusculeMatcherImpl.java | 11 +- .../com/intellij/psi/codeStyle/NameUtil.java | 136 +++- .../psi/codeStyle/TypoTolerantMatcher.java | 11 +- .../src/com/intellij/ui/ActiveComponent.java | 32 + .../com/intellij/ui/AnchorableComponent.java | 1 - .../src/com/intellij/ui/CaptionPanel.java | 3 +- .../com/intellij/ui/CheckBoxListListener.java | 1 - .../src/com/intellij/ui/ClickListener.java | 16 +- .../src/com/intellij/ui/CollapsiblePanel.java | 16 +- .../com/intellij/ui/CollapsingListener.java | 22 + .../src/com/intellij/ui/ColorHexUtil.java | 59 -- .../src/com/intellij/ui/ColorUtil.java | 34 +- platform/util/src/com/intellij/ui/Colors.java | 27 + .../src/com/intellij/ui/CompositeIcon.java | 2 +- .../src/com/intellij/ui/DarculaColors.java | 2 +- .../src/com/intellij/ui/DocumentAdapter.java | 2 +- .../src/com/intellij/ui/EngravedLabel.java | 16 +- .../com/intellij/ui/EngravedTextGraphics.java | 18 +- .../src/com/intellij/ui/FileColorName.java | 23 + .../util/src/com/intellij/ui/Gradient.java | 39 + .../com/intellij/ui/Graphics2DDelegate.java | 16 +- .../src/com/intellij/ui/Graphics2DLog.java | 0 .../{ui => }/src/com/intellij/ui/Gray.java | 16 +- .../com/intellij/ui/HeldDownKeyListener.java | 16 +- .../src/com/intellij/ui/JBAutoscroller.java | 16 +- .../{ui => }/src/com/intellij/ui/JBColor.java | 0 .../src/com/intellij/ui/JBGradientPaint.java | 16 +- .../src/com/intellij/ui/LightColors.java | 16 +- .../com/intellij/ui/MixedColorProducer.java | 4 +- .../src/com/intellij/ui/PanelWithAnchor.java | 1 - .../src/com/intellij/ui/PopupBorder.java | 16 +- .../src/com/intellij/ui/RetrievableIcon.java | 33 + .../com/intellij/ui/SeparatorComponent.java | 16 +- .../com/intellij/ui/SeparatorOrientation.java | 33 + .../src/com/intellij/ui/SideBorder.java | 16 +- .../src/com/intellij/ui/SmartExpander.java | 16 +- .../src/com/intellij/ui/TableUtil.java | 16 +- .../src/com/intellij/ui/TitlePanel.java | 0 .../src/com/intellij/ui/TransparentPanel.java | 16 +- .../src/com/intellij/ui/UIBundle.java | 16 +- .../com/intellij/ui/awt/RelativePoint.java | 18 +- .../intellij/ui/awt/RelativeRectangle.java | 16 +- .../intellij/ui/border/CustomLineBorder.java | 16 +- .../com/intellij/ui/components/JBPanel.java | 16 +- .../ui/mac/foundation/Foundation.java | 2 +- .../ui/mac/foundation/FoundationLibrary.java | 22 +- .../com/intellij/ui/mac/foundation/ID.java | 36 + .../intellij/ui/mac/foundation/MacUtil.java | 2 +- .../intellij/ui/mac/foundation/NSColor.java | 2 +- .../ui/mac/foundation/NSDefaults.java | 2 +- .../ui/mac/foundation/NSWorkspace.java | 16 +- .../intellij/ui/mac/foundation/Selector.java | 49 ++ .../com/intellij/ui/paint/LinePainter2D.java | 3 +- .../src/com/intellij/ui/paint/PaintUtil.java | 3 +- .../intellij/ui/paint/RectanglePainter.java | 16 +- .../intellij/ui/paint/RectanglePainter2D.java | 3 +- .../intellij/ui/paint/RegionPainter2D.java | 2 +- .../src/com/intellij/ui/util/Axis.java | 16 +- .../intellij/util/AppleHiDPIScaledImage.java | 2 +- .../util/ComponentTreeEventDispatcher.java | 17 +- .../src/com/intellij/util/FontUtil.java | 18 +- .../intellij/util/HiDPIScaledGraphics.java | 16 +- .../src/com/intellij/util/ImageLoader.java | 7 +- .../com/intellij/util/JBHiDPIScaledImage.java | 17 +- .../src/com/intellij/util/RetinaImage.java | 2 +- .../src/com/intellij/util/SVGLoader.java | 11 +- .../src/com/intellij/util/text/Matcher.java | 28 + .../com/intellij/util/text/NameUtilCore.java | 131 ---- .../src/com/intellij/util/ui/AATextInfo.java | 0 .../util/ui/AbstractLayoutManager.java | 16 +- .../util/ui/AbstractTableCellEditor.java | 24 + .../util/ui/AdjustComponentWhenShown.java | 16 +- .../util/ui/AppleBoldDottedPainter.java | 16 +- .../src/com/intellij/util/ui/BlockBorder.java | 16 +- .../com/intellij/util/ui/CenteredIcon.java | 16 +- .../src/com/intellij/util/ui/Centerizer.java | 16 +- .../util/ui/ClientPropertyHolder.java | 24 + .../src/com/intellij/util/ui/ColorIcon.java | 20 +- .../src/com/intellij/util/ui/ColorsIcon.java | 0 .../src/com/intellij/util/ui/ColumnInfo.java | 16 +- .../intellij/util/ui/ComboBoxCellEditor.java | 16 +- .../util/ui/ComboBoxTableCellEditor.java | 16 +- .../util/ui/EditableListModelDecorator.java | 16 +- .../com/intellij/util/ui/EditableModel.java | 27 + .../intellij/util/ui/EditableTreeModel.java | 36 + .../util/ui/EdtInvocationManager.java | 16 +- .../com/intellij/util/ui/ElementProducer.java | 24 + .../intellij/util/ui/EmptyClipboardOwner.java | 34 + .../src/com/intellij/util/ui/EmptyIcon.java | 2 +- .../util/ui/FilePathSplittingPolicy.java | 16 +- .../src/com/intellij/util/ui/FontInfo.java | 4 +- .../com/intellij/util/ui/GeometryUtil.java | 16 +- .../com/intellij/util/ui/GraphicsUtil.java | 0 .../src/com/intellij/util/ui/GridBag.java | 16 +- .../util/src/com/intellij/util/ui/Html.java | 39 + .../src/com/intellij/util/ui/ImageUtil.java | 0 .../com/intellij/util/ui/IndentedIcon.java | 16 +- .../src/com/intellij/util/ui/IsRetina.java | 39 + .../com/intellij/util/ui/ItemRemovable.java | 30 + .../util/ui/JBCachingScalableIcon.java | 0 .../src/com/intellij/util/ui/JBDimension.java | 16 +- .../com/intellij/util/ui/JBEmptyBorder.java | 16 +- .../src/com/intellij/util/ui/JBFont.java | 16 +- .../src/com/intellij/util/ui/JBImageIcon.java | 40 ++ .../src/com/intellij/util/ui/JBInsets.java | 20 +- .../src/com/intellij/util/ui/JBPoint.java | 33 + .../src/com/intellij/util/ui/JBRectangle.java | 16 +- .../com/intellij/util/ui/JBScalableIcon.java | 0 .../intellij/util/ui/JBSwingUtilities.java | 2 +- .../src/com/intellij/util/ui/JBUI.java | 0 .../src/com/intellij/util/ui/JBUIScale.java | 3 +- .../src/com/intellij/util/ui/JBValue.java | 3 +- .../intellij/util/ui/KeyboardLayoutUtil.java | 0 .../intellij/util/ui/LabelWithTooltip.java | 16 +- .../src/com/intellij/util/ui/Layers.java | 16 +- .../com/intellij/util/ui/ListTableModel.java | 16 +- .../src/com/intellij/util/ui/MacUIUtil.java | 4 +- .../intellij/util/ui/MouseEventAdapter.java | 2 +- .../intellij/util/ui/MouseEventHandler.java | 20 +- .../intellij/util/ui/MultiRowFlowPanel.java | 16 +- .../com/intellij/util/ui/PlatformColors.java | 27 + .../util/ui/RadioButtonEnumModel.java | 16 +- .../com/intellij/util/ui/RegionPainter.java | 20 +- .../src/com/intellij/util/ui/SameColor.java | 29 + .../src/com/intellij/util/ui/ScrollUtil.java | 16 +- .../intellij/util/ui/SortableColumnModel.java | 33 + .../intellij/util/ui/SplitByLetterPolicy.java | 16 +- .../util/ui/SplitBySeparatorPolicy.java | 16 +- .../com/intellij/util/ui/TableViewModel.java | 27 + .../intellij/util/ui/ThreeStateCheckBox.java | 16 +- .../com/intellij/util/ui/TwoColorsIcon.java | 48 ++ .../src/com/intellij/util/ui/UIUtil.java | 0 .../com/intellij/util/ui/WatermarkIcon.java | 16 +- .../src/com/intellij/util/ui/WavePainter.java | 16 +- .../com/intellij/util/ui/WavePainter2D.java | 2 +- .../AbstractAccessibleContextDelegate.java | 0 .../AccessibleContextAccessor.java | 0 .../AccessibleContextDelegate.java | 0 .../accessibility/AccessibleContextUtil.java | 0 .../util/ui/accessibility/ScreenReader.java | 0 .../ui/accessibility/SimpleAccessible.java | 2 +- .../util/ui/components/BorderLayoutPanel.java | 17 +- .../util/ui/components/JBComponent.java | 33 + .../util/ui/tree/AbstractTreeModel.java | 16 +- .../util/ui/tree/TreeModelAdapter.java | 20 +- .../util/ui/tree/TreeModelListenerList.java | 16 +- .../util/ui/tree/WideSelectionTreeUI.java | 20 +- .../util/ui/update/ComparableObject.java | 16 +- .../util/ui/update/ComparableObjectCheck.java | 16 +- .../batik/script/rhino/RhinoInterpreter.java | 17 + .../script/rhino/RhinoInterpreterFactory.java | 6 + .../src/org/w3c/dom/ElementTraversal.java | 2 +- .../{ui => }/src/org/w3c/dom/Location.java | 2 +- .../util/{ui => }/src/org/w3c/dom/Window.java | 2 +- .../intellij/openapi/ui/DescriptionLabel.java | 25 - .../src/com/intellij/openapi/ui/Divider.java | 20 - .../openapi/ui/NullableComponent.java | 27 - .../com/intellij/openapi/ui/Splittable.java | 27 - .../com/intellij/openapi/util/IdRunnable.java | 15 - .../src/com/intellij/ui/ActiveComponent.java | 18 - .../com/intellij/ui/CollapsingListener.java | 8 - .../util/ui/src/com/intellij/ui/Colors.java | 13 - .../ui/src/com/intellij/ui/FileColorName.java | 9 - .../util/ui/src/com/intellij/ui/Gradient.java | 25 - .../src/com/intellij/ui/RetrievableIcon.java | 19 - .../com/intellij/ui/SeparatorOrientation.java | 19 - .../com/intellij/ui/mac/foundation/ID.java | 22 - .../intellij/ui/mac/foundation/Selector.java | 35 - .../util/ui/AbstractTableCellEditor.java | 10 - .../util/ui/ClientPropertyHolder.java | 10 - .../com/intellij/util/ui/EditableModel.java | 13 - .../intellij/util/ui/EditableTreeModel.java | 22 - .../com/intellij/util/ui/ElementProducer.java | 10 - .../intellij/util/ui/EmptyClipboardOwner.java | 20 - .../ui/src/com/intellij/util/ui/Html.java | 25 - .../ui/src/com/intellij/util/ui/IsRetina.java | 25 - .../com/intellij/util/ui/ItemRemovable.java | 16 - .../src/com/intellij/util/ui/JBImageIcon.java | 26 - .../ui/src/com/intellij/util/ui/JBPoint.java | 19 - .../com/intellij/util/ui/PlatformColors.java | 13 - .../src/com/intellij/util/ui/SameColor.java | 15 - .../intellij/util/ui/SortableColumnModel.java | 19 - .../com/intellij/util/ui/TableViewModel.java | 13 - .../com/intellij/util/ui/TwoColorsIcon.java | 30 - .../util/ui/components/JBComponent.java | 19 - .../apache/batik/script/InterpreterPool.java | 5 - platform/vcs-api/intellij.platform.vcs.iml | 1 - .../intellij/vcs/log/ui/frame/MainFrame.java | 29 +- .../com/intellij/vcs/log/util/VcsLogUtil.java | 7 +- .../intellij.platform.debugger.iml | 1 - .../sh/formatter/ShExternalFormatter.java | 2 +- .../sh/formatter/ShShfmtFormatterUtil.java | 2 +- .../com/intellij/sh/settings/ShSettings.java | 2 +- .../sh/shellcheck/ShShellcheckInspection.java | 13 +- .../sh/shellcheck/ShShellcheckUtil.java | 670 +++++++++--------- .../sh/shellcheck/ShellcheckOptionsPanel.form | 99 ++- .../sh/shellcheck/ShellcheckOptionsPanel.java | 16 +- .../ShellcheckSetupNotificationProvider.java | 2 +- .../shellcheck/disableInspection.after.sh | 6 - .../testData/shellcheck/disableInspection.sh | 6 - .../sh/testData/shellcheck/quickFix.after.sh | 5 - plugins/sh/testData/shellcheck/quickFix.sh | 5 - .../shellcheck/suppressInspection.after.sh | 8 - .../testData/shellcheck/suppressInspection.sh | 6 - .../suppressSameInspection.after.sh | 9 - .../shellcheck/suppressSameInspection.sh | 7 - .../sh/tests/com/intellij/sh/ShTestSuite.java | 84 --- .../sh/lexer/ShHighlightingLexerTest.java | 15 + .../sh/parser/ShShebangParserUtilTest.java | 22 +- .../ShShellcheckInspectionTest.java | 96 --- .../sh/shellcheck/ShShellcheckTestSetup.java | 33 - .../sh/shellcheck/ShShellcheckTestUtil.java | 95 --- python/intellij.python.pydev.iml | 1 - python/psi-api/intellij.python.psi.iml | 1 - .../spellchecker/BaseSuggestionProvider.java | 20 +- xml/dom-openapi/intellij.xml.dom.iml | 1 - .../intellij/util/xml/HyphenNameStrategy.java | 20 +- .../intellij/util/xml/JavaNameStrategy.java | 20 +- .../generate/AbstractDomGenerateProvider.java | 20 +- xml/openapi/intellij.xml.iml | 1 - .../intellij.xml.analysis.impl.iml | 1 - xml/xml-psi-impl/intellij.xml.psi.impl.iml | 1 - .../intellij.xml.structureView.impl.iml | 1 - 308 files changed, 3296 insertions(+), 2107 deletions(-) create mode 100644 .idea/libraries/batik.xml delete mode 100644 .idea/libraries/batik_transcoder.xml delete mode 100644 platform/platform-api/src/com/intellij/util/text/Matcher.java rename platform/util/{intellij.platform.concurrency.iml => intellij.platform.util.concurrency.iml} (100%) delete mode 100644 platform/util/intellij.platform.util.ui.iml rename platform/util/{ui => }/src/com/intellij/icons/AllIcons.java (99%) rename platform/util/{ui => }/src/com/intellij/openapi/ui/CheckBoxWithDescription.java (57%) create mode 100644 platform/util/src/com/intellij/openapi/ui/DescriptionLabel.java create mode 100644 platform/util/src/com/intellij/openapi/ui/Divider.java rename platform/util/{ui => }/src/com/intellij/openapi/ui/GraphicsConfig.java (80%) rename platform/util/{ui => }/src/com/intellij/openapi/ui/InvariantIcon.java (77%) create mode 100644 platform/util/src/com/intellij/openapi/ui/NullableComponent.java rename platform/util/{ui => }/src/com/intellij/openapi/ui/PseudoSplitter.java (71%) create mode 100644 platform/util/src/com/intellij/openapi/ui/Splittable.java rename platform/util/{ui => }/src/com/intellij/openapi/ui/Splitter.java (99%) rename platform/util/{ui => }/src/com/intellij/openapi/ui/VerticalFlowLayout.java (89%) rename platform/util/{ui => }/src/com/intellij/openapi/util/IconLoader.java (98%) create mode 100644 platform/util/src/com/intellij/openapi/util/IdRunnable.java rename platform/util/{ui => }/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java (58%) rename platform/util/{ui => }/src/com/intellij/openapi/util/text/TextWithMnemonic.java (100%) rename platform/util/{ui => }/src/com/intellij/openapi/wm/FocusWatcher.java (90%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/AllOccurrencesMatcher.java (79%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/FixingLayoutMatcher.java (73%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.java (92%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/MatcherWithFallback.java (100%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/MinusculeMatcher.java (100%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/MinusculeMatcherImpl.java (98%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/NameUtil.java (75%) rename platform/{platform-api => util}/src/com/intellij/psi/codeStyle/TypoTolerantMatcher.java (98%) create mode 100644 platform/util/src/com/intellij/ui/ActiveComponent.java rename platform/util/{ui => }/src/com/intellij/ui/AnchorableComponent.java (64%) rename platform/util/{ui => }/src/com/intellij/ui/CaptionPanel.java (96%) rename platform/util/{ui => }/src/com/intellij/ui/CheckBoxListListener.java (51%) rename platform/util/{ui => }/src/com/intellij/ui/ClickListener.java (77%) rename platform/util/{ui => }/src/com/intellij/ui/CollapsiblePanel.java (92%) create mode 100644 platform/util/src/com/intellij/ui/CollapsingListener.java delete mode 100644 platform/util/src/com/intellij/ui/ColorHexUtil.java rename platform/util/{ui => }/src/com/intellij/ui/ColorUtil.java (84%) create mode 100644 platform/util/src/com/intellij/ui/Colors.java rename platform/util/{ui => }/src/com/intellij/ui/CompositeIcon.java (89%) rename platform/util/{ui => }/src/com/intellij/ui/DarculaColors.java (82%) rename platform/util/{ui => }/src/com/intellij/ui/DocumentAdapter.java (91%) rename platform/util/{ui => }/src/com/intellij/ui/EngravedLabel.java (58%) rename platform/util/{ui => }/src/com/intellij/ui/EngravedTextGraphics.java (81%) create mode 100644 platform/util/src/com/intellij/ui/FileColorName.java create mode 100644 platform/util/src/com/intellij/ui/Gradient.java rename platform/util/{ui => }/src/com/intellij/ui/Graphics2DDelegate.java (93%) rename platform/util/{ui => }/src/com/intellij/ui/Graphics2DLog.java (100%) rename platform/util/{ui => }/src/com/intellij/ui/Gray.java (97%) rename platform/util/{ui => }/src/com/intellij/ui/HeldDownKeyListener.java (68%) rename platform/util/{ui => }/src/com/intellij/ui/JBAutoscroller.java (95%) rename platform/util/{ui => }/src/com/intellij/ui/JBColor.java (100%) rename platform/util/{ui => }/src/com/intellij/ui/JBGradientPaint.java (67%) rename platform/util/{ui => }/src/com/intellij/ui/LightColors.java (51%) rename platform/util/{ui => }/src/com/intellij/ui/MixedColorProducer.java (95%) rename platform/util/{ui => }/src/com/intellij/ui/PanelWithAnchor.java (62%) rename platform/util/{ui => }/src/com/intellij/ui/PopupBorder.java (78%) create mode 100644 platform/util/src/com/intellij/ui/RetrievableIcon.java rename platform/util/{ui => }/src/com/intellij/ui/SeparatorComponent.java (81%) create mode 100644 platform/util/src/com/intellij/ui/SeparatorOrientation.java rename platform/util/{ui => }/src/com/intellij/ui/SideBorder.java (76%) rename platform/util/{ui => }/src/com/intellij/ui/SmartExpander.java (72%) rename platform/util/{ui => }/src/com/intellij/ui/TableUtil.java (93%) rename platform/util/{ui => }/src/com/intellij/ui/TitlePanel.java (100%) rename platform/util/{ui => }/src/com/intellij/ui/TransparentPanel.java (59%) rename platform/util/{ui => }/src/com/intellij/ui/UIBundle.java (61%) rename platform/util/{ui => }/src/com/intellij/ui/awt/RelativePoint.java (88%) rename platform/util/{ui => }/src/com/intellij/ui/awt/RelativeRectangle.java (77%) rename platform/util/{ui => }/src/com/intellij/ui/border/CustomLineBorder.java (73%) rename platform/util/{ui => }/src/com/intellij/ui/components/JBPanel.java (82%) rename platform/util/{ui => }/src/com/intellij/ui/mac/foundation/Foundation.java (100%) rename platform/util/{ui => }/src/com/intellij/ui/mac/foundation/FoundationLibrary.java (86%) create mode 100644 platform/util/src/com/intellij/ui/mac/foundation/ID.java rename platform/util/{ui => }/src/com/intellij/ui/mac/foundation/MacUtil.java (99%) rename platform/util/{ui => }/src/com/intellij/ui/mac/foundation/NSColor.java (95%) rename platform/util/{ui => }/src/com/intellij/ui/mac/foundation/NSDefaults.java (99%) rename platform/util/{ui => }/src/com/intellij/ui/mac/foundation/NSWorkspace.java (55%) create mode 100644 platform/util/src/com/intellij/ui/mac/foundation/Selector.java rename platform/util/{ui => }/src/com/intellij/ui/paint/LinePainter2D.java (99%) rename platform/util/{ui => }/src/com/intellij/ui/paint/PaintUtil.java (99%) rename platform/util/{ui => }/src/com/intellij/ui/paint/RectanglePainter.java (73%) rename platform/util/{ui => }/src/com/intellij/ui/paint/RectanglePainter2D.java (99%) rename platform/util/{ui => }/src/com/intellij/ui/paint/RegionPainter2D.java (92%) rename platform/util/{ui => }/src/com/intellij/ui/util/Axis.java (58%) rename platform/util/{ui => }/src/com/intellij/util/AppleHiDPIScaledImage.java (91%) rename platform/util/{ui => }/src/com/intellij/util/ComponentTreeEventDispatcher.java (69%) rename platform/util/{ui => }/src/com/intellij/util/FontUtil.java (69%) rename platform/util/{ui => }/src/com/intellij/util/HiDPIScaledGraphics.java (94%) rename platform/util/{ui => }/src/com/intellij/util/ImageLoader.java (98%) rename platform/util/{ui => }/src/com/intellij/util/JBHiDPIScaledImage.java (93%) rename platform/util/{ui => }/src/com/intellij/util/RetinaImage.java (97%) rename platform/util/{ui => }/src/com/intellij/util/SVGLoader.java (97%) create mode 100644 platform/util/src/com/intellij/util/text/Matcher.java delete mode 100644 platform/util/src/com/intellij/util/text/NameUtilCore.java rename platform/util/{ui => }/src/com/intellij/util/ui/AATextInfo.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/AbstractLayoutManager.java (60%) create mode 100644 platform/util/src/com/intellij/util/ui/AbstractTableCellEditor.java rename platform/util/{ui => }/src/com/intellij/util/ui/AdjustComponentWhenShown.java (64%) rename platform/util/{ui => }/src/com/intellij/util/ui/AppleBoldDottedPainter.java (84%) rename platform/util/{ui => }/src/com/intellij/util/ui/BlockBorder.java (84%) rename platform/util/{ui => }/src/com/intellij/util/ui/CenteredIcon.java (68%) rename platform/util/{ui => }/src/com/intellij/util/ui/Centerizer.java (73%) create mode 100644 platform/util/src/com/intellij/util/ui/ClientPropertyHolder.java rename platform/util/{ui => }/src/com/intellij/util/ui/ColorIcon.java (79%) rename platform/util/{ui => }/src/com/intellij/util/ui/ColorsIcon.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/ColumnInfo.java (78%) rename platform/util/{ui => }/src/com/intellij/util/ui/ComboBoxCellEditor.java (74%) rename platform/util/{ui => }/src/com/intellij/util/ui/ComboBoxTableCellEditor.java (74%) rename platform/util/{ui => }/src/com/intellij/util/ui/EditableListModelDecorator.java (57%) create mode 100644 platform/util/src/com/intellij/util/ui/EditableModel.java create mode 100644 platform/util/src/com/intellij/util/ui/EditableTreeModel.java rename platform/util/{ui => }/src/com/intellij/util/ui/EdtInvocationManager.java (78%) create mode 100644 platform/util/src/com/intellij/util/ui/ElementProducer.java create mode 100644 platform/util/src/com/intellij/util/ui/EmptyClipboardOwner.java rename platform/util/{ui => }/src/com/intellij/util/ui/EmptyIcon.java (98%) rename platform/util/{ui => }/src/com/intellij/util/ui/FilePathSplittingPolicy.java (67%) rename platform/util/{ui => }/src/com/intellij/util/ui/FontInfo.java (98%) rename platform/util/{ui => }/src/com/intellij/util/ui/GeometryUtil.java (94%) rename platform/util/{ui => }/src/com/intellij/util/ui/GraphicsUtil.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/GridBag.java (94%) create mode 100644 platform/util/src/com/intellij/util/ui/Html.java rename platform/util/{ui => }/src/com/intellij/util/ui/ImageUtil.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/IndentedIcon.java (51%) create mode 100644 platform/util/src/com/intellij/util/ui/IsRetina.java create mode 100644 platform/util/src/com/intellij/util/ui/ItemRemovable.java rename platform/util/{ui => }/src/com/intellij/util/ui/JBCachingScalableIcon.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBDimension.java (87%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBEmptyBorder.java (63%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBFont.java (70%) create mode 100644 platform/util/src/com/intellij/util/ui/JBImageIcon.java rename platform/util/{ui => }/src/com/intellij/util/ui/JBInsets.java (83%) create mode 100644 platform/util/src/com/intellij/util/ui/JBPoint.java rename platform/util/{ui => }/src/com/intellij/util/ui/JBRectangle.java (52%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBScalableIcon.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBSwingUtilities.java (97%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBUI.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBUIScale.java (99%) rename platform/util/{ui => }/src/com/intellij/util/ui/JBValue.java (98%) rename platform/util/{ui => }/src/com/intellij/util/ui/KeyboardLayoutUtil.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/LabelWithTooltip.java (53%) rename platform/util/{ui => }/src/com/intellij/util/ui/Layers.java (80%) rename platform/util/{ui => }/src/com/intellij/util/ui/ListTableModel.java (89%) rename platform/util/{ui => }/src/com/intellij/util/ui/MacUIUtil.java (98%) rename platform/util/{ui => }/src/com/intellij/util/ui/MouseEventAdapter.java (98%) rename platform/util/{ui => }/src/com/intellij/util/ui/MouseEventHandler.java (66%) rename platform/util/{ui => }/src/com/intellij/util/ui/MultiRowFlowPanel.java (84%) create mode 100644 platform/util/src/com/intellij/util/ui/PlatformColors.java rename platform/util/{ui => }/src/com/intellij/util/ui/RadioButtonEnumModel.java (71%) rename platform/util/{ui => }/src/com/intellij/util/ui/RegionPainter.java (86%) create mode 100644 platform/util/src/com/intellij/util/ui/SameColor.java rename platform/util/{ui => }/src/com/intellij/util/ui/ScrollUtil.java (87%) create mode 100644 platform/util/src/com/intellij/util/ui/SortableColumnModel.java rename platform/util/{ui => }/src/com/intellij/util/ui/SplitByLetterPolicy.java (61%) rename platform/util/{ui => }/src/com/intellij/util/ui/SplitBySeparatorPolicy.java (76%) create mode 100644 platform/util/src/com/intellij/util/ui/TableViewModel.java rename platform/util/{ui => }/src/com/intellij/util/ui/ThreeStateCheckBox.java (91%) create mode 100644 platform/util/src/com/intellij/util/ui/TwoColorsIcon.java rename platform/util/{ui => }/src/com/intellij/util/ui/UIUtil.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/WatermarkIcon.java (53%) rename platform/util/{ui => }/src/com/intellij/util/ui/WavePainter.java (50%) rename platform/util/{ui => }/src/com/intellij/util/ui/WavePainter2D.java (97%) rename platform/util/{ui => }/src/com/intellij/util/ui/accessibility/AbstractAccessibleContextDelegate.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/accessibility/AccessibleContextAccessor.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/accessibility/AccessibleContextDelegate.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/accessibility/AccessibleContextUtil.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/accessibility/ScreenReader.java (100%) rename platform/util/{ui => }/src/com/intellij/util/ui/accessibility/SimpleAccessible.java (90%) rename platform/util/{ui => }/src/com/intellij/util/ui/components/BorderLayoutPanel.java (81%) create mode 100644 platform/util/src/com/intellij/util/ui/components/JBComponent.java rename platform/util/{ui => }/src/com/intellij/util/ui/tree/AbstractTreeModel.java (84%) rename platform/util/{ui => }/src/com/intellij/util/ui/tree/TreeModelAdapter.java (80%) rename platform/util/{ui => }/src/com/intellij/util/ui/tree/TreeModelListenerList.java (82%) rename platform/util/{ui => }/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java (96%) rename platform/util/{ui => }/src/com/intellij/util/ui/update/ComparableObject.java (57%) rename platform/util/{ui => }/src/com/intellij/util/ui/update/ComparableObjectCheck.java (63%) create mode 100644 platform/util/src/org/apache/batik/script/rhino/RhinoInterpreter.java create mode 100644 platform/util/src/org/apache/batik/script/rhino/RhinoInterpreterFactory.java rename platform/util/{ui => }/src/org/w3c/dom/ElementTraversal.java (79%) rename platform/util/{ui => }/src/org/w3c/dom/Location.java (78%) rename platform/util/{ui => }/src/org/w3c/dom/Window.java (77%) delete mode 100644 platform/util/ui/src/com/intellij/openapi/ui/DescriptionLabel.java delete mode 100644 platform/util/ui/src/com/intellij/openapi/ui/Divider.java delete mode 100644 platform/util/ui/src/com/intellij/openapi/ui/NullableComponent.java delete mode 100644 platform/util/ui/src/com/intellij/openapi/ui/Splittable.java delete mode 100644 platform/util/ui/src/com/intellij/openapi/util/IdRunnable.java delete mode 100644 platform/util/ui/src/com/intellij/ui/ActiveComponent.java delete mode 100644 platform/util/ui/src/com/intellij/ui/CollapsingListener.java delete mode 100644 platform/util/ui/src/com/intellij/ui/Colors.java delete mode 100644 platform/util/ui/src/com/intellij/ui/FileColorName.java delete mode 100644 platform/util/ui/src/com/intellij/ui/Gradient.java delete mode 100644 platform/util/ui/src/com/intellij/ui/RetrievableIcon.java delete mode 100644 platform/util/ui/src/com/intellij/ui/SeparatorOrientation.java delete mode 100644 platform/util/ui/src/com/intellij/ui/mac/foundation/ID.java delete mode 100644 platform/util/ui/src/com/intellij/ui/mac/foundation/Selector.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/AbstractTableCellEditor.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/ClientPropertyHolder.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/EditableModel.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/EditableTreeModel.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/ElementProducer.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/EmptyClipboardOwner.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/Html.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/IsRetina.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/ItemRemovable.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/JBImageIcon.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/JBPoint.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/PlatformColors.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/SameColor.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/SortableColumnModel.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/TableViewModel.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/TwoColorsIcon.java delete mode 100644 platform/util/ui/src/com/intellij/util/ui/components/JBComponent.java delete mode 100644 platform/util/ui/src/org/apache/batik/script/InterpreterPool.java delete mode 100644 plugins/sh/testData/shellcheck/disableInspection.after.sh delete mode 100644 plugins/sh/testData/shellcheck/disableInspection.sh delete mode 100644 plugins/sh/testData/shellcheck/quickFix.after.sh delete mode 100644 plugins/sh/testData/shellcheck/quickFix.sh delete mode 100644 plugins/sh/testData/shellcheck/suppressInspection.after.sh delete mode 100644 plugins/sh/testData/shellcheck/suppressInspection.sh delete mode 100644 plugins/sh/testData/shellcheck/suppressSameInspection.after.sh delete mode 100644 plugins/sh/testData/shellcheck/suppressSameInspection.sh delete mode 100644 plugins/sh/tests/com/intellij/sh/ShTestSuite.java create mode 100644 plugins/sh/tests/com/intellij/sh/lexer/ShHighlightingLexerTest.java delete mode 100644 plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckInspectionTest.java delete mode 100644 plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestSetup.java delete mode 100644 plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestUtil.java diff --git a/.idea/libraries/batik.xml b/.idea/libraries/batik.xml new file mode 100644 index 000000000000..97e7b31c4be6 --- /dev/null +++ b/.idea/libraries/batik.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/batik_transcoder.xml b/.idea/libraries/batik_transcoder.xml deleted file mode 100644 index b53a66849b2c..000000000000 --- a/.idea/libraries/batik_transcoder.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index d7d08db933d7..da4fa9eff2c0 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -626,11 +626,10 @@ - + - diff --git a/java/compiler/openapi/intellij.java.compiler.iml b/java/compiler/openapi/intellij.java.compiler.iml index 539164484755..017da494bbc3 100644 --- a/java/compiler/openapi/intellij.java.compiler.iml +++ b/java/compiler/openapi/intellij.java.compiler.iml @@ -10,7 +10,6 @@ - diff --git a/java/java-analysis-impl/intellij.java.analysis.impl.iml b/java/java-analysis-impl/intellij.java.analysis.impl.iml index f60a50d6fb49..365dd92a69a1 100644 --- a/java/java-analysis-impl/intellij.java.analysis.impl.iml +++ b/java/java-analysis-impl/intellij.java.analysis.impl.iml @@ -23,6 +23,5 @@ - \ No newline at end of file diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java index 89baf76aa298..916475d4b5ba 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.codeStyle; import com.intellij.application.options.CodeStyle; @@ -20,7 +20,6 @@ import com.intellij.util.ArrayUtil; import com.intellij.util.BitUtil; import com.intellij.util.IncorrectOperationException; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.text.NameUtilCore; import gnu.trove.THashSet; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -624,7 +623,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager { } } - String[] words = NameUtilCore.nameToWords(methodName); + String[] words = NameUtil.nameToWords(methodName); if (words.length > 0) { final String firstWord = words[0]; if (GET_PREFIX.equals(firstWord) @@ -814,7 +813,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager { name = variableNameToPropertyName(name, VariableKind.PARAMETER); if (expressions.length == 1) { final String methodName = method.getName(); - String[] words = NameUtilCore.nameToWords(methodName); + String[] words = NameUtil.nameToWords(methodName); if (words.length > 0) { final String firstWord = words[0]; if (SET_PREFIX.equals(firstWord)) { @@ -912,7 +911,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager { @Override public String propertyNameToVariableName(@NotNull String propertyName, @NotNull VariableKind variableKind) { if (variableKind == VariableKind.STATIC_FINAL_FIELD) { - String[] words = NameUtilCore.nameToWords(propertyName); + String[] words = NameUtil.nameToWords(propertyName); return StringUtil.join(words, StringUtil::toUpperCase, "_"); } diff --git a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java index f301b0cedc53..2b8a1c9a0f7c 100644 --- a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java +++ b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java @@ -1,10 +1,25 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.refactoring.rename; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; import com.intellij.psi.codeStyle.JavaCodeStyleManager; +import com.intellij.psi.codeStyle.NameUtil; import com.intellij.psi.codeStyle.SuggestedNameInfo; import com.intellij.psi.codeStyle.VariableKind; import com.intellij.psi.util.PropertyUtilBase; @@ -12,7 +27,6 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.usageView.UsageViewUtil; import com.intellij.util.ArrayUtil; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -88,18 +102,18 @@ public class JavaNameSuggestionProvider implements NameSuggestionProvider { final VariableKind kind = codeStyleManager.getVariableKind((PsiVariable)psiElement); prefix = codeStyleManager.getPrefixByVariableKind(kind); if (kind == VariableKind.STATIC_FINAL_FIELD) { - final String[] words = NameUtilCore.splitNameIntoWords(name); + final String[] words = NameUtil.splitNameIntoWords(name); String buffer = Arrays.stream(words).map(StringUtil::toUpperCase).collect(Collectors.joining("_")); return new String[] {buffer}; } } final List result = new ArrayList<>(); - result.add(suggestProperlyCasedName(prefix, NameUtilCore.splitNameIntoWords(name))); + result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(name))); if (name.startsWith(prefix) && !prefix.isEmpty()) { name = name.substring(prefix.length()); - result.add(suggestProperlyCasedName(prefix, NameUtilCore.splitNameIntoWords(name))); + result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(name))); } - result.add(suggestProperlyCasedName(prefix, NameUtilCore.splitNameIntoWords(StringUtil.toLowerCase(name)))); + result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(StringUtil.toLowerCase(name)))); return ArrayUtil.toStringArray(result); } diff --git a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java index a49d855ee201..7c409b36e442 100644 --- a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java +++ b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java @@ -381,7 +381,8 @@ public class RefactoringUtil { if (infos.length > 0) { type = infos[0].getType(); if (type instanceof PsiPrimitiveType) { - type = ((PsiPrimitiveType)type).getBoxedType(expr); + type = infos.length > 1 && !(infos[1].getType() instanceof PsiPrimitiveType) ? infos[1].getType() + : ((PsiPrimitiveType)type).getBoxedType(expr); } } else { diff --git a/java/java-psi-api/intellij.java.psi.iml b/java/java-psi-api/intellij.java.psi.iml index 637d6a661985..41eeef4653dd 100644 --- a/java/java-psi-api/intellij.java.psi.iml +++ b/java/java-psi-api/intellij.java.psi.iml @@ -8,6 +8,5 @@ - \ No newline at end of file diff --git a/java/java-psi-impl/intellij.java.psi.impl.iml b/java/java-psi-impl/intellij.java.psi.impl.iml index ae060f3a4b39..1293f223ab3e 100644 --- a/java/java-psi-impl/intellij.java.psi.impl.iml +++ b/java/java-psi-impl/intellij.java.psi.impl.iml @@ -13,6 +13,5 @@ - \ No newline at end of file diff --git a/java/java-structure-view/intellij.java.structureView.iml b/java/java-structure-view/intellij.java.structureView.iml index 3bb6d240b86c..761efd80e1ad 100644 --- a/java/java-structure-view/intellij.java.structureView.iml +++ b/java/java-structure-view/intellij.java.structureView.iml @@ -9,6 +9,5 @@ - \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/template/JavaLiveTemplateTest.groovy b/java/java-tests/testSrc/com/intellij/java/codeInsight/template/JavaLiveTemplateTest.groovy index 6776d443d051..2e74d887a7f7 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/template/JavaLiveTemplateTest.groovy +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/template/JavaLiveTemplateTest.groovy @@ -7,6 +7,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.EmptyExpression import com.intellij.codeInsight.lookup.Lookup import com.intellij.codeInsight.template.JavaCodeContextType import com.intellij.codeInsight.template.Template +import com.intellij.codeInsight.template.TemplateManager import com.intellij.codeInsight.template.actions.SaveAsTemplateAction import com.intellij.codeInsight.template.impl.* import com.intellij.codeInsight.template.macro.* @@ -16,6 +17,7 @@ import com.intellij.psi.PsiDocumentManager import groovy.transform.CompileStatic import static com.intellij.codeInsight.template.Template.Property.USE_STATIC_IMPORT_IF_POSSIBLE + /** * @author peter */ @@ -27,7 +29,8 @@ class JavaLiveTemplateTest extends LiveTemplateTestCase { myFixture.configureByText 'a.java', ''' ''' - Template template = templateManager.createTemplate("imp", "user", 'import $MODIFIER$ java.$NAME$;') + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("imp", "user", 'import $MODIFIER$ java.$NAME$;') template.addVariable('NAME', new MacroCallNode(new CompleteMacro(true)), new EmptyNode(), true) template.addVariable('MODIFIER', new EmptyExpression(), true) startTemplate(template) @@ -49,7 +52,8 @@ public class Main { } } ''' - Template template = templateManager.createTemplate("for", "user", 'for ($ELEMENT_TYPE$ $VAR$ : $ITERABLE_TYPE$) {\n' + + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("for", "user", 'for ($ELEMENT_TYPE$ $VAR$ : $ITERABLE_TYPE$) {\n' + '$END$;\n' + '}') template.addVariable('ITERABLE_TYPE', new MacroCallNode(new CompleteSmartMacro()), new EmptyNode(), true) @@ -84,7 +88,8 @@ public class Main { } } ''' - Template template = templateManager.createTemplate("for", "user", 'for ($ELEMENT_TYPE$ $VAR$ : $ITERABLE_TYPE$) {\n' + + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("for", "user", 'for ($ELEMENT_TYPE$ $VAR$ : $ITERABLE_TYPE$) {\n' + '$END$;\n' + '}') template.addVariable('ITERABLE_TYPE', new MacroCallNode(new CompleteSmartMacro()), new EmptyNode(), true) @@ -116,7 +121,8 @@ class Foo { { } } ''' - Template template = templateManager.createTemplate("frm", "user", '$VAR$') + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("frm", "user", '$VAR$') template.addVariable('VAR', new MacroCallNode(new ClassNameCompleteMacro()), new EmptyNode(), true) startTemplate(template) assert !state.finished @@ -140,7 +146,8 @@ class Outer { } ''' - Template template = templateManager.createTemplate("myCbDo", "user", 'MyUtils.doSomethingWithCallback($CB$)') + TemplateManager manager = TemplateManager.getInstance(getProject()) + Template template = manager.createTemplate("myCbDo", "user", 'MyUtils.doSomethingWithCallback($CB$)') MacroCallNode call = new MacroCallNode(new VariableOfTypeMacro()) call.addParameter(new ConstantNode("MyCallback")) @@ -303,7 +310,8 @@ class Foo { } ''' - Template template = templateManager.createTemplate("result", "user", '$T$ result;') + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("result", "user", '$T$ result;') template.addVariable('T', new MacroCallNode(new MethodReturnTypeMacro()), new EmptyNode(), false) template.toReformat = true @@ -356,7 +364,8 @@ class Foo { } } """ - Template template = templateManager.createTemplate("xxx", "user", 'foo.Bar.someMethod($END$)') + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("xxx", "user", 'foo.Bar.someMethod($END$)') template.setValue(USE_STATIC_IMPORT_IF_POSSIBLE, true) startTemplate(template) @@ -386,7 +395,8 @@ class Foo { } } """ - Template template = templateManager.createTemplate("xxx", "user", 'foo.Bar.someMethod($END$)') + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("xxx", "user", 'foo.Bar.someMethod($END$)') template.setValue(USE_STATIC_IMPORT_IF_POSSIBLE, true) startTemplate(template) @@ -409,7 +419,8 @@ class Foo { } } """ - Template template = templateManager.createTemplate("xxx", "user", 'java.lang.Math.abs(java.lang.Math.PI);') + final TemplateManager manager = TemplateManager.getInstance(getProject()) + final Template template = manager.createTemplate("xxx", "user", 'java.lang.Math.abs(java.lang.Math.PI);') template.setValue(USE_STATIC_IMPORT_IF_POSSIBLE, true) startTemplate(template) diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTest.groovy b/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTest.groovy index 6b2782cacf8e..8ba601c7339d 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTest.groovy +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTest.groovy @@ -349,19 +349,20 @@ class Foo { } void testJavaOtherContext() throws IOException { + def manager = (TemplateManagerImpl)TemplateManager.getInstance(project) def stmtContext = TemplateContextType.EP_NAME.findExtension(JavaCodeContextType.Statement) configureFromFileText("a.java", "class Foo {{ iter }}") TemplateImpl template = TemplateSettings.instance.getTemplate("iter", "iterations") - assert (template in templateManager.findMatchingTemplates(myFixture.file, editor, Lookup.REPLACE_SELECT_CHAR, TemplateSettings.instance)?.keySet()) + assert (template in manager.findMatchingTemplates(myFixture.file, editor, Lookup.REPLACE_SELECT_CHAR, TemplateSettings.instance)?.keySet()) assert template.templateContext.getOwnValue(stmtContext) assert !template.templateContext.getOwnValue(stmtContext.baseContextType) template.templateContext.setEnabled(stmtContext, false) template.templateContext.setEnabled(stmtContext.baseContextType, true) try { - assert !(template in templateManager.findMatchingTemplates(myFixture.file, editor, Lookup.REPLACE_SELECT_CHAR, TemplateSettings.instance)?.keySet()) + assert !(template in manager.findMatchingTemplates(myFixture.file, editor, Lookup.REPLACE_SELECT_CHAR, TemplateSettings.instance)?.keySet()) } finally { template.templateContext.setEnabled(stmtContext, true) template.templateContext.setEnabled(stmtContext.baseContextType, false) @@ -955,6 +956,7 @@ class Foo { } void "test finish template on moving caret by completion insert handler"() { + TemplateManagerImpl templateManager = TemplateManager.getInstance(project) as TemplateManagerImpl myFixture.configureByText('a.html', '

') def template = TemplateSettings.instance.getTemplate("T", "HTML/XML") myFixture.testAction(new InvokeTemplateAction(template, myFixture.editor, myFixture.project, new HashSet())) @@ -965,23 +967,6 @@ class Foo { assertNull(templateManager.getActiveTemplate(myFixture.editor)) } - void "test goto next variable when completion insert handler moves toward it"() { - myFixture.configureByText('a.java', 'class C { void foo(C c, String s) {}; { } }') - - Template template = templateManager.createTemplate("empty", "user", 'foo($CS$, "$S$");') - template.addVariable("CS", "completeSmart()", '', true) - template.addVariable("S", "", '""', true) - templateManager.startTemplate(myFixture.editor, template) - UIUtil.dispatchAllInvocationEvents() - - assert myFixture.editor.document.text.contains('foo(this, "");') - assert state - - myFixture.type("string\n") - assert myFixture.editor.document.text.contains('foo(this, "string");') - assert !state - } - void "test escape with selection"() { myFixture.configureByText "a.java", """ class Foo { @@ -996,10 +981,10 @@ class Foo { myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ESCAPE) assert !myFixture.editor.selectionModel.hasSelection() - assert templateManager.getActiveTemplate(myFixture.editor) + assert TemplateManager.getInstance(project).getActiveTemplate(myFixture.editor) myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ESCAPE) - assert !templateManager.getActiveTemplate(myFixture.editor) + assert !TemplateManager.getInstance(project).getActiveTemplate(myFixture.editor) myFixture.checkResult """ class Foo { @@ -1024,10 +1009,10 @@ class Foo { myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ESCAPE) assert !myFixture.lookup - assert templateManager.getActiveTemplate(myFixture.editor) + assert TemplateManager.getInstance(project).getActiveTemplate(myFixture.editor) myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ESCAPE) - assert !templateManager.getActiveTemplate(myFixture.editor) + assert !TemplateManager.getInstance(project).getActiveTemplate(myFixture.editor) myFixture.checkResult """ class Foo { @@ -1057,10 +1042,10 @@ class Foo { myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ESCAPE) assert !myFixture.editor.selectionModel.hasSelection() assert !myFixture.lookup - assert templateManager.getActiveTemplate(myFixture.editor) + assert TemplateManager.getInstance(project).getActiveTemplate(myFixture.editor) myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ESCAPE) - assert !templateManager.getActiveTemplate(myFixture.editor) + assert !TemplateManager.getInstance(project).getActiveTemplate(myFixture.editor) myFixture.checkResult """ class Foo { @@ -1087,7 +1072,7 @@ class Foo { myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ESCAPE) assert !myFixture.lookup - assert !templateManager.getActiveTemplate(myFixture.editor) + assert !TemplateManager.getInstance(project).getActiveTemplate(myFixture.editor) myFixture.checkResult """ class Foo { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTestCase.groovy b/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTestCase.groovy index 94dabb64a57e..23913d3e39ab 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTestCase.groovy +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/template/LiveTemplateTestCase.groovy @@ -39,10 +39,6 @@ abstract class LiveTemplateTestCase extends LightCodeInsightFixtureTestCase { editor?.with { TemplateManagerImpl.getTemplateState(it) } } - protected TemplateManagerImpl getTemplateManager() { - return TemplateManager.getInstance(project) as TemplateManagerImpl - } - def startTemplate(Template template) { TemplateManager.getInstance(getProject()).startTemplate(getEditor(), template) UIUtil.dispatchAllInvocationEvents() diff --git a/java/java-tests/testSrc/com/intellij/java/refactoring/LightIntroduceVariableTest.java b/java/java-tests/testSrc/com/intellij/java/refactoring/LightIntroduceVariableTest.java index ad78d0443d28..b8867f9da57b 100644 --- a/java/java-tests/testSrc/com/intellij/java/refactoring/LightIntroduceVariableTest.java +++ b/java/java-tests/testSrc/com/intellij/java/refactoring/LightIntroduceVariableTest.java @@ -3,9 +3,13 @@ package com.intellij.java.refactoring; import com.intellij.JavaTestUtil; import com.intellij.openapi.fileTypes.StdFileTypes; +import com.intellij.psi.PsiArrayType; import com.intellij.psi.PsiExpression; import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiType; +import com.intellij.psi.util.PsiTreeUtil; import com.intellij.refactoring.introduceVariable.IntroduceVariableBase; +import com.intellij.refactoring.util.RefactoringUtil; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import org.jetbrains.annotations.NotNull; @@ -18,6 +22,15 @@ public class LightIntroduceVariableTest extends LightCodeInsightFixtureTestCase IntroduceVariableBase.collectExpressions(file, myFixture.getEditor(), myFixture.getCaretOffset(), false); assertSize(2, expressions); } + + public void testPreferVarargsToBoxing() { + PsiFile file = myFixture.configureByText(StdFileTypes.JAVA, "class A { void m(int... is) {} {m(null);}}"); + PsiExpression expression = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getEditor().getCaretModel().getOffset()), PsiExpression.class); + assertNotNull(expression); + PsiType type = RefactoringUtil.getTypeByExpression(expression); + assertTrue(type instanceof PsiArrayType); + } + @NotNull @Override protected String getTestDataPath() { diff --git a/java/openapi/intellij.java.iml b/java/openapi/intellij.java.iml index 6a536986ca54..5226b74eef6b 100644 --- a/java/openapi/intellij.java.iml +++ b/java/openapi/intellij.java.iml @@ -27,7 +27,6 @@ -
\ No newline at end of file diff --git a/platform/analysis-impl/intellij.platform.analysis.impl.iml b/platform/analysis-impl/intellij.platform.analysis.impl.iml index b307b271f275..9a7da7630777 100644 --- a/platform/analysis-impl/intellij.platform.analysis.impl.iml +++ b/platform/analysis-impl/intellij.platform.analysis.impl.iml @@ -18,6 +18,5 @@ -
\ No newline at end of file diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy index cae7a0d1bccd..2355ee134cc1 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy @@ -131,10 +131,8 @@ class CommunityLibraryLicenses { url: "http://joel-costigliola.github.io/assertj/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt"), new LibraryLicense(name: "Automaton", libraryName: "automaton", version: "1.12-1", license: "BSD", url: "http://www.brics.dk/automaton/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php"), - - new LibraryLicense(name: "batik", libraryName: "batik-transcoder", version: "1.11", license: "Apache 2.0", + new LibraryLicense(name: "batik", libraryName: "batik", version: "1.9.1", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://xmlgraphics.apache.org/batik/"), - new LibraryLicense(name: "bouncy-castle", version: "1.59", license: "MIT License", url: "http://bouncycastle.org", licenseUrl: "http://bouncycastle.org/licence.html"), new LibraryLicense(name: "bouncy-castle-provider", version: "1.59", license: "MIT License", url: "http://bouncycastle.org", diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy index 0a07772eee6a..d569e40465d9 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy @@ -120,8 +120,7 @@ class DistributionJARsBuilder { withModule("intellij.platform.util") withModule("intellij.platform.util.rt", "util.jar") withModule("intellij.platform.util.classLoader", "util.jar") - withModule("intellij.platform.util.ui") - withModule("intellij.platform.concurrency") + withModule("intellij.platform.util.concurrency") withModule("intellij.platform.extensions") withModule("intellij.platform.bootstrap") diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MavenArtifactsBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MavenArtifactsBuilder.groovy index 711a72282b09..0f6466f8083b 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MavenArtifactsBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/MavenArtifactsBuilder.groovy @@ -3,6 +3,7 @@ package org.jetbrains.intellij.build.impl import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.StringUtil +import com.intellij.psi.codeStyle.NameUtil import groovy.transform.CompileDynamic import groovy.transform.CompileStatic import groovy.transform.Immutable @@ -138,14 +139,7 @@ class MavenArtifactsBuilder { } private static List splitByCamelHumpsMergingNumbers(String s) { - String[] words - try { - words = Class.forName("com.intellij.util.text.NameUtilCore").getDeclaredMethod("splitNameIntoWords", String.class).invoke(null, s) as String[] - } - catch (Throwable ignore) { - words = Class.forName("com.intellij.psi.codeStyle.NameUtil").getDeclaredMethod("splitNameIntoWords", String.class).invoke(null, s) as String[] - } - + def words = NameUtil.splitNameIntoWords(s) def result = new ArrayList() for (int i = 0; i < words.length; i++) { String next diff --git a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt index 3ed7398ac1a2..ae163b302a2c 100644 --- a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt +++ b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt @@ -428,11 +428,11 @@ class IconsClassGenerator(private val projectHome: File, val util: JpsModule, pr } } - return if (Character.isJavaIdentifierStart(sb.first())) { - sb.toString() + if (Character.isJavaIdentifierStart(sb.first())) { + return sb.toString() } else { - "_$sb" + return "_" + sb.toString() } } diff --git a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/generateIconClasses.kt b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/generateIconClasses.kt index d29f81e7d56e..bdcc7884dabc 100644 --- a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/generateIconClasses.kt +++ b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/generateIconClasses.kt @@ -1,4 +1,6 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ package org.jetbrains.intellij.build.images import com.intellij.openapi.application.PathManager @@ -12,7 +14,9 @@ internal fun generateIconsClasses() { val home = File(homePath) val project = JpsSerializationManager.getInstance().loadModel(homePath, null).project - val generator = IconsClassGenerator(home, project.modules.find { it.name == "intellij.platform.util.ui" } ?: throw IllegalStateException("Can't load module 'util'")) + val util = project.modules.find { it.name == "intellij.platform.util" } ?: throw IllegalStateException("Can't load module 'util'") + + val generator = IconsClassGenerator(home, util) project.modules.parallelStream().forEach(generator::processModule) generator.printStats() diff --git a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/mappings/generateMappings.kt b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/mappings/generateMappings.kt index 3a588e98ae0f..13d302426c21 100644 --- a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/mappings/generateMappings.kt +++ b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/mappings/generateMappings.kt @@ -1,6 +1,7 @@ // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.intellij.build.images.mappings +import com.intellij.openapi.application.PathManager import org.jetbrains.intellij.build.images.IconsClassGenerator import org.jetbrains.intellij.build.images.ImageCollector import org.jetbrains.intellij.build.images.isImage @@ -87,7 +88,10 @@ private fun loadIdeaGeneratedIcons(context: Context): Collection { val home = context.devRepoDir val homePath = home.absolutePath val project = JpsSerializationManager.getInstance().loadModel(homePath, null).project - val generator = IconsClassGenerator(home, project.modules.find { it.name == "intellij.platform.util.ui" } ?: throw error("Can't load module 'util'")) + val util = project.modules.find { + it.name == "intellij.platform.util" + } ?: throw error("Can't load module 'util'") + val generator = IconsClassGenerator(home, util) return protectStdErr { project.modules.parallelStream().map { module -> val iconsClassInfo = generator.getIconsClassInfo(module) ?: return@map null diff --git a/platform/build-scripts/icons/tests/org/jetbrains/intellij/build/images/ImageResourcesTest.kt b/platform/build-scripts/icons/tests/org/jetbrains/intellij/build/images/ImageResourcesTest.kt index ccde6b5f0b9b..d3d62ad60538 100644 --- a/platform/build-scripts/icons/tests/org/jetbrains/intellij/build/images/ImageResourcesTest.kt +++ b/platform/build-scripts/icons/tests/org/jetbrains/intellij/build/images/ImageResourcesTest.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.intellij.build.images import com.intellij.openapi.application.PathManager @@ -116,8 +116,10 @@ abstract class ImageResourcesTestBase { @JvmStatic fun collectNonRegeneratedIconClasses(root: TestRoot): List> { val model = loadProjectModel(root) + val util = model.project.modules.find { it.name == "intellij.platform.util" } ?: throw IllegalStateException("Can't load module 'util'") val modules = collectModules(root, model) - val checker = MyIconClassFileChecker(File(PathManager.getHomePath()), model.project.modules.find { it.name == "intellij.platform.util.ui" } ?: throw IllegalStateException("Can't load module 'util'")) + + val checker = MyIconClassFileChecker(File(PathManager.getHomePath()), util) modules.forEach { checker.checkIconClasses(it) } diff --git a/platform/core-api/intellij.platform.core.iml b/platform/core-api/intellij.platform.core.iml index 9a58fcdb2597..1ee2ee25db09 100644 --- a/platform/core-api/intellij.platform.core.iml +++ b/platform/core-api/intellij.platform.core.iml @@ -13,6 +13,5 @@ -
\ No newline at end of file diff --git a/platform/core-api/src/com/intellij/ide/TypePresentationService.java b/platform/core-api/src/com/intellij/ide/TypePresentationService.java index 7bd1bf29b94d..8fb5eaf4b046 100644 --- a/platform/core-api/src/com/intellij/ide/TypePresentationService.java +++ b/platform/core-api/src/com/intellij/ide/TypePresentationService.java @@ -1,9 +1,23 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ide; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.text.NameUtilCore; +import com.intellij.psi.codeStyle.NameUtil; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -36,6 +50,6 @@ public abstract class TypePresentationService { if (i >= 0) { simpleName = simpleName.substring(i + 1); } - return StringUtil.capitalizeWords(StringUtil.join(NameUtilCore.nameToWords(simpleName), " "), true); + return StringUtil.capitalizeWords(StringUtil.join(NameUtil.nameToWords(simpleName), " "), true); } } diff --git a/platform/core-impl/intellij.platform.core.impl.iml b/platform/core-impl/intellij.platform.core.impl.iml index c8fa13492872..29fafb1ed976 100644 --- a/platform/core-impl/intellij.platform.core.impl.iml +++ b/platform/core-impl/intellij.platform.core.impl.iml @@ -11,6 +11,5 @@ -
\ No newline at end of file diff --git a/platform/diff-api/intellij.platform.diff.iml b/platform/diff-api/intellij.platform.diff.iml index 7e12bce90f97..2d438213c832 100644 --- a/platform/diff-api/intellij.platform.diff.iml +++ b/platform/diff-api/intellij.platform.diff.iml @@ -8,6 +8,5 @@ -
\ No newline at end of file diff --git a/platform/editor-ui-api/intellij.platform.editor.iml b/platform/editor-ui-api/intellij.platform.editor.iml index 1f00225f0f16..c5b5cd4ca74e 100644 --- a/platform/editor-ui-api/intellij.platform.editor.iml +++ b/platform/editor-ui-api/intellij.platform.editor.iml @@ -16,7 +16,6 @@ - - +
\ No newline at end of file diff --git a/platform/editor-ui-ex/intellij.platform.editor.ex.iml b/platform/editor-ui-ex/intellij.platform.editor.ex.iml index 819c40802c50..989d24dd80b0 100644 --- a/platform/editor-ui-ex/intellij.platform.editor.ex.iml +++ b/platform/editor-ui-ex/intellij.platform.editor.ex.iml @@ -14,6 +14,5 @@ -
\ No newline at end of file diff --git a/platform/external-system-api/intellij.platform.externalSystem.iml b/platform/external-system-api/intellij.platform.externalSystem.iml index 7e660b13b7d0..f7169ddfae4d 100644 --- a/platform/external-system-api/intellij.platform.externalSystem.iml +++ b/platform/external-system-api/intellij.platform.externalSystem.iml @@ -21,6 +21,5 @@ -
\ No newline at end of file diff --git a/platform/indexing-api/intellij.platform.indexing.iml b/platform/indexing-api/intellij.platform.indexing.iml index 187ad6f064d0..e12007973871 100644 --- a/platform/indexing-api/intellij.platform.indexing.iml +++ b/platform/indexing-api/intellij.platform.indexing.iml @@ -11,6 +11,5 @@ - \ No newline at end of file diff --git a/platform/lang-api/intellij.platform.lang.iml b/platform/lang-api/intellij.platform.lang.iml index aca4a49128cd..6f1120545586 100644 --- a/platform/lang-api/intellij.platform.lang.iml +++ b/platform/lang-api/intellij.platform.lang.iml @@ -19,6 +19,5 @@ - \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java index f3cab5fe1792..11568d7b7fa9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java @@ -109,7 +109,7 @@ public class TemplateState implements Disposable { @Override public void itemSelected(@NotNull LookupEvent event) { if (isCaretOutsideCurrentSegment(null)) { - if (isCaretInsideOrBeforeNextVariable()) { + if (isCaretInsideNextVariable()) { nextTab(); } else { @@ -176,17 +176,11 @@ public class TemplateState implements Disposable { editor.getCaretModel().addCaretListener(listener, this); } - private boolean isCaretInsideOrBeforeNextVariable() { + private boolean isCaretInsideNextVariable() { if (myEditor != null && myCurrentVariableNumber >= 0) { int nextVar = getNextVariableNumber(myCurrentVariableNumber); - TextRange nextVarRange = nextVar < 0 ? null : getVariableRange(myTemplate.getVariableNameAt(nextVar)); - if (nextVarRange == null) return false; - - int caretOffset = myEditor.getCaretModel().getOffset(); - if (nextVarRange.containsOffset(caretOffset)) return true; - - TextRange currentVarRange = getVariableRange(myTemplate.getVariableNameAt(myCurrentVariableNumber)); - return currentVarRange != null && currentVarRange.getEndOffset() < caretOffset && caretOffset < nextVarRange.getStartOffset(); + TextRange range = nextVar < 0 ? null : getVariableRange(myTemplate.getVariableNameAt(nextVar)); + return range != null && range.containsOffset(myEditor.getCaretModel().getOffset()); } return false; } @@ -966,7 +960,7 @@ public class TemplateState implements Disposable { TextRange range = getCurrentVariableRange(); if (range != null && range.getLength() > 0) { int caret = myEditor.getCaretModel().getOffset(); - if (caret == range.getEndOffset() || isCaretInsideOrBeforeNextVariable()) { + if (caret == range.getEndOffset() || isCaretInsideNextVariable()) { nextTab(); } else if (caret > range.getEndOffset()) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/macro/ConvertToCamelCaseMacro.java b/platform/lang-impl/src/com/intellij/codeInsight/template/macro/ConvertToCamelCaseMacro.java index 15a17faed8c6..255dba0a9651 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/macro/ConvertToCamelCaseMacro.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/macro/ConvertToCamelCaseMacro.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.template.macro; import com.google.common.annotations.VisibleForTesting; @@ -8,7 +22,7 @@ import com.intellij.codeInsight.template.ExpressionContext; import com.intellij.codeInsight.template.Result; import com.intellij.codeInsight.template.TextResult; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.text.NameUtilCore; +import com.intellij.psi.codeStyle.NameUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,7 +66,7 @@ public class ConvertToCamelCaseMacro extends MacroBase { @NotNull protected String[] splitWords(String text) { - return NameUtilCore.nameToWords(text); + return NameUtil.nameToWords(text); } public static class ReplaceUnderscoresToCamelCaseMacro extends ConvertToCamelCaseMacro { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java index 7d826a665e9a..5bdb05977701 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java @@ -12,6 +12,7 @@ import com.intellij.ide.impl.ProjectUtil; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.TransactionGuard; import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.application.ex.ApplicationInfoEx; import com.intellij.openapi.application.ex.ApplicationManagerEx; @@ -146,7 +147,7 @@ public class InspectionApplication { return; } - Project project = ProjectUtil.openOrImport(projectPath, null, false); + Project project = openProject(projectPath); if (project == null) { logError("Unable to open project"); gracefulExit(); @@ -243,6 +244,12 @@ public class InspectionApplication { } } + private static Project openProject(@NotNull @SystemIndependent String projectPath) { + Project[] project = new Project[1]; + TransactionGuard.getInstance().submitTransactionAndWait(() -> project[0] = ProjectUtil.openOrImport(projectPath, null, false)); + return project[0]; + } + private void runUnderProgress(@NotNull Project project, @NotNull GlobalInspectionContextImpl context, @NotNull AnalysisScope scope, diff --git a/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java b/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java index 191d0e2b3039..d7b6b6c2ce0b 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java @@ -31,12 +31,12 @@ import java.util.List; import java.util.function.Consumer; public class CommonProgramParametersPanel extends JPanel implements PanelWithAnchor { - protected LabeledComponent myProgramParametersComponent; - protected LabeledComponent myWorkingDirectoryComponent; + private LabeledComponent myProgramParametersComponent; + private LabeledComponent myWorkingDirectoryComponent; @Deprecated protected TextFieldWithBrowseButton myWorkingDirectoryField; - protected MacroComboBoxWithBrowseButton myWorkingDirectoryComboBox; - protected EnvironmentVariablesComponent myEnvVariablesComponent; + private MacroComboBoxWithBrowseButton myWorkingDirectoryComboBox; + private EnvironmentVariablesComponent myEnvVariablesComponent; protected JComponent myAnchor; private Module myModuleContext = null; @@ -183,7 +183,7 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc myEnvVariablesComponent.setAnchor(anchor); } - public void applyTo(@NotNull CommonProgramRunConfigurationParameters configuration) { + public void applyTo(CommonProgramRunConfigurationParameters configuration) { configuration.setProgramParameters(fromTextField(myProgramParametersComponent.getComponent(), configuration)); configuration.setWorkingDirectory(fromTextField(myWorkingDirectoryComboBox, configuration)); @@ -196,7 +196,7 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc return textAccessor.getText(); } - public void reset(@NotNull CommonProgramRunConfigurationParameters configuration) { + public void reset(CommonProgramRunConfigurationParameters configuration) { setProgramParameters(configuration.getProgramParameters()); setWorkingDirectory(PathUtil.toSystemDependentName(configuration.getWorkingDirectory())); diff --git a/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/TopHitSEContributor.java b/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/TopHitSEContributor.java index cba5dc332f9d..472a22cbfdf8 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/TopHitSEContributor.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/TopHitSEContributor.java @@ -30,6 +30,8 @@ import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; +import javax.accessibility.Accessible; +import javax.accessibility.AccessibleContext; import javax.swing.*; import java.awt.*; import java.util.List; @@ -183,11 +185,27 @@ public class TopHitSEContributor implements SearchEverywhereContributor private static class TopHitRenderer extends ColoredListCellRenderer { private final Project myProject; + private final MyAccessiblePanel myRendererPanel = new MyAccessiblePanel(); private TopHitRenderer(Project project) { myProject = project; } + private static class MyAccessiblePanel extends JPanel { + private Accessible myAccessible; + MyAccessiblePanel() { + super(new BorderLayout()); + setOpaque(false); + } + void setAccessible(Accessible comp) { + myAccessible = comp; + } + @Override + public AccessibleContext getAccessibleContext() { + return accessibleContext = (myAccessible != null ? myAccessible.getAccessibleContext() : super.getAccessibleContext()); + } + } + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean selected, boolean hasFocus) { Component cmp = super.getListCellRendererComponent(list, value, index, selected, hasFocus); @@ -195,16 +213,34 @@ public class TopHitSEContributor implements SearchEverywhereContributor if (value instanceof BooleanOptionDescription) { final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(UIUtil.getListBackground(selected, true)); + panel.add(cmp, BorderLayout.CENTER); + final Component rightComponent; final OnOffButton button = new OnOffButton(); button.setSelected(((BooleanOptionDescription)value).isOptionEnabled()); + rightComponent = button; - panel.add(cmp, BorderLayout.CENTER); - panel.add(button, BorderLayout.EAST); + panel.add(rightComponent, BorderLayout.EAST); cmp = panel; } - return cmp; + Color bg = cmp.getBackground(); + if (bg == null) { + cmp.setBackground(UIUtil.getListBackground(selected, true)); + bg = cmp.getBackground(); + } + + myRendererPanel.removeAll(); + + JPanel wrapped = new JPanel(new BorderLayout()); + wrapped.setBackground(bg); + wrapped.add(cmp, BorderLayout.CENTER); + myRendererPanel.add(wrapped, BorderLayout.CENTER); + if (cmp instanceof Accessible) { + myRendererPanel.setAccessible((Accessible)cmp); + } + + return myRendererPanel; } @Override diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java index fd3db198e7af..00ef7706292e 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerImpl.java @@ -3,7 +3,6 @@ package com.intellij.psi.impl.source.codeStyle; import com.intellij.application.options.CodeStyle; -import com.intellij.diagnostic.PluginException; import com.intellij.formatting.*; import com.intellij.injected.editor.DocumentWindow; import com.intellij.lang.*; @@ -14,7 +13,6 @@ import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.fileTypes.FileType; -import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Pair; @@ -105,11 +103,8 @@ public class CodeStyleManagerImpl extends CodeStyleManager implements Formatting try { result = postFormatProcessor.processElement(result, settingsForFile); } - catch (ProcessCanceledException e) { - throw e; - } - catch (Throwable e) { - LOG.error(PluginException.createByClass(e, postFormatProcessor.getClass())); + catch (Exception e) { + LOG.error("Cannot process element using extension \"" + postFormatProcessor + '"', e); } } } diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java index 0d881070c3f6..4845aad54b47 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/naming/NameSuggester.java @@ -1,11 +1,25 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.refactoring.rename.naming; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.text.NameUtilCore; +import com.intellij.psi.codeStyle.NameUtil; import gnu.trove.TIntIntHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -27,8 +41,8 @@ public class NameSuggester { public NameSuggester(String oldClassName, String newClassName) { myOldClassNameAsGiven = oldClassName; myNewClassNameAsGiven = newClassName; - myOldClassName = NameUtilCore.splitNameIntoWords(oldClassName); - myNewClassName = NameUtilCore.splitNameIntoWords(newClassName); + myOldClassName = NameUtil.splitNameIntoWords(oldClassName); + myNewClassName = NameUtil.splitNameIntoWords(newClassName); myChanges = new ArrayList<>(); int oldIndex = myOldClassName.length - 1; @@ -76,7 +90,7 @@ public class NameSuggester { public String suggestName(final String propertyName) { if (myOldClassNameAsGiven.equals(propertyName)) return myNewClassNameAsGiven; - final String[] propertyWords = NameUtilCore.splitNameIntoWords(propertyName); + final String[] propertyWords = NameUtil.splitNameIntoWords(propertyName); TIntIntHashMap matches = calculateMatches(propertyWords); if (matches.isEmpty()) return propertyName; TreeMap, String> replacements = calculateReplacements(propertyWords, matches); @@ -158,7 +172,7 @@ public class NameSuggester { * @return */ private TreeMap, String> calculateReplacements(String[] propertyWords, TIntIntHashMap matches) { - TreeMap, String> replacements = new TreeMap<>(Comparator.comparing(pair -> pair.getFirst())); + TreeMap, String> replacements = new TreeMap<>((pair, pair1) -> pair.getFirst().compareTo(pair1.getFirst())); for (final OriginalToNewChange change : myChanges) { final int first = change.oldFirst; final int last = change.oldLast; diff --git a/platform/lang-impl/src/com/intellij/testIntegration/TestFinderHelper.java b/platform/lang-impl/src/com/intellij/testIntegration/TestFinderHelper.java index 55fe2c5dacba..6bea5bff08c0 100644 --- a/platform/lang-impl/src/com/intellij/testIntegration/TestFinderHelper.java +++ b/platform/lang-impl/src/com/intellij/testIntegration/TestFinderHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.testIntegration; @@ -7,7 +7,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiNamedElement; -import com.intellij.util.text.NameUtilCore; +import com.intellij.psi.codeStyle.NameUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -82,7 +82,7 @@ public class TestFinderHelper { } public static List> collectPossibleClassNamesWithWeights(String testName) { - String[] words = NameUtilCore.splitNameIntoWords(testName); + String[] words = NameUtil.splitNameIntoWords(testName); List> result = new ArrayList<>(); for (int from = 0; from < words.length; from++) { diff --git a/platform/platform-api/intellij.platform.ide.iml b/platform/platform-api/intellij.platform.ide.iml index f3fda639fabf..8ef5610df5ee 100644 --- a/platform/platform-api/intellij.platform.ide.iml +++ b/platform/platform-api/intellij.platform.ide.iml @@ -39,7 +39,6 @@ - - + \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/util/text/Matcher.java b/platform/platform-api/src/com/intellij/util/text/Matcher.java deleted file mode 100644 index a4d57f7c5c53..000000000000 --- a/platform/platform-api/src/com/intellij/util/text/Matcher.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.text; - -import com.intellij.psi.codeStyle.NameUtil; -import org.jetbrains.annotations.NotNull; - -/** - * @author Konstantin Bulenkov - */ -@SuppressWarnings("ClassNameSameAsAncestorName") -public interface Matcher extends NameUtil.Matcher { - @Override - boolean matches(@NotNull String name); -} diff --git a/platform/platform-impl/intellij.platform.ide.impl.iml b/platform/platform-impl/intellij.platform.ide.impl.iml index a98aa0b03d0f..9459fa1e5ffe 100644 --- a/platform/platform-impl/intellij.platform.ide.impl.iml +++ b/platform/platform-impl/intellij.platform.ide.impl.iml @@ -61,6 +61,5 @@ - \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/diagnostic/IdeaFreezeReporter.java b/platform/platform-impl/src/com/intellij/diagnostic/IdeaFreezeReporter.java index c66a61b11184..a649e7a67a4a 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/IdeaFreezeReporter.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/IdeaFreezeReporter.java @@ -30,32 +30,23 @@ public class IdeaFreezeReporter { app.getMessageBus().connect().subscribe(IdePerformanceListener.TOPIC, new IdePerformanceListener() { final List myCurrentDumps = new ArrayList<>(); List myStacktraceCommonPart = null; - volatile boolean myFreezeActive = false; - - @Override - public void uiFreezeStarted() { - myFreezeActive = true; - } @Override public void dumpedThreads(@NotNull File toFile, @NotNull ThreadDump dump) { - if (myFreezeActive) { - myCurrentDumps.add(dump); - StackTraceElement[] edtStack = dump.getEDTStackTrace(); - if (edtStack != null) { - if (myStacktraceCommonPart == null) { - myStacktraceCommonPart = ContainerUtil.newArrayList(edtStack); - } - else { - myStacktraceCommonPart = PerformanceWatcher.getStacktraceCommonPart(myStacktraceCommonPart, edtStack); - } + myCurrentDumps.add(dump); + StackTraceElement[] edtStack = dump.getEDTStackTrace(); + if (edtStack != null) { + if (myStacktraceCommonPart == null) { + myStacktraceCommonPart = ContainerUtil.newArrayList(edtStack); + } + else { + myStacktraceCommonPart = PerformanceWatcher.getStacktraceCommonPart(myStacktraceCommonPart, edtStack); } } } @Override public void uiFreezeFinished(int lengthInSeconds) { - myFreezeActive = false; if (Registry.is("performance.watcher.freeze.report") && lengthInSeconds > FREEZE_THRESHOLD && // check that we have at least half of the dumps required diff --git a/platform/platform-impl/src/com/intellij/ide/gdpr/EndUserAgreement.java b/platform/platform-impl/src/com/intellij/ide/gdpr/EndUserAgreement.java index 185fcf38a409..0f6a19f53dde 100644 --- a/platform/platform-impl/src/com/intellij/ide/gdpr/EndUserAgreement.java +++ b/platform/platform-impl/src/com/intellij/ide/gdpr/EndUserAgreement.java @@ -99,26 +99,6 @@ public final class EndUserAgreement { return loadContent(docName, EndUserAgreement.class.getResourceAsStream(getBundledResourcePath(docName))); } - public static boolean updateCachedContentToLatestBundledVersion() { - try { - final String docName = getDocumentName(); - final File cacheFile = getDocumentContentFile(docName); - if (cacheFile.exists()) { - final Document cached = loadContent(docName, new FileInputStream(cacheFile)); - if (!cached.getVersion().isUnknown()) { - final Document bundled = loadContent(docName, EndUserAgreement.class.getResourceAsStream(getBundledResourcePath(docName))); - if (!bundled.getVersion().isUnknown() && bundled.getVersion().isNewer(cached.getVersion())) { - update(docName, bundled.getText()); - return true; - } - } - } - } - catch (Throwable ignored) { - } - return false; - } - public static void update(String docName, String text) { try { FileUtil.writeToFile(getDocumentContentFile(docName), text); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/ToolWindowCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/ToolWindowCollector.java index 57dd826e0c5b..d529c669ebe5 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/ToolWindowCollector.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/ToolWindowCollector.java @@ -4,9 +4,6 @@ package com.intellij.internal.statistic.collectors.fus.actions.persistence; import com.intellij.facet.ui.FacetDependentToolWindow; import com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector; import com.intellij.internal.statistic.eventLog.FeatureUsageData; -import com.intellij.internal.statistic.eventLog.validator.ValidationResultType; -import com.intellij.internal.statistic.eventLog.validator.rules.EventContext; -import com.intellij.internal.statistic.eventLog.validator.rules.impl.CustomUtilsWhiteListRule; import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; import com.intellij.internal.statistic.service.fus.collectors.FUCounterUsageLogger; import com.intellij.internal.statistic.utils.PluginInfo; @@ -24,6 +21,7 @@ import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; +import static com.intellij.internal.statistic.beans.ConvertUsagesUtil.escapeDescriptorName; import static com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowCollector.ToolWindowActivationSource.ACTIVATION; import static com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowCollector.ToolWindowActivationSource.CLICK; import static com.intellij.internal.statistic.utils.PluginInfoDetectorKt.getPlatformPlugin; @@ -96,13 +94,17 @@ public class ToolWindowCollector implements PersistentStateComponent { + assertInTransaction(); - Runnable doLoad = () -> success.set(loadProjectUnderProgress(project, () -> { beforeProjectOpened(project); TransactionGuard.getInstance().submitTransactionAndWait(() -> fireProjectOpened(project)); @@ -409,16 +408,9 @@ public class ProjectManagerImpl extends ProjectManagerEx implements Disposable { } } }, ModalityState.NON_MODAL); - })); + }; - if (ApplicationManager.getApplication().isDispatchThread()) { - TransactionGuard.getInstance().submitTransactionAndWait(doLoad); - } else { - assertInTransaction(); - doLoad.run(); - } - - if (!success.get()) { + if (!loadProjectUnderProgress(project, process)) { GuiUtils.invokeLaterIfNeeded(() -> { closeProject(project, false, false, false, true); WriteAction.run(() -> Disposer.dispose(project)); @@ -443,6 +435,8 @@ public class ProjectManagerImpl extends ProjectManagerEx implements Disposable { } private static boolean loadProjectUnderProgress(@NotNull Project project, @NotNull Runnable performLoading) { + assertInTransaction(); + ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (!ApplicationManager.getApplication().isDispatchThread() && indicator != null) { indicator.setText("Preparing workspace..."); diff --git a/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java b/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java index c7ee6a6725e3..0e4216ae7038 100644 --- a/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java +++ b/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java @@ -296,7 +296,6 @@ public class AppUIUtil { public static void showUserAgreementAndConsentsIfNeeded(@NotNull Logger log) { if (ApplicationInfoImpl.getShadowInstance().isVendorJetBrains()) { - EndUserAgreement.updateCachedContentToLatestBundledVersion(); EndUserAgreement.Document agreement = EndUserAgreement.getLatestDocument(); if (!agreement.isAccepted()) { try { diff --git a/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java b/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java index 44a181872f16..743a05fed7a6 100644 --- a/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java +++ b/platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; import com.intellij.featureStatistics.FeatureUsageTracker; @@ -17,10 +17,10 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ex.ToolWindowManagerListener; +import com.intellij.psi.codeStyle.NameUtil; import com.intellij.ui.border.CustomLineBorder; import com.intellij.ui.speedSearch.SpeedSearch; import com.intellij.ui.speedSearch.SpeedSearchSupply; -import com.intellij.util.text.NameUtilCore; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -99,7 +99,7 @@ public abstract class SpeedSearchBase extends SpeedSear public void actionPerformed(@NotNull AnActionEvent e) { final String prefix = getEnteredPrefix(); assert prefix != null; - final String[] strings = NameUtilCore.splitNameIntoWords(prefix); + final String[] strings = NameUtil.splitNameIntoWords(prefix); final String last = strings[strings.length - 1]; final int i = prefix.lastIndexOf(last); mySearchPopup.mySearchField.setText(prefix.substring(0, i).trim()); diff --git a/platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java b/platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java index e882f327cba3..67cf8ceda736 100644 --- a/platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java +++ b/platform/platform-impl/src/com/intellij/ui/SpeedSearchComparator.java @@ -1,11 +1,24 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.codeStyle.MinusculeMatcher; import com.intellij.psi.codeStyle.NameUtil; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -25,7 +38,7 @@ public class SpeedSearchComparator { public SpeedSearchComparator(boolean shouldMatchFromTheBeginning) { this(shouldMatchFromTheBeginning, false); } - + public SpeedSearchComparator(boolean shouldMatchFromTheBeginning, boolean shouldMatchCamelCase) { myShouldMatchFromTheBeginning = shouldMatchFromTheBeginning; myShouldMatchCamelCase = shouldMatchCamelCase; @@ -44,7 +57,7 @@ public class SpeedSearchComparator { if (myRecentSearchText == null || !myRecentSearchText.equals(pattern)) { myRecentSearchText = pattern; if (myShouldMatchCamelCase) { - pattern = StringUtil.join(NameUtilCore.nameToWords(pattern), "*"); + pattern = StringUtil.join(NameUtil.nameToWords(pattern), "*"); } if (!myShouldMatchFromTheBeginning && !pattern.startsWith("*")) { pattern = "*" + pattern; diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index ed92da3be807..191a7be9b114 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -917,7 +917,6 @@ - diff --git a/platform/platform-tests/intellij.platform.tests.iml b/platform/platform-tests/intellij.platform.tests.iml index 19539c7fba55..f259b344fc3b 100644 --- a/platform/platform-tests/intellij.platform.tests.iml +++ b/platform/platform-tests/intellij.platform.tests.iml @@ -36,9 +36,9 @@ + - \ No newline at end of file diff --git a/platform/projectModel-api/intellij.platform.projectModel.iml b/platform/projectModel-api/intellij.platform.projectModel.iml index c022608de3d4..2d07cf81d4d8 100644 --- a/platform/projectModel-api/intellij.platform.projectModel.iml +++ b/platform/projectModel-api/intellij.platform.projectModel.iml @@ -11,8 +11,7 @@ - + - \ No newline at end of file diff --git a/platform/projectModel-impl/intellij.platform.projectModel.impl.iml b/platform/projectModel-impl/intellij.platform.projectModel.impl.iml index 17cfdbc27303..3e548dd9e240 100644 --- a/platform/projectModel-impl/intellij.platform.projectModel.impl.iml +++ b/platform/projectModel-impl/intellij.platform.projectModel.impl.iml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/platform/remote-servers/api/intellij.platform.remoteServers.iml b/platform/remote-servers/api/intellij.platform.remoteServers.iml index 2d80e48d187f..8b56447a83ec 100644 --- a/platform/remote-servers/api/intellij.platform.remoteServers.iml +++ b/platform/remote-servers/api/intellij.platform.remoteServers.iml @@ -11,6 +11,5 @@ - \ No newline at end of file diff --git a/platform/structure-view-impl/intellij.platform.structureView.impl.iml b/platform/structure-view-impl/intellij.platform.structureView.impl.iml index ba8c4c5f4526..897646e11085 100644 --- a/platform/structure-view-impl/intellij.platform.structureView.impl.iml +++ b/platform/structure-view-impl/intellij.platform.structureView.impl.iml @@ -19,6 +19,5 @@ - \ No newline at end of file diff --git a/platform/testFramework/core/src/com/intellij/ClassFinder.java b/platform/testFramework/core/src/com/intellij/ClassFinder.java index 2563ae2d07d5..906a6ab322e2 100644 --- a/platform/testFramework/core/src/com/intellij/ClassFinder.java +++ b/platform/testFramework/core/src/com/intellij/ClassFinder.java @@ -1,10 +1,12 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ package com.intellij; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.codeStyle.NameUtil; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -46,7 +48,7 @@ public class ClassFinder { } // A test may be named Test*, *Test, *Tests*, *TestCase, *TestSuite, *Suite, etc - List words = Arrays.asList(NameUtilCore.nameToWords(className)); + List words = Arrays.asList(NameUtil.nameToWords(className)); if (words.contains("Test") || words.contains("Tests") || words.contains("Suite")) { String fqn = StringUtil.trimEnd(absPath.substring(startPackageName), ".class").replace(File.separatorChar, '.'); diff --git a/platform/util/intellij.platform.concurrency.iml b/platform/util/intellij.platform.util.concurrency.iml similarity index 100% rename from platform/util/intellij.platform.concurrency.iml rename to platform/util/intellij.platform.util.concurrency.iml diff --git a/platform/util/intellij.platform.util.iml b/platform/util/intellij.platform.util.iml index 90d38994058f..1ac9feaa4ffc 100644 --- a/platform/util/intellij.platform.util.iml +++ b/platform/util/intellij.platform.util.iml @@ -9,6 +9,7 @@ + @@ -19,8 +20,13 @@ + + + + + diff --git a/platform/util/intellij.platform.util.ui.iml b/platform/util/intellij.platform.util.ui.iml deleted file mode 100644 index b0a651562a82..000000000000 --- a/platform/util/intellij.platform.util.ui.iml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/icons/AllIcons.java b/platform/util/src/com/intellij/icons/AllIcons.java similarity index 99% rename from platform/util/ui/src/com/intellij/icons/AllIcons.java rename to platform/util/src/com/intellij/icons/AllIcons.java index 5d034eb2f404..e214c2049399 100644 --- a/platform/util/ui/src/com/intellij/icons/AllIcons.java +++ b/platform/util/src/com/intellij/icons/AllIcons.java @@ -1575,6 +1575,8 @@ public class AllIcons { /** 128x128 */ public static final Icon Icon_128 = IconLoader.getIcon("/icon_128.png"); /** 32x32 */ public static final Icon Icon_CE = IconLoader.getIcon("/icon_CE.png"); /** 128x128 */ public static final Icon Icon_CE_128 = IconLoader.getIcon("/icon_CE_128.png"); + /** 256x256 */ public static final Icon Icon_CE_256 = IconLoader.getIcon("/icon_CE_256.png"); + /** 512x512 */ public static final Icon Icon_CE_512 = IconLoader.getIcon("/icon_CE_512.png"); /** 64x64 */ public static final Icon Icon_CE_64 = IconLoader.getIcon("/icon_CE_64.png"); /** 16x16 */ public static final Icon Icon_CEsmall = IconLoader.getIcon("/icon_CEsmall.png"); /** 16x16 */ public static final Icon Icon_small = IconLoader.getIcon("/icon_small.png"); diff --git a/platform/util/ui/src/com/intellij/openapi/ui/CheckBoxWithDescription.java b/platform/util/src/com/intellij/openapi/ui/CheckBoxWithDescription.java similarity index 57% rename from platform/util/ui/src/com/intellij/openapi/ui/CheckBoxWithDescription.java rename to platform/util/src/com/intellij/openapi/ui/CheckBoxWithDescription.java index 2925d4368959..1fa45e136314 100644 --- a/platform/util/ui/src/com/intellij/openapi/ui/CheckBoxWithDescription.java +++ b/platform/util/src/com/intellij/openapi/ui/CheckBoxWithDescription.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.openapi.ui; import org.jetbrains.annotations.Nullable; diff --git a/platform/util/src/com/intellij/openapi/ui/DescriptionLabel.java b/platform/util/src/com/intellij/openapi/ui/DescriptionLabel.java new file mode 100644 index 000000000000..3cd894cd253c --- /dev/null +++ b/platform/util/src/com/intellij/openapi/ui/DescriptionLabel.java @@ -0,0 +1,39 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.ui; + +import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + +public class DescriptionLabel extends JLabel { + + public DescriptionLabel(@Nullable String text) { + setText(text); + } + + @Override + public void updateUI() { + super.updateUI(); + setForeground(UIUtil.getLabelDisabledForeground()); + int size = getFont().getSize(); + if (size >= 12) { + size -= 2; + } + setFont(getFont().deriveFont((float)size)); + } +} \ No newline at end of file diff --git a/platform/util/src/com/intellij/openapi/ui/Divider.java b/platform/util/src/com/intellij/openapi/ui/Divider.java new file mode 100644 index 000000000000..1b2b6b1a3d6a --- /dev/null +++ b/platform/util/src/com/intellij/openapi/ui/Divider.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.ui; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Konstantin Bulenkov + */ +public abstract class Divider extends JPanel { + public Divider(LayoutManager layout) { + super(layout); + } + + public abstract void setResizeEnabled(boolean resizeEnabled); + + public abstract void setSwitchOrientationEnabled(boolean switchOrientationEnabled); + + public abstract void setOrientation(boolean vertical); +} diff --git a/platform/util/ui/src/com/intellij/openapi/ui/GraphicsConfig.java b/platform/util/src/com/intellij/openapi/ui/GraphicsConfig.java similarity index 80% rename from platform/util/ui/src/com/intellij/openapi/ui/GraphicsConfig.java rename to platform/util/src/com/intellij/openapi/ui/GraphicsConfig.java index 66120f48789c..78d283dbd680 100644 --- a/platform/util/ui/src/com/intellij/openapi/ui/GraphicsConfig.java +++ b/platform/util/src/com/intellij/openapi/ui/GraphicsConfig.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.openapi.ui; diff --git a/platform/util/ui/src/com/intellij/openapi/ui/InvariantIcon.java b/platform/util/src/com/intellij/openapi/ui/InvariantIcon.java similarity index 77% rename from platform/util/ui/src/com/intellij/openapi/ui/InvariantIcon.java rename to platform/util/src/com/intellij/openapi/ui/InvariantIcon.java index 098b1929b850..6aa1e137d78e 100644 --- a/platform/util/ui/src/com/intellij/openapi/ui/InvariantIcon.java +++ b/platform/util/src/com/intellij/openapi/ui/InvariantIcon.java @@ -1,4 +1,3 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.ui; import com.intellij.openapi.util.Condition; diff --git a/platform/util/src/com/intellij/openapi/ui/NullableComponent.java b/platform/util/src/com/intellij/openapi/ui/NullableComponent.java new file mode 100644 index 000000000000..aa00d69da338 --- /dev/null +++ b/platform/util/src/com/intellij/openapi/ui/NullableComponent.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.intellij.openapi.ui; + +import java.awt.*; + +public interface NullableComponent { + + boolean isNull(); + + class Check { + private Check() { + } + + public static boolean isNull(Component c) { + return c == null || c instanceof NullableComponent && ((NullableComponent)c).isNull(); + } + + public static boolean isNullOrHidden(Component c) { + return c != null && !c.isShowing() || isNull(c); + } + + public static boolean isNotNullAndVisible(Component c) { + return !isNull(c) && c.isVisible(); + } + } +} diff --git a/platform/util/ui/src/com/intellij/openapi/ui/PseudoSplitter.java b/platform/util/src/com/intellij/openapi/ui/PseudoSplitter.java similarity index 71% rename from platform/util/ui/src/com/intellij/openapi/ui/PseudoSplitter.java rename to platform/util/src/com/intellij/openapi/ui/PseudoSplitter.java index 408ca8188e7a..3287b3d1d027 100644 --- a/platform/util/ui/src/com/intellij/openapi/ui/PseudoSplitter.java +++ b/platform/util/src/com/intellij/openapi/ui/PseudoSplitter.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.openapi.ui; import javax.swing.*; @@ -48,7 +62,7 @@ public class PseudoSplitter extends Splitter { boolean firstIsFixed = myFirstIsFixed; myFirstIsFixed = false; super.setProportion(proportion); - + int total = getSizeForComp(this); if (firstIsFixed) { myFirstFixedSize = (int) (myProportion * (total - getDividerWidth())); diff --git a/platform/util/src/com/intellij/openapi/ui/Splittable.java b/platform/util/src/com/intellij/openapi/ui/Splittable.java new file mode 100644 index 000000000000..3b11925d9a15 --- /dev/null +++ b/platform/util/src/com/intellij/openapi/ui/Splittable.java @@ -0,0 +1,41 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.ui; + +import org.jetbrains.annotations.NotNull; + +import java.awt.*; + +public interface Splittable { + float getMinProportion(boolean first); + + void setProportion(float proportion); + + /** + * @return {@code true} if splitter has vertical orientation, {@code false} otherwise + */ + boolean getOrientation(); + + /** + * @param verticalSplit {@code true} means that splitter will have vertical split + */ + void setOrientation(boolean verticalSplit); + + @NotNull + Component asComponent(); + + void setDragging(boolean dragging); +} diff --git a/platform/util/ui/src/com/intellij/openapi/ui/Splitter.java b/platform/util/src/com/intellij/openapi/ui/Splitter.java similarity index 99% rename from platform/util/ui/src/com/intellij/openapi/ui/Splitter.java rename to platform/util/src/com/intellij/openapi/ui/Splitter.java index 0af983f40502..ab8bb10ce935 100644 --- a/platform/util/ui/src/com/intellij/openapi/ui/Splitter.java +++ b/platform/util/src/com/intellij/openapi/ui/Splitter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.ui; import com.intellij.icons.AllIcons; diff --git a/platform/util/ui/src/com/intellij/openapi/ui/VerticalFlowLayout.java b/platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java similarity index 89% rename from platform/util/ui/src/com/intellij/openapi/ui/VerticalFlowLayout.java rename to platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java index 5372549b1942..4681a107d308 100644 --- a/platform/util/ui/src/com/intellij/openapi/ui/VerticalFlowLayout.java +++ b/platform/util/src/com/intellij/openapi/ui/VerticalFlowLayout.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.openapi.ui; import com.intellij.util.ui.JBInsets; diff --git a/platform/util/ui/src/com/intellij/openapi/util/IconLoader.java b/platform/util/src/com/intellij/openapi/util/IconLoader.java similarity index 98% rename from platform/util/ui/src/com/intellij/openapi/util/IconLoader.java rename to platform/util/src/com/intellij/openapi/util/IconLoader.java index 8877eaf65d01..70edd8e64c6a 100644 --- a/platform/util/ui/src/com/intellij/openapi/util/IconLoader.java +++ b/platform/util/src/com/intellij/openapi/util/IconLoader.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.util; import com.intellij.openapi.diagnostic.Logger; @@ -10,14 +10,11 @@ import com.intellij.ui.RetrievableIcon; import com.intellij.util.*; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.FixedHashMap; -import com.intellij.util.ui.ImageUtil; -import com.intellij.util.ui.JBImageIcon; -import com.intellij.util.ui.JBUI; -import com.intellij.util.ui.JBUIScale.ScaleContext; -import com.intellij.util.ui.JBUIScale.ScaleContextAware; +import com.intellij.util.ui.*; import com.intellij.util.ui.JBUIScale.ScaleContextSupport; import com.intellij.util.ui.JBUIScale.UserScaleContext.UpdateListener; -import com.intellij.util.ui.UIUtil; +import com.intellij.util.ui.JBUIScale.ScaleContext; +import com.intellij.util.ui.JBUIScale.ScaleContextAware; import org.jetbrains.annotations.*; import javax.swing.*; @@ -39,8 +36,7 @@ import java.util.function.Supplier; import static com.intellij.ui.paint.PaintUtil.RoundingMode.ROUND; import static com.intellij.util.ui.JBUIScale.DerivedScaleType.DEV_SCALE; import static com.intellij.util.ui.JBUIScale.DerivedScaleType.EFF_USR_SCALE; -import static com.intellij.util.ui.JBUIScale.ScaleType.OBJ_SCALE; -import static com.intellij.util.ui.JBUIScale.ScaleType.SYS_SCALE; +import static com.intellij.util.ui.JBUIScale.ScaleType.*; public final class IconLoader { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.IconLoader"); @@ -53,7 +49,7 @@ public final class IconLoader { * This cache contains mapping between icons and disabled icons. */ private static final Map ourIcon2DisabledIcon = ContainerUtil.createWeakMap(200); - + private static volatile boolean STRICT_GLOBAL; private static final ThreadLocal STRICT_LOCAL = new ThreadLocal() { @Override @@ -96,7 +92,7 @@ public final class IconLoader { public static void setStrictGlobally(boolean strict) { STRICT_GLOBAL = strict; } - + private static void updateTransform(Function updater) { IconTransform prev, next; do { @@ -694,7 +690,7 @@ public final class IconLoader { private Icon createWithFilter(@NotNull Supplier filterSupplier) { return new CachedImageIcon(myOriginalPath, myResolver, myDarkOverridden, myUseCacheOnLoad, myTransform, filterSupplier); } - + private boolean isDark() { return myDarkOverridden == null ? myTransform.isDark() : myDarkOverridden; } @@ -795,7 +791,7 @@ public final class IconLoader { @Nullable private final ClassLoader myClassLoader; @Nullable private final String myOverriddenPath; @NotNull private final HandleNotFound myHandleNotFound; - // Every myUrl write is performed before isResolved write (see resolve()) + // Every myUrl write is performed before isResolved write (see resolve()) // and every myUrl read is performed after isResolved read (see getUrl()), thus // no necessary to declare myUrl as volatile: happens-before is established via isResolved. @Nullable private URL myUrl; @@ -1011,33 +1007,33 @@ public final class IconLoader { myPatchers = patchers; myFilter = filter; } - + public boolean isDark() { return myDark; } - + @Nullable public ImageFilter getFilter() { return myFilter; } - + public IconTransform withPathPatcher(IconPathPatcher patcher) { return new IconTransform(myDark, ArrayUtil.append(myPatchers, patcher), myFilter); } - + public IconTransform withoutPathPatcher(IconPathPatcher patcher) { IconPathPatcher[] newPatchers = ArrayUtil.remove(myPatchers, patcher); return newPatchers == myPatchers ? this : new IconTransform(myDark, newPatchers, myFilter); } - + public IconTransform withFilter(ImageFilter filter) { return filter == myFilter ? this : new IconTransform(myDark, myPatchers, filter); } - + public IconTransform withDark(boolean dark) { return dark == myDark ? this : new IconTransform(dark, myPatchers, myFilter); } - + public Pair patchPath(@NotNull String path, ClassLoader classLoader) { for (IconPathPatcher patcher : myPatchers) { String newPath = patcher.patchPath(path, classLoader); diff --git a/platform/util/src/com/intellij/openapi/util/IdRunnable.java b/platform/util/src/com/intellij/openapi/util/IdRunnable.java new file mode 100644 index 000000000000..46d27177a0b0 --- /dev/null +++ b/platform/util/src/com/intellij/openapi/util/IdRunnable.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.util; + +import com.intellij.util.ui.update.ComparableObject; + +public abstract class IdRunnable extends ComparableObject.Impl implements Runnable { + + public IdRunnable(Object object) { + super(object); + } + + public IdRunnable(Object[] objects) { + super(objects); + } +} diff --git a/platform/util/src/com/intellij/openapi/util/registry/Registry.java b/platform/util/src/com/intellij/openapi/util/registry/Registry.java index 3e478620f3e1..8d71a0a80817 100644 --- a/platform/util/src/com/intellij/openapi/util/registry/Registry.java +++ b/platform/util/src/com/intellij/openapi/util/registry/Registry.java @@ -5,6 +5,7 @@ import com.intellij.util.ConcurrencyUtil; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.PropertyKey; import java.awt.*; import java.lang.ref.Reference; diff --git a/platform/util/src/com/intellij/openapi/util/registry/RegistryValue.java b/platform/util/src/com/intellij/openapi/util/registry/RegistryValue.java index f093a30f4199..99d87d6b2542 100644 --- a/platform/util/src/com/intellij/openapi/util/registry/RegistryValue.java +++ b/platform/util/src/com/intellij/openapi/util/registry/RegistryValue.java @@ -4,7 +4,7 @@ package com.intellij.openapi.util.registry; import com.intellij.openapi.Disposable; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Disposer; -import com.intellij.ui.ColorHexUtil; +import com.intellij.ui.ColorUtil; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -92,7 +92,7 @@ public class RegistryValue { Color asColor(Color defaultValue) { final String s = get(myKey, null, true); if (s != null) { - Color color = ColorHexUtil.fromHex(s, null); + Color color = ColorUtil.fromHex(s, null); if (color != null && myKey.contains("color")) { return color; } diff --git a/platform/util/ui/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java b/platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java similarity index 58% rename from platform/util/ui/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java rename to platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java index 80aa6d58fabb..ffc664eacab1 100644 --- a/platform/util/ui/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java +++ b/platform/util/src/com/intellij/openapi/util/registry/ui/RegistryCheckBox.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.openapi.util.registry.ui; import com.intellij.openapi.ui.CheckBoxWithDescription; diff --git a/platform/util/ui/src/com/intellij/openapi/util/text/TextWithMnemonic.java b/platform/util/src/com/intellij/openapi/util/text/TextWithMnemonic.java similarity index 100% rename from platform/util/ui/src/com/intellij/openapi/util/text/TextWithMnemonic.java rename to platform/util/src/com/intellij/openapi/util/text/TextWithMnemonic.java diff --git a/platform/util/ui/src/com/intellij/openapi/wm/FocusWatcher.java b/platform/util/src/com/intellij/openapi/wm/FocusWatcher.java similarity index 90% rename from platform/util/ui/src/com/intellij/openapi/wm/FocusWatcher.java rename to platform/util/src/com/intellij/openapi/wm/FocusWatcher.java index 769f84b398c5..d6560b43b0bf 100644 --- a/platform/util/ui/src/com/intellij/openapi/wm/FocusWatcher.java +++ b/platform/util/src/com/intellij/openapi/wm/FocusWatcher.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.openapi.wm; import com.intellij.reference.SoftReference; @@ -115,7 +129,7 @@ public class FocusWatcher implements ContainerListener,FocusListener{ myTopComponent = new WeakReference<>(component); installImpl(component); } - + private void installImpl(Component component){ if(component instanceof Container){ Container container=(Container)component; @@ -166,7 +180,7 @@ public class FocusWatcher implements ContainerListener,FocusListener{ * @param cause */ protected void focusedComponentChanged(Component component, @Nullable final AWTEvent cause){} - + protected void focusLostImpl(final FocusEvent e){} private void setFocusedComponent(final Component focusedComponent) { diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/AllOccurrencesMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/AllOccurrencesMatcher.java similarity index 79% rename from platform/platform-api/src/com/intellij/psi/codeStyle/AllOccurrencesMatcher.java rename to platform/util/src/com/intellij/psi/codeStyle/AllOccurrencesMatcher.java index 6d51b19a757e..73bfb5881dde 100644 --- a/platform/platform-api/src/com/intellij/psi/codeStyle/AllOccurrencesMatcher.java +++ b/platform/util/src/com/intellij/psi/codeStyle/AllOccurrencesMatcher.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.codeStyle; import com.intellij.openapi.util.TextRange; @@ -11,7 +25,7 @@ import java.util.ArrayList; import java.util.List; /** - * {@link FixingLayoutMatcher} extension that returns all matches (not just the first one) + * {@link FixingLayoutMatcher} extension that returns all matches (not just the first one) * from {@link MinusculeMatcher#matchingFragments(String)}. */ public class AllOccurrencesMatcher extends MinusculeMatcher { diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/FixingLayoutMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/FixingLayoutMatcher.java similarity index 73% rename from platform/platform-api/src/com/intellij/psi/codeStyle/FixingLayoutMatcher.java rename to platform/util/src/com/intellij/psi/codeStyle/FixingLayoutMatcher.java index 96c164325c00..003916204bd1 100644 --- a/platform/platform-api/src/com/intellij/psi/codeStyle/FixingLayoutMatcher.java +++ b/platform/util/src/com/intellij/psi/codeStyle/FixingLayoutMatcher.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.codeStyle; import com.intellij.util.ui.KeyboardLayoutUtil; diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.java similarity index 92% rename from platform/platform-api/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.java rename to platform/util/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.java index 09299281bc36..fc509035dd9e 100644 --- a/platform/platform-api/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.java +++ b/platform/util/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle; import org.jetbrains.annotations.NotNull; diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/MatcherWithFallback.java b/platform/util/src/com/intellij/psi/codeStyle/MatcherWithFallback.java similarity index 100% rename from platform/platform-api/src/com/intellij/psi/codeStyle/MatcherWithFallback.java rename to platform/util/src/com/intellij/psi/codeStyle/MatcherWithFallback.java diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/MinusculeMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java similarity index 100% rename from platform/platform-api/src/com/intellij/psi/codeStyle/MinusculeMatcher.java rename to platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/MinusculeMatcherImpl.java b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcherImpl.java similarity index 98% rename from platform/platform-api/src/com/intellij/psi/codeStyle/MinusculeMatcherImpl.java rename to platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcherImpl.java index dcc82f523e8e..c226d69cef83 100644 --- a/platform/platform-api/src/com/intellij/psi/codeStyle/MinusculeMatcherImpl.java +++ b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcherImpl.java @@ -1,11 +1,10 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.containers.FList; import com.intellij.util.io.IOUtil; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -79,7 +78,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher { if (start < name.length() && Character.isDigit(name.charAt(start))) { return start + 1; //treat each digit as a separate hump } - return NameUtilCore.nextWord(name, start); + return NameUtil.nextWord(name, start); } private boolean hasFlag(int start, boolean[] flags) { @@ -154,7 +153,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher { int startIndex = first.getStartOffset(); boolean afterSeparator = StringUtil.indexOfAny(name, myHardSeparators, 0, startIndex) >= 0; - boolean wordStart = startIndex == 0 || NameUtilCore.isWordStart(name, startIndex) && !NameUtilCore.isWordStart(name, startIndex - 1); + boolean wordStart = startIndex == 0 || NameUtil.isWordStart(name, startIndex) && !NameUtil.isWordStart(name, startIndex - 1); boolean finalMatch = fragments.get(fragments.size() - 1).getEndOffset() == name.length(); return (wordStart ? 1000 : 0) + @@ -335,7 +334,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher { // uppercase should match either uppercase or a word start return !isUpperCase[patternIndex] || Character.isUpperCase(name.charAt(nextOccurrence)) || - NameUtilCore.isWordStart(name, nextOccurrence) || + NameUtil.isWordStart(name, nextOccurrence) || // accept uppercase matching lowercase if the whole prefix is uppercase and case sensitivity allows that !myHasHumps && myOptions != NameUtil.MatchingCaseSensitivity.ALL; } @@ -403,7 +402,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher { private boolean isMiddleMatch(@NotNull String name, int patternIndex, int nameIndex) { return isPatternChar(patternIndex - 1, '*') && !isWildcard(patternIndex + 1) && - Character.isLetterOrDigit(name.charAt(nameIndex)) && !NameUtilCore.isWordStart(name, nameIndex); + Character.isLetterOrDigit(name.charAt(nameIndex)) && !NameUtil.isWordStart(name, nameIndex); } @Nullable diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/NameUtil.java b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java similarity index 75% rename from platform/platform-api/src/com/intellij/psi/codeStyle/NameUtil.java rename to platform/util/src/com/intellij/psi/codeStyle/NameUtil.java index 24c2f638919a..b0d1f1165478 100644 --- a/platform/platform-api/src/com/intellij/psi/codeStyle/NameUtil.java +++ b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java @@ -1,25 +1,68 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.ArrayUtil; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -public final class NameUtil { +public class NameUtil { private static final int MAX_LENGTH = 40; private NameUtil() {} @NotNull public static List nameToWordsLowerCase(@NotNull String name){ - return ContainerUtil.map(NameUtilCore.nameToWords(name), StringUtil::toLowerCase); + return ContainerUtil.map(nameToWords(name), StringUtil::toLowerCase); + } + + @NotNull + public static String[] nameToWords(@NotNull String name){ + List array = new ArrayList<>(); + int index = 0; + + while(index < name.length()){ + int wordStart = index; + int upperCaseCount = 0; + int lowerCaseCount = 0; + int digitCount = 0; + int specialCount = 0; + while(index < name.length()){ + char c = name.charAt(index); + if (Character.isDigit(c)){ + if (upperCaseCount > 0 || lowerCaseCount > 0 || specialCount > 0) break; + digitCount++; + } + else if (Character.isUpperCase(c)){ + if (lowerCaseCount > 0 || digitCount > 0 || specialCount > 0) break; + upperCaseCount++; + } + else if (Character.isLowerCase(c)){ + if (digitCount > 0 || specialCount > 0) break; + if (upperCaseCount > 1) { + index--; + break; + } + lowerCaseCount++; + } + else{ + if (upperCaseCount > 0 || lowerCaseCount > 0 || digitCount > 0) break; + specialCount++; + } + index++; + } + String word = name.substring(wordStart, index); + if (!StringUtil.isEmptyOrSpaces(word)) { + array.add(word); + } + } + return ArrayUtil.toStringArray(array); } @NotNull @@ -169,6 +212,23 @@ public final class NameUtil { return buffer.toString(); } + /** + * Splits an identifier into words, separated with underscores or upper-case characters + * (camel-case). + * + * @param name the identifier to split. + * @return the array of strings into which the identifier has been split. + */ + @NotNull + public static String[] splitNameIntoWords(@NotNull String name) { + final String[] underlineDelimited = name.split("_"); + List result = new ArrayList<>(); + for (String word : underlineDelimited) { + addAllWords(word, result); + } + return ArrayUtil.toStringArray(result); + } + @NotNull public static List getSuggestionsByName(@NotNull String name, @NotNull String prefix, @@ -177,7 +237,7 @@ public final class NameUtil { boolean preferLongerNames, boolean isArray) { ArrayList answer = new ArrayList<>(); - String[] words = NameUtilCore.nameToWords(name); + String[] words = nameToWords(name); for (int step = 0; step < words.length; step++) { int wordCount = preferLongerNames ? words.length - step : step + 1; @@ -255,14 +315,64 @@ public final class NameUtil { return suggestion; } - @NotNull - public static String[] splitNameIntoWords(@NotNull String name) { - return NameUtilCore.splitNameIntoWords(name); + static int nextWord(@NotNull String text, int start) { + if (!Character.isLetterOrDigit(text.charAt(start))) { + return start + 1; + } + + int i = start; + while (i < text.length() && Character.isDigit(text.charAt(i))) i++; + if (i > start) { + // digits form a separate hump + return i; + } + + while (i < text.length() && Character.isUpperCase(text.charAt(i))) i++; + + if (i > start + 1) { + // several consecutive uppercase letter form a hump + if (i == text.length() || !Character.isLetter(text.charAt(i))) { + return i; + } + return i - 1; + } + + if (i == start) i++; + while (i < text.length() && Character.isLetter(text.charAt(i)) && !isWordStart(text, i)) i++; + return i; } - @NotNull - public static String[] nameToWords(@NotNull String name) { - return NameUtilCore.nameToWords(name); + private static void addAllWords(@NotNull String text, @NotNull List result) { + int start = 0; + while (start < text.length()) { + int next = nextWord(text, start); + result.add(text.substring(start, next)); + start = next; + } + } + + static boolean isWordStart(String text, int i) { + char c = text.charAt(i); + if (Character.isUpperCase(c)) { + if (i > 0 && Character.isUpperCase(text.charAt(i - 1))) { + // check that we're not in the middle of an all-caps word + return i + 1 < text.length() && Character.isLowerCase(text.charAt(i + 1)); + } + return true; + } + if (Character.isDigit(c)) { + return true; + } + if (!Character.isLetter(c)) { + return false; + } + return i == 0 || !Character.isLetterOrDigit(text.charAt(i - 1)) || isHardCodedWordStart(text, i); + } + + private static boolean isHardCodedWordStart(String text, int i) { + return text.charAt(i) == 'l' && + i < text.length() - 1 && text.charAt(i + 1) == 'n' && + (text.length() == i + 2 || isWordStart(text, i + 2)); } /** @@ -274,7 +384,7 @@ public final class NameUtil { } @NotNull - public static com.intellij.util.text.Matcher buildMatcher(@NotNull String pattern, int exactPrefixLen, + public static com.intellij.util.text.Matcher buildMatcher(@NotNull String pattern, int exactPrefixLen, boolean allowToUpper, boolean allowToLower) { MatchingCaseSensitivity options = !allowToLower && !allowToUpper ? MatchingCaseSensitivity.ALL : exactPrefixLen > 0 ? MatchingCaseSensitivity.FIRST_LETTER @@ -345,7 +455,7 @@ public final class NameUtil { @NotNull public static String splitWords(@NotNull String text, char separator, @NotNull Function transformWord) { - final String[] words = NameUtilCore.nameToWords(text); + final String[] words = nameToWords(text); boolean insertSeparator = false; final StringBuilder buf = new StringBuilder(); for (String word : words) { diff --git a/platform/platform-api/src/com/intellij/psi/codeStyle/TypoTolerantMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/TypoTolerantMatcher.java similarity index 98% rename from platform/platform-api/src/com/intellij/psi/codeStyle/TypoTolerantMatcher.java rename to platform/util/src/com/intellij/psi/codeStyle/TypoTolerantMatcher.java index 56960ca5a503..3727deb986d9 100644 --- a/platform/platform-api/src/com/intellij/psi/codeStyle/TypoTolerantMatcher.java +++ b/platform/util/src/com/intellij/psi/codeStyle/TypoTolerantMatcher.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle; import com.intellij.openapi.util.Pair; @@ -9,7 +9,6 @@ import com.intellij.util.Processor; import com.intellij.util.SmartList; import com.intellij.util.containers.FList; import com.intellij.util.io.IOUtil; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -80,7 +79,7 @@ class TypoTolerantMatcher extends MinusculeMatcher { if (start < name.length() && Character.isDigit(name.charAt(start))) { return start + 1; //treat each digit as a separate hump } - return NameUtilCore.nextWord(name, start); + return NameUtil.nextWord(name, start); } private boolean hasFlag(int start, boolean[] flags) { @@ -168,7 +167,7 @@ class TypoTolerantMatcher extends MinusculeMatcher { int startIndex = first.getStartOffset(); boolean afterSeparator = StringUtil.indexOfAny(name, myHardSeparators, 0, startIndex) >= 0; - boolean wordStart = startIndex == 0 || NameUtilCore.isWordStart(name, startIndex) && !NameUtilCore.isWordStart(name, startIndex - 1); + boolean wordStart = startIndex == 0 || NameUtil.isWordStart(name, startIndex) && !NameUtil.isWordStart(name, startIndex - 1); boolean finalMatch = fragments.get(fragments.size() - 1).getEndOffset() == name.length(); return (wordStart ? 1000 : 0) + @@ -428,7 +427,7 @@ class TypoTolerantMatcher extends MinusculeMatcher { // uppercase should match either uppercase or a word start return !isUpperCase(patternIndex, errorState) || Character.isUpperCase(myName.charAt(nextOccurrence)) || - NameUtilCore.isWordStart(myName, nextOccurrence) || + NameUtil.isWordStart(myName, nextOccurrence) || // accept uppercase matching lowercase if the whole prefix is uppercase and case sensitivity allows that !myHasHumps && myOptions != NameUtil.MatchingCaseSensitivity.ALL; } @@ -544,7 +543,7 @@ class TypoTolerantMatcher extends MinusculeMatcher { private boolean isMiddleMatch(int patternIndex, int nameIndex, @NotNull ErrorState errorState) { return isPatternChar(patternIndex - 1, '*', errorState) && !isWildcard(patternIndex + 1) && - Character.isLetterOrDigit(myName.charAt(nameIndex)) && !NameUtilCore.isWordStart(myName, nameIndex); + Character.isLetterOrDigit(myName.charAt(nameIndex)) && !NameUtil.isWordStart(myName, nameIndex); } @Nullable diff --git a/platform/util/src/com/intellij/ui/ActiveComponent.java b/platform/util/src/com/intellij/ui/ActiveComponent.java new file mode 100644 index 000000000000..b5a9496f3690 --- /dev/null +++ b/platform/util/src/com/intellij/ui/ActiveComponent.java @@ -0,0 +1,32 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; + +public interface ActiveComponent { + void setActive(boolean active); + + @NotNull + JComponent getComponent(); + + abstract class Adapter implements ActiveComponent { + @Override + public void setActive(boolean active) { } + } +} diff --git a/platform/util/ui/src/com/intellij/ui/AnchorableComponent.java b/platform/util/src/com/intellij/ui/AnchorableComponent.java similarity index 64% rename from platform/util/ui/src/com/intellij/ui/AnchorableComponent.java rename to platform/util/src/com/intellij/ui/AnchorableComponent.java index 4758493b49a7..a99589787fde 100644 --- a/platform/util/ui/src/com/intellij/ui/AnchorableComponent.java +++ b/platform/util/src/com/intellij/ui/AnchorableComponent.java @@ -1,4 +1,3 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; import org.jetbrains.annotations.Nullable; diff --git a/platform/util/ui/src/com/intellij/ui/CaptionPanel.java b/platform/util/src/com/intellij/ui/CaptionPanel.java similarity index 96% rename from platform/util/ui/src/com/intellij/ui/CaptionPanel.java rename to platform/util/src/com/intellij/ui/CaptionPanel.java index 3e223b1ccd89..9bac57763424 100644 --- a/platform/util/ui/src/com/intellij/ui/CaptionPanel.java +++ b/platform/util/src/com/intellij/ui/CaptionPanel.java @@ -1,7 +1,8 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; +import com.intellij.util.NotNullProducer; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/ui/src/com/intellij/ui/CheckBoxListListener.java b/platform/util/src/com/intellij/ui/CheckBoxListListener.java similarity index 51% rename from platform/util/ui/src/com/intellij/ui/CheckBoxListListener.java rename to platform/util/src/com/intellij/ui/CheckBoxListListener.java index 30b8a688d9fe..80e12a2566c3 100644 --- a/platform/util/ui/src/com/intellij/ui/CheckBoxListListener.java +++ b/platform/util/src/com/intellij/ui/CheckBoxListListener.java @@ -1,4 +1,3 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; /** diff --git a/platform/util/ui/src/com/intellij/ui/ClickListener.java b/platform/util/src/com/intellij/ui/ClickListener.java similarity index 77% rename from platform/util/ui/src/com/intellij/ui/ClickListener.java rename to platform/util/src/com/intellij/ui/ClickListener.java index 6dd5d4a3cbb7..bf3e706d3c09 100644 --- a/platform/util/ui/src/com/intellij/ui/ClickListener.java +++ b/platform/util/src/com/intellij/ui/ClickListener.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* * @author max diff --git a/platform/util/ui/src/com/intellij/ui/CollapsiblePanel.java b/platform/util/src/com/intellij/ui/CollapsiblePanel.java similarity index 92% rename from platform/util/ui/src/com/intellij/ui/CollapsiblePanel.java rename to platform/util/src/com/intellij/ui/CollapsiblePanel.java index 7b096efab68c..58e4cf6d815b 100644 --- a/platform/util/ui/src/com/intellij/ui/CollapsiblePanel.java +++ b/platform/util/src/com/intellij/ui/CollapsiblePanel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.util.containers.ContainerUtil; diff --git a/platform/util/src/com/intellij/ui/CollapsingListener.java b/platform/util/src/com/intellij/ui/CollapsingListener.java new file mode 100644 index 000000000000..96d7fe792e1f --- /dev/null +++ b/platform/util/src/com/intellij/ui/CollapsingListener.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +import org.jetbrains.annotations.NotNull; + +public interface CollapsingListener { + void onCollapsingChanged(@NotNull CollapsiblePanel panel, boolean newValue); +} diff --git a/platform/util/src/com/intellij/ui/ColorHexUtil.java b/platform/util/src/com/intellij/ui/ColorHexUtil.java deleted file mode 100644 index 66e4cbbdb452..000000000000 --- a/platform/util/src/com/intellij/ui/ColorHexUtil.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.awt.*; - -public class ColorHexUtil { - /** - * Return Color object from string. The following formats are allowed: - * {@code 0xA1B2C3}, - * {@code #abc123}, - * {@code ABC123}, - * {@code ab5}, - * {@code #FFF}. - * - * @param str hex string - * @return Color object - */ - @SuppressWarnings("UseJBColor") - @NotNull - public static Color fromHex(@NotNull String str) { - int pos = str.startsWith("#") ? 1 : str.startsWith("0x") ? 2 : 0; - int len = str.length() - pos; - if (len == 3) return new Color(fromHex1(str, pos), fromHex1(str, pos + 1), fromHex1(str, pos + 2), 255); - if (len == 4) return new Color(fromHex1(str, pos), fromHex1(str, pos + 1), fromHex1(str, pos + 2), fromHex1(str, pos + 3)); - if (len == 6) return new Color(fromHex2(str, pos), fromHex2(str, pos + 2), fromHex2(str, pos + 4), 255); - if (len == 8) return new Color(fromHex2(str, pos), fromHex2(str, pos + 2), fromHex2(str, pos + 4), fromHex2(str, pos + 6)); - throw new IllegalArgumentException("unsupported length:" + str); - } - - @Nullable - public static Color fromHex(@Nullable String str, @Nullable Color defaultValue) { - if (str == null) return defaultValue; - try { - return fromHex(str); - } - catch (Exception e) { - return defaultValue; - } - } - - private static int fromHex(@NotNull String str, int pos) { - char ch = str.charAt(pos); - if (ch >= '0' && ch <= '9') return ch - '0'; - if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; - if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; - throw new IllegalArgumentException("unsupported char at " + pos + ":" + str); - } - - private static int fromHex1(@NotNull String str, int pos) { - return 17 * fromHex(str, pos); - } - - private static int fromHex2(@NotNull String str, int pos) { - return 16 * fromHex(str, pos) + fromHex(str, pos + 1); - } -} diff --git a/platform/util/ui/src/com/intellij/ui/ColorUtil.java b/platform/util/src/com/intellij/ui/ColorUtil.java similarity index 84% rename from platform/util/ui/src/com/intellij/ui/ColorUtil.java rename to platform/util/src/com/intellij/ui/ColorUtil.java index 5977ec7c09f7..20b8a1994df5 100644 --- a/platform/util/ui/src/com/intellij/ui/ColorUtil.java +++ b/platform/util/src/com/intellij/ui/ColorUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. /* * @author max @@ -190,12 +190,40 @@ public class ColorUtil { */ @NotNull public static Color fromHex(@NotNull String str) { - return ColorHexUtil.fromHex(str); + int pos = str.startsWith("#") ? 1 : str.startsWith("0x") ? 2 : 0; + int len = str.length() - pos; + if (len == 3) return new Color(fromHex1(str, pos), fromHex1(str, pos + 1), fromHex1(str, pos + 2), 255); + if (len == 4) return new Color(fromHex1(str, pos), fromHex1(str, pos + 1), fromHex1(str, pos + 2), fromHex1(str, pos + 3)); + if (len == 6) return new Color(fromHex2(str, pos), fromHex2(str, pos + 2), fromHex2(str, pos + 4), 255); + if (len == 8) return new Color(fromHex2(str, pos), fromHex2(str, pos + 2), fromHex2(str, pos + 4), fromHex2(str, pos + 6)); + throw new IllegalArgumentException("unsupported length:" + str); + } + + private static int fromHex(@NotNull String str, int pos) { + char ch = str.charAt(pos); + if (ch >= '0' && ch <= '9') return ch - '0'; + if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; + if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; + throw new IllegalArgumentException("unsupported char at " + pos + ":" + str); + } + + private static int fromHex1(@NotNull String str, int pos) { + return 17 * fromHex(str, pos); + } + + private static int fromHex2(@NotNull String str, int pos) { + return 16 * fromHex(str, pos) + fromHex(str, pos + 1); } @Nullable public static Color fromHex(@Nullable String str, @Nullable Color defaultValue) { - return ColorHexUtil.fromHex(str, defaultValue); + if (str == null) return defaultValue; + try { + return fromHex(str); + } + catch (Exception e) { + return defaultValue; + } } /** diff --git a/platform/util/src/com/intellij/ui/Colors.java b/platform/util/src/com/intellij/ui/Colors.java new file mode 100644 index 000000000000..f93316a26d27 --- /dev/null +++ b/platform/util/src/com/intellij/ui/Colors.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +import java.awt.*; + +public interface Colors { + + Color DARK_RED = new Color(140, 0, 0); + Color DARK_GREEN = new Color(0, 140, 0); + Color DARK_BLUE = new Color(0, 0, 140); + + Color DISABLED_COLOR = Gray._150; +} diff --git a/platform/util/ui/src/com/intellij/ui/CompositeIcon.java b/platform/util/src/com/intellij/ui/CompositeIcon.java similarity index 89% rename from platform/util/ui/src/com/intellij/ui/CompositeIcon.java rename to platform/util/src/com/intellij/ui/CompositeIcon.java index 9c03cefa0ca3..4ed01bd8a71e 100644 --- a/platform/util/ui/src/com/intellij/ui/CompositeIcon.java +++ b/platform/util/src/com/intellij/ui/CompositeIcon.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; import org.jetbrains.annotations.Nullable; diff --git a/platform/util/ui/src/com/intellij/ui/DarculaColors.java b/platform/util/src/com/intellij/ui/DarculaColors.java similarity index 82% rename from platform/util/ui/src/com/intellij/ui/DarculaColors.java rename to platform/util/src/com/intellij/ui/DarculaColors.java index 7f733844ac69..602fa9ec6f4a 100644 --- a/platform/util/ui/src/com/intellij/ui/DarculaColors.java +++ b/platform/util/src/com/intellij/ui/DarculaColors.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/ui/DocumentAdapter.java b/platform/util/src/com/intellij/ui/DocumentAdapter.java similarity index 91% rename from platform/util/ui/src/com/intellij/ui/DocumentAdapter.java rename to platform/util/src/com/intellij/ui/DocumentAdapter.java index f72db40a5a6c..15bacbccb9ab 100644 --- a/platform/util/ui/src/com/intellij/ui/DocumentAdapter.java +++ b/platform/util/src/com/intellij/ui/DocumentAdapter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/ui/src/com/intellij/ui/EngravedLabel.java b/platform/util/src/com/intellij/ui/EngravedLabel.java similarity index 58% rename from platform/util/ui/src/com/intellij/ui/EngravedLabel.java rename to platform/util/src/com/intellij/ui/EngravedLabel.java index 52e895a626ae..ec4fc8afef8c 100644 --- a/platform/util/ui/src/com/intellij/ui/EngravedLabel.java +++ b/platform/util/src/com/intellij/ui/EngravedLabel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* * @author max diff --git a/platform/util/ui/src/com/intellij/ui/EngravedTextGraphics.java b/platform/util/src/com/intellij/ui/EngravedTextGraphics.java similarity index 81% rename from platform/util/ui/src/com/intellij/ui/EngravedTextGraphics.java rename to platform/util/src/com/intellij/ui/EngravedTextGraphics.java index e7595fa0e5cf..07f3452d2f6d 100644 --- a/platform/util/ui/src/com/intellij/ui/EngravedTextGraphics.java +++ b/platform/util/src/com/intellij/ui/EngravedTextGraphics.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* * @author max @@ -35,7 +49,7 @@ public class EngravedTextGraphics extends Graphics2DDelegate { public void drawChars(char[] data, int offset, int length, int x, int y) { if (ALLOW_ENGRAVEMENT) { final Color color = getColor(); - + if (color != myShadowColor) { setColor(myShadowColor); super.drawChars(data, offset, length, x + myXOffset, y + myYOffset); diff --git a/platform/util/src/com/intellij/ui/FileColorName.java b/platform/util/src/com/intellij/ui/FileColorName.java new file mode 100644 index 000000000000..f6231748fc63 --- /dev/null +++ b/platform/util/src/com/intellij/ui/FileColorName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +/** + * @author Konstantin Bulenkov + */ +public interface FileColorName { + String colorName(); +} diff --git a/platform/util/src/com/intellij/ui/Gradient.java b/platform/util/src/com/intellij/ui/Gradient.java new file mode 100644 index 000000000000..511fff947154 --- /dev/null +++ b/platform/util/src/com/intellij/ui/Gradient.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + +import java.awt.*; + +/** + * @author Konstantin Bulenkov + */ +public class Gradient { + private final Color myStartColor; + private final Color myEndColor; + + public Gradient(Color startColor, Color endColor) { + myStartColor = startColor; + myEndColor = endColor; + } + + public Color getStartColor() { + return myStartColor; + } + + public Color getEndColor() { + return myEndColor; + } +} diff --git a/platform/util/ui/src/com/intellij/ui/Graphics2DDelegate.java b/platform/util/src/com/intellij/ui/Graphics2DDelegate.java similarity index 93% rename from platform/util/ui/src/com/intellij/ui/Graphics2DDelegate.java rename to platform/util/src/com/intellij/ui/Graphics2DDelegate.java index 1dbfdabcefcb..2718e741943e 100644 --- a/platform/util/ui/src/com/intellij/ui/Graphics2DDelegate.java +++ b/platform/util/src/com/intellij/ui/Graphics2DDelegate.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.util.ui.UIUtil; diff --git a/platform/util/ui/src/com/intellij/ui/Graphics2DLog.java b/platform/util/src/com/intellij/ui/Graphics2DLog.java similarity index 100% rename from platform/util/ui/src/com/intellij/ui/Graphics2DLog.java rename to platform/util/src/com/intellij/ui/Graphics2DLog.java diff --git a/platform/util/ui/src/com/intellij/ui/Gray.java b/platform/util/src/com/intellij/ui/Gray.java similarity index 97% rename from platform/util/ui/src/com/intellij/ui/Gray.java rename to platform/util/src/com/intellij/ui/Gray.java index 552a85eadab3..bd26bcfef117 100644 --- a/platform/util/ui/src/com/intellij/ui/Gray.java +++ b/platform/util/src/com/intellij/ui/Gray.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/ui/HeldDownKeyListener.java b/platform/util/src/com/intellij/ui/HeldDownKeyListener.java similarity index 68% rename from platform/util/ui/src/com/intellij/ui/HeldDownKeyListener.java rename to platform/util/src/com/intellij/ui/HeldDownKeyListener.java index 7696859ac265..88d8ee3172f0 100644 --- a/platform/util/ui/src/com/intellij/ui/HeldDownKeyListener.java +++ b/platform/util/src/com/intellij/ui/HeldDownKeyListener.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/ui/JBAutoscroller.java b/platform/util/src/com/intellij/ui/JBAutoscroller.java similarity index 95% rename from platform/util/ui/src/com/intellij/ui/JBAutoscroller.java rename to platform/util/src/com/intellij/ui/JBAutoscroller.java index c37d577642e7..e4306645b5f5 100644 --- a/platform/util/ui/src/com/intellij/ui/JBAutoscroller.java +++ b/platform/util/src/com/intellij/ui/JBAutoscroller.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.openapi.util.Key; diff --git a/platform/util/ui/src/com/intellij/ui/JBColor.java b/platform/util/src/com/intellij/ui/JBColor.java similarity index 100% rename from platform/util/ui/src/com/intellij/ui/JBColor.java rename to platform/util/src/com/intellij/ui/JBColor.java diff --git a/platform/util/ui/src/com/intellij/ui/JBGradientPaint.java b/platform/util/src/com/intellij/ui/JBGradientPaint.java similarity index 67% rename from platform/util/ui/src/com/intellij/ui/JBGradientPaint.java rename to platform/util/src/com/intellij/ui/JBGradientPaint.java index 8679f5b7b96a..6f511e77bcde 100644 --- a/platform/util/ui/src/com/intellij/ui/JBGradientPaint.java +++ b/platform/util/src/com/intellij/ui/JBGradientPaint.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/ui/LightColors.java b/platform/util/src/com/intellij/ui/LightColors.java similarity index 51% rename from platform/util/ui/src/com/intellij/ui/LightColors.java rename to platform/util/src/com/intellij/ui/LightColors.java index 807534a2294b..39042d68bfce 100644 --- a/platform/util/ui/src/com/intellij/ui/LightColors.java +++ b/platform/util/src/com/intellij/ui/LightColors.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; diff --git a/platform/util/ui/src/com/intellij/ui/MixedColorProducer.java b/platform/util/src/com/intellij/ui/MixedColorProducer.java similarity index 95% rename from platform/util/ui/src/com/intellij/ui/MixedColorProducer.java rename to platform/util/src/com/intellij/ui/MixedColorProducer.java index aa27941c528b..c19afce1d1ff 100644 --- a/platform/util/ui/src/com/intellij/ui/MixedColorProducer.java +++ b/platform/util/src/com/intellij/ui/MixedColorProducer.java @@ -1,11 +1,11 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; import com.intellij.openapi.util.Couple; import com.intellij.util.NotNullProducer; import org.jetbrains.annotations.NotNull; -import java.awt.*; +import java.awt.Color; /** * This is a color producer that allows dynamically mix two colors. diff --git a/platform/util/ui/src/com/intellij/ui/PanelWithAnchor.java b/platform/util/src/com/intellij/ui/PanelWithAnchor.java similarity index 62% rename from platform/util/ui/src/com/intellij/ui/PanelWithAnchor.java rename to platform/util/src/com/intellij/ui/PanelWithAnchor.java index 8446c0967c01..a31ccf79939d 100644 --- a/platform/util/ui/src/com/intellij/ui/PanelWithAnchor.java +++ b/platform/util/src/com/intellij/ui/PanelWithAnchor.java @@ -1,4 +1,3 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui; import org.jetbrains.annotations.Nullable; diff --git a/platform/util/ui/src/com/intellij/ui/PopupBorder.java b/platform/util/src/com/intellij/ui/PopupBorder.java similarity index 78% rename from platform/util/ui/src/com/intellij/ui/PopupBorder.java rename to platform/util/src/com/intellij/ui/PopupBorder.java index 6d71184b17f2..cca30cda75d5 100644 --- a/platform/util/ui/src/com/intellij/ui/PopupBorder.java +++ b/platform/util/src/com/intellij/ui/PopupBorder.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.openapi.util.SystemInfo; diff --git a/platform/util/src/com/intellij/ui/RetrievableIcon.java b/platform/util/src/com/intellij/ui/RetrievableIcon.java new file mode 100644 index 000000000000..162cfcbb2de8 --- /dev/null +++ b/platform/util/src/com/intellij/ui/RetrievableIcon.java @@ -0,0 +1,33 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.intellij.ui; + +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + + +/** + * An icon wrapping and painting another icon. + */ +public interface RetrievableIcon extends Icon { + /** + * Returns the wrapped icon. + */ + @Nullable + Icon retrieveIcon(); +} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/ui/SeparatorComponent.java b/platform/util/src/com/intellij/ui/SeparatorComponent.java similarity index 81% rename from platform/util/ui/src/com/intellij/ui/SeparatorComponent.java rename to platform/util/src/com/intellij/ui/SeparatorComponent.java index 4853ce9340cb..d5e17c898268 100644 --- a/platform/util/ui/src/com/intellij/ui/SeparatorComponent.java +++ b/platform/util/src/com/intellij/ui/SeparatorComponent.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.util.ui.JBUI; diff --git a/platform/util/src/com/intellij/ui/SeparatorOrientation.java b/platform/util/src/com/intellij/ui/SeparatorOrientation.java new file mode 100644 index 000000000000..bea84d6e2e01 --- /dev/null +++ b/platform/util/src/com/intellij/ui/SeparatorOrientation.java @@ -0,0 +1,33 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui; + + +public class SeparatorOrientation { + public static final SeparatorOrientation HORIZONTAL = new SeparatorOrientation("HORIZONTAL"); + public static final SeparatorOrientation VERTICAL = new SeparatorOrientation("VERTICAL"); + + private final String myName; // for debug only + + private SeparatorOrientation(String name) { + myName = name; + } + + public String toString() { + return myName; + } + +} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/ui/SideBorder.java b/platform/util/src/com/intellij/ui/SideBorder.java similarity index 76% rename from platform/util/ui/src/com/intellij/ui/SideBorder.java rename to platform/util/src/com/intellij/ui/SideBorder.java index 1ca17930d445..c54f01abbd4d 100644 --- a/platform/util/ui/src/com/intellij/ui/SideBorder.java +++ b/platform/util/src/com/intellij/ui/SideBorder.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; diff --git a/platform/util/ui/src/com/intellij/ui/SmartExpander.java b/platform/util/src/com/intellij/ui/SmartExpander.java similarity index 72% rename from platform/util/ui/src/com/intellij/ui/SmartExpander.java rename to platform/util/src/com/intellij/ui/SmartExpander.java index ac756efea44d..54a3079f4e3e 100644 --- a/platform/util/ui/src/com/intellij/ui/SmartExpander.java +++ b/platform/util/src/com/intellij/ui/SmartExpander.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/ui/TableUtil.java b/platform/util/src/com/intellij/ui/TableUtil.java similarity index 93% rename from platform/util/ui/src/com/intellij/ui/TableUtil.java rename to platform/util/src/com/intellij/ui/TableUtil.java index 595bb368b6da..c69dca5b7be1 100644 --- a/platform/util/ui/src/com/intellij/ui/TableUtil.java +++ b/platform/util/src/com/intellij/ui/TableUtil.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.util.SmartList; diff --git a/platform/util/ui/src/com/intellij/ui/TitlePanel.java b/platform/util/src/com/intellij/ui/TitlePanel.java similarity index 100% rename from platform/util/ui/src/com/intellij/ui/TitlePanel.java rename to platform/util/src/com/intellij/ui/TitlePanel.java diff --git a/platform/util/ui/src/com/intellij/ui/TransparentPanel.java b/platform/util/src/com/intellij/ui/TransparentPanel.java similarity index 59% rename from platform/util/ui/src/com/intellij/ui/TransparentPanel.java rename to platform/util/src/com/intellij/ui/TransparentPanel.java index 7e76d84c02e2..a663e1b5600c 100644 --- a/platform/util/ui/src/com/intellij/ui/TransparentPanel.java +++ b/platform/util/src/com/intellij/ui/TransparentPanel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/ui/UIBundle.java b/platform/util/src/com/intellij/ui/UIBundle.java similarity index 61% rename from platform/util/ui/src/com/intellij/ui/UIBundle.java rename to platform/util/src/com/intellij/ui/UIBundle.java index 984a950c3cbf..8d45841305d6 100644 --- a/platform/util/ui/src/com/intellij/ui/UIBundle.java +++ b/platform/util/src/com/intellij/ui/UIBundle.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.CommonBundle; diff --git a/platform/util/ui/src/com/intellij/ui/awt/RelativePoint.java b/platform/util/src/com/intellij/ui/awt/RelativePoint.java similarity index 88% rename from platform/util/ui/src/com/intellij/ui/awt/RelativePoint.java rename to platform/util/src/com/intellij/ui/awt/RelativePoint.java index b1e65708d913..dc5bb76a3fdb 100644 --- a/platform/util/ui/src/com/intellij/ui/awt/RelativePoint.java +++ b/platform/util/src/com/intellij/ui/awt/RelativePoint.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.awt; import org.jetbrains.annotations.NotNull; @@ -98,7 +112,7 @@ public class RelativePoint { @NotNull public MouseEvent toMouseEvent() { - return new MouseEvent(myComponent, 0, 0, 0, myPointOnComponent.x, myPointOnComponent.y, 1, false); + return new MouseEvent(myComponent, 0, 0, 0, myPointOnComponent.x, myPointOnComponent.y, 1, false); } @Override diff --git a/platform/util/ui/src/com/intellij/ui/awt/RelativeRectangle.java b/platform/util/src/com/intellij/ui/awt/RelativeRectangle.java similarity index 77% rename from platform/util/ui/src/com/intellij/ui/awt/RelativeRectangle.java rename to platform/util/src/com/intellij/ui/awt/RelativeRectangle.java index b2ca0bd92a41..206af879b647 100644 --- a/platform/util/ui/src/com/intellij/ui/awt/RelativeRectangle.java +++ b/platform/util/src/com/intellij/ui/awt/RelativeRectangle.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.awt; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/ui/border/CustomLineBorder.java b/platform/util/src/com/intellij/ui/border/CustomLineBorder.java similarity index 73% rename from platform/util/ui/src/com/intellij/ui/border/CustomLineBorder.java rename to platform/util/src/com/intellij/ui/border/CustomLineBorder.java index 3d617f3e2858..b9908c956adf 100644 --- a/platform/util/ui/src/com/intellij/ui/border/CustomLineBorder.java +++ b/platform/util/src/com/intellij/ui/border/CustomLineBorder.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.border; import com.intellij.util.ui.JBUI; diff --git a/platform/util/ui/src/com/intellij/ui/components/JBPanel.java b/platform/util/src/com/intellij/ui/components/JBPanel.java similarity index 82% rename from platform/util/ui/src/com/intellij/ui/components/JBPanel.java rename to platform/util/src/com/intellij/ui/components/JBPanel.java index ca506d9f2433..41d6b80dc22d 100644 --- a/platform/util/ui/src/com/intellij/ui/components/JBPanel.java +++ b/platform/util/src/com/intellij/ui/components/JBPanel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.components; import com.intellij.util.ui.JBFont; diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/Foundation.java b/platform/util/src/com/intellij/ui/mac/foundation/Foundation.java similarity index 100% rename from platform/util/ui/src/com/intellij/ui/mac/foundation/Foundation.java rename to platform/util/src/com/intellij/ui/mac/foundation/Foundation.java index e4648d2d6dae..e0abb668d330 100644 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/Foundation.java +++ b/platform/util/src/com/intellij/ui/mac/foundation/Foundation.java @@ -12,8 +12,8 @@ import org.jetbrains.annotations.Nullable; import java.awt.*; import java.io.File; -import java.util.List; import java.util.*; +import java.util.List; /** * @author spleaner diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/FoundationLibrary.java b/platform/util/src/com/intellij/ui/mac/foundation/FoundationLibrary.java similarity index 86% rename from platform/util/ui/src/com/intellij/ui/mac/foundation/FoundationLibrary.java rename to platform/util/src/com/intellij/ui/mac/foundation/FoundationLibrary.java index e5c7d9e05124..6aa64b8e10c3 100644 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/FoundationLibrary.java +++ b/platform/util/src/com/intellij/ui/mac/foundation/FoundationLibrary.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.mac.foundation; import com.sun.jna.Callback; @@ -25,7 +39,7 @@ public interface FoundationLibrary extends Library { long CFStringConvertIANACharSetNameToEncoding(ID encodingName); long CFStringConvertEncodingToNSStringEncoding(long cfEncoding); - + ID CGWindowListCreateImage(Foundation.NSRect screenBounds, int windowOption, ID windowID, int imageOption); void CFRetain(ID cfTypeRef); @@ -72,7 +86,7 @@ public interface FoundationLibrary extends Library { int kCFStringEncodingUTF32 = 0x0c000100; int kCFStringEncodingUTF32BE = 0x18000100; int kCFStringEncodingUTF32LE = 0x1c000100; - + // https://developer.apple.com/library/mac/documentation/Carbon/Reference/CGWindow_Reference/Constants/Constants.html#//apple_ref/doc/constant_group/Window_List_Option_Constants int kCGWindowListOptionAll = 0; int kCGWindowListOptionOnScreenOnly = 1; @@ -80,7 +94,7 @@ public interface FoundationLibrary extends Library { int kCGWindowListOptionOnScreenBelowWindow = 4; int kCGWindowListOptionIncludingWindow = 8; int kCGWindowListExcludeDesktopElements = 16; - + //https://developer.apple.com/library/mac/documentation/Carbon/Reference/CGWindow_Reference/Constants/Constants.html#//apple_ref/doc/constant_group/Window_Image_Types int kCGWindowImageDefault = 0; int kCGWindowImageBoundsIgnoreFraming = 1; diff --git a/platform/util/src/com/intellij/ui/mac/foundation/ID.java b/platform/util/src/com/intellij/ui/mac/foundation/ID.java new file mode 100644 index 000000000000..17a55d3267f4 --- /dev/null +++ b/platform/util/src/com/intellij/ui/mac/foundation/ID.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui.mac.foundation; + +import com.sun.jna.NativeLong; + +/** + * Could be an address in memory (if pointer to a class or method) or a value (like 0 or 1) + * + * User: spLeaner + */ +public class ID extends NativeLong { + + public ID() { + } + + public ID(long peer) { + super(peer); + } + + public static final ID NIL = new ID(0); + +} diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/MacUtil.java b/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java similarity index 99% rename from platform/util/ui/src/com/intellij/ui/mac/foundation/MacUtil.java rename to platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java index 94ec69e14e50..7bd3607a7ee1 100644 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/MacUtil.java +++ b/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.mac.foundation; import com.intellij.openapi.Disposable; diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/NSColor.java b/platform/util/src/com/intellij/ui/mac/foundation/NSColor.java similarity index 95% rename from platform/util/ui/src/com/intellij/ui/mac/foundation/NSColor.java rename to platform/util/src/com/intellij/ui/mac/foundation/NSColor.java index beb3a7d37d6f..6e572dddf21c 100644 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/NSColor.java +++ b/platform/util/src/com/intellij/ui/mac/foundation/NSColor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.mac.foundation; import com.intellij.openapi.util.SystemInfo; diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/NSDefaults.java b/platform/util/src/com/intellij/ui/mac/foundation/NSDefaults.java similarity index 99% rename from platform/util/ui/src/com/intellij/ui/mac/foundation/NSDefaults.java rename to platform/util/src/com/intellij/ui/mac/foundation/NSDefaults.java index 0a54a4f7d9ff..64593629a7c5 100644 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/NSDefaults.java +++ b/platform/util/src/com/intellij/ui/mac/foundation/NSDefaults.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.mac.foundation; import com.intellij.openapi.diagnostic.Logger; diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/NSWorkspace.java b/platform/util/src/com/intellij/ui/mac/foundation/NSWorkspace.java similarity index 55% rename from platform/util/ui/src/com/intellij/ui/mac/foundation/NSWorkspace.java rename to platform/util/src/com/intellij/ui/mac/foundation/NSWorkspace.java index 69234af1fff9..f03536ca3a0f 100644 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/NSWorkspace.java +++ b/platform/util/src/com/intellij/ui/mac/foundation/NSWorkspace.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.mac.foundation; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/src/com/intellij/ui/mac/foundation/Selector.java b/platform/util/src/com/intellij/ui/mac/foundation/Selector.java new file mode 100644 index 000000000000..d8c62a1a8ca8 --- /dev/null +++ b/platform/util/src/com/intellij/ui/mac/foundation/Selector.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui.mac.foundation; + +import com.sun.jna.NativeLong; + +/** + * @author spleaner + */ +public class Selector extends NativeLong { + + private String myName; + + public Selector() { + this("undefined selector", 0); + } + + public Selector(String name, long value) { + super(value); + myName = name; + } + + public String getName() { + return myName; + } + + @Override + public String toString() { + return String.format("[Selector %s]", myName); + } + + public Selector initName(final String name) { + myName = name; + return this; + } +} diff --git a/platform/util/ui/src/com/intellij/ui/paint/LinePainter2D.java b/platform/util/src/com/intellij/ui/paint/LinePainter2D.java similarity index 99% rename from platform/util/ui/src/com/intellij/ui/paint/LinePainter2D.java rename to platform/util/src/com/intellij/ui/paint/LinePainter2D.java index e5796ec783e4..9cd9889dc230 100644 --- a/platform/util/ui/src/com/intellij/ui/paint/LinePainter2D.java +++ b/platform/util/src/com/intellij/ui/paint/LinePainter2D.java @@ -1,10 +1,11 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.paint; import com.intellij.openapi.util.Pair; import com.intellij.ui.paint.PaintUtil.ParityMode; import com.intellij.ui.paint.PaintUtil.RoundingMode; import com.intellij.util.ui.JBUIScale.ScaleContext; +import com.intellij.util.ui.JBUIScale; import com.intellij.util.ui.JBUIScale.ScaleType; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.ApiStatus; diff --git a/platform/util/ui/src/com/intellij/ui/paint/PaintUtil.java b/platform/util/src/com/intellij/ui/paint/PaintUtil.java similarity index 99% rename from platform/util/ui/src/com/intellij/ui/paint/PaintUtil.java rename to platform/util/src/com/intellij/ui/paint/PaintUtil.java index adbaeee502ad..fd89b0426efe 100644 --- a/platform/util/ui/src/com/intellij/ui/paint/PaintUtil.java +++ b/platform/util/src/com/intellij/ui/paint/PaintUtil.java @@ -1,10 +1,11 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.paint; import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.JBUIScale.ScaleContext; import com.intellij.util.ui.JBUIScale.ScaleType; +import com.intellij.util.ui.JBUIScale; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/util/ui/src/com/intellij/ui/paint/RectanglePainter.java b/platform/util/src/com/intellij/ui/paint/RectanglePainter.java similarity index 73% rename from platform/util/ui/src/com/intellij/ui/paint/RectanglePainter.java rename to platform/util/src/com/intellij/ui/paint/RectanglePainter.java index d04d23952fa9..163a702f3fdf 100644 --- a/platform/util/ui/src/com/intellij/ui/paint/RectanglePainter.java +++ b/platform/util/src/com/intellij/ui/paint/RectanglePainter.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.paint; import com.intellij.ui.paint.LinePainter2D.StrokeType; diff --git a/platform/util/ui/src/com/intellij/ui/paint/RectanglePainter2D.java b/platform/util/src/com/intellij/ui/paint/RectanglePainter2D.java similarity index 99% rename from platform/util/ui/src/com/intellij/ui/paint/RectanglePainter2D.java rename to platform/util/src/com/intellij/ui/paint/RectanglePainter2D.java index 33a4fb8f2a6e..5c273cd680b6 100644 --- a/platform/util/ui/src/com/intellij/ui/paint/RectanglePainter2D.java +++ b/platform/util/src/com/intellij/ui/paint/RectanglePainter2D.java @@ -1,9 +1,10 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.paint; import com.intellij.openapi.util.Pair; import com.intellij.ui.paint.LinePainter2D.Align; import com.intellij.ui.paint.LinePainter2D.StrokeType; +import com.intellij.util.ui.JBUIScale; import com.intellij.util.ui.JBUIScale.ScaleContext; import com.intellij.util.ui.JBUIScale.ScaleType; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/ui/src/com/intellij/ui/paint/RegionPainter2D.java b/platform/util/src/com/intellij/ui/paint/RegionPainter2D.java similarity index 92% rename from platform/util/ui/src/com/intellij/ui/paint/RegionPainter2D.java rename to platform/util/src/com/intellij/ui/paint/RegionPainter2D.java index 661c4077cc8c..42dc917f589b 100644 --- a/platform/util/ui/src/com/intellij/ui/paint/RegionPainter2D.java +++ b/platform/util/src/com/intellij/ui/paint/RegionPainter2D.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.paint; import com.intellij.util.ui.RegionPainter; diff --git a/platform/util/ui/src/com/intellij/ui/util/Axis.java b/platform/util/src/com/intellij/ui/util/Axis.java similarity index 58% rename from platform/util/ui/src/com/intellij/ui/util/Axis.java rename to platform/util/src/com/intellij/ui/util/Axis.java index 35ac0fa65de1..4641217a5c7e 100644 --- a/platform/util/ui/src/com/intellij/ui/util/Axis.java +++ b/platform/util/src/com/intellij/ui/util/Axis.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui.util; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/util/AppleHiDPIScaledImage.java b/platform/util/src/com/intellij/util/AppleHiDPIScaledImage.java similarity index 91% rename from platform/util/ui/src/com/intellij/util/AppleHiDPIScaledImage.java rename to platform/util/src/com/intellij/util/AppleHiDPIScaledImage.java index 9164030c6502..c028cb093d57 100644 --- a/platform/util/ui/src/com/intellij/util/AppleHiDPIScaledImage.java +++ b/platform/util/src/com/intellij/util/AppleHiDPIScaledImage.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; import apple.awt.CImage; diff --git a/platform/util/ui/src/com/intellij/util/ComponentTreeEventDispatcher.java b/platform/util/src/com/intellij/util/ComponentTreeEventDispatcher.java similarity index 69% rename from platform/util/ui/src/com/intellij/util/ComponentTreeEventDispatcher.java rename to platform/util/src/com/intellij/util/ComponentTreeEventDispatcher.java index 6b56832562bb..46833c19ef35 100644 --- a/platform/util/ui/src/com/intellij/util/ComponentTreeEventDispatcher.java +++ b/platform/util/src/com/intellij/util/ComponentTreeEventDispatcher.java @@ -1,6 +1,21 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util; +import com.intellij.openapi.util.Getter; import com.intellij.util.containers.JBTreeTraverser; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/util/ui/src/com/intellij/util/FontUtil.java b/platform/util/src/com/intellij/util/FontUtil.java similarity index 69% rename from platform/util/ui/src/com/intellij/util/FontUtil.java rename to platform/util/src/com/intellij/util/FontUtil.java index 222b00fd0d16..a9ca6a03abb6 100644 --- a/platform/util/ui/src/com/intellij/util/FontUtil.java +++ b/platform/util/src/com/intellij/util/FontUtil.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util; import com.intellij.util.ui.UIUtil; @@ -33,7 +47,7 @@ public class FontUtil { public static String spaceAndThinSpace() { return " " + thinSpace(); } - + @NotNull public static String thinSpace() { return canDisplay(UIUtil.getLabelFont(), '\u2009', " "); diff --git a/platform/util/ui/src/com/intellij/util/HiDPIScaledGraphics.java b/platform/util/src/com/intellij/util/HiDPIScaledGraphics.java similarity index 94% rename from platform/util/ui/src/com/intellij/util/HiDPIScaledGraphics.java rename to platform/util/src/com/intellij/util/HiDPIScaledGraphics.java index d2c16dd060d0..4ec53d3690ab 100644 --- a/platform/util/ui/src/com/intellij/util/HiDPIScaledGraphics.java +++ b/platform/util/src/com/intellij/util/HiDPIScaledGraphics.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util; import com.intellij.util.ui.GraphicsUtil; diff --git a/platform/util/ui/src/com/intellij/util/ImageLoader.java b/platform/util/src/com/intellij/util/ImageLoader.java similarity index 98% rename from platform/util/ui/src/com/intellij/util/ImageLoader.java rename to platform/util/src/com/intellij/util/ImageLoader.java index 3e12cde8b5b8..cce72641a59d 100644 --- a/platform/util/ui/src/com/intellij/util/ImageLoader.java +++ b/platform/util/src/com/intellij/util/ImageLoader.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; import com.intellij.openapi.diagnostic.Logger; @@ -9,11 +9,8 @@ import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.ui.EmptyIcon; -import com.intellij.util.ui.ImageUtil; -import com.intellij.util.ui.JBUI; +import com.intellij.util.ui.*; import com.intellij.util.ui.JBUIScale.ScaleContext; -import com.intellij.util.ui.UIUtil; import org.apache.xmlgraphics.java2d.Dimension2DDouble; import org.imgscalr.Scalr; import org.jetbrains.annotations.NonNls; diff --git a/platform/util/ui/src/com/intellij/util/JBHiDPIScaledImage.java b/platform/util/src/com/intellij/util/JBHiDPIScaledImage.java similarity index 93% rename from platform/util/ui/src/com/intellij/util/JBHiDPIScaledImage.java rename to platform/util/src/com/intellij/util/JBHiDPIScaledImage.java index d8f34f87ca09..628a56220fc6 100644 --- a/platform/util/ui/src/com/intellij/util/JBHiDPIScaledImage.java +++ b/platform/util/src/com/intellij/util/JBHiDPIScaledImage.java @@ -1,9 +1,24 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util; import com.intellij.ui.paint.PaintUtil.RoundingMode; import com.intellij.util.ui.ImageUtil; import com.intellij.util.ui.JBUI; +import com.intellij.util.ui.JBUIScale; import com.intellij.util.ui.JBUIScale.ScaleContext; import org.imgscalr.Scalr; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/ui/src/com/intellij/util/RetinaImage.java b/platform/util/src/com/intellij/util/RetinaImage.java similarity index 97% rename from platform/util/ui/src/com/intellij/util/RetinaImage.java rename to platform/util/src/com/intellij/util/RetinaImage.java index ea71f7ba9724..c061e6e785b3 100644 --- a/platform/util/ui/src/com/intellij/util/RetinaImage.java +++ b/platform/util/src/com/intellij/util/RetinaImage.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; import com.intellij.ui.paint.PaintUtil.RoundingMode; diff --git a/platform/util/ui/src/com/intellij/util/SVGLoader.java b/platform/util/src/com/intellij/util/SVGLoader.java similarity index 97% rename from platform/util/ui/src/com/intellij/util/SVGLoader.java rename to platform/util/src/com/intellij/util/SVGLoader.java index 67a82a5e89eb..4ba4d6460e7f 100644 --- a/platform/util/ui/src/com/intellij/util/SVGLoader.java +++ b/platform/util/src/com/intellij/util/SVGLoader.java @@ -7,7 +7,6 @@ import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream; import com.intellij.util.LazyInitializer.NotNullValue; import com.intellij.util.ui.ImageUtil; import com.intellij.util.ui.JBUI; -import com.intellij.util.ui.JBUIScale; import com.intellij.util.ui.JBUIScale.ScaleContext; import org.apache.batik.anim.dom.*; import org.apache.batik.bridge.BridgeContext; @@ -39,6 +38,8 @@ import java.io.StringReader; import java.net.URISyntaxException; import java.net.URL; +import static com.intellij.util.ui.JBUIScale.DerivedScaleType.PIX_SCALE; + /** * @author tav */ @@ -146,7 +147,7 @@ public class SVGLoader { */ public static Image load(@Nullable URL url, @NotNull InputStream stream, @NotNull ScaleContext ctx, double width, double height) throws IOException { try { - double s = ctx.getScale(JBUIScale.DerivedScaleType.PIX_SCALE); + double s = ctx.getScale(PIX_SCALE); return new SVGLoader(url, stream, width * s, height * s, 1).createImage(); } catch (TranscoderException ex) { @@ -171,7 +172,7 @@ public class SVGLoader { * Loads a HiDPI-aware image of the size specified in the svg file. */ public static T loadHiDPI(@Nullable URL url, @NotNull InputStream stream, ScaleContext ctx) throws IOException { - BufferedImage image = (BufferedImage)load(url, stream, ctx.getScale(JBUIScale.DerivedScaleType.PIX_SCALE)); + BufferedImage image = (BufferedImage)load(url, stream, ctx.getScale(PIX_SCALE)); @SuppressWarnings("unchecked") T t = (T)ImageUtil.ensureHiDPI(image, ctx); return t; } @@ -207,7 +208,7 @@ public class SVGLoader { } public static double getMaxZoomFactor(@Nullable URL url, @NotNull InputStream stream, @NotNull ScaleContext ctx) throws IOException { - SVGLoader loader = new SVGLoader(url, stream, ctx.getScale(JBUIScale.DerivedScaleType.PIX_SCALE)); + SVGLoader loader = new SVGLoader(url, stream, ctx.getScale(PIX_SCALE)); Dimension2D size = loader.getDocumentSize(); return Math.min(ICON_MAX_SIZE.get() / size.getWidth(), ICON_MAX_SIZE.get() / size.getHeight()); } @@ -318,7 +319,7 @@ public class SVGLoader { private static class MySVGDOMImplementation extends SVGDOMImplementation { static { - SVGDOMImplementation.svg11Factories.put("rect", new SVGDOMImplementation.RectElementFactory() { + svg11Factories.put("rect", new SVGDOMImplementation.RectElementFactory() { @Override public Element create(String prefix, Document doc) { return new SVGOMRectElement(prefix, (AbstractDocument)doc) { diff --git a/platform/util/src/com/intellij/util/text/Matcher.java b/platform/util/src/com/intellij/util/text/Matcher.java new file mode 100644 index 000000000000..94b2a3959770 --- /dev/null +++ b/platform/util/src/com/intellij/util/text/Matcher.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.text; + +import com.intellij.psi.codeStyle.NameUtil; +import org.jetbrains.annotations.NotNull; + +/** + * @author Konstantin Bulenkov + */ +@SuppressWarnings("ClassNameSameAsAncestorName") +public interface Matcher extends NameUtil.Matcher { + @Override + boolean matches(@NotNull String name); +} diff --git a/platform/util/src/com/intellij/util/text/NameUtilCore.java b/platform/util/src/com/intellij/util/text/NameUtilCore.java deleted file mode 100644 index 38863dac03e7..000000000000 --- a/platform/util/src/com/intellij/util/text/NameUtilCore.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.text; - -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.ArrayUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class NameUtilCore { - /** - * Splits an identifier into words, separated with underscores or upper-case characters - * (camel-case). - * - * @param name the identifier to split. - * @return the array of strings into which the identifier has been split. - */ - @NotNull - public static String[] splitNameIntoWords(@NotNull String name) { - final String[] underlineDelimited = name.split("_"); - List result = new ArrayList<>(); - for (String word : underlineDelimited) { - addAllWords(word, result); - } - return ArrayUtil.toStringArray(result); - } - - private static void addAllWords(@NotNull String text, @NotNull List result) { - int start = 0; - while (start < text.length()) { - int next = nextWord(text, start); - result.add(text.substring(start, next)); - start = next; - } - } - - public static int nextWord(@NotNull String text, int start) { - if (!Character.isLetterOrDigit(text.charAt(start))) { - return start + 1; - } - - int i = start; - while (i < text.length() && Character.isDigit(text.charAt(i))) i++; - if (i > start) { - // digits form a separate hump - return i; - } - - while (i < text.length() && Character.isUpperCase(text.charAt(i))) i++; - - if (i > start + 1) { - // several consecutive uppercase letter form a hump - if (i == text.length() || !Character.isLetter(text.charAt(i))) { - return i; - } - return i - 1; - } - - if (i == start) i++; - while (i < text.length() && Character.isLetter(text.charAt(i)) && !isWordStart(text, i)) i++; - return i; - } - - public static boolean isWordStart(String text, int i) { - char c = text.charAt(i); - if (Character.isUpperCase(c)) { - if (i > 0 && Character.isUpperCase(text.charAt(i - 1))) { - // check that we're not in the middle of an all-caps word - return i + 1 < text.length() && Character.isLowerCase(text.charAt(i + 1)); - } - return true; - } - if (Character.isDigit(c)) { - return true; - } - if (!Character.isLetter(c)) { - return false; - } - return i == 0 || !Character.isLetterOrDigit(text.charAt(i - 1)) || isHardCodedWordStart(text, i); - } - - private static boolean isHardCodedWordStart(String text, int i) { - return text.charAt(i) == 'l' && - i < text.length() - 1 && text.charAt(i + 1) == 'n' && - (text.length() == i + 2 || isWordStart(text, i + 2)); - } - - @NotNull - public static String[] nameToWords(@NotNull String name) { - List array = new ArrayList<>(); - int index = 0; - - while (index < name.length()) { - int wordStart = index; - int upperCaseCount = 0; - int lowerCaseCount = 0; - int digitCount = 0; - int specialCount = 0; - while (index < name.length()) { - char c = name.charAt(index); - if (Character.isDigit(c)) { - if (upperCaseCount > 0 || lowerCaseCount > 0 || specialCount > 0) break; - digitCount++; - } - else if (Character.isUpperCase(c)) { - if (lowerCaseCount > 0 || digitCount > 0 || specialCount > 0) break; - upperCaseCount++; - } - else if (Character.isLowerCase(c)) { - if (digitCount > 0 || specialCount > 0) break; - if (upperCaseCount > 1) { - index--; - break; - } - lowerCaseCount++; - } - else { - if (upperCaseCount > 0 || lowerCaseCount > 0 || digitCount > 0) break; - specialCount++; - } - index++; - } - String word = name.substring(wordStart, index); - if (!StringUtil.isEmptyOrSpaces(word)) { - array.add(word); - } - } - return ArrayUtil.toStringArray(array); - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/AATextInfo.java b/platform/util/src/com/intellij/util/ui/AATextInfo.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/AATextInfo.java rename to platform/util/src/com/intellij/util/ui/AATextInfo.java diff --git a/platform/util/ui/src/com/intellij/util/ui/AbstractLayoutManager.java b/platform/util/src/com/intellij/util/ui/AbstractLayoutManager.java similarity index 60% rename from platform/util/ui/src/com/intellij/util/ui/AbstractLayoutManager.java rename to platform/util/src/com/intellij/util/ui/AbstractLayoutManager.java index 7eb0c640f22d..16371ceaaac2 100644 --- a/platform/util/ui/src/com/intellij/util/ui/AbstractLayoutManager.java +++ b/platform/util/src/com/intellij/util/ui/AbstractLayoutManager.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; diff --git a/platform/util/src/com/intellij/util/ui/AbstractTableCellEditor.java b/platform/util/src/com/intellij/util/ui/AbstractTableCellEditor.java new file mode 100644 index 000000000000..7311d0f6fead --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/AbstractTableCellEditor.java @@ -0,0 +1,24 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import javax.swing.*; +import javax.swing.table.TableCellEditor; + + +public abstract class AbstractTableCellEditor extends AbstractCellEditor implements TableCellEditor{ + +} diff --git a/platform/util/ui/src/com/intellij/util/ui/AdjustComponentWhenShown.java b/platform/util/src/com/intellij/util/ui/AdjustComponentWhenShown.java similarity index 64% rename from platform/util/ui/src/com/intellij/util/ui/AdjustComponentWhenShown.java rename to platform/util/src/com/intellij/util/ui/AdjustComponentWhenShown.java index 27af4ac9b58d..35cc6042a471 100644 --- a/platform/util/ui/src/com/intellij/util/ui/AdjustComponentWhenShown.java +++ b/platform/util/src/com/intellij/util/ui/AdjustComponentWhenShown.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/AppleBoldDottedPainter.java b/platform/util/src/com/intellij/util/ui/AppleBoldDottedPainter.java similarity index 84% rename from platform/util/ui/src/com/intellij/util/ui/AppleBoldDottedPainter.java rename to platform/util/src/com/intellij/util/ui/AppleBoldDottedPainter.java index a86c86b6df72..5a4eea2946af 100644 --- a/platform/util/ui/src/com/intellij/util/ui/AppleBoldDottedPainter.java +++ b/platform/util/src/com/intellij/util/ui/AppleBoldDottedPainter.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/BlockBorder.java b/platform/util/src/com/intellij/util/ui/BlockBorder.java similarity index 84% rename from platform/util/ui/src/com/intellij/util/ui/BlockBorder.java rename to platform/util/src/com/intellij/util/ui/BlockBorder.java index 60ad70e04c4d..2c59d42d6bbd 100644 --- a/platform/util/ui/src/com/intellij/util/ui/BlockBorder.java +++ b/platform/util/src/com/intellij/util/ui/BlockBorder.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.ui.Gray; diff --git a/platform/util/ui/src/com/intellij/util/ui/CenteredIcon.java b/platform/util/src/com/intellij/util/ui/CenteredIcon.java similarity index 68% rename from platform/util/ui/src/com/intellij/util/ui/CenteredIcon.java rename to platform/util/src/com/intellij/util/ui/CenteredIcon.java index 955617eb72e3..1f69e491de24 100644 --- a/platform/util/ui/src/com/intellij/util/ui/CenteredIcon.java +++ b/platform/util/src/com/intellij/util/ui/CenteredIcon.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; diff --git a/platform/util/ui/src/com/intellij/util/ui/Centerizer.java b/platform/util/src/com/intellij/util/ui/Centerizer.java similarity index 73% rename from platform/util/ui/src/com/intellij/util/ui/Centerizer.java rename to platform/util/src/com/intellij/util/ui/Centerizer.java index e641229387b1..e237735b750c 100644 --- a/platform/util/ui/src/com/intellij/util/ui/Centerizer.java +++ b/platform/util/src/com/intellij/util/ui/Centerizer.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.openapi.util.Couple; diff --git a/platform/util/src/com/intellij/util/ui/ClientPropertyHolder.java b/platform/util/src/com/intellij/util/ui/ClientPropertyHolder.java new file mode 100644 index 000000000000..6a53cc1394fb --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/ClientPropertyHolder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import org.jetbrains.annotations.NonNls; + +public interface ClientPropertyHolder { + + void putClientProperty(@NonNls String key, @NonNls Object value); + +} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/util/ui/ColorIcon.java b/platform/util/src/com/intellij/util/ui/ColorIcon.java similarity index 79% rename from platform/util/ui/src/com/intellij/util/ui/ColorIcon.java rename to platform/util/src/com/intellij/util/ui/ColorIcon.java index b571e849aad2..c4a4212c9ad6 100644 --- a/platform/util/ui/src/com/intellij/util/ui/ColorIcon.java +++ b/platform/util/src/com/intellij/util/ui/ColorIcon.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.ui.Gray; @@ -58,9 +72,9 @@ public class ColorIcon extends EmptyIcon { final int size = getColorSize(); final int x = i + (iconWidth - size) / 2; final int y = j + (iconHeight - size) / 2; - + g.fillRect(x, y, size, size); - + if (myBorder) { g.setColor(Gray.x00.withAlpha(40)); g.drawRect(x, y, size, size); diff --git a/platform/util/ui/src/com/intellij/util/ui/ColorsIcon.java b/platform/util/src/com/intellij/util/ui/ColorsIcon.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/ColorsIcon.java rename to platform/util/src/com/intellij/util/ui/ColorsIcon.java diff --git a/platform/util/ui/src/com/intellij/util/ui/ColumnInfo.java b/platform/util/src/com/intellij/util/ui/ColumnInfo.java similarity index 78% rename from platform/util/ui/src/com/intellij/util/ui/ColumnInfo.java rename to platform/util/src/com/intellij/util/ui/ColumnInfo.java index da9bf91d569c..a885c21d0a42 100644 --- a/platform/util/ui/src/com/intellij/util/ui/ColumnInfo.java +++ b/platform/util/src/com/intellij/util/ui/ColumnInfo.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import org.jetbrains.annotations.Nullable; diff --git a/platform/util/ui/src/com/intellij/util/ui/ComboBoxCellEditor.java b/platform/util/src/com/intellij/util/ui/ComboBoxCellEditor.java similarity index 74% rename from platform/util/ui/src/com/intellij/util/ui/ComboBoxCellEditor.java rename to platform/util/src/com/intellij/util/ui/ComboBoxCellEditor.java index 82ef79666ac5..373ef980ffb8 100644 --- a/platform/util/ui/src/com/intellij/util/ui/ComboBoxCellEditor.java +++ b/platform/util/src/com/intellij/util/ui/ComboBoxCellEditor.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.openapi.util.Comparing; diff --git a/platform/util/ui/src/com/intellij/util/ui/ComboBoxTableCellEditor.java b/platform/util/src/com/intellij/util/ui/ComboBoxTableCellEditor.java similarity index 74% rename from platform/util/ui/src/com/intellij/util/ui/ComboBoxTableCellEditor.java rename to platform/util/src/com/intellij/util/ui/ComboBoxTableCellEditor.java index 8bfcc3cfebe5..b2ba22d192ab 100644 --- a/platform/util/ui/src/com/intellij/util/ui/ComboBoxTableCellEditor.java +++ b/platform/util/src/com/intellij/util/ui/ComboBoxTableCellEditor.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.util.ListWithSelection; diff --git a/platform/util/ui/src/com/intellij/util/ui/EditableListModelDecorator.java b/platform/util/src/com/intellij/util/ui/EditableListModelDecorator.java similarity index 57% rename from platform/util/ui/src/com/intellij/util/ui/EditableListModelDecorator.java rename to platform/util/src/com/intellij/util/ui/EditableListModelDecorator.java index 972d7abbe903..11c572fd0da8 100644 --- a/platform/util/ui/src/com/intellij/util/ui/EditableListModelDecorator.java +++ b/platform/util/src/com/intellij/util/ui/EditableListModelDecorator.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import javax.swing.*; diff --git a/platform/util/src/com/intellij/util/ui/EditableModel.java b/platform/util/src/com/intellij/util/ui/EditableModel.java new file mode 100644 index 000000000000..7c4abd3c4b9a --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/EditableModel.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +/** + * @author Konstantin Bulenkov + */ +public interface EditableModel extends ItemRemovable { + void addRow(); + + void exchangeRows(int oldIndex, int newIndex); + + boolean canExchangeRows(int oldIndex, int newIndex); +} diff --git a/platform/util/src/com/intellij/util/ui/EditableTreeModel.java b/platform/util/src/com/intellij/util/ui/EditableTreeModel.java new file mode 100644 index 000000000000..816c29bb3c91 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/EditableTreeModel.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import javax.swing.tree.TreePath; +import java.util.Collection; + +/** + * @author Konstantin Bulenkov + */ +public interface EditableTreeModel { + /** + * Adds a new node into a + * @param parentOrNeighbour selected node, maybe used as parent or as a neighbour + * @return path to newly created element + */ + TreePath addNode(TreePath parentOrNeighbour); + + void removeNode(TreePath path); + void removeNodes(Collection path); + + void moveNodeTo(TreePath parentOrNeighbour); +} diff --git a/platform/util/ui/src/com/intellij/util/ui/EdtInvocationManager.java b/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java similarity index 78% rename from platform/util/ui/src/com/intellij/util/ui/EdtInvocationManager.java rename to platform/util/src/com/intellij/util/ui/EdtInvocationManager.java index eac44d45e38e..c52b5b527e4c 100644 --- a/platform/util/ui/src/com/intellij/util/ui/EdtInvocationManager.java +++ b/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/src/com/intellij/util/ui/ElementProducer.java b/platform/util/src/com/intellij/util/ui/ElementProducer.java new file mode 100644 index 000000000000..e9dc6f440de5 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/ElementProducer.java @@ -0,0 +1,24 @@ +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +/** + * @author Konstantin Bulenkov + */ +public interface ElementProducer { + E createElement(); + boolean canCreateElement(); +} diff --git a/platform/util/src/com/intellij/util/ui/EmptyClipboardOwner.java b/platform/util/src/com/intellij/util/ui/EmptyClipboardOwner.java new file mode 100644 index 000000000000..633bc7a0ec92 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/EmptyClipboardOwner.java @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.Transferable; + +/** + * @author yole +*/ +public class EmptyClipboardOwner implements ClipboardOwner { + public static EmptyClipboardOwner INSTANCE = new EmptyClipboardOwner(); + + private EmptyClipboardOwner() { + } + + @Override + public void lostOwnership(Clipboard clipboard, Transferable contents) { + } +} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/util/ui/EmptyIcon.java b/platform/util/src/com/intellij/util/ui/EmptyIcon.java similarity index 98% rename from platform/util/ui/src/com/intellij/util/ui/EmptyIcon.java rename to platform/util/src/com/intellij/util/ui/EmptyIcon.java index f1856dbad62e..39d978c70aab 100644 --- a/platform/util/ui/src/com/intellij/util/ui/EmptyIcon.java +++ b/platform/util/src/com/intellij/util/ui/EmptyIcon.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui; diff --git a/platform/util/ui/src/com/intellij/util/ui/FilePathSplittingPolicy.java b/platform/util/src/com/intellij/util/ui/FilePathSplittingPolicy.java similarity index 67% rename from platform/util/ui/src/com/intellij/util/ui/FilePathSplittingPolicy.java rename to platform/util/src/com/intellij/util/ui/FilePathSplittingPolicy.java index 89fcb5485ab4..8e810e214606 100644 --- a/platform/util/ui/src/com/intellij/util/ui/FilePathSplittingPolicy.java +++ b/platform/util/src/com/intellij/util/ui/FilePathSplittingPolicy.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/FontInfo.java b/platform/util/src/com/intellij/util/ui/FontInfo.java similarity index 98% rename from platform/util/ui/src/com/intellij/util/ui/FontInfo.java rename to platform/util/src/com/intellij/util/ui/FontInfo.java index ac3c2f19753a..ace17e3876e0 100644 --- a/platform/util/ui/src/com/intellij/util/ui/FontInfo.java +++ b/platform/util/src/com/intellij/util/ui/FontInfo.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui; import java.awt.*; @@ -154,7 +154,7 @@ public final class FontInfo { try { if (font == null) { font = new Font(name, Font.PLAIN, DEFAULT_SIZE); - // Java uses Dialog family for nonexistent fonts + // Java uses Dialog family for nonexistent fonts if (!Font.DIALOG.equals(name) && UIUtil.isDialogFont(font)) { throw new IllegalArgumentException("not supported " + font); } diff --git a/platform/util/ui/src/com/intellij/util/ui/GeometryUtil.java b/platform/util/src/com/intellij/util/ui/GeometryUtil.java similarity index 94% rename from platform/util/ui/src/com/intellij/util/ui/GeometryUtil.java rename to platform/util/src/com/intellij/util/ui/GeometryUtil.java index f7cda1e679b4..48e431c196bf 100644 --- a/platform/util/ui/src/com/intellij/util/ui/GeometryUtil.java +++ b/platform/util/src/com/intellij/util/ui/GeometryUtil.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/GraphicsUtil.java b/platform/util/src/com/intellij/util/ui/GraphicsUtil.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/GraphicsUtil.java rename to platform/util/src/com/intellij/util/ui/GraphicsUtil.java diff --git a/platform/util/ui/src/com/intellij/util/ui/GridBag.java b/platform/util/src/com/intellij/util/ui/GridBag.java similarity index 94% rename from platform/util/ui/src/com/intellij/util/ui/GridBag.java rename to platform/util/src/com/intellij/util/ui/GridBag.java index 2d72244ebced..0eff674e635e 100644 --- a/platform/util/ui/src/com/intellij/util/ui/GridBag.java +++ b/platform/util/src/com/intellij/util/ui/GridBag.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import gnu.trove.TIntDoubleHashMap; diff --git a/platform/util/src/com/intellij/util/ui/Html.java b/platform/util/src/com/intellij/util/ui/Html.java new file mode 100644 index 000000000000..d322030e89b6 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/Html.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +public class Html { + + private final String myText; + private boolean myKeepFont = false; + + public Html(String text) { + myText = text; + } + + public String getText() { + return myText; + } + + public Html setKeepFont(boolean keepFont) { + myKeepFont = keepFont; + return this; + } + + public boolean isKeepFont() { + return myKeepFont; + } +} diff --git a/platform/util/ui/src/com/intellij/util/ui/ImageUtil.java b/platform/util/src/com/intellij/util/ui/ImageUtil.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/ImageUtil.java rename to platform/util/src/com/intellij/util/ui/ImageUtil.java diff --git a/platform/util/ui/src/com/intellij/util/ui/IndentedIcon.java b/platform/util/src/com/intellij/util/ui/IndentedIcon.java similarity index 51% rename from platform/util/ui/src/com/intellij/util/ui/IndentedIcon.java rename to platform/util/src/com/intellij/util/ui/IndentedIcon.java index f000d2b971c4..831b9d73bbc0 100644 --- a/platform/util/ui/src/com/intellij/util/ui/IndentedIcon.java +++ b/platform/util/src/com/intellij/util/ui/IndentedIcon.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; diff --git a/platform/util/src/com/intellij/util/ui/IsRetina.java b/platform/util/src/com/intellij/util/ui/IsRetina.java new file mode 100644 index 000000000000..ec7d80a5c457 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/IsRetina.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import apple.awt.CImage; + +import java.awt.image.BufferedImage; + +class IsRetina { + public static boolean isRetina() { + try { + final boolean[] isRetina = new boolean[1]; + new CImage.HiDPIScaledImage(1, 1, BufferedImage.TYPE_INT_ARGB) { + @Override + public void drawIntoImage(BufferedImage image, float v) { + isRetina[0] = v > 1; + } + }; + return isRetina[0]; + } + catch (Throwable e) { + e.printStackTrace(); + return false; + } + } +} diff --git a/platform/util/src/com/intellij/util/ui/ItemRemovable.java b/platform/util/src/com/intellij/util/ui/ItemRemovable.java new file mode 100644 index 000000000000..d11187b60ccb --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/ItemRemovable.java @@ -0,0 +1,30 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +/** + * Implement this interface in {@link javax.swing.table.TableModel}'s implementation if it supports removal of items. This will allow using + * utility methods to remove items from the table. + * + * @see com.intellij.ui.TableUtil#removeSelectedItems(javax.swing.JTable) + */ +public interface ItemRemovable { + /** + * Remove row with index {@code idx} and fire {@link javax.swing.event.TableModelEvent#DELETE DELETE} event (e.g. by calling + * {@link javax.swing.table.AbstractTableModel#fireTableRowsDeleted(int, int)}) + */ + void removeRow(int idx); +} diff --git a/platform/util/ui/src/com/intellij/util/ui/JBCachingScalableIcon.java b/platform/util/src/com/intellij/util/ui/JBCachingScalableIcon.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/JBCachingScalableIcon.java rename to platform/util/src/com/intellij/util/ui/JBCachingScalableIcon.java diff --git a/platform/util/ui/src/com/intellij/util/ui/JBDimension.java b/platform/util/src/com/intellij/util/ui/JBDimension.java similarity index 87% rename from platform/util/ui/src/com/intellij/util/ui/JBDimension.java rename to platform/util/src/com/intellij/util/ui/JBDimension.java index 4258beb8ef94..b3a7d18ca603 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBDimension.java +++ b/platform/util/src/com/intellij/util/ui/JBDimension.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.util.ui.JBUIScale.ScaleType; diff --git a/platform/util/ui/src/com/intellij/util/ui/JBEmptyBorder.java b/platform/util/src/com/intellij/util/ui/JBEmptyBorder.java similarity index 63% rename from platform/util/ui/src/com/intellij/util/ui/JBEmptyBorder.java rename to platform/util/src/com/intellij/util/ui/JBEmptyBorder.java index a2ee6ca4a693..41f07aa55034 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBEmptyBorder.java +++ b/platform/util/src/com/intellij/util/ui/JBEmptyBorder.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/JBFont.java b/platform/util/src/com/intellij/util/ui/JBFont.java similarity index 70% rename from platform/util/ui/src/com/intellij/util/ui/JBFont.java rename to platform/util/src/com/intellij/util/ui/JBFont.java index b6b362a55606..829b6eb79cc2 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBFont.java +++ b/platform/util/src/com/intellij/util/ui/JBFont.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import javax.swing.plaf.UIResource; diff --git a/platform/util/src/com/intellij/util/ui/JBImageIcon.java b/platform/util/src/com/intellij/util/ui/JBImageIcon.java new file mode 100644 index 000000000000..d3990cf18396 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/JBImageIcon.java @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; +import java.awt.*; +import java.awt.image.ImageObserver; + +/** + * HiDPI-aware image icon + * + * @author Konstantin Bulenkov + */ +public class JBImageIcon extends ImageIcon { + public JBImageIcon(@NotNull Image image) { + super(image); + } + + @Override + public synchronized void paintIcon(final Component c, final Graphics g, final int x, final int y) { + final ImageObserver observer = getImageObserver(); + + UIUtil.drawImage(g, getImage(), x, y, observer == null ? c : observer); + } +} diff --git a/platform/util/ui/src/com/intellij/util/ui/JBInsets.java b/platform/util/src/com/intellij/util/ui/JBInsets.java similarity index 83% rename from platform/util/ui/src/com/intellij/util/ui/JBInsets.java rename to platform/util/src/com/intellij/util/ui/JBInsets.java index 8c8da82c407d..0769492d9c3d 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBInsets.java +++ b/platform/util/src/com/intellij/util/ui/JBInsets.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import org.jetbrains.annotations.NotNull; @@ -24,11 +38,11 @@ public class JBInsets extends Insets { public JBInsets(int top, int left, int bottom, int right) { super(scale(top), scale(left), scale(bottom), scale(right)); } - + public int width() { return left + right; } - + public int height() { return top + bottom; } diff --git a/platform/util/src/com/intellij/util/ui/JBPoint.java b/platform/util/src/com/intellij/util/ui/JBPoint.java new file mode 100644 index 000000000000..18ee13e9d6e2 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/JBPoint.java @@ -0,0 +1,33 @@ +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import org.jetbrains.annotations.NotNull; + +import java.awt.*; + +/** + * @author Konstantin Bulenkov + */ +public class JBPoint extends Point { + public JBPoint(@NotNull Point p) { + super(p instanceof JBPoint ? p : new JBPoint(p.x, p.y)); + } + + public JBPoint(int x, int y) { + super(JBUI.scale(x), JBUI.scale(y)); + } +} diff --git a/platform/util/ui/src/com/intellij/util/ui/JBRectangle.java b/platform/util/src/com/intellij/util/ui/JBRectangle.java similarity index 52% rename from platform/util/ui/src/com/intellij/util/ui/JBRectangle.java rename to platform/util/src/com/intellij/util/ui/JBRectangle.java index 5d3a91b8c505..a31e1860613b 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBRectangle.java +++ b/platform/util/src/com/intellij/util/ui/JBRectangle.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/JBScalableIcon.java b/platform/util/src/com/intellij/util/ui/JBScalableIcon.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/JBScalableIcon.java rename to platform/util/src/com/intellij/util/ui/JBScalableIcon.java diff --git a/platform/util/ui/src/com/intellij/util/ui/JBSwingUtilities.java b/platform/util/src/com/intellij/util/ui/JBSwingUtilities.java similarity index 97% rename from platform/util/ui/src/com/intellij/util/ui/JBSwingUtilities.java rename to platform/util/src/com/intellij/util/ui/JBSwingUtilities.java index 2b07bb4cf6e4..1976afebcfcf 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBSwingUtilities.java +++ b/platform/util/src/com/intellij/util/ui/JBSwingUtilities.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui; import com.intellij.openapi.Disposable; diff --git a/platform/util/ui/src/com/intellij/util/ui/JBUI.java b/platform/util/src/com/intellij/util/ui/JBUI.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/JBUI.java rename to platform/util/src/com/intellij/util/ui/JBUI.java diff --git a/platform/util/ui/src/com/intellij/util/ui/JBUIScale.java b/platform/util/src/com/intellij/util/ui/JBUIScale.java similarity index 99% rename from platform/util/ui/src/com/intellij/util/ui/JBUIScale.java rename to platform/util/src/com/intellij/util/ui/JBUIScale.java index d5c809ee6cc6..651577595d33 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBUIScale.java +++ b/platform/util/src/com/intellij/util/ui/JBUIScale.java @@ -16,8 +16,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; -import static com.intellij.util.ui.JBUIScale.DerivedScaleType.DEV_SCALE; -import static com.intellij.util.ui.JBUIScale.DerivedScaleType.PIX_SCALE; +import static com.intellij.util.ui.JBUIScale.DerivedScaleType.*; import static com.intellij.util.ui.JBUIScale.ScaleType.*; /** diff --git a/platform/util/ui/src/com/intellij/util/ui/JBValue.java b/platform/util/src/com/intellij/util/ui/JBValue.java similarity index 98% rename from platform/util/ui/src/com/intellij/util/ui/JBValue.java rename to platform/util/src/com/intellij/util/ui/JBValue.java index 682c00df00a2..4a8b3937a636 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBValue.java +++ b/platform/util/src/com/intellij/util/ui/JBValue.java @@ -1,10 +1,11 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui; import com.intellij.ui.paint.PaintUtil.RoundingMode; import org.jetbrains.annotations.NotNull; import javax.swing.*; + import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.LinkedList; diff --git a/platform/util/ui/src/com/intellij/util/ui/KeyboardLayoutUtil.java b/platform/util/src/com/intellij/util/ui/KeyboardLayoutUtil.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/KeyboardLayoutUtil.java rename to platform/util/src/com/intellij/util/ui/KeyboardLayoutUtil.java diff --git a/platform/util/ui/src/com/intellij/util/ui/LabelWithTooltip.java b/platform/util/src/com/intellij/util/ui/LabelWithTooltip.java similarity index 53% rename from platform/util/ui/src/com/intellij/util/ui/LabelWithTooltip.java rename to platform/util/src/com/intellij/util/ui/LabelWithTooltip.java index 6d8da1b3e41a..aa41e328f6d0 100644 --- a/platform/util/ui/src/com/intellij/util/ui/LabelWithTooltip.java +++ b/platform/util/src/com/intellij/util/ui/LabelWithTooltip.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import javax.swing.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/Layers.java b/platform/util/src/com/intellij/util/ui/Layers.java similarity index 80% rename from platform/util/ui/src/com/intellij/util/ui/Layers.java rename to platform/util/src/com/intellij/util/ui/Layers.java index f87af818dacd..d8166378358e 100644 --- a/platform/util/ui/src/com/intellij/util/ui/Layers.java +++ b/platform/util/src/com/intellij/util/ui/Layers.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; diff --git a/platform/util/ui/src/com/intellij/util/ui/ListTableModel.java b/platform/util/src/com/intellij/util/ui/ListTableModel.java similarity index 89% rename from platform/util/ui/src/com/intellij/util/ui/ListTableModel.java rename to platform/util/src/com/intellij/util/ui/ListTableModel.java index 159278a9e6d1..8a5816b68237 100644 --- a/platform/util/ui/src/com/intellij/util/ui/ListTableModel.java +++ b/platform/util/src/com/intellij/util/ui/ListTableModel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2011 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.util.containers.ContainerUtil; diff --git a/platform/util/ui/src/com/intellij/util/ui/MacUIUtil.java b/platform/util/src/com/intellij/util/ui/MacUIUtil.java similarity index 98% rename from platform/util/ui/src/com/intellij/util/ui/MacUIUtil.java rename to platform/util/src/com/intellij/util/ui/MacUIUtil.java index d310742e8fdc..cb00033f14ea 100644 --- a/platform/util/ui/src/com/intellij/util/ui/MacUIUtil.java +++ b/platform/util/src/com/intellij/util/ui/MacUIUtil.java @@ -1,4 +1,6 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ package com.intellij.util.ui; import com.intellij.openapi.util.SystemInfo; diff --git a/platform/util/ui/src/com/intellij/util/ui/MouseEventAdapter.java b/platform/util/src/com/intellij/util/ui/MouseEventAdapter.java similarity index 98% rename from platform/util/ui/src/com/intellij/util/ui/MouseEventAdapter.java rename to platform/util/src/com/intellij/util/ui/MouseEventAdapter.java index 6d83c4c496ce..4398029bad3a 100644 --- a/platform/util/ui/src/com/intellij/util/ui/MouseEventAdapter.java +++ b/platform/util/src/com/intellij/util/ui/MouseEventAdapter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/ui/src/com/intellij/util/ui/MouseEventHandler.java b/platform/util/src/com/intellij/util/ui/MouseEventHandler.java similarity index 66% rename from platform/util/ui/src/com/intellij/util/ui/MouseEventHandler.java rename to platform/util/src/com/intellij/util/ui/MouseEventHandler.java index a9cc5bc1d7e2..532563c973cf 100644 --- a/platform/util/ui/src/com/intellij/util/ui/MouseEventHandler.java +++ b/platform/util/src/com/intellij/util/ui/MouseEventHandler.java @@ -1,10 +1,22 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import javax.swing.event.MouseInputListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; +import java.awt.event.*; /** * @author Sergey.Malenkov diff --git a/platform/util/ui/src/com/intellij/util/ui/MultiRowFlowPanel.java b/platform/util/src/com/intellij/util/ui/MultiRowFlowPanel.java similarity index 84% rename from platform/util/ui/src/com/intellij/util/ui/MultiRowFlowPanel.java rename to platform/util/src/com/intellij/util/ui/MultiRowFlowPanel.java index 4e2497dce12a..341dff0936af 100644 --- a/platform/util/ui/src/com/intellij/util/ui/MultiRowFlowPanel.java +++ b/platform/util/src/com/intellij/util/ui/MultiRowFlowPanel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import org.intellij.lang.annotations.JdkConstants; diff --git a/platform/util/src/com/intellij/util/ui/PlatformColors.java b/platform/util/src/com/intellij/util/ui/PlatformColors.java new file mode 100644 index 000000000000..2515a79151cf --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/PlatformColors.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import com.intellij.ui.JBColor; + +import java.awt.*; + +/** + * @author Konstantin Bulenkov + */ +public class PlatformColors { + public static final Color BLUE = JBColor.BLUE; +} diff --git a/platform/util/ui/src/com/intellij/util/ui/RadioButtonEnumModel.java b/platform/util/src/com/intellij/util/ui/RadioButtonEnumModel.java similarity index 71% rename from platform/util/ui/src/com/intellij/util/ui/RadioButtonEnumModel.java rename to platform/util/src/com/intellij/util/ui/RadioButtonEnumModel.java index cb3abf8feea0..e7613de48489 100644 --- a/platform/util/ui/src/com/intellij/util/ui/RadioButtonEnumModel.java +++ b/platform/util/src/com/intellij/util/ui/RadioButtonEnumModel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2010 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.util.containers.ContainerUtil; diff --git a/platform/util/ui/src/com/intellij/util/ui/RegionPainter.java b/platform/util/src/com/intellij/util/ui/RegionPainter.java similarity index 86% rename from platform/util/ui/src/com/intellij/util/ui/RegionPainter.java rename to platform/util/src/com/intellij/util/ui/RegionPainter.java index c4455a42aae0..1fbbcdf24144 100644 --- a/platform/util/ui/src/com/intellij/util/ui/RegionPainter.java +++ b/platform/util/src/com/intellij/util/ui/RegionPainter.java @@ -1,9 +1,25 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import org.jetbrains.annotations.Nullable; -import java.awt.*; +import java.awt.AlphaComposite; +import java.awt.Composite; +import java.awt.Graphics2D; import java.awt.image.BufferedImage; /** diff --git a/platform/util/src/com/intellij/util/ui/SameColor.java b/platform/util/src/com/intellij/util/ui/SameColor.java new file mode 100644 index 000000000000..701182ede269 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/SameColor.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import java.awt.*; + +/** + * @author Eugene Belyaev + * @deprecated use com.intellij.ui.Gray + */ +@Deprecated +public class SameColor extends Color { + public SameColor(int i) { + super(i, i, i); + } +} diff --git a/platform/util/ui/src/com/intellij/util/ui/ScrollUtil.java b/platform/util/src/com/intellij/util/ui/ScrollUtil.java similarity index 87% rename from platform/util/ui/src/com/intellij/util/ui/ScrollUtil.java rename to platform/util/src/com/intellij/util/ui/ScrollUtil.java index 854823a5125d..19b70f1c5f32 100644 --- a/platform/util/ui/src/com/intellij/util/ui/ScrollUtil.java +++ b/platform/util/src/com/intellij/util/ui/ScrollUtil.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; diff --git a/platform/util/src/com/intellij/util/ui/SortableColumnModel.java b/platform/util/src/com/intellij/util/ui/SortableColumnModel.java new file mode 100644 index 000000000000..37e36fbe0b16 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/SortableColumnModel.java @@ -0,0 +1,33 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + +public interface SortableColumnModel { + ColumnInfo[] getColumnInfos(); + + void setSortable(boolean aBoolean); + + boolean isSortable(); + + Object getRowValue(int row); + + @Nullable + RowSorter.SortKey getDefaultSortKey(); +} diff --git a/platform/util/ui/src/com/intellij/util/ui/SplitByLetterPolicy.java b/platform/util/src/com/intellij/util/ui/SplitByLetterPolicy.java similarity index 61% rename from platform/util/ui/src/com/intellij/util/ui/SplitByLetterPolicy.java rename to platform/util/src/com/intellij/util/ui/SplitByLetterPolicy.java index f508c5d5b473..bb0d169a54cf 100644 --- a/platform/util/ui/src/com/intellij/util/ui/SplitByLetterPolicy.java +++ b/platform/util/src/com/intellij/util/ui/SplitByLetterPolicy.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import java.io.File; diff --git a/platform/util/ui/src/com/intellij/util/ui/SplitBySeparatorPolicy.java b/platform/util/src/com/intellij/util/ui/SplitBySeparatorPolicy.java similarity index 76% rename from platform/util/ui/src/com/intellij/util/ui/SplitBySeparatorPolicy.java rename to platform/util/src/com/intellij/util/ui/SplitBySeparatorPolicy.java index 0e5750af34b3..8003f4202c1c 100644 --- a/platform/util/ui/src/com/intellij/util/ui/SplitBySeparatorPolicy.java +++ b/platform/util/src/com/intellij/util/ui/SplitBySeparatorPolicy.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import java.io.File; diff --git a/platform/util/src/com/intellij/util/ui/TableViewModel.java b/platform/util/src/com/intellij/util/ui/TableViewModel.java new file mode 100644 index 000000000000..1da5a7be4b81 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/TableViewModel.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import org.jetbrains.annotations.NotNull; + +import javax.swing.table.AbstractTableModel; +import java.util.List; + +public abstract class TableViewModel extends AbstractTableModel implements SortableColumnModel { + public abstract void setItems(@NotNull List items); + @NotNull + public abstract List getItems(); +} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/util/ui/ThreeStateCheckBox.java b/platform/util/src/com/intellij/util/ui/ThreeStateCheckBox.java similarity index 91% rename from platform/util/ui/src/com/intellij/util/ui/ThreeStateCheckBox.java rename to platform/util/src/com/intellij/util/ui/ThreeStateCheckBox.java index cd7ad242423b..40da3d515f21 100644 --- a/platform/util/ui/src/com/intellij/util/ui/ThreeStateCheckBox.java +++ b/platform/util/src/com/intellij/util/ui/ThreeStateCheckBox.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import com.intellij.util.ui.accessibility.AccessibleContextUtil; diff --git a/platform/util/src/com/intellij/util/ui/TwoColorsIcon.java b/platform/util/src/com/intellij/util/ui/TwoColorsIcon.java new file mode 100644 index 000000000000..b3bfe1468ee2 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/TwoColorsIcon.java @@ -0,0 +1,48 @@ +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import com.intellij.openapi.ui.GraphicsConfig; +import com.intellij.ui.Gray; +import com.intellij.ui.JBColor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.awt.*; +import java.awt.image.BufferedImage; + +/** + * @author Vassiliy Kudryashov + * @author Konstantin Bulenkov + * + * @deprecated use {@link com.intellij.util.ui.ColorsIcon} instead + */ +@Deprecated +public class TwoColorsIcon extends ColorsIcon { + public TwoColorsIcon(int size, @Nullable Color color1, @Nullable Color secondColor) { + super(size, color1, secondColor); + } + + protected TwoColorsIcon(TwoColorsIcon icon) { + super(icon); + } + + @NotNull + @Override + public TwoColorsIcon copy() { + return new TwoColorsIcon(this); + } +} diff --git a/platform/util/ui/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/UIUtil.java rename to platform/util/src/com/intellij/util/ui/UIUtil.java diff --git a/platform/util/ui/src/com/intellij/util/ui/WatermarkIcon.java b/platform/util/src/com/intellij/util/ui/WatermarkIcon.java similarity index 53% rename from platform/util/ui/src/com/intellij/util/ui/WatermarkIcon.java rename to platform/util/src/com/intellij/util/ui/WatermarkIcon.java index 8d99cd78cda4..06931876dd22 100644 --- a/platform/util/ui/src/com/intellij/util/ui/WatermarkIcon.java +++ b/platform/util/src/com/intellij/util/ui/WatermarkIcon.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; diff --git a/platform/util/ui/src/com/intellij/util/ui/WavePainter.java b/platform/util/src/com/intellij/util/ui/WavePainter.java similarity index 50% rename from platform/util/ui/src/com/intellij/util/ui/WavePainter.java rename to platform/util/src/com/intellij/util/ui/WavePainter.java index 00f840b70337..f8cc321d24b5 100644 --- a/platform/util/ui/src/com/intellij/util/ui/WavePainter.java +++ b/platform/util/src/com/intellij/util/ui/WavePainter.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/WavePainter2D.java b/platform/util/src/com/intellij/util/ui/WavePainter2D.java similarity index 97% rename from platform/util/ui/src/com/intellij/util/ui/WavePainter2D.java rename to platform/util/src/com/intellij/util/ui/WavePainter2D.java index f952964aff1e..d63b9af036ab 100644 --- a/platform/util/ui/src/com/intellij/util/ui/WavePainter2D.java +++ b/platform/util/src/com/intellij/util/ui/WavePainter2D.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui; import java.awt.*; diff --git a/platform/util/ui/src/com/intellij/util/ui/accessibility/AbstractAccessibleContextDelegate.java b/platform/util/src/com/intellij/util/ui/accessibility/AbstractAccessibleContextDelegate.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/accessibility/AbstractAccessibleContextDelegate.java rename to platform/util/src/com/intellij/util/ui/accessibility/AbstractAccessibleContextDelegate.java diff --git a/platform/util/ui/src/com/intellij/util/ui/accessibility/AccessibleContextAccessor.java b/platform/util/src/com/intellij/util/ui/accessibility/AccessibleContextAccessor.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/accessibility/AccessibleContextAccessor.java rename to platform/util/src/com/intellij/util/ui/accessibility/AccessibleContextAccessor.java diff --git a/platform/util/ui/src/com/intellij/util/ui/accessibility/AccessibleContextDelegate.java b/platform/util/src/com/intellij/util/ui/accessibility/AccessibleContextDelegate.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/accessibility/AccessibleContextDelegate.java rename to platform/util/src/com/intellij/util/ui/accessibility/AccessibleContextDelegate.java diff --git a/platform/util/ui/src/com/intellij/util/ui/accessibility/AccessibleContextUtil.java b/platform/util/src/com/intellij/util/ui/accessibility/AccessibleContextUtil.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/accessibility/AccessibleContextUtil.java rename to platform/util/src/com/intellij/util/ui/accessibility/AccessibleContextUtil.java diff --git a/platform/util/ui/src/com/intellij/util/ui/accessibility/ScreenReader.java b/platform/util/src/com/intellij/util/ui/accessibility/ScreenReader.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/accessibility/ScreenReader.java rename to platform/util/src/com/intellij/util/ui/accessibility/ScreenReader.java diff --git a/platform/util/ui/src/com/intellij/util/ui/accessibility/SimpleAccessible.java b/platform/util/src/com/intellij/util/ui/accessibility/SimpleAccessible.java similarity index 90% rename from platform/util/ui/src/com/intellij/util/ui/accessibility/SimpleAccessible.java rename to platform/util/src/com/intellij/util/ui/accessibility/SimpleAccessible.java index c74a4a16e1e0..58fc83134581 100644 --- a/platform/util/ui/src/com/intellij/util/ui/accessibility/SimpleAccessible.java +++ b/platform/util/src/com/intellij/util/ui/accessibility/SimpleAccessible.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui.accessibility; import org.jetbrains.annotations.NotNull; diff --git a/platform/util/ui/src/com/intellij/util/ui/components/BorderLayoutPanel.java b/platform/util/src/com/intellij/util/ui/components/BorderLayoutPanel.java similarity index 81% rename from platform/util/ui/src/com/intellij/util/ui/components/BorderLayoutPanel.java rename to platform/util/src/com/intellij/util/ui/components/BorderLayoutPanel.java index 582a50d5d5e3..8db3ed71cd99 100644 --- a/platform/util/ui/src/com/intellij/util/ui/components/BorderLayoutPanel.java +++ b/platform/util/src/com/intellij/util/ui/components/BorderLayoutPanel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui.components; import com.intellij.ui.components.JBPanel; @@ -6,6 +20,7 @@ import com.intellij.util.ui.JBUI; import com.intellij.util.ui.accessibility.AccessibleContextDelegate; import org.jetbrains.annotations.NotNull; +import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; import java.awt.*; diff --git a/platform/util/src/com/intellij/util/ui/components/JBComponent.java b/platform/util/src/com/intellij/util/ui/components/JBComponent.java new file mode 100644 index 000000000000..dab7bed29b52 --- /dev/null +++ b/platform/util/src/com/intellij/util/ui/components/JBComponent.java @@ -0,0 +1,33 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui.components; + +import com.intellij.util.ui.JBFont; + +import javax.swing.border.Border; + +/** + * @author Konstantin Bulenkov + */ +public interface JBComponent { + T withBorder(Border border); + + T withFont(JBFont font); + + T andTransparent(); + + T andOpaque(); +} diff --git a/platform/util/ui/src/com/intellij/util/ui/tree/AbstractTreeModel.java b/platform/util/src/com/intellij/util/ui/tree/AbstractTreeModel.java similarity index 84% rename from platform/util/ui/src/com/intellij/util/ui/tree/AbstractTreeModel.java rename to platform/util/src/com/intellij/util/ui/tree/AbstractTreeModel.java index cb37d15ec97f..2bdb65a270a5 100644 --- a/platform/util/ui/src/com/intellij/util/ui/tree/AbstractTreeModel.java +++ b/platform/util/src/com/intellij/util/ui/tree/AbstractTreeModel.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui.tree; import com.intellij.openapi.Disposable; diff --git a/platform/util/ui/src/com/intellij/util/ui/tree/TreeModelAdapter.java b/platform/util/src/com/intellij/util/ui/tree/TreeModelAdapter.java similarity index 80% rename from platform/util/ui/src/com/intellij/util/ui/tree/TreeModelAdapter.java rename to platform/util/src/com/intellij/util/ui/tree/TreeModelAdapter.java index bc3b81e9178c..4c7d4a479319 100644 --- a/platform/util/ui/src/com/intellij/util/ui/tree/TreeModelAdapter.java +++ b/platform/util/src/com/intellij/util/ui/tree/TreeModelAdapter.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui.tree; import com.intellij.util.PairConsumer; @@ -12,9 +26,9 @@ import javax.swing.event.TreeModelListener; * @author Sergey.Malenkov */ public abstract class TreeModelAdapter implements TreeModelListener { - + public enum EventType {StructureChanged, NodesChanged, NodesInserted, NodesRemoved} - + @NotNull public static TreeModelListener create(@NotNull final PairConsumer consumer) { return new TreeModelAdapter() { diff --git a/platform/util/ui/src/com/intellij/util/ui/tree/TreeModelListenerList.java b/platform/util/src/com/intellij/util/ui/tree/TreeModelListenerList.java similarity index 82% rename from platform/util/ui/src/com/intellij/util/ui/tree/TreeModelListenerList.java rename to platform/util/src/com/intellij/util/ui/tree/TreeModelListenerList.java index e190fd207826..5fc0e0c50f34 100644 --- a/platform/util/ui/src/com/intellij/util/ui/tree/TreeModelListenerList.java +++ b/platform/util/src/com/intellij/util/ui/tree/TreeModelListenerList.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2016 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui.tree; import com.intellij.util.containers.ContainerUtil; diff --git a/platform/util/ui/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java b/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java similarity index 96% rename from platform/util/ui/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java rename to platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java index 5667a09d61d1..530db585ea3f 100644 --- a/platform/util/ui/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java +++ b/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui.tree; import com.intellij.openapi.diagnostic.Logger; @@ -110,7 +124,7 @@ public class WideSelectionTreeUI extends BasicTreeUI { /** * Creates new {@code WideSelectionTreeUI} object. - * + * * @param wideSelection flag that determines if wide selection should be used * @param wideSelectionCondition strategy that determine if wide selection should be used for a target row (it's zero-based index * is given to the condition as an argument) @@ -141,7 +155,7 @@ public class WideSelectionTreeUI extends BasicTreeUI { JTree tree = (JTree)event.getSource(); Object property = tree.getClientProperty("DnD Source"); // DnDManagerImpl.SOURCE_KEY if (property == null) { - super.mouseDragged(event); // use Swing-based DnD only if custom DnD is not set + super.mouseDragged(event); // use Swing-based DnD only if custom DnD is not set } } diff --git a/platform/util/ui/src/com/intellij/util/ui/update/ComparableObject.java b/platform/util/src/com/intellij/util/ui/update/ComparableObject.java similarity index 57% rename from platform/util/ui/src/com/intellij/util/ui/update/ComparableObject.java rename to platform/util/src/com/intellij/util/ui/update/ComparableObject.java index 20f947bad7fc..dd68c14b2fa9 100644 --- a/platform/util/ui/src/com/intellij/util/ui/update/ComparableObject.java +++ b/platform/util/src/com/intellij/util/ui/update/ComparableObject.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui.update; import com.intellij.util.ArrayUtil; diff --git a/platform/util/ui/src/com/intellij/util/ui/update/ComparableObjectCheck.java b/platform/util/src/com/intellij/util/ui/update/ComparableObjectCheck.java similarity index 63% rename from platform/util/ui/src/com/intellij/util/ui/update/ComparableObjectCheck.java rename to platform/util/src/com/intellij/util/ui/update/ComparableObjectCheck.java index d16adfdc4cd8..c29585ce4311 100644 --- a/platform/util/ui/src/com/intellij/util/ui/update/ComparableObjectCheck.java +++ b/platform/util/src/com/intellij/util/ui/update/ComparableObjectCheck.java @@ -1,4 +1,18 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.ui.update; import com.intellij.openapi.util.Comparing; diff --git a/platform/util/src/org/apache/batik/script/rhino/RhinoInterpreter.java b/platform/util/src/org/apache/batik/script/rhino/RhinoInterpreter.java new file mode 100644 index 000000000000..030170dee7e7 --- /dev/null +++ b/platform/util/src/org/apache/batik/script/rhino/RhinoInterpreter.java @@ -0,0 +1,17 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package org.apache.batik.script.rhino; + +import org.apache.batik.script.ImportInfo; + +import java.net.URL; + +// A workaround for the class rename in Batik 1.10 +public class RhinoInterpreter extends org.apache.batik.bridge.RhinoInterpreter { + public RhinoInterpreter(URL documentURL) { + super(documentURL); + } + + public RhinoInterpreter(URL documentURL, ImportInfo imports) { + super(documentURL, imports); + } +} diff --git a/platform/util/src/org/apache/batik/script/rhino/RhinoInterpreterFactory.java b/platform/util/src/org/apache/batik/script/rhino/RhinoInterpreterFactory.java new file mode 100644 index 000000000000..fcf6d4f816eb --- /dev/null +++ b/platform/util/src/org/apache/batik/script/rhino/RhinoInterpreterFactory.java @@ -0,0 +1,6 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package org.apache.batik.script.rhino; + +// A workaround for the class rename in Batik 1.10 +public class RhinoInterpreterFactory extends org.apache.batik.bridge.RhinoInterpreterFactory { +} diff --git a/platform/util/ui/src/org/w3c/dom/ElementTraversal.java b/platform/util/src/org/w3c/dom/ElementTraversal.java similarity index 79% rename from platform/util/ui/src/org/w3c/dom/ElementTraversal.java rename to platform/util/src/org/w3c/dom/ElementTraversal.java index 7abd4920be8b..58a73d2cd2f3 100644 --- a/platform/util/ui/src/org/w3c/dom/ElementTraversal.java +++ b/platform/util/src/org/w3c/dom/ElementTraversal.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.w3c.dom; // Workaround for IDEA-193340 diff --git a/platform/util/ui/src/org/w3c/dom/Location.java b/platform/util/src/org/w3c/dom/Location.java similarity index 78% rename from platform/util/ui/src/org/w3c/dom/Location.java rename to platform/util/src/org/w3c/dom/Location.java index 0605e4782786..688f30f36ca6 100644 --- a/platform/util/ui/src/org/w3c/dom/Location.java +++ b/platform/util/src/org/w3c/dom/Location.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.w3c.dom; // Workaround for IDEA-193340 diff --git a/platform/util/ui/src/org/w3c/dom/Window.java b/platform/util/src/org/w3c/dom/Window.java similarity index 77% rename from platform/util/ui/src/org/w3c/dom/Window.java rename to platform/util/src/org/w3c/dom/Window.java index cb9e35beabbb..0e163981789c 100644 --- a/platform/util/ui/src/org/w3c/dom/Window.java +++ b/platform/util/src/org/w3c/dom/Window.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.w3c.dom; // Workaround for IDEA-193340 diff --git a/platform/util/ui/src/com/intellij/openapi/ui/DescriptionLabel.java b/platform/util/ui/src/com/intellij/openapi/ui/DescriptionLabel.java deleted file mode 100644 index ab15f62b287d..000000000000 --- a/platform/util/ui/src/com/intellij/openapi/ui/DescriptionLabel.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.openapi.ui; - -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; - -public class DescriptionLabel extends JLabel { - - public DescriptionLabel(@Nullable String text) { - setText(text); - } - - @Override - public void updateUI() { - super.updateUI(); - setForeground(UIUtil.getLabelDisabledForeground()); - int size = getFont().getSize(); - if (size >= 12) { - size -= 2; - } - setFont(getFont().deriveFont((float)size)); - } -} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/openapi/ui/Divider.java b/platform/util/ui/src/com/intellij/openapi/ui/Divider.java deleted file mode 100644 index ae1f1abe2384..000000000000 --- a/platform/util/ui/src/com/intellij/openapi/ui/Divider.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.openapi.ui; - -import javax.swing.*; -import java.awt.*; - -/** - * @author Konstantin Bulenkov - */ -public abstract class Divider extends JPanel { - public Divider(LayoutManager layout) { - super(layout); - } - - public abstract void setResizeEnabled(boolean resizeEnabled); - - public abstract void setSwitchOrientationEnabled(boolean switchOrientationEnabled); - - public abstract void setOrientation(boolean vertical); -} diff --git a/platform/util/ui/src/com/intellij/openapi/ui/NullableComponent.java b/platform/util/ui/src/com/intellij/openapi/ui/NullableComponent.java deleted file mode 100644 index fd31009c1758..000000000000 --- a/platform/util/ui/src/com/intellij/openapi/ui/NullableComponent.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - -package com.intellij.openapi.ui; - -import java.awt.*; - -public interface NullableComponent { - - boolean isNull(); - - class Check { - private Check() { - } - - public static boolean isNull(Component c) { - return c == null || c instanceof NullableComponent && ((NullableComponent)c).isNull(); - } - - public static boolean isNullOrHidden(Component c) { - return c != null && !c.isShowing() || isNull(c); - } - - public static boolean isNotNullAndVisible(Component c) { - return !isNull(c) && c.isVisible(); - } - } -} diff --git a/platform/util/ui/src/com/intellij/openapi/ui/Splittable.java b/platform/util/ui/src/com/intellij/openapi/ui/Splittable.java deleted file mode 100644 index dd917650af34..000000000000 --- a/platform/util/ui/src/com/intellij/openapi/ui/Splittable.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.openapi.ui; - -import org.jetbrains.annotations.NotNull; - -import java.awt.*; - -public interface Splittable { - float getMinProportion(boolean first); - - void setProportion(float proportion); - - /** - * @return {@code true} if splitter has vertical orientation, {@code false} otherwise - */ - boolean getOrientation(); - - /** - * @param verticalSplit {@code true} means that splitter will have vertical split - */ - void setOrientation(boolean verticalSplit); - - @NotNull - Component asComponent(); - - void setDragging(boolean dragging); -} diff --git a/platform/util/ui/src/com/intellij/openapi/util/IdRunnable.java b/platform/util/ui/src/com/intellij/openapi/util/IdRunnable.java deleted file mode 100644 index 0e1a8a4a2220..000000000000 --- a/platform/util/ui/src/com/intellij/openapi/util/IdRunnable.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.openapi.util; - -import com.intellij.util.ui.update.ComparableObject; - -public abstract class IdRunnable extends ComparableObject.Impl implements Runnable { - - public IdRunnable(Object object) { - super(object); - } - - public IdRunnable(Object[] objects) { - super(objects); - } -} diff --git a/platform/util/ui/src/com/intellij/ui/ActiveComponent.java b/platform/util/ui/src/com/intellij/ui/ActiveComponent.java deleted file mode 100644 index 81589f2f7f0b..000000000000 --- a/platform/util/ui/src/com/intellij/ui/ActiveComponent.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui; - -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; - -public interface ActiveComponent { - void setActive(boolean active); - - @NotNull - JComponent getComponent(); - - abstract class Adapter implements ActiveComponent { - @Override - public void setActive(boolean active) { } - } -} diff --git a/platform/util/ui/src/com/intellij/ui/CollapsingListener.java b/platform/util/ui/src/com/intellij/ui/CollapsingListener.java deleted file mode 100644 index aac26ee77b8e..000000000000 --- a/platform/util/ui/src/com/intellij/ui/CollapsingListener.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui; - -import org.jetbrains.annotations.NotNull; - -public interface CollapsingListener { - void onCollapsingChanged(@NotNull CollapsiblePanel panel, boolean newValue); -} diff --git a/platform/util/ui/src/com/intellij/ui/Colors.java b/platform/util/ui/src/com/intellij/ui/Colors.java deleted file mode 100644 index 49d1fb19ba9d..000000000000 --- a/platform/util/ui/src/com/intellij/ui/Colors.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui; - -import java.awt.*; - -public interface Colors { - - Color DARK_RED = new Color(140, 0, 0); - Color DARK_GREEN = new Color(0, 140, 0); - Color DARK_BLUE = new Color(0, 0, 140); - - Color DISABLED_COLOR = Gray._150; -} diff --git a/platform/util/ui/src/com/intellij/ui/FileColorName.java b/platform/util/ui/src/com/intellij/ui/FileColorName.java deleted file mode 100644 index 64a6f183458b..000000000000 --- a/platform/util/ui/src/com/intellij/ui/FileColorName.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui; - -/** - * @author Konstantin Bulenkov - */ -public interface FileColorName { - String colorName(); -} diff --git a/platform/util/ui/src/com/intellij/ui/Gradient.java b/platform/util/ui/src/com/intellij/ui/Gradient.java deleted file mode 100644 index fa742e448655..000000000000 --- a/platform/util/ui/src/com/intellij/ui/Gradient.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui; - -import java.awt.*; - -/** - * @author Konstantin Bulenkov - */ -public class Gradient { - private final Color myStartColor; - private final Color myEndColor; - - public Gradient(Color startColor, Color endColor) { - myStartColor = startColor; - myEndColor = endColor; - } - - public Color getStartColor() { - return myStartColor; - } - - public Color getEndColor() { - return myEndColor; - } -} diff --git a/platform/util/ui/src/com/intellij/ui/RetrievableIcon.java b/platform/util/ui/src/com/intellij/ui/RetrievableIcon.java deleted file mode 100644 index 4d77dadec524..000000000000 --- a/platform/util/ui/src/com/intellij/ui/RetrievableIcon.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - -package com.intellij.ui; - -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; - - -/** - * An icon wrapping and painting another icon. - */ -public interface RetrievableIcon extends Icon { - /** - * Returns the wrapped icon. - */ - @Nullable - Icon retrieveIcon(); -} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/ui/SeparatorOrientation.java b/platform/util/ui/src/com/intellij/ui/SeparatorOrientation.java deleted file mode 100644 index f9e52b19b3eb..000000000000 --- a/platform/util/ui/src/com/intellij/ui/SeparatorOrientation.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui; - - -public class SeparatorOrientation { - public static final SeparatorOrientation HORIZONTAL = new SeparatorOrientation("HORIZONTAL"); - public static final SeparatorOrientation VERTICAL = new SeparatorOrientation("VERTICAL"); - - private final String myName; // for debug only - - private SeparatorOrientation(String name) { - myName = name; - } - - public String toString() { - return myName; - } - -} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/ID.java b/platform/util/ui/src/com/intellij/ui/mac/foundation/ID.java deleted file mode 100644 index 9b5dfbc81635..000000000000 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/ID.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui.mac.foundation; - -import com.sun.jna.NativeLong; - -/** - * Could be an address in memory (if pointer to a class or method) or a value (like 0 or 1) - * - * User: spLeaner - */ -public class ID extends NativeLong { - - public ID() { - } - - public ID(long peer) { - super(peer); - } - - public static final ID NIL = new ID(0); - -} diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/Selector.java b/platform/util/ui/src/com/intellij/ui/mac/foundation/Selector.java deleted file mode 100644 index b8977179fed5..000000000000 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/Selector.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui.mac.foundation; - -import com.sun.jna.NativeLong; - -/** - * @author spleaner - */ -public class Selector extends NativeLong { - - private String myName; - - public Selector() { - this("undefined selector", 0); - } - - public Selector(String name, long value) { - super(value); - myName = name; - } - - public String getName() { - return myName; - } - - @Override - public String toString() { - return String.format("[Selector %s]", myName); - } - - public Selector initName(final String name) { - myName = name; - return this; - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/AbstractTableCellEditor.java b/platform/util/ui/src/com/intellij/util/ui/AbstractTableCellEditor.java deleted file mode 100644 index c90aaf88bb21..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/AbstractTableCellEditor.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import javax.swing.*; -import javax.swing.table.TableCellEditor; - - -public abstract class AbstractTableCellEditor extends AbstractCellEditor implements TableCellEditor{ - -} diff --git a/platform/util/ui/src/com/intellij/util/ui/ClientPropertyHolder.java b/platform/util/ui/src/com/intellij/util/ui/ClientPropertyHolder.java deleted file mode 100644 index 47b84e4dcdf3..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/ClientPropertyHolder.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import org.jetbrains.annotations.NonNls; - -public interface ClientPropertyHolder { - - void putClientProperty(@NonNls String key, @NonNls Object value); - -} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/util/ui/EditableModel.java b/platform/util/ui/src/com/intellij/util/ui/EditableModel.java deleted file mode 100644 index 8ae157ccc4ca..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/EditableModel.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -/** - * @author Konstantin Bulenkov - */ -public interface EditableModel extends ItemRemovable { - void addRow(); - - void exchangeRows(int oldIndex, int newIndex); - - boolean canExchangeRows(int oldIndex, int newIndex); -} diff --git a/platform/util/ui/src/com/intellij/util/ui/EditableTreeModel.java b/platform/util/ui/src/com/intellij/util/ui/EditableTreeModel.java deleted file mode 100644 index a010a3c3a54d..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/EditableTreeModel.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import javax.swing.tree.TreePath; -import java.util.Collection; - -/** - * @author Konstantin Bulenkov - */ -public interface EditableTreeModel { - /** - * Adds a new node into a - * @param parentOrNeighbour selected node, maybe used as parent or as a neighbour - * @return path to newly created element - */ - TreePath addNode(TreePath parentOrNeighbour); - - void removeNode(TreePath path); - void removeNodes(Collection path); - - void moveNodeTo(TreePath parentOrNeighbour); -} diff --git a/platform/util/ui/src/com/intellij/util/ui/ElementProducer.java b/platform/util/ui/src/com/intellij/util/ui/ElementProducer.java deleted file mode 100644 index 5ddcd06c47d1..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/ElementProducer.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -/** - * @author Konstantin Bulenkov - */ -public interface ElementProducer { - E createElement(); - boolean canCreateElement(); -} diff --git a/platform/util/ui/src/com/intellij/util/ui/EmptyClipboardOwner.java b/platform/util/ui/src/com/intellij/util/ui/EmptyClipboardOwner.java deleted file mode 100644 index 70de774ae74c..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/EmptyClipboardOwner.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.ClipboardOwner; -import java.awt.datatransfer.Transferable; - -/** - * @author yole -*/ -public class EmptyClipboardOwner implements ClipboardOwner { - public static EmptyClipboardOwner INSTANCE = new EmptyClipboardOwner(); - - private EmptyClipboardOwner() { - } - - @Override - public void lostOwnership(Clipboard clipboard, Transferable contents) { - } -} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/util/ui/Html.java b/platform/util/ui/src/com/intellij/util/ui/Html.java deleted file mode 100644 index 867943155d64..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/Html.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -public class Html { - - private final String myText; - private boolean myKeepFont = false; - - public Html(String text) { - myText = text; - } - - public String getText() { - return myText; - } - - public Html setKeepFont(boolean keepFont) { - myKeepFont = keepFont; - return this; - } - - public boolean isKeepFont() { - return myKeepFont; - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/IsRetina.java b/platform/util/ui/src/com/intellij/util/ui/IsRetina.java deleted file mode 100644 index 2adf3ee3db73..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/IsRetina.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import apple.awt.CImage; - -import java.awt.image.BufferedImage; - -class IsRetina { - public static boolean isRetina() { - try { - final boolean[] isRetina = new boolean[1]; - new CImage.HiDPIScaledImage(1, 1, BufferedImage.TYPE_INT_ARGB) { - @Override - public void drawIntoImage(BufferedImage image, float v) { - isRetina[0] = v > 1; - } - }; - return isRetina[0]; - } - catch (Throwable e) { - e.printStackTrace(); - return false; - } - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/ItemRemovable.java b/platform/util/ui/src/com/intellij/util/ui/ItemRemovable.java deleted file mode 100644 index 1bfbc7118a40..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/ItemRemovable.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -/** - * Implement this interface in {@link javax.swing.table.TableModel}'s implementation if it supports removal of items. This will allow using - * utility methods to remove items from the table. - * - * @see com.intellij.ui.TableUtil#removeSelectedItems(javax.swing.JTable) - */ -public interface ItemRemovable { - /** - * Remove row with index {@code idx} and fire {@link javax.swing.event.TableModelEvent#DELETE DELETE} event (e.g. by calling - * {@link javax.swing.table.AbstractTableModel#fireTableRowsDeleted(int, int)}) - */ - void removeRow(int idx); -} diff --git a/platform/util/ui/src/com/intellij/util/ui/JBImageIcon.java b/platform/util/ui/src/com/intellij/util/ui/JBImageIcon.java deleted file mode 100644 index eaed21b4b50f..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/JBImageIcon.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; -import java.awt.*; -import java.awt.image.ImageObserver; - -/** - * HiDPI-aware image icon - * - * @author Konstantin Bulenkov - */ -public class JBImageIcon extends ImageIcon { - public JBImageIcon(@NotNull Image image) { - super(image); - } - - @Override - public synchronized void paintIcon(final Component c, final Graphics g, final int x, final int y) { - final ImageObserver observer = getImageObserver(); - - UIUtil.drawImage(g, getImage(), x, y, observer == null ? c : observer); - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/JBPoint.java b/platform/util/ui/src/com/intellij/util/ui/JBPoint.java deleted file mode 100644 index 3f539faf59df..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/JBPoint.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import org.jetbrains.annotations.NotNull; - -import java.awt.*; - -/** - * @author Konstantin Bulenkov - */ -public class JBPoint extends Point { - public JBPoint(@NotNull Point p) { - super(p instanceof JBPoint ? p : new JBPoint(p.x, p.y)); - } - - public JBPoint(int x, int y) { - super(JBUI.scale(x), JBUI.scale(y)); - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/PlatformColors.java b/platform/util/ui/src/com/intellij/util/ui/PlatformColors.java deleted file mode 100644 index 241a74e6b56b..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/PlatformColors.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import com.intellij.ui.JBColor; - -import java.awt.*; - -/** - * @author Konstantin Bulenkov - */ -public class PlatformColors { - public static final Color BLUE = JBColor.BLUE; -} diff --git a/platform/util/ui/src/com/intellij/util/ui/SameColor.java b/platform/util/ui/src/com/intellij/util/ui/SameColor.java deleted file mode 100644 index 9fa397aee5a0..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/SameColor.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import java.awt.*; - -/** - * @author Eugene Belyaev - * @deprecated use com.intellij.ui.Gray - */ -@Deprecated -public class SameColor extends Color { - public SameColor(int i) { - super(i, i, i); - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/SortableColumnModel.java b/platform/util/ui/src/com/intellij/util/ui/SortableColumnModel.java deleted file mode 100644 index 79a75aefa40b..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/SortableColumnModel.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; - -public interface SortableColumnModel { - ColumnInfo[] getColumnInfos(); - - void setSortable(boolean aBoolean); - - boolean isSortable(); - - Object getRowValue(int row); - - @Nullable - RowSorter.SortKey getDefaultSortKey(); -} diff --git a/platform/util/ui/src/com/intellij/util/ui/TableViewModel.java b/platform/util/ui/src/com/intellij/util/ui/TableViewModel.java deleted file mode 100644 index 911e4348aad2..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/TableViewModel.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import org.jetbrains.annotations.NotNull; - -import javax.swing.table.AbstractTableModel; -import java.util.List; - -public abstract class TableViewModel extends AbstractTableModel implements SortableColumnModel { - public abstract void setItems(@NotNull List items); - @NotNull - public abstract List getItems(); -} \ No newline at end of file diff --git a/platform/util/ui/src/com/intellij/util/ui/TwoColorsIcon.java b/platform/util/ui/src/com/intellij/util/ui/TwoColorsIcon.java deleted file mode 100644 index ca771cde5576..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/TwoColorsIcon.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.awt.*; - -/** - * @author Vassiliy Kudryashov - * @author Konstantin Bulenkov - * - * @deprecated use {@link com.intellij.util.ui.ColorsIcon} instead - */ -@Deprecated -public class TwoColorsIcon extends ColorsIcon { - public TwoColorsIcon(int size, @Nullable Color color1, @Nullable Color secondColor) { - super(size, color1, secondColor); - } - - protected TwoColorsIcon(TwoColorsIcon icon) { - super(icon); - } - - @NotNull - @Override - public TwoColorsIcon copy() { - return new TwoColorsIcon(this); - } -} diff --git a/platform/util/ui/src/com/intellij/util/ui/components/JBComponent.java b/platform/util/ui/src/com/intellij/util/ui/components/JBComponent.java deleted file mode 100644 index d8e058249ea4..000000000000 --- a/platform/util/ui/src/com/intellij/util/ui/components/JBComponent.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.util.ui.components; - -import com.intellij.util.ui.JBFont; - -import javax.swing.border.Border; - -/** - * @author Konstantin Bulenkov - */ -public interface JBComponent { - T withBorder(Border border); - - T withFont(JBFont font); - - T andTransparent(); - - T andOpaque(); -} diff --git a/platform/util/ui/src/org/apache/batik/script/InterpreterPool.java b/platform/util/ui/src/org/apache/batik/script/InterpreterPool.java deleted file mode 100644 index cbc280ef2155..000000000000 --- a/platform/util/ui/src/org/apache/batik/script/InterpreterPool.java +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package org.apache.batik.script; - -public final class InterpreterPool { -} diff --git a/platform/vcs-api/intellij.platform.vcs.iml b/platform/vcs-api/intellij.platform.vcs.iml index 9db64295bbcd..4664c63f4233 100644 --- a/platform/vcs-api/intellij.platform.vcs.iml +++ b/platform/vcs-api/intellij.platform.vcs.iml @@ -16,6 +16,5 @@ - \ No newline at end of file diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java index 8ef8db3a8327..af70a2740e28 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/MainFrame.java @@ -61,6 +61,7 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { private static final String CHANGES_SPLITTER_PROPORTION = "vcs.log.changes.splitter.proportion"; @NotNull private final VcsLogData myLogData; + @NotNull private final AbstractVcsLogUi myUi; @NotNull private final VcsLog myLog; @NotNull private final VcsLogClassicFilterUi myFilterUi; @@ -78,27 +79,28 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { @NotNull private final VcsLogChangeProcessor myPreviewDiff; public MainFrame(@NotNull VcsLogData logData, - @NotNull VcsLogUiImpl logUi, + @NotNull VcsLogUiImpl ui, @NotNull MainVcsLogUiProperties uiProperties, @NotNull VcsLog log, @NotNull VisiblePack initialDataPack, @Nullable VcsLogFilterCollection filters) { // collect info myLogData = logData; + myUi = ui; myLog = log; myUiProperties = uiProperties; - myFilterUi = new VcsLogClassicFilterUi(logUi, logData, myUiProperties, initialDataPack, filters); + myFilterUi = new VcsLogClassicFilterUi(ui, logData, myUiProperties, initialDataPack, filters); // initialize components - myGraphTable = new MyVcsLogGraphTable(logUi, logData, initialDataPack); + myGraphTable = new MyVcsLogGraphTable(ui, logData, initialDataPack); myGraphTable.setCompactReferencesView(myUiProperties.get(MainVcsLogUiProperties.COMPACT_REFERENCES_VIEW)); myGraphTable.setShowTagNames(myUiProperties.get(MainVcsLogUiProperties.SHOW_TAG_NAMES)); PopupHandler.installPopupHandler(myGraphTable, VcsLogActionPlaces.POPUP_ACTION_GROUP, VcsLogActionPlaces.VCS_LOG_TABLE_PLACE); - myDetailsPanel = new DetailsPanel(logData, logUi.getColorManager(), this) { + myDetailsPanel = new DetailsPanel(logData, ui.getColorManager(), this) { @Override protected void navigate(@NotNull CommitId commit) { - logUi.jumpToCommit(commit.getHash(), commit.getRoot()); + myUi.jumpToCommit(commit.getHash(), commit.getRoot()); } }; @@ -127,7 +129,7 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { JComponent toolbarsAndTable = new JPanel(new BorderLayout()); toolbarsAndTable.add(toolbars, BorderLayout.NORTH); toolbarsAndTable.add(VcsLogUiUtil.installProgress(VcsLogUiUtil.setupScrolledGraph(myGraphTable, SideBorder.TOP), - myLogData, logUi.getId(), this), BorderLayout.CENTER); + myLogData, ui.getId(), this), BorderLayout.CENTER); myDetailsSplitter = new OnePixelSplitter(true, DETAILS_SPLITTER_PROPORTION, 0.7f); myDetailsSplitter.setFirstComponent(myChangesLoadingPane); @@ -145,7 +147,7 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { setLayout(new BorderLayout()); add(myPreviewDiffSplitter); - Disposer.register(logUi, this); + Disposer.register(ui, this); myGraphTable.resetDefaultFocusTraversalKeys(); setFocusCycleRoot(true); setFocusTraversalPolicy(new MyFocusPolicy()); @@ -161,7 +163,7 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { public void updateDataPack(@NotNull VisiblePack dataPack, boolean permGraphChanged) { myFilterUi.updateDataPack(dataPack); myGraphTable.updateDataPack(dataPack, permGraphChanged); - myChangesBrowser.setAffectedPaths(VcsLogUtil.getAffectedPaths(dataPack)); + myChangesBrowser.setAffectedPaths(VcsLogUtil.getAffectedPaths(myUi)); } @NotNull @@ -249,7 +251,7 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { else if (VcsLogInternalDataKeys.LOG_DIFF_HANDLER.is(dataId)) { Collection roots = getSelectedRoots(); if (roots.size() != 1) return null; - return myLogData.getLogProvider(notNull(getFirstItem(roots))).getDiffHandler(); + return myUi.getLogData().getLogProvider(notNull(getFirstItem(roots))).getDiffHandler(); } else if (ShowPreviewEditorAction.DATA_KEY.is(dataId)) { return new ShowPreviewEditorAction.DiffPreviewProvider() { @@ -265,7 +267,7 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { @NotNull @Override public Object getOwner() { - return MainFrame.this; + return myUi; } }; } @@ -274,12 +276,9 @@ public class MainFrame extends JPanel implements DataProvider, Disposable { @NotNull private Collection getSelectedRoots() { - Collection roots = myLogData.getRoots(); - if (roots.size() == 1) return roots; + if (myUi.getLogData().getRoots().size() == 1) return myUi.getLogData().getRoots(); int[] selectedRows = myGraphTable.getSelectedRows(); - if (selectedRows.length == 0 || selectedRows.length > VcsLogUtil.MAX_SELECTED_COMMITS) { - return VcsLogUtil.getAllVisibleRoots(roots, myFilterUi.getFilters()); - } + if (selectedRows.length == 0 || selectedRows.length > VcsLogUtil.MAX_SELECTED_COMMITS) return VcsLogUtil.getVisibleRoots(myUi); return ContainerUtil.map2Set(Ints.asList(selectedRows), row -> myGraphTable.getModel().getRoot(row)); } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java index 11e630011755..2e6bf5d23b23 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java @@ -286,12 +286,7 @@ public class VcsLogUtil { @Nullable public static Collection getAffectedPaths(@NotNull VcsLogUi logUi) { - return getAffectedPaths(logUi.getDataPack()); - } - - @Nullable - public static Collection getAffectedPaths(@NotNull VcsLogDataPack dataPack) { - VcsLogStructureFilter structureFilter = dataPack.getFilters().get(VcsLogFilterCollection.STRUCTURE_FILTER); + VcsLogStructureFilter structureFilter = logUi.getDataPack().getFilters().get(VcsLogFilterCollection.STRUCTURE_FILTER); if (structureFilter != null) { return structureFilter.getFiles(); } diff --git a/platform/xdebugger-api/intellij.platform.debugger.iml b/platform/xdebugger-api/intellij.platform.debugger.iml index eded1215b873..21e6ec859f2c 100644 --- a/platform/xdebugger-api/intellij.platform.debugger.iml +++ b/platform/xdebugger-api/intellij.platform.debugger.iml @@ -8,6 +8,5 @@ - \ No newline at end of file diff --git a/plugins/sh/src/com/intellij/sh/formatter/ShExternalFormatter.java b/plugins/sh/src/com/intellij/sh/formatter/ShExternalFormatter.java index 99fdb4fe5b88..c2b55b2c96a2 100644 --- a/plugins/sh/src/com/intellij/sh/formatter/ShExternalFormatter.java +++ b/plugins/sh/src/com/intellij/sh/formatter/ShExternalFormatter.java @@ -76,7 +76,7 @@ public class ShExternalFormatter implements ExternalFormatProcessor { })); notification.addAction(NotificationAction.createSimple("No, thanks", () -> { notification.expire(); - shSettings.SHFMT_PATH = ShSettings.I_DO_MIND; + shSettings.SHFMT_PATH = ShSettings.NOT_AVAILABLE_PATH; })); Notifications.Bus.notify(notification); return; diff --git a/plugins/sh/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java b/plugins/sh/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java index 92269b4ded3a..2951422fc001 100644 --- a/plugins/sh/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java +++ b/plugins/sh/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java @@ -107,7 +107,7 @@ public class ShShfmtFormatterUtil { public static boolean isValidPath(@Nullable String path) { if (path == null) return false; - if (ShSettings.I_DO_MIND.equals(path)) return true; + if (ShSettings.NOT_AVAILABLE_PATH.equals(path)) return true; File file = new File(path); if (!file.canExecute()) return false; return file.getName().contains("shfmt"); diff --git a/plugins/sh/src/com/intellij/sh/settings/ShSettings.java b/plugins/sh/src/com/intellij/sh/settings/ShSettings.java index aa570d4e08fa..aeb418e92f6c 100644 --- a/plugins/sh/src/com/intellij/sh/settings/ShSettings.java +++ b/plugins/sh/src/com/intellij/sh/settings/ShSettings.java @@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ShSettings { - public static final String I_DO_MIND = "I do mind"; + public static final String NOT_AVAILABLE_PATH = "N/A"; private static final String SHELLCHECK_PATH = "SHELLCHECK.PATH"; diff --git a/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckInspection.java b/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckInspection.java index 3415e142ad98..bbb52efe6d52 100644 --- a/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckInspection.java +++ b/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckInspection.java @@ -17,9 +17,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.ArrayList; +import java.util.List; import java.util.Set; import java.util.TreeSet; -import java.util.HashSet; public class ShShellcheckInspection extends LocalInspectionTool implements ExternalAnnotatorBatchInspection { public static final String SHORT_NAME = "ShellCheck"; @@ -34,12 +35,6 @@ public class ShShellcheckInspection extends LocalInspectionTool implements Exter return SuppressQuickFix.EMPTY_ARRAY; } - @NotNull - @Override - public String getShortName() { - return SHORT_NAME; - } - @Override public void readSettings(@NotNull Element node) { String inspectionSettings = JDOMExternalizerUtil.readCustomField(node, SHELLCHECK_SETTINGS_TAG); @@ -70,8 +65,8 @@ public class ShShellcheckInspection extends LocalInspectionTool implements Exter } @NotNull - Set getDisabledInspections() { - return new HashSet<>(myDisabledInspections); + List getDisabledInspections() { + return new ArrayList<>(myDisabledInspections); } public void disableInspection(String inspectionCode) { diff --git a/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java b/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java index d6b78bb4dd0e..2ed44d5a6ccf 100644 --- a/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java +++ b/plugins/sh/src/com/intellij/sh/shellcheck/ShShellcheckUtil.java @@ -32,16 +32,15 @@ import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.TreeMap; class ShShellcheckUtil { private static final Logger LOG = Logger.getInstance(ShShellcheckUtil.class); - static final String SHELLCHECK = "shellcheck"; - static final String SHELLCHECK_VERSION = "0.6.0-1"; - static final String SHELLCHECK_ARCHIVE_EXTENSION = ".tar.gz"; - static final String SHELLCHECK_URL = "https://jetbrains.bintray.com/" + - "intellij-third-party-dependencies/" + - "org/jetbrains/intellij/deps/shellcheck/"; + private static final String SHELLCHECK = "shellcheck"; + private static final String SHELLCHECK_VERSION = "0.6.0-1"; + private static final String SHELLCHECK_ARCHIVE_EXTENSION = ".tar.gz"; + private static final String SHELLCHECK_URL = "https://jetbrains.bintray.com/" + + "intellij-third-party-dependencies/" + + "org/jetbrains/intellij/deps/shellcheck/"; private static final String DOWNLOAD_PATH = PathManager.getPluginsPath() + File.separator + ShLanguage.INSTANCE.getID(); static void download(@Nullable Project project, @Nullable Runnable onSuccess) { @@ -116,7 +115,7 @@ class ShShellcheckUtil { static boolean isValidPath(@Nullable String path) { if (path == null) return false; - if (ShSettings.I_DO_MIND.equals(path)) return true; + if (ShSettings.NOT_AVAILABLE_PATH.equals(path)) return true; File file = new File(path); return file.canExecute() && file.getName().contains("shellcheck"); @@ -133,7 +132,7 @@ class ShShellcheckUtil { } @NotNull - static String decompressShellcheck(@NotNull String tarPath, File directory) throws IOException { + private static String decompressShellcheck(@NotNull String tarPath, File directory) throws IOException { File archive = new File(tarPath); Decompressor.Tar tar = new Decompressor.Tar(archive); @@ -181,333 +180,332 @@ class ShShellcheckUtil { NotificationType.ERROR)); } - static final Map shellCheckCodes = new TreeMap(){{ - put("SC1000", "$ is not used specially and should therefore be escaped."); - put("SC1001", "This \\o will be a regular 'o' in this context."); - put("SC1003", "Want to escape a single quote? echo 'This is how it'\\''s done'."); - put("SC1004", "This backslash+linefeed is literal. Break outside single quotes if you just want to break the line."); - put("SC1007", "Remove space after = if trying to assign a value (or for empty string, use var='' ... )."); - put("SC1008", "This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify."); - put("SC1009", "The mentioned parser error was in ..."); - put("SC1010", "Use semicolon or linefeed before 'done' (or quote to make it literal)."); - put("SC1011", "This apostrophe terminated the single quoted string!"); - put("SC1012", "`\t` is just literal `t` here. For tab, use \"$(printf '\t')\" instead."); - put("SC1014", "Use 'if cmd; then ..' to check exit code, or 'if [ \"$(cmd)\" = .. ]' to check output."); - put("SC1015", "This is a unicode double quote. Delete and retype it."); - put("SC1016", "This is a Unicode single quote. Delete and retype it."); - put("SC1017", "Literal carriage return. Run script through `tr -d '\r'` ."); - put("SC1018", "This is a unicode non-breaking space. Delete it and retype as space."); - put("SC1019", "Expected this to be an argument to the unary condition."); - put("SC1020", "You need a space before the if single then \"]\" else \"]]\""); - put("SC1026", "If grouping expressions inside [[..]], use ( .. )."); - put("SC1028", "In [..] you have to escape \\( \\) or preferably combine [..] expressions."); - put("SC1029", "In `[[..]]` you shouldn't escape `(` or `)`."); - put("SC1035", "You need a space here"); - put("SC1036", "`(` is invalid here. Did you forget to escape it?"); - put("SC1037", "Braces are required for positionals over 9, e.g. ${10}."); - put("SC1038", "Shells are space sensitive. Use '< <(cmd)', not '<<(cmd)'."); - put("SC1039", "Remove indentation before end token (or use `<<-` and indent with tabs)."); - put("SC1040", "When using <<-, you can only indent with tabs."); - put("SC1041", "Found 'eof' further down, but not on a separate line."); - put("SC1042", "Found 'eof' further down, but not on a separate line."); - put("SC1044", "Couldn't find end token `EOF' in the here document."); - put("SC1045", "It's not 'foo &; bar', just 'foo & bar'."); - put("SC1046", "Couldn't find 'fi' for this 'if'."); - put("SC1047", "Expected 'fi' matching previously mentioned 'if'."); - put("SC1048", "Can't have empty then clauses (use 'true' as a no-op)."); - put("SC1049", "Did you forget the 'then' for this 'if'?"); - put("SC1050", "Expected 'then'."); - put("SC1051", "Semicolons directly after 'then' are not allowed. Just remove it."); - put("SC1052", "Semicolons directly after 'then' are not allowed. Just remove it."); - put("SC1053", "Semicolons directly after 'else' are not allowed. Just remove it."); - put("SC1054", "You need a space after the '{'."); - put("SC1058", "Expected `do`."); - put("SC1061", "Couldn't find 'done' for this 'do'."); - put("SC1062", "Expected 'done' matching previously mentioned 'do'."); - put("SC1064", "Expected a { to open the function definition."); - put("SC1065", "Trying to declare parameters? Don't. Use () and refer to params as $1, $2.."); - put("SC1066", "Don't use $ on the left side of assignments."); - put("SC1068", "Don't put spaces around the = in assignments."); - put("SC1069", "You need a space before the [."); - put("SC1071", "ShellCheck only supports sh/bash/dash/ksh scripts. Sorry!"); - put("SC1072", "Unexpected .."); - put("SC1073", "Couldn't parse this (thing). Fix to allow more checks."); - put("SC1075", "Use 'elif' instead of 'else if'."); - put("SC1077", "For command expansion, the tick should slant left (` vs ยด)."); - put("SC1078", "Did you forget to close this double quoted string?"); - put("SC1079", "This is actually an end quote, but due to next char it looks suspect."); - put("SC1081", "Scripts are case sensitive. Use 'if', not 'If'."); - put("SC1082", "This file has a UTF-8 BOM. Remove it with: LC_CTYPE=C sed '1s/^...//' < yourscript ."); - put("SC1083", "This `{`/`}` is literal. Check expression (missing `;/\n?`) or quote it."); - put("SC1084", "Use #!, not !#, for the shebang."); - put("SC1086", "Don't use $ on the iterator name in for loops."); - put("SC1087", "Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet)."); - put("SC1088", "Parsing stopped here. Invalid use of parentheses?"); - put("SC1089", "Parsing stopped here. Is this keyword correctly matched up?"); - put("SC1090", "Can't follow non-constant source. Use a directive to specify location."); - put("SC1091", "Not following: (error message here)"); - put("SC1094", "Parsing of sourced file failed. Ignoring it."); - put("SC1095", "You need a space or linefeed between the function name and body."); - put("SC1097", "Unexpected ==. For assignment, use =. For comparison, use [/[[."); - put("SC1098", "Quote/escape special characters when using eval, e.g. eval \"a=(b)\"."); - put("SC1099", "You need a space before the #."); - put("SC1100", "This is a unicode dash. Delete and retype as ASCII minus."); - put("SC1101", "Delete trailing spaces after \\ to break line (or use quotes for literal space)."); - put("SC1102", "Shells disambiguate $(( differently or not at all. If the first $( should start command substitution, add a space after it."); - put("SC1104", "Use #!, not just !, for the shebang."); - put("SC1105", "Shells disambiguate (( differently or not at all. If the first ( should start a subshell, add a space after it."); - put("SC1107", "This directive is unknown. It will be ignored."); - put("SC1108", "You need a space before and after the = ."); - put("SC1109", "This is an unquoted HTML entity. Replace with corresponding character."); - put("SC1110", "This is a unicode quote. Delete and retype it (or quote to make literal)."); - put("SC1111", "This is a unicode quote. Delete and retype it (or ignore/singlequote for literal)."); - put("SC1112", "This is a unicode quote. Delete and retype it (or ignore/doublequote for literal)."); - put("SC1113", "Use #!, not just #, for the shebang."); - put("SC1114", "Remove leading spaces before the shebang."); - put("SC1115", "Remove spaces between # and ! in the shebang."); - put("SC1116", "Missing $ on a $((..)) expression? (or use ( ( for arrays)."); - put("SC1117", "Backslash is literal in \"\n\". Prefer explicit escaping: \"\\n\"."); - put("SC1118", "Delete whitespace after the here-doc end token."); - put("SC1119", "Add a linefeed between end token and terminating ')'."); - put("SC1120", "No comments allowed after here-doc token. Comment the next line instead."); - put("SC1121", "Add ;/& terminators (and other syntax) on the line with the <<, not here."); - put("SC1122", "Nothing allowed after end token. To continue a command, put it on the line with the `<<`."); - put("SC1123", "ShellCheck directives are only valid in front of complete compound commands, like `if`, not e.g. individual `elif` branches."); - put("SC1124", "ShellCheck directives are only valid in front of complete commands like 'case' statements, not individual case branches."); - put("SC1126", "Place shellcheck directives before commands, not after."); - put("SC1127", "Was this intended as a comment? Use `#` in sh."); - put("SC1128", "The shebang must be on the first line. Delete blanks and move comments."); - put("SC1129", "You need a space before the !."); - put("SC1130", "You need a space before the :."); - put("SC1131", "Use `elif` to start another branch."); - put("SC1132", "This `&` terminates the command. Escape it or add space after `&` to silence."); - put("SC1133", "Unexpected start of line. If breaking lines, |/||/&& should be at the end of the previous one."); - put("SC2001", "SC2001: See if you can use ${variable//search/replace} instead."); - put("SC2002", "Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead."); - put("SC2003", "expr is antiquated. Consider rewriting this using $((..)), ${} or \\[\\[ \\]\\]."); - put("SC2004", "$/${} is unnecessary on arithmetic variables."); - put("SC2005", "Useless `echo`? Instead of `echo $(cmd)`, just use `cmd`"); - put("SC2006", "Use $(...) notation instead of legacy backticked `` `...` ``."); - put("SC2007", "Use $((..)) instead of deprecated $[..]"); - put("SC2008", "echo doesn't read from stdin, are you sure you should be piping to it?"); - put("SC2009", "SC2009 Consider using pgrep instead of grepping ps output."); - put("SC2010", "Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames."); - put("SC2012", "Use `find` instead of `ls` to better handle non-alphanumeric filenames."); - put("SC2013", "To read lines rather than words, pipe/redirect to a 'while read' loop."); - put("SC2014", "This will expand once before find runs, not per file found."); - put("SC2015", "Note that A && B || C is not if-then-else. C may run when A is true."); - put("SC2016", "Expressions don't expand in single quotes, use double quotes for that."); - put("SC2017", "Increase precision by replacing a/b\\*c with a\\*c/b."); - put("SC2018", "Use '[:lower:]' to support accents and foreign alphabets."); - put("SC2019", "Use '[:upper:]' to support accents and foreign alphabets."); - put("SC2020", "tr replaces sets of chars, not words (mentioned due to duplicates)."); - put("SC2021", "Don't use [] around ranges in tr, it replaces literal square brackets."); - put("SC2022", "Note that unlike globs, o* here matches 'ooo' but not 'oscar'"); - put("SC2024", "`sudo` doesn't affect redirects. Use `..| sudo tee file`"); - put("SC2025", "Make sure all escape sequences are enclosed in `\\[..\\]` to prevent line wrapping issues"); - put("SC2026", "This word is outside of quotes. Did you intend to 'nest '\"'single quotes'\"' instead'?"); - put("SC2027", "The surrounding quotes actually unquote this. Remove or escape them."); - put("SC2028", "echo won't expand escape sequences. Consider printf."); - put("SC2029", "Note that, unescaped, this expands on the client side."); - put("SC2030", "Modification of var is local (to subshell caused by pipeline)."); - put("SC2031", "var was modified in a subshell. That change might be lost."); - put("SC2032", "Use own script or sh -c '..' to run this from su."); - put("SC2033", "Shell functions can't be passed to external commands."); - put("SC2034", "foo appears unused. Verify it or export it."); - put("SC2035", "Use ./\\*glob* or -- \\*glob* so names with dashes won't become options."); - put("SC2036", "If you wanted to assign the output of the pipeline, use a=$(b | c) ."); - put("SC2037", "To assign the output of a command, use var=$(cmd) ."); - put("SC2038", "Use -print0/-0 or find -exec + to allow for non-alphanumeric filenames."); - put("SC2039", "In POSIX sh, *something* is undefined."); - put("SC2040", "#!/bin/sh was specified, so ____ is not supported, even when sh is actually bash."); - put("SC2041", "This is a literal string. To run as a command, use $(..) instead of '..' ."); - put("SC2043", "This loop will only ever run once for a constant value. Did you perhaps mean to loop over dir/*, $var or $(cmd)?"); - put("SC2044", "For loops over find output are fragile. Use find -exec or a while read loop."); - put("SC2045", "Iterating over ls output is fragile. Use globs."); - put("SC2046", "Quote this to prevent word splitting"); - put("SC2048", "Use \"$@\" (with quotes) to prevent whitespace problems."); - put("SC2049", "=~ is for regex, but this looks like a glob. Use = instead."); - put("SC2050", "This expression is constant. Did you forget the `$` on a variable?"); - put("SC2051", "Bash doesn't support variables in brace range expansions."); - put("SC2053", "Quote the rhs of = in [[ ]] to prevent glob matching."); - put("SC2054", "Use spaces, not commas, to separate array elements."); - put("SC2055", "You probably wanted && here"); - put("SC2056", "You probably wanted && here"); - put("SC2057", "Unknown binary operator."); - put("SC2058", "Unknown unaryoperator."); - put("SC2059", "Don't use variables in the printf format string. Use printf \"..%s..\" \"$foo\"."); - put("SC2060", "Quote parameters to tr to prevent glob expansion."); - put("SC2061", "Quote the parameter to -name so the shell won't interpret it."); - put("SC2062", "Quote the grep pattern so the shell won't interpret it."); - put("SC2063", "Grep uses regex, but this looks like a glob."); - put("SC2064", "Use single quotes, otherwise this expands now rather than when signalled."); - put("SC2065", "This is interpreted as a shell file redirection, not a comparison."); - put("SC2066", "Since you double quoted this, it will not word split, and the loop will only run once."); - put("SC2067", "Missing ';' or + terminating -exec. You can't use |/||/&&, and ';' has to be a separate, quoted argument."); - put("SC2068", "Double quote array expansions to avoid re-splitting elements."); - put("SC2069", "To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify)."); - put("SC2070", "`-n` doesn't work with unquoted arguments. Quote or use ``[[ ]]``."); - put("SC2071", "> is for string comparisons. Use -gt instead."); - put("SC2072", "Decimals are not supported. Either use integers only, or use bc or awk to compare."); - put("SC2074", "Can't use `=~` in `[ ]`. Use `[[..]]` instead."); - put("SC2076", "Don't quote rhs of =~, it'll match literally rather than as a regex."); - put("SC2077", "You need spaces around the comparison operator."); - put("SC2078", "This expression is constant. Did you forget a `$` somewhere?"); - put("SC2079", "(( )) doesn't support decimals. Use bc or awk."); - put("SC2080", "Numbers with leading 0 are considered octal."); - put("SC2081", "`[ .. ]` can't match globs. Use `[[ .. ]]` or grep."); - put("SC2082", "To expand via indirection, use name=\"foo$n\"; echo \"${!name}\"."); - put("SC2084", "Remove '$' or use '_=$((expr))' to avoid executing output."); - put("SC2086", "Double quote to prevent globbing and word splitting."); - put("SC2087", "Quote 'EOF' to make here document expansions happen on the server side rather than on the client."); - put("SC2088", "Tilde does not expand in quotes. Use $HOME."); - put("SC2089", "Quotes/backslashes will be treated literally. Use an array."); - put("SC2090", "Quotes/backslashes in this variable will not be respected."); - put("SC2091", "Remove surrounding $() to avoid executing output."); - put("SC2092", "Remove backticks to avoid executing output."); - put("SC2093", "Remove \"exec \" if script should continue after this command."); - put("SC2094", "SC2094 Make sure not to read and write the same file in the same pipeline."); - put("SC2095", "Add < /dev/null to prevent ssh from swallowing stdin."); - put("SC2096", "On most OS, shebangs can only specify a single parameter."); - put("SC2097", "This assignment is only seen by the forked process."); - put("SC2098", "This expansion will not see the mentioned assignment."); - put("SC2099", "Use `$((..))` for arithmetics, e.g. `i=$((i + 2))`"); - put("SC2100", "Use `$((..))` for arithmetics, e.g. `i=$((i + 2))`"); - put("SC2101", "Named class needs outer [], e.g. [[:digit:]\\]."); - put("SC2102", "Ranges can only match single chars (mentioned due to duplicates)."); - put("SC2103", "Use a ( subshell ) to avoid having to cd back."); - put("SC2104", "In functions, use return instead of break."); - put("SC2105", "`break` is only valid in loops"); - put("SC2106", "SC2106: This only exits the subshell caused by the pipeline."); - put("SC2107", "Instead of [ a && b ], use [ a ] && [ b ]."); - put("SC2108", "In [\\[..]], use && instead of -a."); - put("SC2109", "Instead of [ a || b ], use [ a ] || [ b ]."); - put("SC2110", "In [\\[..]], use || instead of -o."); - put("SC2112", "'function' keyword is non-standard. Delete it."); - put("SC2114", "Warning: deletes a system directory."); - put("SC2115", "Use \"${var:?}\" to ensure this never expands to /* ."); - put("SC2116", "Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'."); - put("SC2117", "To run commands as another user, use su -c or sudo."); - put("SC2119", "Use foo \"$@\" if function's $1 should mean script's $1."); - put("SC2120", "foo references arguments, but none are ever passed."); - put("SC2121", "To assign a variable, use just 'var=value', no 'set ..'."); - put("SC2122", ">= is not a valid operator. Use '! a < b' instead."); - put("SC2123", "PATH is the shell search path. Use another name."); - put("SC2124", "Assigning an array to a string! Assign as array, or use * instead of @ to concatenate."); - put("SC2125", "Brace expansions and globs are literal in assignments. Quote it or use an array."); - put("SC2126", "Consider using grep -c instead of grep|wc."); - put("SC2128", "Expanding an array without an index only gives the first element."); - put("SC2129", "Consider using { cmd1; cmd2; } >> file instead of individual redirects."); - put("SC2130", "-eq is for integer comparisons. Use = instead."); - put("SC2139", "This expands when defined, not when used. Consider escaping."); - put("SC2140", " Word is on the form \"A\"B\"C\" (B indicated). Did you mean \"ABC\" or \"A\\\"B\\\"C\"?"); - put("SC2141", "Did you mean IFS=$'\t' ?"); - put("SC2142", "Aliases can't use positional parameters. Use a function."); - put("SC2143", "Use grep -q instead of comparing output with [ -n .. ]."); - put("SC2144", "-e doesn't work with globs. Use a for loop."); - put("SC2145", "Argument mixes string and array. Use * or separate argument."); - put("SC2146", "This action ignores everything before the -o. Use \\( \\) to group."); - put("SC2147", "Literal tilde in PATH works poorly across programs."); - put("SC2148", "Tips depend on target shell and yours is unknown. Add a shebang."); - put("SC2149", "Remove $/${} for numeric index, or escape it for string."); - put("SC2150", "-exec does not automatically invoke a shell. Use -exec sh -c .. for that."); - put("SC2151", "Only one integer 0-255 can be returned. Use stdout for other data."); - put("SC2152", "Can only return 0-255. Other data should be written to stdout."); - put("SC2153", "Possible Misspelling: MYVARIABLE may not be assigned, but MY_VARIABLE is."); - put("SC2154", "var is referenced but not assigned."); - put("SC2155", "Declare and assign separately to avoid masking return values."); - put("SC2156", "Injecting filenames is fragile and insecure. Use parameters."); - put("SC2157", "Argument to implicit -n is always true due to literal strings."); - put("SC2158", "[ false ] is true. Remove the brackets"); - put("SC2159", "[ 0 ] is true. Use 'false' instead"); - put("SC2160", "Instead of '[ true ]', just use 'true'."); - put("SC2161", "Instead of '[ 1 ]', use 'true'."); - put("SC2162", "read without -r will mangle backslashes"); - put("SC2163", "This does not export 'FOO'. Remove $/${} for that, or use ${var?} to quiet."); - put("SC2164", "Use cd ... || exit in case cd fails."); - put("SC2165", "This nested loop overrides the index variable of its parent."); - put("SC2166", "Prefer [ p ] && [ q ] as [ p -a q ] is not well defined."); - put("SC2167", "This parent loop has its index variable overridden."); - put("SC2168", "'local' is only valid in functions."); - put("SC2169", "In dash, *something* is not supported."); - put("SC2170", "Numerical -eq does not dereference in [..]. Expand or use string operator."); - put("SC2172", "Trapping signals by number is not well defined. Prefer signal names."); - put("SC2173", "SIGKILL/SIGSTOP can not be trapped."); - put("SC2174", "When used with -p, -m only applies to the deepest directory."); - put("SC2175", "Quote this invalid brace expansion since it should be passed literally to eval"); - put("SC2176", "'time' is undefined for pipelines. time single stage or bash -c instead."); - put("SC2177", "'time' is undefined for compound commands, time sh -c instead."); - put("SC2178", "Variable was used as an array but is now assigned a string."); - put("SC2179", "Use array+=(\"item\") to append items to an array."); - put("SC2180", "Bash does not support multidimensional arrays. Use 1D or associative arrays."); - put("SC2181", "Check exit code directly with e.g. 'if mycmd;', not indirectly with $?."); - put("SC2182", "This printf format string has no variables. Other arguments are ignored."); - put("SC2183", "This format string has 2 variables, but is passed 1 arguments."); - put("SC2184", "Quote arguments to unset so they're not glob expanded."); - put("SC2185", "Some finds don't have a default path. Specify '.' explicitly."); - put("SC2186", "tempfile is deprecated. Use mktemp instead."); - put("SC2187", "Ash scripts will be checked as Dash. Add '# shellcheck shell=dash' to silence."); - put("SC2188", "This redirection doesn't have a command. Move to its command (or use 'true' as no-op)."); - put("SC2189", "You can't have | between this redirection and the command it should apply to."); - put("SC2190", "Elements in associative arrays need index, e.g. array=( [index]=value ) ."); - put("SC2191", "The = here is literal. To assign by index, use ( [index]=value ) with no spaces. To keep as literal, quote it."); - put("SC2192", "This array element has no value. Remove spaces after = or use \"\" for empty string."); - put("SC2193", "The arguments to this comparison can never be equal. Make sure your syntax is correct."); - put("SC2194", "This word is constant. Did you forget the $ on a variable?"); - put("SC2195", "This pattern will never match the case statement's word. Double check them."); - put("SC2196", "egrep is non-standard and deprecated. Use grep -E instead."); - put("SC2197", "fgrep is non-standard and deprecated. Use grep -F instead."); - put("SC2198", "Arrays don't work as operands in [ ]. Use a loop (or concatenate with * instead of @)."); - put("SC2199", "Arrays implicitly concatenate in `[[ ]]`. Use a loop (or explicit * instead of @)."); - put("SC2200", "Brace expansions don't work as operands in [ ]. Use a loop."); - put("SC2201", "Brace expansion doesn't happen in `[[ ]]`. Use a loop."); - put("SC2202", "Globs don't work as operands in [ ]. Use a loop."); - put("SC2203", "Globs are ignored in `[[ ]]` except right of =/!=. Use a loop."); - put("SC2204", "(..) is a subshell. Did you mean [ .. ], a test expression?"); - put("SC2205", "(..) is a subshell. Did you mean [ .. ], a test expression?"); - put("SC2206", "Quote to prevent word splitting, or split robustly with mapfile or read -a."); - put("SC2207", "Prefer mapfile or read -a to split command output (or quote to avoid splitting)."); - put("SC2208", "Use `[[ ]]` or quote arguments to -v to avoid glob expansion."); - put("SC2209", "Use var=$(command) to assign output (or quote to assign string)."); - put("SC2210", "This is a file redirection. Was it supposed to be a comparison or fd operation?"); - put("SC2211", "This is a glob used as a command name. Was it supposed to be in ${..}, array, or is it missing quoting?"); - put("SC2212", "Use 'false' instead of empty [/[[ conditionals."); - put("SC2213", "getopts specified -n, but it's not handled by this 'case'."); - put("SC2214", "This case is not specified by getopts."); - put("SC2215", "This flag is used as a command name. Bad line break or missing `[ .. ]`?"); - put("SC2216", "Piping to 'rm', a command that doesn't read stdin. Wrong command or missing xargs?"); - put("SC2217", "Redirecting to 'echo', a command that doesn't read stdin. Bad quoting or missing xargs?"); - put("SC2218", "This function is only defined later. Move the definition up."); - put("SC2219", "Instead of `let expr`, prefer `(( expr ))` ."); - put("SC2220", "Invalid flags are not handled. Add a `*)` case."); - put("SC2221", "This pattern always overrides a later one."); - put("SC2222", "This pattern never matches because of a previous pattern."); - put("SC2223", "This default assignment may cause DoS due to globbing. Quote it."); - put("SC2224", "This mv has no destination. Check the arguments."); - put("SC2225", "This cp has no destination. Check the arguments."); - put("SC2226", "This ln has no destination. Check the arguments, or specify '.' explicitly."); - put("SC2227", "Redirection applies to the find command itself. Rewrite to work per action (or move to end)."); - put("SC2229", "This does not read 'foo'. Remove $/${} for that, or use ${var?} to quiet."); - put("SC2230", "which is non-standard. Use builtin 'command -v' instead."); - put("SC2231", "Quote expansions in this for loop glob to prevent wordsplitting, e.g. \"$dir\"/*.txt ."); - put("SC2232", "Can't use sudo with builtins like cd. Did you want sudo sh -c .. instead?"); - put("SC2233", "Remove superfluous `(..)` around condition."); - put("SC2234", "Remove superfluous `(..)` around test command."); - put("SC2235", "Use `{ ..; }` instead of `(..)` to avoid subshell overhead."); - put("SC2236", "Use `-n` instead of `! -z`."); - put("SC2237", "Use `[ -n .. ]` instead of `! [ -z .. ]`."); - put("SC2238", "Redirecting to/from command name instead of file. Did you want pipes/xargs (or quote to ignore)?"); - put("SC2239", "Ensure the shebang uses the absolute path to the interpreter."); - put("SC2240", "The dot command does not support arguments in sh/dash. Set them as variables."); - put("SC2241", "The exit status can only be one integer 0-255. Use stdout for other data."); - put("SC2242", "Can only exit with status 0-255. Other data should be written to stdout/stderr."); - put("SC2243", "Prefer explicit -n to check for output (or run command without [/[[ to check for success)"); - put("SC2244", "Prefer explicit -n to check non-empty string (or use =/-ne to check boolean/integer)."); - put("SC2245", "-d only applies to the first expansion of this glob. Use a loop to check any/all."); - put("SC2246", "This shebang specifies a directory. Ensure the interpreter is a file."); - put("SC2247", "Flip leading $ and \" if this should be a quoted substitution."); - put("SC2249", "Consider adding a default *) case, even if it just exits with error."); - }}; + static final Map shellCheckCodes = ContainerUtil.stringMap( + "SC1000", "$ is not used specially and should therefore be escaped.", + "SC1001", "This \\o will be a regular 'o' in this context.", + "SC1003", "Want to escape a single quote? echo 'This is how it'\\''s done'.", + "SC1004", "This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.", + "SC1007", "Remove space after = if trying to assign a value (or for empty string, use var='' ... ).", + "SC1008", "This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.", + "SC1009", "The mentioned parser error was in ...", + "SC1010", "Use semicolon or linefeed before 'done' (or quote to make it literal).", + "SC1011", "This apostrophe terminated the single quoted string!", + "SC1012", "`\t` is just literal `t` here. For tab, use \"$(printf '\t')\" instead.", + "SC1014", "Use 'if cmd; then ..' to check exit code, or 'if [ \"$(cmd)\" = .. ]' to check output.", + "SC1015", "This is a unicode double quote. Delete and retype it.", + "SC1016", "This is a Unicode single quote. Delete and retype it.", + "SC1017", "Literal carriage return. Run script through `tr -d '\r'` .", + "SC1018", "This is a unicode non-breaking space. Delete it and retype as space.", + "SC1019", "Expected this to be an argument to the unary condition.", + "SC1020", "You need a space before the if single then \"]\" else \"]]\"", + "SC1026", "If grouping expressions inside [[..]], use ( .. ).", + "SC1028", "In [..] you have to escape \\( \\) or preferably combine [..] expressions.", + "SC1029", "In `[[..]]` you shouldn't escape `(` or `)`.", + "SC1035", "You need a space here", + "SC1036", "`(` is invalid here. Did you forget to escape it?", + "SC1037", "Braces are required for positionals over 9, e.g. ${10}.", + "SC1038", "Shells are space sensitive. Use '< <(cmd)', not '<<(cmd)'.", + "SC1039", "Remove indentation before end token (or use `<<-` and indent with tabs).", + "SC1040", "When using <<-, you can only indent with tabs.", + "SC1041", "Found 'eof' further down, but not on a separate line.", + "SC1042", "Found 'eof' further down, but not on a separate line.", + "SC1044", "Couldn't find end token `EOF' in the here document.", + "SC1045", "It's not 'foo &; bar', just 'foo & bar'.", + "SC1046", "Couldn't find 'fi' for this 'if'.", + "SC1047", "Expected 'fi' matching previously mentioned 'if'.", + "SC1048", "Can't have empty then clauses (use 'true' as a no-op).", + "SC1049", "Did you forget the 'then' for this 'if'?", + "SC1050", "Expected 'then'.", + "SC1051", "Semicolons directly after 'then' are not allowed. Just remove it.", + "SC1052", "Semicolons directly after 'then' are not allowed. Just remove it.", + "SC1053", "Semicolons directly after 'else' are not allowed. Just remove it.", + "SC1054", "You need a space after the '{'.", + "SC1058", "Expected `do`.", + "SC1061", "Couldn't find 'done' for this 'do'.", + "SC1062", "Expected 'done' matching previously mentioned 'do'.", + "SC1064", "Expected a { to open the function definition.", + "SC1065", "Trying to declare parameters? Don't. Use () and refer to params as $1, $2..", + "SC1066", "Don't use $ on the left side of assignments.", + "SC1068", "Don't put spaces around the = in assignments.", + "SC1069", "You need a space before the [.", + "SC1071", "ShellCheck only supports sh/bash/dash/ksh scripts. Sorry!", + "SC1072", "Unexpected ..", + "SC1073", "Couldn't parse this (thing). Fix to allow more checks.", + "SC1075", "Use 'elif' instead of 'else if'.", + "SC1077", "For command expansion, the tick should slant left (` vs ยด).", + "SC1078", "Did you forget to close this double quoted string?", + "SC1079", "This is actually an end quote, but due to next char it looks suspect.", + "SC1081", "Scripts are case sensitive. Use 'if', not 'If'.", + "SC1082", "This file has a UTF-8 BOM. Remove it with: LC_CTYPE=C sed '1s/^...//' < yourscript .", + "SC1083", "This `{`/`}` is literal. Check expression (missing `;/\n?`) or quote it.", + "SC1084", "Use #!, not !#, for the shebang.", + "SC1086", "Don't use $ on the iterator name in for loops.", + "SC1087", "Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).", + "SC1088", "Parsing stopped here. Invalid use of parentheses?", + "SC1089", "Parsing stopped here. Is this keyword correctly matched up?", + "SC1090", "Can't follow non-constant source. Use a directive to specify location.", + "SC1091", "Not following: (error message here)", + "SC1094", "Parsing of sourced file failed. Ignoring it.", + "SC1095", "You need a space or linefeed between the function name and body.", + "SC1097", "Unexpected ==. For assignment, use =. For comparison, use [/[[.", + "SC1098", "Quote/escape special characters when using eval, e.g. eval \"a=(b)\".", + "SC1099", "You need a space before the #.", + "SC1100", "This is a unicode dash. Delete and retype as ASCII minus.", + "SC1101", "Delete trailing spaces after \\ to break line (or use quotes for literal space).", + "SC1102", "Shells disambiguate $(( differently or not at all. If the first $( should start command substitution, add a space after it.", + "SC1104", "Use #!, not just !, for the shebang.", + "SC1105", "Shells disambiguate (( differently or not at all. If the first ( should start a subshell, add a space after it.", + "SC1107", "This directive is unknown. It will be ignored.", + "SC1108", "You need a space before and after the = .", + "SC1109", "This is an unquoted HTML entity. Replace with corresponding character.", + "SC1110", "This is a unicode quote. Delete and retype it (or quote to make literal).", + "SC1111", "This is a unicode quote. Delete and retype it (or ignore/singlequote for literal).", + "SC1112", "This is a unicode quote. Delete and retype it (or ignore/doublequote for literal).", + "SC1113", "Use #!, not just #, for the shebang.", + "SC1114", "Remove leading spaces before the shebang.", + "SC1115", "Remove spaces between # and ! in the shebang.", + "SC1116", "Missing $ on a $((..)) expression? (or use ( ( for arrays).", + "SC1117", "Backslash is literal in \"\n\". Prefer explicit escaping: \"\\n\".", + "SC1118", "Delete whitespace after the here-doc end token.", + "SC1119", "Add a linefeed between end token and terminating ')'.", + "SC1120", "No comments allowed after here-doc token. Comment the next line instead.", + "SC1121", "Add ;/& terminators (and other syntax) on the line with the <<, not here.", + "SC1122", "Nothing allowed after end token. To continue a command, put it on the line with the `<<`.", + "SC1123", "ShellCheck directives are only valid in front of complete compound commands, like `if`, not e.g. individual `elif` branches.", + "SC1124", "ShellCheck directives are only valid in front of complete commands like 'case' statements, not individual case branches.", + "SC1126", "Place shellcheck directives before commands, not after.", + "SC1127", "Was this intended as a comment? Use `#` in sh.", + "SC1128", "The shebang must be on the first line. Delete blanks and move comments.", + "SC1129", "You need a space before the !.", + "SC1130", "You need a space before the :.", + "SC1131", "Use `elif` to start another branch.", + "SC1132", "This `&` terminates the command. Escape it or add space after `&` to silence.", + "SC1133", "Unexpected start of line. If breaking lines, |/||/&& should be at the end of the previous one.", + "SC2001", "SC2001: See if you can use ${variable//search/replace} instead.", + "SC2002", "Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.", + "SC2003", "expr is antiquated. Consider rewriting this using $((..)), ${} or \\[\\[ \\]\\].", + "SC2004", "$/${} is unnecessary on arithmetic variables.", + "SC2005", "Useless `echo`? Instead of `echo $(cmd)`, just use `cmd`", + "SC2006", "Use $(...) notation instead of legacy backticked `` `...` ``.", + "SC2007", "Use $((..)) instead of deprecated $[..]", + "SC2008", "echo doesn't read from stdin, are you sure you should be piping to it?", + "SC2009", "SC2009 Consider using pgrep instead of grepping ps output.", + "SC2010", "Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.", + "SC2012", "Use `find` instead of `ls` to better handle non-alphanumeric filenames.", + "SC2013", "To read lines rather than words, pipe/redirect to a 'while read' loop.", + "SC2014", "This will expand once before find runs, not per file found.", + "SC2015", "Note that A && B || C is not if-then-else. C may run when A is true.", + "SC2016", "Expressions don't expand in single quotes, use double quotes for that.", + "SC2017", "Increase precision by replacing a/b\\*c with a\\*c/b.", + "SC2018", "Use '[:lower:]' to support accents and foreign alphabets.", + "SC2019", "Use '[:upper:]' to support accents and foreign alphabets.", + "SC2020", "tr replaces sets of chars, not words (mentioned due to duplicates).", + "SC2021", "Don't use [] around ranges in tr, it replaces literal square brackets.", + "SC2022", "Note that unlike globs, o* here matches 'ooo' but not 'oscar'", + "SC2024", "`sudo` doesn't affect redirects. Use `..| sudo tee file`", + "SC2025", "Make sure all escape sequences are enclosed in `\\[..\\]` to prevent line wrapping issues", + "SC2026", "This word is outside of quotes. Did you intend to 'nest '\"'single quotes'\"' instead'?", + "SC2027", "The surrounding quotes actually unquote this. Remove or escape them.", + "SC2028", "echo won't expand escape sequences. Consider printf.", + "SC2029", "Note that, unescaped, this expands on the client side.", + "SC2030", "Modification of var is local (to subshell caused by pipeline).", + "SC2031", "var was modified in a subshell. That change might be lost.", + "SC2032", "Use own script or sh -c '..' to run this from su.", + "SC2033", "Shell functions can't be passed to external commands.", + "SC2034", "foo appears unused. Verify it or export it.", + "SC2035", "Use ./\\*glob* or -- \\*glob* so names with dashes won't become options.", + "SC2036", "If you wanted to assign the output of the pipeline, use a=$(b | c) .", + "SC2037", "To assign the output of a command, use var=$(cmd) .", + "SC2038", "Use -print0/-0 or find -exec + to allow for non-alphanumeric filenames.", + "SC2039", "In POSIX sh, *something* is undefined.", + "SC2040", "#!/bin/sh was specified, so ____ is not supported, even when sh is actually bash.", + "SC2041", "This is a literal string. To run as a command, use $(..) instead of '..' .", + "SC2043", "This loop will only ever run once for a constant value. Did you perhaps mean to loop over dir/*, $var or $(cmd)?", + "SC2044", "For loops over find output are fragile. Use find -exec or a while read loop.", + "SC2045", "Iterating over ls output is fragile. Use globs.", + "SC2046", "Quote this to prevent word splitting", + "SC2048", "Use \"$@\" (with quotes) to prevent whitespace problems.", + "SC2049", "=~ is for regex, but this looks like a glob. Use = instead.", + "SC2050", "This expression is constant. Did you forget the `$` on a variable?", + "SC2051", "Bash doesn't support variables in brace range expansions.", + "SC2053", "Quote the rhs of = in [[ ]] to prevent glob matching.", + "SC2054", "Use spaces, not commas, to separate array elements.", + "SC2055", "You probably wanted && here", + "SC2056", "You probably wanted && here", + "SC2057", "Unknown binary operator.", + "SC2058", "Unknown unaryoperator.", + "SC2059", "Don't use variables in the printf format string. Use printf \"..%s..\" \"$foo\".", + "SC2060", "Quote parameters to tr to prevent glob expansion.", + "SC2061", "Quote the parameter to -name so the shell won't interpret it.", + "SC2062", "Quote the grep pattern so the shell won't interpret it.", + "SC2063", "Grep uses regex, but this looks like a glob.", + "SC2064", "Use single quotes, otherwise this expands now rather than when signalled.", + "SC2065", "This is interpreted as a shell file redirection, not a comparison.", + "SC2066", "Since you double quoted this, it will not word split, and the loop will only run once.", + "SC2067", "Missing ';' or + terminating -exec. You can't use |/||/&&, and ';' has to be a separate, quoted argument.", + "SC2068", "Double quote array expansions to avoid re-splitting elements.", + "SC2069", "To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).", + "SC2070", "`-n` doesn't work with unquoted arguments. Quote or use ``[[ ]]``.", + "SC2071", "> is for string comparisons. Use -gt instead.", + "SC2072", "Decimals are not supported. Either use integers only, or use bc or awk to compare.", + "SC2074", "Can't use `=~` in `[ ]`. Use `[[..]]` instead.", + "SC2076", "Don't quote rhs of =~, it'll match literally rather than as a regex.", + "SC2077", "You need spaces around the comparison operator.", + "SC2078", "This expression is constant. Did you forget a `$` somewhere?", + "SC2079", "(( )) doesn't support decimals. Use bc or awk.", + "SC2080", "Numbers with leading 0 are considered octal.", + "SC2081", "`[ .. ]` can't match globs. Use `[[ .. ]]` or grep.", + "SC2082", "To expand via indirection, use name=\"foo$n\"; echo \"${!name}\".", + "SC2084", "Remove '$' or use '_=$((expr))' to avoid executing output.", + "SC2086", "Double quote to prevent globbing and word splitting.", + "SC2087", "Quote 'EOF' to make here document expansions happen on the server side rather than on the client.", + "SC2088", "Tilde does not expand in quotes. Use $HOME.", + "SC2089", "Quotes/backslashes will be treated literally. Use an array.", + "SC2090", "Quotes/backslashes in this variable will not be respected.", + "SC2091", "Remove surrounding $() to avoid executing output.", + "SC2092", "Remove backticks to avoid executing output.", + "SC2093", "Remove \"exec \" if script should continue after this command.", + "SC2094", "SC2094 Make sure not to read and write the same file in the same pipeline.", + "SC2095", "Add < /dev/null to prevent ssh from swallowing stdin.", + "SC2096", "On most OS, shebangs can only specify a single parameter.", + "SC2097", "This assignment is only seen by the forked process.", + "SC2098", "This expansion will not see the mentioned assignment.", + "SC2099", "Use `$((..))` for arithmetics, e.g. `i=$((i + 2))`", + "SC2100", "Use `$((..))` for arithmetics, e.g. `i=$((i + 2))`", + "SC2101", "Named class needs outer [], e.g. [[:digit:]\\].", + "SC2102", "Ranges can only match single chars (mentioned due to duplicates).", + "SC2103", "Use a ( subshell ) to avoid having to cd back.", + "SC2104", "In functions, use return instead of break.", + "SC2105", "`break` is only valid in loops", + "SC2106", "SC2106: This only exits the subshell caused by the pipeline.", + "SC2107", "Instead of [ a && b ], use [ a ] && [ b ].", + "SC2108", "In [\\[..]], use && instead of -a.", + "SC2109", "Instead of [ a || b ], use [ a ] || [ b ].", + "SC2110", "In [\\[..]], use || instead of -o.", + "SC2112", "'function' keyword is non-standard. Delete it.", + "SC2114", "Warning: deletes a system directory.", + "SC2115", "Use \"${var:?}\" to ensure this never expands to /* .", + "SC2116", "Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.", + "SC2117", "To run commands as another user, use su -c or sudo.", + "SC2119", "Use foo \"$@\" if function's $1 should mean script's $1.", + "SC2120", "foo references arguments, but none are ever passed.", + "SC2121", "To assign a variable, use just 'var=value', no 'set ..'.", + "SC2122", ">= is not a valid operator. Use '! a < b' instead.", + "SC2123", "PATH is the shell search path. Use another name.", + "SC2124", "Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.", + "SC2125", "Brace expansions and globs are literal in assignments. Quote it or use an array.", + "SC2126", "Consider using grep -c instead of grep|wc.", + "SC2128", "Expanding an array without an index only gives the first element.", + "SC2129", "Consider using { cmd1; cmd2; } >> file instead of individual redirects.", + "SC2130", "-eq is for integer comparisons. Use = instead.", + "SC2139", "This expands when defined, not when used. Consider escaping.", + "SC2140", " Word is on the form \"A\"B\"C\" (B indicated). Did you mean \"ABC\" or \"A\\\"B\\\"C\"?", + "SC2141", "Did you mean IFS=$'\t' ?", + "SC2142", "Aliases can't use positional parameters. Use a function.", + "SC2143", "Use grep -q instead of comparing output with [ -n .. ].", + "SC2144", "-e doesn't work with globs. Use a for loop.", + "SC2145", "Argument mixes string and array. Use * or separate argument.", + "SC2146", "This action ignores everything before the -o. Use \\( \\) to group.", + "SC2147", "Literal tilde in PATH works poorly across programs.", + "SC2148", "Tips depend on target shell and yours is unknown. Add a shebang.", + "SC2149", "Remove $/${} for numeric index, or escape it for string.", + "SC2150", "-exec does not automatically invoke a shell. Use -exec sh -c .. for that.", + "SC2151", "Only one integer 0-255 can be returned. Use stdout for other data.", + "SC2152", "Can only return 0-255. Other data should be written to stdout.", + "SC2153", "Possible Misspelling: MYVARIABLE may not be assigned, but MY_VARIABLE is.", + "SC2154", "var is referenced but not assigned.", + "SC2155", "Declare and assign separately to avoid masking return values.", + "SC2156", "Injecting filenames is fragile and insecure. Use parameters.", + "SC2157", "Argument to implicit -n is always true due to literal strings.", + "SC2158", "[ false ] is true. Remove the brackets", + "SC2159", "[ 0 ] is true. Use 'false' instead", + "SC2160", "Instead of '[ true ]', just use 'true'.", + "SC2161", "Instead of '[ 1 ]', use 'true'.", + "SC2162", "read without -r will mangle backslashes", + "SC2163", "This does not export 'FOO'. Remove $/${} for that, or use ${var?} to quiet.", + "SC2164", "Use cd ... || exit in case cd fails.", + "SC2165", "This nested loop overrides the index variable of its parent.", + "SC2166", "Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.", + "SC2167", "This parent loop has its index variable overridden.", + "SC2168", "'local' is only valid in functions.", + "SC2169", "In dash, *something* is not supported.", + "SC2170", "Numerical -eq does not dereference in [..]. Expand or use string operator.", + "SC2172", "Trapping signals by number is not well defined. Prefer signal names.", + "SC2173", "SIGKILL/SIGSTOP can not be trapped.", + "SC2174", "When used with -p, -m only applies to the deepest directory.", + "SC2175", "Quote this invalid brace expansion since it should be passed literally to eval", + "SC2176", "'time' is undefined for pipelines. time single stage or bash -c instead.", + "SC2177", "'time' is undefined for compound commands, time sh -c instead.", + "SC2178", "Variable was used as an array but is now assigned a string.", + "SC2179", "Use array+=(\"item\") to append items to an array.", + "SC2180", "Bash does not support multidimensional arrays. Use 1D or associative arrays.", + "SC2181", "Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.", + "SC2182", "This printf format string has no variables. Other arguments are ignored.", + "SC2183", "This format string has 2 variables, but is passed 1 arguments.", + "SC2184", "Quote arguments to unset so they're not glob expanded.", + "SC2185", "Some finds don't have a default path. Specify '.' explicitly.", + "SC2186", "tempfile is deprecated. Use mktemp instead.", + "SC2187", "Ash scripts will be checked as Dash. Add '# shellcheck shell=dash' to silence.", + "SC2188", "This redirection doesn't have a command. Move to its command (or use 'true' as no-op).", + "SC2189", "You can't have | between this redirection and the command it should apply to.", + "SC2190", "Elements in associative arrays need index, e.g. array=( [index]=value ) .", + "SC2191", "The = here is literal. To assign by index, use ( [index]=value ) with no spaces. To keep as literal, quote it.", + "SC2192", "This array element has no value. Remove spaces after = or use \"\" for empty string.", + "SC2193", "The arguments to this comparison can never be equal. Make sure your syntax is correct.", + "SC2194", "This word is constant. Did you forget the $ on a variable?", + "SC2195", "This pattern will never match the case statement's word. Double check them.", + "SC2196", "egrep is non-standard and deprecated. Use grep -E instead.", + "SC2197", "fgrep is non-standard and deprecated. Use grep -F instead.", + "SC2198", "Arrays don't work as operands in [ ]. Use a loop (or concatenate with * instead of @).", + "SC2199", "Arrays implicitly concatenate in `[[ ]]`. Use a loop (or explicit * instead of @).", + "SC2200", "Brace expansions don't work as operands in [ ]. Use a loop.", + "SC2201", "Brace expansion doesn't happen in `[[ ]]`. Use a loop.", + "SC2202", "Globs don't work as operands in [ ]. Use a loop.", + "SC2203", "Globs are ignored in `[[ ]]` except right of =/!=. Use a loop.", + "SC2204", "(..) is a subshell. Did you mean [ .. ], a test expression?", + "SC2205", "(..) is a subshell. Did you mean [ .. ], a test expression?", + "SC2206", "Quote to prevent word splitting, or split robustly with mapfile or read -a.", + "SC2207", "Prefer mapfile or read -a to split command output (or quote to avoid splitting).", + "SC2208", "Use `[[ ]]` or quote arguments to -v to avoid glob expansion.", + "SC2209", "Use var=$(command) to assign output (or quote to assign string).", + "SC2210", "This is a file redirection. Was it supposed to be a comparison or fd operation?", + "SC2211", "This is a glob used as a command name. Was it supposed to be in ${..}, array, or is it missing quoting?", + "SC2212", "Use 'false' instead of empty [/[[ conditionals.", + "SC2213", "getopts specified -n, but it's not handled by this 'case'.", + "SC2214", "This case is not specified by getopts.", + "SC2215", "This flag is used as a command name. Bad line break or missing `[ .. ]`?", + "SC2216", "Piping to 'rm', a command that doesn't read stdin. Wrong command or missing xargs?", + "SC2217", "Redirecting to 'echo', a command that doesn't read stdin. Bad quoting or missing xargs?", + "SC2218", "This function is only defined later. Move the definition up.", + "SC2219", "Instead of `let expr`, prefer `(( expr ))` .", + "SC2220", "Invalid flags are not handled. Add a `*)` case.", + "SC2221", "This pattern always overrides a later one.", + "SC2222", "This pattern never matches because of a previous pattern.", + "SC2223", "This default assignment may cause DoS due to globbing. Quote it.", + "SC2224", "This mv has no destination. Check the arguments.", + "SC2225", "This cp has no destination. Check the arguments.", + "SC2226", "This ln has no destination. Check the arguments, or specify '.' explicitly.", + "SC2227", "Redirection applies to the find command itself. Rewrite to work per action (or move to end).", + "SC2229", "This does not read 'foo'. Remove $/${} for that, or use ${var?} to quiet.", + "SC2230", "which is non-standard. Use builtin 'command -v' instead.", + "SC2231", "Quote expansions in this for loop glob to prevent wordsplitting, e.g. \"$dir\"/*.txt .", + "SC2232", "Can't use sudo with builtins like cd. Did you want sudo sh -c .. instead?", + "SC2233", "Remove superfluous `(..)` around condition.", + "SC2234", "Remove superfluous `(..)` around test command.", + "SC2235", "Use `{ ..; }` instead of `(..)` to avoid subshell overhead.", + "SC2236", "Use `-n` instead of `! -z`.", + "SC2237", "Use `[ -n .. ]` instead of `! [ -z .. ]`.", + "SC2238", "Redirecting to/from command name instead of file. Did you want pipes/xargs (or quote to ignore)?", + "SC2239", "Ensure the shebang uses the absolute path to the interpreter.", + "SC2240", "The dot command does not support arguments in sh/dash. Set them as variables.", + "SC2241", "The exit status can only be one integer 0-255. Use stdout for other data.", + "SC2242", "Can only exit with status 0-255. Other data should be written to stdout/stderr.", + "SC2243", "Prefer explicit -n to check for output (or run command without [/[[ to check for success)", + "SC2244", "Prefer explicit -n to check non-empty string (or use =/-ne to check boolean/integer).", + "SC2245", "-d only applies to the first expansion of this glob. Use a loop to check any/all.", + "SC2246", "This shebang specifies a directory. Ensure the interpreter is a file.", + "SC2247", "Flip leading $ and \" if this should be a quoted substitution.", + "SC2249", "Consider adding a default *) case, even if it just exits with error."); static int calcOffset(CharSequence sequence, int startOffset, int column) { int i = 1; diff --git a/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.form b/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.form index 24477180e882..1996e81d4ea5 100644 --- a/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.form +++ b/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.form @@ -1,75 +1,72 @@
- - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.java b/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.java index 4fa233f6a00c..c23373d77fa0 100644 --- a/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.java +++ b/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckOptionsPanel.java @@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.event.DocumentEvent; -import java.util.Set; +import java.util.List; import java.util.function.BiConsumer; public class ShellcheckOptionsPanel { @@ -33,12 +33,10 @@ public class ShellcheckOptionsPanel { private TextFieldWithBrowseButton myShellcheckSelector; private MultipleCheckboxOptionsPanel myInspectionsCheckboxPanel; private final BiConsumer myInspectionsChangeListener; - private final Set myDisabledInspections; private final Project myProject; - ShellcheckOptionsPanel(Set disabledInspections, BiConsumer inspectionsChangeListener) { + ShellcheckOptionsPanel(List disabledInspections, BiConsumer inspectionsChangeListener) { myInspectionsChangeListener = inspectionsChangeListener; - myDisabledInspections = disabledInspections; myProject = ProjectUtil.guessCurrentProject(getPanel()); myShellcheckSelector.addBrowseFolderListener(BROWSE_SHELLCHECK_TITLE, "", myProject, FileChooserDescriptorFactory.createSingleFileDescriptor()); @@ -55,7 +53,13 @@ public class ShellcheckOptionsPanel { myShellcheckSelector.setText(shellcheckPath); myWarningPanel.setVisible(!ShShellcheckUtil.isValidPath(shellcheckPath)); - ShShellcheckUtil.shellCheckCodes.forEach((key, value) -> myInspectionsCheckboxPanel.addCheckbox(key + " " + value, key)); + disabledInspections.forEach(setting -> { + String value = ShShellcheckUtil.shellCheckCodes.get(setting); + if (value != null) { + myInspectionsCheckboxPanel.addCheckbox(setting + " " + value, setting); + } + }); + myWarningLabel.setIcon(AllIcons.General.Warning); } @@ -71,7 +75,7 @@ public class ShellcheckOptionsPanel { myInspectionsCheckboxPanel = new MultipleCheckboxOptionsPanel(new OptionAccessor() { @Override public boolean getOption(String optionName) { - return myDisabledInspections.contains(optionName); + return true; } @Override diff --git a/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java b/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java index 11b6414500c0..d9689c921adc 100644 --- a/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java +++ b/plugins/sh/src/com/intellij/sh/shellcheck/ShellcheckSetupNotificationProvider.java @@ -40,7 +40,7 @@ public class ShellcheckSetupNotificationProvider extends EditorNotifications.Pro } })); panel.createActionLabel("No, thanks", () -> { - ShSettings.setShellcheckPath(ShSettings.I_DO_MIND); + ShSettings.setShellcheckPath(ShSettings.NOT_AVAILABLE_PATH); EditorNotifications.getInstance(project).updateAllNotifications(); }); return panel; diff --git a/plugins/sh/testData/shellcheck/disableInspection.after.sh b/plugins/sh/testData/shellcheck/disableInspection.after.sh deleted file mode 100644 index 7d4b34d555d4..000000000000 --- a/plugins/sh/testData/shellcheck/disableInspection.after.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -param1=5 -param2=10 - -echo "$param2" $(pwd) \ No newline at end of file diff --git a/plugins/sh/testData/shellcheck/disableInspection.sh b/plugins/sh/testData/shellcheck/disableInspection.sh deleted file mode 100644 index 7d4b34d555d4..000000000000 --- a/plugins/sh/testData/shellcheck/disableInspection.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -param1=5 -param2=10 - -echo "$param2" $(pwd) \ No newline at end of file diff --git a/plugins/sh/testData/shellcheck/quickFix.after.sh b/plugins/sh/testData/shellcheck/quickFix.after.sh deleted file mode 100644 index f40c4217d237..000000000000 --- a/plugins/sh/testData/shellcheck/quickFix.after.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -version=$1 -folder=test-${version} -rm -rf "${folder}" \ No newline at end of file diff --git a/plugins/sh/testData/shellcheck/quickFix.sh b/plugins/sh/testData/shellcheck/quickFix.sh deleted file mode 100644 index d783ee1f9069..000000000000 --- a/plugins/sh/testData/shellcheck/quickFix.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -version=$1 -folder=test-${version} -rm -rf ${folder} \ No newline at end of file diff --git a/plugins/sh/testData/shellcheck/suppressInspection.after.sh b/plugins/sh/testData/shellcheck/suppressInspection.after.sh deleted file mode 100644 index 744dd574a781..000000000000 --- a/plugins/sh/testData/shellcheck/suppressInspection.after.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# shellcheck disable=SC2034 -param1=5 -param2=10 - -# shellcheck disable=SC2046 -echo "$param2" $(pwd) \ No newline at end of file diff --git a/plugins/sh/testData/shellcheck/suppressInspection.sh b/plugins/sh/testData/shellcheck/suppressInspection.sh deleted file mode 100644 index 7d4b34d555d4..000000000000 --- a/plugins/sh/testData/shellcheck/suppressInspection.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -param1=5 -param2=10 - -echo "$param2" $(pwd) \ No newline at end of file diff --git a/plugins/sh/testData/shellcheck/suppressSameInspection.after.sh b/plugins/sh/testData/shellcheck/suppressSameInspection.after.sh deleted file mode 100644 index 9855352bf4f9..000000000000 --- a/plugins/sh/testData/shellcheck/suppressSameInspection.after.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# shellcheck disable=SC2034 -param1=1 -param2=2 -param3=3 - -# shellcheck disable=SC2046 -echo "$param3" $(pwd) \ No newline at end of file diff --git a/plugins/sh/testData/shellcheck/suppressSameInspection.sh b/plugins/sh/testData/shellcheck/suppressSameInspection.sh deleted file mode 100644 index 14b652e06d7d..000000000000 --- a/plugins/sh/testData/shellcheck/suppressSameInspection.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -param1=1 -param2=2 -param3=3 - -echo "$param3" $(pwd) \ No newline at end of file diff --git a/plugins/sh/tests/com/intellij/sh/ShTestSuite.java b/plugins/sh/tests/com/intellij/sh/ShTestSuite.java deleted file mode 100644 index 6ea5eec05a10..000000000000 --- a/plugins/sh/tests/com/intellij/sh/ShTestSuite.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.sh; - -import com.intellij.sh.completion.ShCompletionTest; -import com.intellij.sh.completion.ShFileCompletionTest; -import com.intellij.sh.completion.ShKeywordCompletionTest; -import com.intellij.sh.editing.ShTypingTest; -import com.intellij.sh.formatter.ShLineIndentProviderTest; -import com.intellij.sh.lexer.ShFileLexerTest; -import com.intellij.sh.lexer.ShOldLexerVersion3Test; -import com.intellij.sh.lexer.ShOldLexerVersion4Test; -import com.intellij.sh.oldParser.ShOldParserTest; -import com.intellij.sh.parser.ShParserTest; -import com.intellij.sh.parser.ShShebangParserUtilTest; -import com.intellij.sh.rename.ShRenameTest; -import com.intellij.sh.shellcheck.ShShellcheckInspectionTest; -import com.intellij.sh.shellcheck.ShShellcheckTestSetup; -import com.intellij.sh.template.ShArrayLiveTemplateTest; -import com.intellij.sh.template.ShLiveTemplateTest; -import junit.framework.Test; -import junit.framework.TestSuite; - -public class ShTestSuite { - - public static Test suite() { - TestSuite testSuite = new TestSuite("All Shell Script tests"); - testSuite.addTest(LexerSuite.suite()); - testSuite.addTest(ParserSuite.suite()); - testSuite.addTest(CompletionAndTemplateSuite.suite()); - testSuite.addTest(InspectionsSuite.suite()); - testSuite.addTest(OthersSuite.suite()); - return testSuite; - } - - public static class LexerSuite { - public static Test suite() { - TestSuite suite = new TestSuite("Lexer"); - suite.addTestSuite(ShFileLexerTest.class); - suite.addTestSuite(ShOldLexerVersion3Test.class); - suite.addTestSuite(ShOldLexerVersion4Test.class); - return suite; - } - } - - public static class ParserSuite { - public static Test suite() { - TestSuite suite = new TestSuite("Parser"); - suite.addTestSuite(ShParserTest.class); - suite.addTestSuite(ShOldParserTest.class); - suite.addTestSuite(ShShebangParserUtilTest.class); - return suite; - } - } - - public static class CompletionAndTemplateSuite { - public static Test suite() { - TestSuite suite = new TestSuite("Completion & Template"); - suite.addTestSuite(ShCompletionTest.class); - suite.addTestSuite(ShFileCompletionTest.class); - suite.addTestSuite(ShKeywordCompletionTest.class); - suite.addTestSuite(ShArrayLiveTemplateTest.class); - suite.addTestSuite(ShLiveTemplateTest.class); - return suite; - } - } - - public static class InspectionsSuite { - public static Test suite() { - return new ShShellcheckTestSetup(new TestSuite(ShShellcheckInspectionTest.class, "Inspections")); - } - } - - public static class OthersSuite { - public static Test suite() { - TestSuite suite = new TestSuite("Others"); - suite.addTestSuite(ShRenameTest.class); - suite.addTestSuite(ShTypingTest.class); - suite.addTestSuite(ShLineIndentProviderTest.class); - return suite; - } - } - - -} diff --git a/plugins/sh/tests/com/intellij/sh/lexer/ShHighlightingLexerTest.java b/plugins/sh/tests/com/intellij/sh/lexer/ShHighlightingLexerTest.java new file mode 100644 index 000000000000..5003c62a2be1 --- /dev/null +++ b/plugins/sh/tests/com/intellij/sh/lexer/ShHighlightingLexerTest.java @@ -0,0 +1,15 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.sh.lexer; + +import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; + +public class ShHighlightingLexerTest extends LightCodeInsightFixtureTestCase { + public void testLexerHighlighting() { + myFixture.configureByText("a.sh", + "for (( i=0; i<1; i++ )) do\n" + + " echo 1\n" + + "done"); + + myFixture.checkHighlighting(); + } +} diff --git a/plugins/sh/tests/com/intellij/sh/parser/ShShebangParserUtilTest.java b/plugins/sh/tests/com/intellij/sh/parser/ShShebangParserUtilTest.java index 141d6b302280..19bba65eec41 100644 --- a/plugins/sh/tests/com/intellij/sh/parser/ShShebangParserUtilTest.java +++ b/plugins/sh/tests/com/intellij/sh/parser/ShShebangParserUtilTest.java @@ -1,15 +1,20 @@ // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.sh.parser; -import junit.framework.TestCase; +import org.junit.Test; -public class ShShebangParserUtilTest extends TestCase { - public void testInvalidShebang() { +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class ShShebangParserUtilTest { + @Test + public void invalidShebangTest() { assertNull(ShShebangParserUtil.getInterpreter(null)); assertNull(ShShebangParserUtil.getInterpreter("/usr/bin")); } - public void testShShebangTest() { + @Test + public void shShebangTest() { assertEquals("sh", ShShebangParserUtil.getInterpreter("#!/bin/sh")); assertEquals("sh", ShShebangParserUtil.getInterpreter("#! /bin/sh ")); assertEquals("sh", ShShebangParserUtil.getInterpreter("#!/bin/sh -x")); @@ -17,16 +22,19 @@ public class ShShebangParserUtilTest extends TestCase { assertEquals("sh", ShShebangParserUtil.getInterpreter("#!C:/AppData/Git/usr/bin/sh.exe")); } - public void testEnvShebangTest() { + @Test + public void envShebangTest() { assertEquals("sh", ShShebangParserUtil.getInterpreter("#!/usr/bin/env sh\n")); assertEquals("sh", ShShebangParserUtil.getInterpreter("#! /usr/bin/env sh \n")); } - public void testBashShebangTest() { + @Test + public void bashShebangTest() { assertEquals("sh", ShShebangParserUtil.getInterpreter("#!/bin/sh -eu \n")); } - public void testAwkShebangTest() { + @Test + public void awkShebangTest() { assertEquals("awk", ShShebangParserUtil.getInterpreter("#!/usr/bin/awk -f\n# ")); } } \ No newline at end of file diff --git a/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckInspectionTest.java b/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckInspectionTest.java deleted file mode 100644 index 53169dadd703..000000000000 --- a/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckInspectionTest.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.sh.shellcheck; - -import com.intellij.codeInsight.daemon.impl.HighlightInfo; -import com.intellij.codeInsight.intention.IntentionAction; -import com.intellij.codeInspection.ex.InspectionProfileImpl; -import com.intellij.lang.annotation.HighlightSeverity; -import com.intellij.openapi.application.PluginPathManager; -import com.intellij.openapi.editor.CaretModel; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.TextRange; -import com.intellij.sh.shellcheck.intention.DisableInspectionIntention; -import com.intellij.sh.shellcheck.intention.SuppressInspectionIntention; -import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.List; - -public class ShShellcheckInspectionTest extends LightCodeInsightFixtureTestCase { - @Override - public void setUp() throws Exception { - super.setUp(); - InspectionProfileImpl.INIT_INSPECTIONS = true; - ShShellcheckTestUtil.downloadShellcheck(); - } - - @Override - protected void tearDown() throws Exception { - InspectionProfileImpl.INIT_INSPECTIONS = false; - super.tearDown(); - } - - @NotNull - @Override - protected String getTestDataPath() { - return PluginPathManager.getPluginHomePath("sh") + "/testData/shellcheck/"; - } - - public void testSuppressInspection() { - doTest(SuppressInspectionIntention.class); - } - - public void testSuppressSameInspection() { - doTest(SuppressInspectionIntention.class); - } - - public void testQuickFix() { - doTest(QuickFixIntention.class); - } - - public void testDisableInspection() { - configFile(); - ShShellcheckInspection inspection = ShShellcheckInspection.findShShellcheckInspection(myFixture.getFile()); - assertEmpty(inspection.getDisabledInspections()); - applyIntentions(DisableInspectionIntention.class); - checkResult(); - - inspection = ShShellcheckInspection.findShShellcheckInspection(myFixture.getFile()); - assertNotEmpty(inspection.getDisabledInspections()); - assertSameElements(inspection.getDisabledInspections(), Arrays.asList("SC2034", "SC2046")); - } - - private void doTest(Class intentionType) { - configFile(); - applyIntentions(intentionType); - checkResult(); - } - - private void configFile() { - myFixture.enableInspections(new ShShellcheckInspection()); - myFixture.configureByFile(getTestName(true) + ".sh"); - } - - private void checkResult() { - myFixture.checkHighlighting(true, false, true); - myFixture.checkResultByFile(getTestName(true) + ".after.sh"); - } - - private void applyIntentions(Class intentionType) { - CaretModel caretModel = myFixture.getEditor().getCaretModel(); - List inspections = myFixture.doHighlighting(HighlightSeverity.WEAK_WARNING); - while (!inspections.isEmpty()) { - List> ranges = inspections.get(0).quickFixActionRanges; - if (ranges != null) { - ranges.stream() - .filter(pair -> intentionType.isInstance(pair.getFirst().getAction())) - .forEach(pair -> { - caretModel.moveToOffset(pair.getSecond().getStartOffset()); - myFixture.launchAction(pair.getFirst().getAction()); - }); - } - inspections = myFixture.doHighlighting(HighlightSeverity.WARNING); - } - } -} \ No newline at end of file diff --git a/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestSetup.java b/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestSetup.java deleted file mode 100644 index ff850db8d34a..000000000000 --- a/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestSetup.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.sh.shellcheck; - -import com.intellij.openapi.util.SystemInfoRt; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.testFramework.UsefulTestCase; -import junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestResult; - -import java.io.File; - -public class ShShellcheckTestSetup extends TestSetup { - public ShShellcheckTestSetup(Test test) { - super(test); - } - - @Override - public void basicRun(TestResult result) { - if (!SystemInfoRt.isMac && !SystemInfoRt.isLinux) return; // "Tests shouldn't run on Windows OS" - super.basicRun(result); - } - - @Override - protected void tearDown() { - if (!UsefulTestCase.IS_UNDER_TEAMCITY) return; - - File testDir = new File(ShShellcheckTestUtil.getShellcheckTestDir()); - if (!testDir.exists()) return; - - FileUtil.delete(testDir); - } -} diff --git a/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestUtil.java b/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestUtil.java deleted file mode 100644 index 7936008b270b..000000000000 --- a/plugins/sh/tests/com/intellij/sh/shellcheck/ShShellcheckTestUtil.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.sh.shellcheck; - -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.SystemInfoRt; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.io.FileUtilRt; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.sh.ShLanguage; -import com.intellij.sh.settings.ShSettings; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.download.DownloadableFileDescription; -import com.intellij.util.download.DownloadableFileService; -import com.intellij.util.download.FileDownloader; -import org.jetbrains.annotations.NotNull; - -import java.io.File; -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import static com.intellij.sh.shellcheck.ShShellcheckUtil.*; -import static com.intellij.testFramework.UsefulTestCase.IS_UNDER_TEAMCITY; - -class ShShellcheckTestUtil { - protected static final Logger LOG = Logger.getInstance(ShShellcheckTestUtil.class); - - private static final String CACHE_SHELLCHECK_URL = "https://cache-redirector.jetbrains.com/jetbrains.bintray.com/" + - "intellij-third-party-dependencies/" + - "org/jetbrains/intellij/deps/shellcheck/"; - - static void downloadShellcheck() { - String downloadPath = getShellcheckTestDir(); - File directory = new File(downloadPath); - if (!directory.exists()) { - //noinspection ResultOfMethodCallIgnored - directory.mkdirs(); - } - - File shellcheck = new File(downloadPath + File.separator + SHELLCHECK); - if (shellcheck.exists()) { - try { - String path = ShSettings.getShellcheckPath(); - String shellcheckPath = shellcheck.getCanonicalPath(); - if (StringUtil.isNotEmpty(path) && path.equals(shellcheckPath)) { - LOG.debug("Shellcheck already downloaded"); - } - else { - ShSettings.setShellcheckPath(shellcheckPath); - } - return; - } - catch (IOException e) { - LOG.debug("Can't evaluate shellcheck path", e); - return; - } - } - - String downloadName = SHELLCHECK + SHELLCHECK_ARCHIVE_EXTENSION; - DownloadableFileService service = DownloadableFileService.getInstance(); - DownloadableFileDescription description = service.createFileDescription(getShellcheckDistributionLink(), downloadName); - FileDownloader downloader = service.createDownloader(Collections.singletonList(description), downloadName); - - try { - List> pairs = downloader.download(new File(downloadPath)); - Pair first = ContainerUtil.getFirstItem(pairs); - File file = first != null ? first.first : null; - if (file != null) { - String path = decompressShellcheck(file.getCanonicalPath(), directory); - if (StringUtil.isNotEmpty(path)) { - FileUtilRt.setExecutableAttribute(path, true); - ShSettings.setShellcheckPath(path); - } - } - } - catch (IOException e) { - LOG.warn("Can't download shellcheck", e); - } - } - - private static String getShellcheckDistributionLink() { - String platform = SystemInfoRt.isMac ? "mac" : "linux"; - String shellcheckUrl = IS_UNDER_TEAMCITY ? CACHE_SHELLCHECK_URL : SHELLCHECK_URL; - return shellcheckUrl + SHELLCHECK_VERSION + "/" + platform + SHELLCHECK_ARCHIVE_EXTENSION; - } - - @NotNull - static String getShellcheckTestDir() { - return IS_UNDER_TEAMCITY ? - FileUtil.getTempDirectory() + File.separator + ShLanguage.INSTANCE.getID() : - PathManager.getTempPath() + File.separator + "plugins" + File.separator + ShLanguage.INSTANCE.getID(); - } -} diff --git a/python/intellij.python.pydev.iml b/python/intellij.python.pydev.iml index 1abab69050cd..a701db3025f2 100644 --- a/python/intellij.python.pydev.iml +++ b/python/intellij.python.pydev.iml @@ -13,6 +13,5 @@ - \ No newline at end of file diff --git a/python/psi-api/intellij.python.psi.iml b/python/psi-api/intellij.python.psi.iml index 1bc4e4132bc3..55b34ece4ab2 100644 --- a/python/psi-api/intellij.python.psi.iml +++ b/python/psi-api/intellij.python.psi.iml @@ -12,6 +12,5 @@ - \ No newline at end of file diff --git a/spellchecker/src/com/intellij/spellchecker/BaseSuggestionProvider.java b/spellchecker/src/com/intellij/spellchecker/BaseSuggestionProvider.java index 1edf7a41aacf..83d70ff37d19 100644 --- a/spellchecker/src/com/intellij/spellchecker/BaseSuggestionProvider.java +++ b/spellchecker/src/com/intellij/spellchecker/BaseSuggestionProvider.java @@ -1,8 +1,22 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.spellchecker; +import com.intellij.psi.codeStyle.NameUtil; import com.intellij.spellchecker.engine.SuggestionProvider; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -21,7 +35,7 @@ public class BaseSuggestionProvider implements SuggestionProvider { @NotNull public List getSuggestions(@NotNull String text) { - String[] words = NameUtilCore.nameToWords(text); + String[] words = NameUtil.nameToWords(text); int index = 0; List[] res = new List[words.length]; diff --git a/xml/dom-openapi/intellij.xml.dom.iml b/xml/dom-openapi/intellij.xml.dom.iml index 5cbc5b2c2667..197845d52965 100644 --- a/xml/dom-openapi/intellij.xml.dom.iml +++ b/xml/dom-openapi/intellij.xml.dom.iml @@ -13,7 +13,6 @@ - diff --git a/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java b/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java index e435a93c608a..0aff0deb0628 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java @@ -1,8 +1,22 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.xml; +import com.intellij.psi.codeStyle.NameUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.NotNull; /** @@ -15,7 +29,7 @@ public class HyphenNameStrategy extends DomNameStrategy { @NotNull @Override public String convertName(@NotNull String propertyName) { - final String[] words = NameUtilCore.nameToWords(propertyName); + final String[] words = NameUtil.nameToWords(propertyName); for (int i = 0; i < words.length; i++) { words[i] = StringUtil.decapitalize(words[i]); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java b/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java index ef4670b9b896..98c4088e144e 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java @@ -1,9 +1,23 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.xml; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.codeStyle.NameUtil; import com.intellij.util.Function; -import com.intellij.util.text.NameUtilCore; import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -24,6 +38,6 @@ public class JavaNameStrategy extends DomNameStrategy { @Override public final String splitIntoWords(final String tagName) { - return StringUtil.join(Arrays.asList(NameUtilCore.nameToWords(tagName)), DECAPITALIZE_FUNCTION, " "); + return StringUtil.join(Arrays.asList(NameUtil.nameToWords(tagName)), DECAPITALIZE_FUNCTION, " "); } } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java index 475b542670bc..14a638c27291 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java @@ -1,12 +1,26 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.xml.actions.generate; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiFile; +import com.intellij.psi.codeStyle.NameUtil; import com.intellij.psi.xml.XmlTag; -import com.intellij.util.text.NameUtilCore; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.DomElementNavigationProvider; import org.jetbrains.annotations.NotNull; @@ -92,7 +106,7 @@ public abstract class AbstractDomGenerateProvider extends } protected static String getDescription(final Class aClass) { - return StringUtil.join(Arrays.asList(NameUtilCore.nameToWords(aClass.getSimpleName())), " "); + return StringUtil.join(Arrays.asList(NameUtil.nameToWords(aClass.getSimpleName())), " "); } @Nullable diff --git a/xml/openapi/intellij.xml.iml b/xml/openapi/intellij.xml.iml index 96c0de894d49..102327f627b3 100644 --- a/xml/openapi/intellij.xml.iml +++ b/xml/openapi/intellij.xml.iml @@ -12,7 +12,6 @@ - diff --git a/xml/xml-analysis-impl/intellij.xml.analysis.impl.iml b/xml/xml-analysis-impl/intellij.xml.analysis.impl.iml index f5db4082977e..16a4b3c91c25 100644 --- a/xml/xml-analysis-impl/intellij.xml.analysis.impl.iml +++ b/xml/xml-analysis-impl/intellij.xml.analysis.impl.iml @@ -13,6 +13,5 @@ - \ No newline at end of file diff --git a/xml/xml-psi-impl/intellij.xml.psi.impl.iml b/xml/xml-psi-impl/intellij.xml.psi.impl.iml index 5458e098d55d..4d80f8223041 100644 --- a/xml/xml-psi-impl/intellij.xml.psi.impl.iml +++ b/xml/xml-psi-impl/intellij.xml.psi.impl.iml @@ -21,6 +21,5 @@ - \ No newline at end of file diff --git a/xml/xml-structure-view-impl/intellij.xml.structureView.impl.iml b/xml/xml-structure-view-impl/intellij.xml.structureView.impl.iml index 57a3d6cc3067..091c3daa7e61 100644 --- a/xml/xml-structure-view-impl/intellij.xml.structureView.impl.iml +++ b/xml/xml-structure-view-impl/intellij.xml.structureView.impl.iml @@ -11,6 +11,5 @@ - \ No newline at end of file