summaryrefslogtreecommitdiff
path: root/platform/util
diff options
context:
space:
mode:
Diffstat (limited to 'platform/util')
-rw-r--r--platform/util/resources/misc/registry.properties408
-rw-r--r--platform/util/src/com/intellij/icons/AllIcons.java3
-rw-r--r--platform/util/src/com/intellij/openapi/ui/Divider.java34
-rw-r--r--platform/util/src/com/intellij/openapi/ui/Splitter.java10
-rw-r--r--platform/util/src/com/intellij/openapi/util/io/FileUtil.java9
-rw-r--r--platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java2
-rw-r--r--platform/util/src/com/intellij/openapi/util/text/StringUtil.java73
-rw-r--r--platform/util/src/com/intellij/ui/JBColor.java120
-rw-r--r--platform/util/src/com/intellij/util/EventDispatcher.java8
-rw-r--r--platform/util/src/com/intellij/util/PatternUtil.java46
-rw-r--r--platform/util/src/com/intellij/util/ReflectionUtil.java20
-rw-r--r--platform/util/src/com/intellij/util/Restarter.java11
-rw-r--r--platform/util/src/com/intellij/util/containers/ContainerUtil.java1
-rw-r--r--platform/util/src/com/intellij/util/containers/LongStack.java75
-rw-r--r--platform/util/src/com/intellij/util/diff/DiffTree.java8
-rw-r--r--platform/util/src/com/intellij/util/io/LongInlineKeyDescriptor.java50
-rw-r--r--platform/util/src/com/intellij/util/text/StringSearcher.java3
-rw-r--r--platform/util/src/com/intellij/util/ui/UIUtil.java8
-rw-r--r--platform/util/src/com/intellij/util/xmlb/XmlSerializerImpl.java13
-rw-r--r--platform/util/testSrc/com/intellij/util/text/StringUtilTest.java19
-rw-r--r--platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java16
-rw-r--r--platform/util/util.iml1
22 files changed, 858 insertions, 80 deletions
diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties
new file mode 100644
index 000000000000..bbda04a2461a
--- /dev/null
+++ b/platform/util/resources/misc/registry.properties
@@ -0,0 +1,408 @@
+localHistory.daysToKeep=5
+localHistory.daysToKeep.description=Specify how many working days changes should be remembered.\n\
+ WARNING: Do not use local history as main version control since it may become corrupted if the IDE hangs.
+undo.globalUndoLimit=10
+undo.documentUndoLimit=100
+
+actionSystem.fixLostTyping=true
+actionSystem.fixLostTyping.description=Redispatch events, lost between actions and dialog show/close.
+actionSystem.fixStickyFocusedWindows=true
+actionSystem.fixNullFocusedComponent=true
+actionSystem.noDefaultComponent=true
+actionSystem.commandProcessingTimeout=30000
+actionSystem.commandProcessingTimeout.description=Timeout after which currently processed command is forcibly cancelled.
+actionSystem.typeAheadTimeBeforeDialog=2000
+actionSystem.typeAheadTimeBeforeDialog.description=If dialog shown as a result of some typing, all key types withing this time\
+ will be re-dispatched after dialog is closed.
+actionSystem.typeAheadTimeAfterPopupAction=500
+actionSystem.playback.delay=20
+actionSystem.playback.delay.description=Delay between events generated by the playback runner.
+actionSystem.playback.useDirectActionCall=true
+actionSystem.playback.useTypingTargets=true
+actionSystem.focusIdleTimeout=20
+actionSystem.mac.screenMenuNotUpdatedFix=false
+actionSystem.keyGestures.enabled=false
+actionSystem.keyGestureDblClickTime=650
+actionSystem.suspendFocusTransferIfApplicationInactive=true
+actionSystem.xWindow.remove.focus.from.nonFocusable.popups=true
+actionSystem.xWindow.remove.focus.from.nonFocusable.popups.delay=50
+actionSystem.noContextComponentWhileFocusTransfer=true
+actionSystem.secondKeystrokeTimeout=2000
+actionSystem.secondKeystrokeAutoPopupEnabled=false
+actionSystem.secondKeystrokePopupTimeout=500
+actionSystem.keyGestureHoldTime=400
+actionSystem.autoSelectTimeout=1000
+actionSystem.quickAccessEnabled=false
+actionSystem.quickAccessModifiers=
+actionSystem.quickAccessShowSpotsTime=1500
+actionSystem.win.suppressAlt=true
+actionSystem.win.suppressAlt.new=true
+actionSystem.mouseGesturesEnabled=true
+actionSystem.assertFocusAccessFromEdt=true
+actionSystem.enableAbbreviations=true
+
+ide.firstStartup=true
+ide.debugMode=false
+ide.debugMode.description=Record additional information to make bug reports more informative.
+ide.debug.minProgressTime=0
+ide.forcedShowTooltip=alt
+ide.forcedShowTooltip.description=Shortcut for forced show tooltip.
+ide.popup.dropShadow=false
+ide.consumeKnownToolkitBugs=true
+ide.highlight.match.in.selected.only=true
+ide.lazyIconLoading=true
+ide.checkDuplicateMnemonics=false
+ide.checkDuplicateMnemonics.description=Check for duplicate mnemonics.
+ide.dnd.textHints=false
+ide.max.recent.projects=25
+
+ide.hide.excluded.files=true
+ide.hide.excluded.files.restartRequired=true
+ide.hide.excluded.files.description=Do not show excluded files in Project View and exclude them from VCS
+
+idea.fix.mac.env=true
+idea.fix.mac.env.restartRequired=true
+idea.fix.mac.env.description=On Mac, use shell environment for external processes.
+
+ide.x11.override.wm=true
+
+ide.appIcon.progress=true
+ide.appIcon.badge=true
+ide.appIcon.requestAttention=true
+
+ide.windowSystem.hScrollChars=5
+ide.windowSystem.vScrollChars=5
+ide.windowSystem.focusAppOnStartup=true
+ide.windowSystem.autoShowProcessPopup=false
+ide.windowSystem.showListItemsPopup=true
+ide.windowSystem.asyncSplitters=true
+ide.windowSystem.showTooWindowButtonsSwitcher=true
+
+ide.help.fxbrowser=false
+
+passwordSafe.masterPassword.ttl=60
+passwordSafe.memorySafe.ttl=-1
+
+ide.tree.yieldingUiUpdate=true
+ide.tree.showBusyIndicator=true
+ide.tree.waitForReadyTimeout=250
+ide.tree.clearOnHideTime=120000
+ide.tree.autoscrollToVCenter=true
+ide.tree.ensureSelectionOnFocusGained=true
+ide.tree.autoExpandMaxDepth=5
+ide.tree.expandRecursionDepth=50
+ide.tree.checkStructure=false
+ide.tree.uiLockAttempt=250
+ide.tree.deferred.icon.invalidates.cache=true
+
+ide.splitter.mouseZone=6
+ide.smart.horizontal.scrolling=true
+
+ide.tooltip.callout=true
+ide.tooltip.animationCycle=150
+ide.tooltip.initialDelay=1200
+ide.tooltip.initialDelay.highlighter=150
+ide.tooltip.reshowDelay=500
+ide.tooltip.dismissDelay=4000
+ide.tooltip.initialReshowDelay=300
+ide.tooltip.autoDismissDeadZone=300
+ide.balloon.shadowEnabled=true
+ide.balloon.shadow.size=15
+ide.expansion.hints.enabled=true
+ide.register.bundled.fonts=true
+ide.register.bundled.fonts.description=Disables automatic registration of bundled fonts: SourceCodePro, Inconsolata
+
+editor.balloonHints=true
+editor.mouseSelectionStateResetTimeout=1000
+editor.mouseSelectionStateResetDeadZone=4
+editor.use.new.tabs=true
+editor.use.scrollable.tabs=true
+editor.smarterSelectionQuoting=true
+editor.skip.copy.and.cut.for.empty.selection=false
+editor.distraction.free.mode=false
+
+editor.add.carets.on.double.control.arrows=true
+
+ide.showIndexRebuildMessage=false
+
+ide.tabbedPane.bufferedPaint=true
+ide.tabbedPane.dragOutMultiplier=1.2
+
+ide.mac.file.chooser.show.hidden.files=false
+ide.mac.file.chooser.native=true
+ide.mac.message.dialogs.as.sheets=true
+skip.untitled.windows.for.mac.messages=false
+skip.untitled.windows.for.mac.messages.description=Temporary key to test a fix for MacMessages
+ide.mac.mountain.lion.notifications.enabled=true
+ide.mac.inplaceDialogMnemonicsFix=false
+ide.mac.fix.dialog.showing=false
+ide.mac.hide.cursor.when.typing=true
+ide.mac.show.native.help=true
+ide.mac.useNativeClipboard=false
+ide.mac.boldEditorTabs=false
+ide.mac.disableMacScrollbars=false
+ide.mac.disableMacScrollbars.restartRequired=true
+ide.mac.disableMacScrollbars.description=Disables OS X overlay scrollbars
+ide.perProjectModality=false
+ide.perProjectModality.description=New modality approach. All dialogs are DOCUMENT_MODAL expect ide-wide dialogs
+
+ide.mac.retina.disableDrawingFix=false
+
+ide.new.preferences=false
+ide.new.license.dialog=true
+
+debugger.valueTooltipAutoShow=true
+debugger.valueTooltipAutoShow.description=Auto show tooltip on mouse over.
+debugger.mayBringFrameToFrontOnBreakpoint=true
+debugger.breakpoint.message.full.trace=false
+debugger.breakpoint.message.full.trace.description='Log message to console' breakpoint action will out full stacktrace\
+ for the thread that hit the breakpoint.
+debugger.batch.evaluation=false
+
+analyze.exceptions.on.the.fly=false
+analyze.exceptions.on.the.fly.description=Automatically analyze clipboard on frame activation,\
+ and if there is a stacktrace calls Analyze Stacktrace.
+
+compiler.perform.outputs.refresh.on.start=false
+compiler.perform.outputs.refresh.on.start.description=Whether to perform initial FS refresh before compilation starts.\
+ Need this to detect external changes to output dirs.
+compiler.max.static.constants.searches=3000
+compiler.max.static.constants.searches.description=If the number of changed compile time constants exceeds this value,\
+ make will start full-project rebuild
+
+compiler.process.jdk=
+compiler.process.jdk.description=Path to a JDK home. Force build process to be run using the JDK specified. It is assumed that the jdk is at least of version 1.6.
+
+compiler.process.32bit.vm.on.mac=true
+compiler.process.32bit.vm.on.mac.description=Force -d32 VM option on Mac (recommended for faster startup and lower memory footprint).
+
+compiler.process.use.memory.temp.cache=true
+compiler.process.use.memory.temp.cache.description=Store temporary data in memory for faster compilation;\
+ requires larger heap size for the build process. If parallel build is enabled, the option is ignored and temp data is always stored in memory.
+
+compiler.process.use.external.javac=false
+compiler.process.use.external.javac.description=Run javac compiler in a separate process (allows to run build process with smaller heap size).
+
+compiler.process.debug.port=-1
+
+compiler.automake.trigger.delay=300
+compiler.automake.trigger.delay.description=Delay in milliseconds before triggering auto-make in response to file system events
+
+compiler.automake.force.fs.rescan=false
+compiler.automake.force.fs.rescan.description=When enabled, for all automatically started builds (automake) collected VFS changes will be ignored and modified files will be determined with FS rescan will be forces
+
+compiler.document.save.trigger.delay=1500
+compiler.document.save.trigger.delay.description=Delay in milliseconds before triggering save in response to document changes
+
+vcs.show.colored.annotations=true
+vcs.showConsole=true
+vcs.log.bek.sort=false
+vcs.log.bek.sort.disabled=false
+
+psi.incremental.reparse.depth.limit=1000
+psi.deferIconLoading=true
+psi.track.invalidation=true
+
+ide.suggest.file.when.creating.filename.like.directory=true
+ide.suggest.file.when.creating.filename.like.directory.description=When creating a directory named foo.txt, suggest to create a file with such a name instead
+
+find.search.in.project.files=true
+
+structureView.coalesceTime=500
+
+keymap.show.alias.actions=false
+frameworks.download.libraries.server.url=http://pluginsrepo-test:8080
+caches.indexerThreadsCount=-1
+vcs.show.history.numbers=true
+navBar.updateMergeTime=100
+navBar.userActivityMergeTime=100
+
+inspectionGadgets.telemetry.enabled=false
+
+ide.mac.fix.accessibleLeak=true
+
+projectView.showHierarchyErrors=true
+projectView.hide.dot.idea=true
+show.live.templates.in.completion=true
+ide.completion.autopopup.select.live.templates=true
+ide.completion.autopopup.choose.by.enter=true
+
+java.completion.make.outer.variables.final=true
+java.completion.make.outer.variables.final.description=Make variables accessed from inner class final automatically
+
+documentation.component.editor.font=false
+
+ide.completion.show.better.matching.classes=true
+ide.completion.show.better.matching.classes.description=Show non-imported but good matching classes in basic completion
+
+ide.completion.show.lower.case.classes=false
+ide.completion.show.lower.case.classes.description=Show non-imported classes starting with a lowercase letter in basic completion
+
+ide.completion.delay.autopopup.until.completed=false
+ide.completion.delay.autopopup.until.completed.description=Controls if completion autopopup is shown immediately and populated in background, or delayed until all suggestion are calculated
+
+ide.completion.middle.matching=true
+ide.completion.middle.matching.description=Suggest items in completion that contain the entered string somewhere in the middle.
+ide.goto.middle.matching=true
+ide.goto.middle.matching.description=Suggest items in goto actions that contain the entered string somewhere in the middle.
+ide.goto.rebuild.delay=0
+
+ide.structural.navigation.visit.fields=false
+ide.structural.navigation.visit.fields.description=Whether fields should be stopped at when navigating to the nex/previous structural member by Alt+Down/Up.
+
+ide.non.english.keyboard.layout.fix=false
+ide.non.english.keyboard.layout.fix.description=Enables a fix for key codes with non-English keyboard layouts
+
+ide.dfa.getters.with.side.effects=java\\.nio\\..*ByteBuffer\\.get.*
+ide.dfa.getters.with.side.effects.description=A regex on qualified names of methods that look like getters but are not. For Constant Conditions & Exception inspection
+
+ide.enable.toolwindow.stack=false
+
+change.signature.awesome.mode=true
+change.signature.awesome.mode.description=Enables list view for change signature.
+
+enable.groovy.hotswap=true
+enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process\
+ which allows to hot-swap Groovy changes in some cases
+dump.threads.on.empty.lookup=false
+dump.threads.on.empty.lookup.description=Whether IDEA should issue a thread dump when an empty completion lookup appears.
+
+file.structure.tree.mode=true
+
+disable.toolwindow.overlay=true
+disable.toolwindow.overlay.description=Disable transparent toolwindow stripes.
+
+core.pooled.threads=20
+
+editor.dumb.mode.available=true
+enable.animation.on.dialogs=false
+type.ahead.logging.enabled=false
+fast.tree.expand.in.structure.view=false
+
+ide.goto.implementation.show.interfaces=true
+ide.goto.implementation.show.interfaces.description=Whether to show sub-interfaces when invoking\
+ 'Go to Implementation' action (Ctrl+Alt+B) on an interface.
+
+file.colors.in.commit.dialog=false
+
+testng.serialized.protocol.enabled=false
+testng.skip.expected.exceptions=true
+dark.laf.available=true
+
+actionSystem.force.alt.gr=false
+completion.show.intention.icon=true
+tabs.alphabetical=false
+remote.changelist.management.available=false
+
+python.import.always.ask=false
+introduce.variable.prefer.statements=false
+show.method.base.class.in.java.file.structure=true
+
+vcs.log.empty.change.list.creation=false
+debugger.enable.breakpoints.during.evaluation=false
+new.project.wizard=false
+diagrams.rendering.no.cache=true
+
+wolf.the.problem.solver=true
+ui.no.bangs.and.whistles=false
+
+comment.by.line.bulk.lines.trigger=100
+
+junit_sm_runner=false
+testng_sm_runner=false
+show.flex.debug.design.view=false
+git.new.log=true
+diff.patience.alg=false
+
+svn.use.terminal=false
+svn.use.incoming.optimization=false
+svn.executable.locale=C.UTF-8
+
+completion.enable.relevant.method.chain.suggestions=false
+ide.mac.message.sheets.java.emulation=false
+ide.mac.message.sheets.java.emulation.description=Use Java message sheets instead of native ones
+ide.mac.message.sheets.java.emulation.dialogs=true
+ide.mac.message.sheets.java.emulation.dialogs.description=Use Java message sheets based on awt dialogs instead of native sheets
+linux.native.menu=false
+linux.native.menu.description=Enables native menu on Ubuntu
+windows.jumplist=true
+windows.jumplist.description=Enables JumpLists on Windows
+
+GRADLE.system.in.process=true
+GRADLE.system.in.process.description=Whether IDEA should use 'in-process' mode for interaction with gradle api
+
+grails.advanced.mode=false
+bigger.font.in.project.view=false
+bigger.font.in.project.view.description=Increases font size in Project View
+darcula.use.native.fonts.on.linux=true
+darcula.use.native.fonts.on.linux.description=If false, uses DejaVu Sans 13pt
+idea.4.5.laf.enabled=false
+ide.libnotify.enabled=true
+ide.libnotify.enabled.description=Enables notifications via LibNotify
+cvs.roots.refresh.uses.vfs=true
+cvs.roots.refresh.uses.vfs.description=Should CVS roots refresh after update use VFS
+vcs.add.remove.silent=true
+ide.open.file.in.temp.project.dir=true
+ide.open.file.in.temp.project.dir.description=Enables opening file in temp project directory
+
+editor.allow.multiple.carets=true
+embed.scene.builder=true
+
+dsm.retina.darcula.legend=true
+dsm.retina.darcula.legend.description=Experimental DSM legend component
+
+ide.scratch.enabled=false
+ide.show.progress.without.status.bar=false
+
+editor.injected.highlighting.enabled=true
+editor.injected.highlighting.enabled.description=Disables injected fragments highlighting (requires project reopening)
+
+run.processes.with.pty=false
+
+ide.certificate.manager=true
+
+editor.richcopy.enable=true
+editor.richcopy.max.size.megabytes=10
+editor.richcopy.strip.indents=true
+allow.dialog.based.popups=true
+allow.dialog.based.popups.description=Allows to use a JDialog as popup toplevel
+
+popup.fix.ide.frame.owner=false
+popup.fix.ide.frame.owner.description=Uses correct owner for IdeFrame, but can break some popups
+
+our.heavy.weight.popup=false
+our.heavy.weight.popup.description=Disables HeavyWeightPopup cache in Swing
+
+focus.fix.lost.cursor=true
+focus.fix.lost.cursor.description=See IDEA-79312
+
+ide.inertial.mouse.fix=false
+ide.inertial.mouse.fix.description=See IDEA-71508
+
+ide.log.focuses=false
+ide.log.focuses.description=Enables logging of focuses (Time consuming)
+
+emmet.segments.limit=50
+emmet.template.length.limit.kilobytes=15
+command.line.execution.timeout=30
+
+console.too.much.text.buffer.ratio=10
+console.too.much.text.buffer.ratio.description=Used for disabling of console processing(console filters for highlights, foldings...),\n\
+ when there is too much of text to process.\n\
+ The ratio is used against the console cycle buffer size (idea.cycle.buffer.size/theRatio=maxTextLength).
+ide.file.settings.order.new=false
+ide.new.project.settings=true
+ide.new.project.settings.description=Temporary key for new project settings dialog UI
+
+commonjs.complete.required.filename.with.extension=false
+commonjs.complete.required.filename.with.extension.description=If checked, required filenames are completed with extension
+
+
+fix.jdk7.alt.shortcuts=true
+fix.jdk7.alt.shortcuts.description=Allow to use alt for shortcuts on MacOSX with jdk7+
+
+ide.new.markup.markers=true
+ide.new.markup.markers.description=New error stripe markers
+
+spy.js.realtime.evaluation=false
+spy.js.realtime.evaluation.description=Enables spy-js autocomplete and realtime evaluation
diff --git a/platform/util/src/com/intellij/icons/AllIcons.java b/platform/util/src/com/intellij/icons/AllIcons.java
index db897fd8c52d..be3f4f212072 100644
--- a/platform/util/src/com/intellij/icons/AllIcons.java
+++ b/platform/util/src/com/intellij/icons/AllIcons.java
@@ -74,6 +74,7 @@ public class AllIcons {
public static final Icon Forward = IconLoader.getIcon("/actions/forward.png"); // 16x16
public static final Icon GC = IconLoader.getIcon("/actions/gc.png"); // 16x16
public static final Icon Get = IconLoader.getIcon("/actions/get.png"); // 16x16
+ public static final Icon GroupByFile = IconLoader.getIcon("/actions/GroupByFile.png"); // 16x16
public static final Icon GroupByMethod = IconLoader.getIcon("/actions/groupByMethod.png"); // 16x16
public static final Icon GroupByModule = IconLoader.getIcon("/actions/GroupByModule.png"); // 16x16
public static final Icon GroupByModuleGroup = IconLoader.getIcon("/actions/GroupByModuleGroup.png"); // 16x16
@@ -459,6 +460,8 @@ public class AllIcons {
public static final Icon PluginManager = IconLoader.getIcon("/general/pluginManager.png"); // 32x32
public static final Icon Progress = IconLoader.getIcon("/general/progress.png"); // 8x10
public static final Icon ProjectConfigurable = IconLoader.getIcon("/general/projectConfigurable.png"); // 9x9
+ public static final Icon ProjectConfigurableBanner = IconLoader.getIcon("/general/projectConfigurableBanner.png"); // 9x9
+ public static final Icon ProjectConfigurableSelected = IconLoader.getIcon("/general/projectConfigurableSelected.png"); // 9x9
public static final Icon ProjectSettings = IconLoader.getIcon("/general/projectSettings.png"); // 16x16
public static final Icon ProjectStructure = IconLoader.getIcon("/general/projectStructure.png"); // 16x16
public static final Icon ProjectTab = IconLoader.getIcon("/general/projectTab.png"); // 16x16
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/src/com/intellij/openapi/ui/Splitter.java b/platform/util/src/com/intellij/openapi/ui/Splitter.java
index 44d2317088c6..71a026702563 100644
--- a/platform/util/src/com/intellij/openapi/ui/Splitter.java
+++ b/platform/util/src/com/intellij/openapi/ui/Splitter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * 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.
@@ -177,7 +177,7 @@ public class Splitter extends JPanel {
}
protected Divider createDivider() {
- return new Divider();
+ return new DividerImpl();
}
@Override
@@ -481,12 +481,12 @@ public class Splitter extends JPanel {
return myDivider;
}
- public class Divider extends JPanel {
+ public class DividerImpl extends Divider {
private boolean myResizeEnabled;
private boolean mySwitchOrientationEnabled;
protected Point myPoint;
- public Divider() {
+ public DividerImpl() {
super(new GridBagLayout());
myResizeEnabled = true;
mySwitchOrientationEnabled = false;
@@ -496,7 +496,7 @@ public class Splitter extends JPanel {
setOrientation(myVerticalSplit);
}
- private void setOrientation(boolean isVerticalSplit) {
+ public void setOrientation(boolean isVerticalSplit) {
removeAll();
setCursor(isVertical() ?
diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java
index 0f95577cf2b5..cfcbe7967d35 100644
--- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java
+++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java
@@ -1255,10 +1255,15 @@ public class FileUtil extends FileUtilRt {
}
@Contract("null -> null")
- public static String getLocationRelativeToUserHome(@Nullable final String path) {
+ public static String getLocationRelativeToUserHome(@Nullable String path) {
+ return getLocationRelativeToUserHome(path, true);
+ }
+
+ @Contract("null,_ -> null")
+ public static String getLocationRelativeToUserHome(@Nullable String path, boolean unixOnly) {
if (path == null) return null;
- if (SystemInfo.isUnix) {
+ if (SystemInfo.isUnix || !unixOnly) {
final File projectDir = new File(path);
final File userHomeDir = new File(SystemProperties.getUserHome());
if (isAncestor(userHomeDir, projectDir, true)) {
diff --git a/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java b/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java
index 3484d0625d37..586668af3864 100644
--- a/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java
+++ b/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java
@@ -35,7 +35,7 @@ public class IdeaWin32 {
static {
IdeaWin32 instance = null;
- if (SystemInfo.isWin2kOrNewer) {
+ if (SystemInfo.isWin2kOrNewer && Boolean.parseBoolean(System.getProperty("idea.use.native.fs.for.win", "true"))) {
try {
UrlClassLoader.loadPlatformLibrary("IdeaWin32");
instance = new IdeaWin32();
diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
index 7ee904c1f344..bc37f673bb03 100644
--- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
+++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
@@ -923,6 +923,10 @@ public class StringUtil extends StringUtilRt {
}
}
+ public static String defaultIfEmpty(@Nullable String value, String defaultValue) {
+ return isEmpty(value) ? defaultValue : value;
+ }
+
@Contract("null -> false")
public static boolean isNotEmpty(@Nullable String s) {
return s != null && !s.isEmpty();
@@ -2513,10 +2517,9 @@ public class StringUtil extends StringUtilRt {
public static String shortenTextWithEllipsis(@NotNull final String text,
final int maxLength,
final int suffixLength,
- boolean useEllipsisSymbol) {
+ @NotNull String symbol) {
final int textLength = text.length();
if (textLength > maxLength) {
- String symbol = useEllipsisSymbol ? "\u2026" : "...";
final int prefixLength = maxLength - suffixLength - symbol.length();
assert prefixLength > 0;
return text.substring(0, prefixLength) + symbol + text.substring(textLength - suffixLength);
@@ -2527,6 +2530,15 @@ public class StringUtil extends StringUtilRt {
}
@NotNull
+ public static String shortenTextWithEllipsis(@NotNull final String text,
+ final int maxLength,
+ final int suffixLength,
+ boolean useEllipsisSymbol) {
+ String symbol = useEllipsisSymbol ? "\u2026" : "...";
+ return shortenTextWithEllipsis(text, maxLength, suffixLength, symbol);
+ }
+
+ @NotNull
public static String shortenPathWithEllipsis(@NotNull final String path, final int maxLength, boolean useEllipsisSymbol) {
return shortenTextWithEllipsis(path, maxLength, (int)(maxLength * 0.7), useEllipsisSymbol);
}
@@ -2650,6 +2662,63 @@ public class StringUtil extends StringUtilRt {
return s.startsWith(smallPart.toLowerCase()) && bigPart.toLowerCase().startsWith(s);
}
+ public static String getShortened(String s, int maxWidth) {
+ int length = s.length();
+ if (isEmpty(s) || length <= maxWidth) return s;
+ ArrayList<String> words = new ArrayList<String>();
+
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < length; i++) {
+ char ch = s.charAt(i);
+
+ if (i == length - 1) {
+ builder.append(ch);
+ words.add(builder.toString());
+ builder.delete(0, builder.length());
+ continue;
+ }
+
+ if (i > 0 && (ch == '/' || ch == '\\' || ch == '.' || Character.isUpperCase(ch))) {
+ words.add(builder.toString());
+ builder.delete(0, builder.length());
+ }
+ builder.append(ch);
+ }
+ for (int i = 0; i < words.size(); i++) {
+ String word = words.get(i);
+ if (i < words.size() - 1 && word.length() == 1) {
+ words.remove(i);
+ words.set(i, word + words.get(i));
+ }
+ }
+
+ int removedLength = 0;
+
+ String toPaste = "...";
+ int index;
+ while (true) {
+ index = Math.max(0, (words.size() - 1) / 2);
+ String aWord = words.get(index);
+ words.remove(index);
+ int toCut = length - removedLength - maxWidth + 3;
+ if (words.size() < 2 || (toCut < aWord.length() - 2 && removedLength == 0)) {
+ int pos = (aWord.length() - toCut) / 2;
+ toPaste = aWord.substring(0, pos) + "..." + aWord.substring(pos+toCut);
+ break;
+ }
+ removedLength += aWord.length();
+ if (length - removedLength <= maxWidth - 3) {
+ break;
+ }
+ }
+ for (int i = 0; i < words.size(); i++) {
+ String word = words.get(i);
+ if (i == index || words.size() == 1) builder.append(toPaste);
+ builder.append(word);
+ }
+ return builder.toString().replaceAll("\\.{4,}", "...");
+ }
+
/**
* Expirable CharSequence. Very useful to control external library execution time,
* i.e. when java.util.regex.Pattern match goes out of control.
diff --git a/platform/util/src/com/intellij/ui/JBColor.java b/platform/util/src/com/intellij/ui/JBColor.java
index d2b4a3bd7623..3669e725610d 100644
--- a/platform/util/src/com/intellij/ui/JBColor.java
+++ b/platform/util/src/com/intellij/ui/JBColor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * 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.
@@ -15,7 +15,9 @@
*/
package com.intellij.ui;
+import com.intellij.util.NotNullProducer;
import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.awt.color.ColorSpace;
@@ -32,6 +34,7 @@ public class JBColor extends Color {
private static volatile boolean DARK = UIUtil.isUnderDarcula();
private final Color darkColor;
+ private final NotNullProducer<Color> func;
public JBColor(int rgb, int darkRGB) {
this(new Color(rgb), new Color(darkRGB));
@@ -42,6 +45,13 @@ public class JBColor extends Color {
darkColor = dark;
//noinspection AssignmentToStaticFieldFromInstanceMethod
DARK = UIUtil.isUnderDarcula(); //Double check. Sometimes DARK != isDarcula() after dialogs appear on splash screen
+ func = null;
+ }
+
+ public JBColor(NotNullProducer<Color> function) {
+ super(0);
+ darkColor = null;
+ func = function;
}
public static void setDark(boolean dark) {
@@ -52,99 +62,142 @@ public class JBColor extends Color {
return darkColor;
}
+ Color getColor() {
+ if (func != null) {
+ return func.produce();
+ } else {
+ return DARK ? getDarkVariant() : this;
+ }
+ }
+
@Override
public int getRed() {
- return DARK ? getDarkVariant().getRed() : super.getRed();
+ final Color c = getColor();
+ return c == this ? super.getRed() : c.getRed();
}
@Override
public int getGreen() {
- return DARK ? getDarkVariant().getGreen() : super.getGreen();
+ final Color c = getColor();
+ return c == this ? super.getGreen() : c.getGreen();
}
@Override
public int getBlue() {
- return DARK ? getDarkVariant().getBlue() : super.getBlue();
+ final Color c = getColor();
+ return c == this ? super.getBlue() : c.getBlue();
}
@Override
public int getAlpha() {
- return DARK ? getDarkVariant().getAlpha() : super.getAlpha();
+ final Color c = getColor();
+ return c == this ? super.getAlpha() : c.getAlpha();
}
@Override
public int getRGB() {
- return DARK ? getDarkVariant().getRGB() : super.getRGB();
+ final Color c = getColor();
+ return c == this ? super.getRGB() : c.getRGB();
}
@Override
public Color brighter() {
+ if (func != null) {
+ return new JBColor(new NotNullProducer<Color>() {
+ @NotNull
+ @Override
+ public Color produce() {
+ return func.produce().brighter();
+ }
+ });
+ }
return new JBColor(super.brighter(), getDarkVariant().brighter());
}
@Override
public Color darker() {
+ if (func != null) {
+ return new JBColor(new NotNullProducer<Color>() {
+ @NotNull
+ @Override
+ public Color produce() {
+ return func.produce().darker();
+ }
+ });
+ }
return new JBColor(super.darker(), getDarkVariant().darker());
}
@Override
public int hashCode() {
- return DARK ? getDarkVariant().hashCode() : super.hashCode();
+ final Color c = getColor();
+ return c == this ? super.hashCode() : c.hashCode();
}
@Override
public boolean equals(Object obj) {
- return DARK ? getDarkVariant().equals(obj) : super.equals(obj);
+ final Color c = getColor();
+ return c == this ? super.equals(obj) : c.equals(obj);
}
@Override
public String toString() {
- return DARK ? getDarkVariant().toString() : super.toString();
+ final Color c = getColor();
+ return c == this ? super.toString() : c.toString();
}
@Override
public float[] getRGBComponents(float[] compArray) {
- return DARK ? getDarkVariant().getRGBComponents(compArray) : super.getRGBComponents(compArray);
+ final Color c = getColor();
+ return c == this ? super.getRGBComponents(compArray) : c.getRGBComponents(compArray);
}
@Override
public float[] getRGBColorComponents(float[] compArray) {
- return DARK ? getDarkVariant().getRGBColorComponents(compArray) : super.getRGBComponents(compArray);
+ final Color c = getColor();
+ return c == this ? super.getRGBComponents(compArray) : c.getRGBColorComponents(compArray);
}
@Override
public float[] getComponents(float[] compArray) {
- return DARK ? getDarkVariant().getComponents(compArray) : super.getComponents(compArray);
+ final Color c = getColor();
+ return c == this ? super.getComponents(compArray) : c.getComponents(compArray);
}
@Override
public float[] getColorComponents(float[] compArray) {
- return DARK ? getDarkVariant().getColorComponents(compArray) : super.getColorComponents(compArray);
+ final Color c = getColor();
+ return c == this ? super.getColorComponents(compArray) : c.getColorComponents(compArray);
}
@Override
public float[] getComponents(ColorSpace cspace, float[] compArray) {
- return DARK ? getDarkVariant().getComponents(cspace, compArray) : super.getComponents(cspace, compArray);
+ final Color c = getColor();
+ return c == this ? super.getComponents(cspace, compArray) : c.getComponents(cspace, compArray);
}
@Override
public float[] getColorComponents(ColorSpace cspace, float[] compArray) {
- return DARK ? getDarkVariant().getColorComponents(cspace, compArray) : super.getColorComponents(cspace, compArray);
+ final Color c = getColor();
+ return c == this ? super.getColorComponents(cspace, compArray) : c.getColorComponents(cspace, compArray);
}
@Override
public ColorSpace getColorSpace() {
- return DARK ? getDarkVariant().getColorSpace() : super.getColorSpace();
+ final Color c = getColor();
+ return c == this ? super.getColorSpace() : c.getColorSpace();
}
@Override
public synchronized PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints) {
- return DARK ? getDarkVariant().createContext(cm, r, r2d, xform, hints) : super.createContext(cm, r, r2d, xform, hints);
+ final Color c = getColor();
+ return c == this ? super.createContext(cm, r, r2d, xform, hints) : c.createContext(cm, r, r2d, xform, hints);
}
@Override
public int getTransparency() {
- return DARK ? getDarkVariant().getTransparency() : super.getTransparency();
+ final Color c = getColor();
+ return c == this ? super.getTransparency() : c.getTransparency();
}
public static final JBColor red = new JBColor(Color.red, DarculaColors.RED);
@@ -196,7 +249,34 @@ public class JBColor extends Color {
public static final Color cyan = new JBColor(Color.cyan, new Color(0, 137, 137));
public static final Color CYAN = cyan;
- public static Color foreground() {return UIUtil.getLabelForeground();}
+ public static Color foreground() {
+ return new JBColor(new NotNullProducer<Color>() {
+ @NotNull
+ @Override
+ public Color produce() {
+ return UIUtil.getLabelForeground();
+ }
+ });
+ }
- public static Color background() {return UIUtil.getListBackground();}
+ public static Color background() {
+ return new JBColor(new NotNullProducer<Color>() {
+ @NotNull
+ @Override
+ public Color produce() {
+ return UIUtil.getListBackground();
+ }
+ });
+ }
+
+ public static Color border() {
+ return new JBColor(new NotNullProducer<Color>() {
+ @NotNull
+ @Override
+ public Color produce() {
+ //noinspection deprecation
+ return UIUtil.getBorderColor();
+ }
+ });
+ }
}
diff --git a/platform/util/src/com/intellij/util/EventDispatcher.java b/platform/util/src/com/intellij/util/EventDispatcher.java
index 34361a8ff31b..e17c6e46e5f3 100644
--- a/platform/util/src/com/intellij/util/EventDispatcher.java
+++ b/platform/util/src/com/intellij/util/EventDispatcher.java
@@ -43,6 +43,7 @@ public class EventDispatcher<T extends EventListener> {
}
private EventDispatcher(@NotNull Class<T> listenerClass) {
+ LOG.assertTrue(listenerClass.isInterface(), "listenerClass must be an interface");
InvocationHandler handler = new InvocationHandler() {
@Override
@NonNls
@@ -71,10 +72,7 @@ public class EventDispatcher<T extends EventListener> {
};
//noinspection unchecked
- myMulticaster = (T)Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class[]{listenerClass},
- handler
- );
+ myMulticaster = (T)Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, handler);
}
@NotNull
@@ -82,7 +80,7 @@ public class EventDispatcher<T extends EventListener> {
return myMulticaster;
}
- private void dispatch(final Method method, final Object[] args) {
+ private void dispatch(@NotNull Method method, Object[] args) {
method.setAccessible(true);
for (T listener : myListeners) {
diff --git a/platform/util/src/com/intellij/util/PatternUtil.java b/platform/util/src/com/intellij/util/PatternUtil.java
index 7159a90d1601..0b683dddc1e6 100644
--- a/platform/util/src/com/intellij/util/PatternUtil.java
+++ b/platform/util/src/com/intellij/util/PatternUtil.java
@@ -17,8 +17,9 @@ package com.intellij.util;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.util.containers.HashMap;
-import org.jetbrains.annotations.NonNls;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -29,30 +30,22 @@ import java.util.regex.PatternSyntaxException;
public class PatternUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.util.PatternUtil");
- private static final HashMap<String, String> ourEscapeRules = new HashMap<String, String>();
+
+ public static final Pattern NOTHING = Pattern.compile("(a\\A)");
+
+ private static final Map<String, String> ourEscapeRules = ContainerUtil.newLinkedHashMap();
static {
// '.' should be escaped first
ourEscapeRules.put("*", ".*");
ourEscapeRules.put("?", ".");
- escape2('+');
- escape2('(');
- escape2(')');
- escape2('[');
- escape2(']');
- escape2('/');
- escape2('^');
- escape2('$');
- escape2('{');
- escape2('}');
- escape2('|');
- }
-
- private static void escape2(char symbol) {
- ourEscapeRules.put(String.valueOf(symbol), "\\" + symbol);
+ for (char c : "+()[]/^${}|".toCharArray()) {
+ ourEscapeRules.put(String.valueOf(c), "\\" + c);
+ }
}
- public static String convertToRegex(String mask) {
+ @NotNull
+ public static String convertToRegex(@NotNull String mask) {
List<String> strings = StringUtil.split(mask, "\\");
StringBuilder pattern = new StringBuilder();
String separator = "";
@@ -69,17 +62,26 @@ public class PatternUtil {
return pattern.toString();
}
- public static Pattern fromMask(@NonNls String mask) {
-// String pattern = mask.replaceAll("\\.", "\\.").replaceAll("\\*", ".*").replaceAll("\\?", ".");
+ @NotNull
+ public static Pattern fromMask(@NotNull String mask) {
try {
return Pattern.compile(convertToRegex(mask));
}
catch (PatternSyntaxException e) {
LOG.error(mask, e);
- return Pattern.compile("");
+ return NOTHING;
}
}
+ @Contract("_, !null->!null")
+ public static Pattern compileSafe(String pattern, Pattern def) {
+ try {
+ return Pattern.compile(pattern);
+ }
+ catch (Exception e) {
+ return def;
+ }
+ }
/**
* Finds the first match in a list os Strings.
*
diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java
index a4bf4318a76e..df33a80d4cba 100644
--- a/platform/util/src/com/intellij/util/ReflectionUtil.java
+++ b/platform/util/src/com/intellij/util/ReflectionUtil.java
@@ -426,6 +426,26 @@ public class ReflectionUtil {
}
}
+ /**
+ * {@link Class#newInstance()} cannot instantiate private classes
+ */
+ @NotNull
+ public static <T> T newInstance(@NotNull Class<T> aClass, @NotNull Class... parameterTypes) {
+ try {
+ Constructor<T> constructor = aClass.getDeclaredConstructor(parameterTypes);
+ try {
+ constructor.setAccessible(true);
+ }
+ catch (SecurityException e) {
+ return aClass.newInstance();
+ }
+ return constructor.newInstance();
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
@NotNull
public static <T> T createInstance(@NotNull Constructor<T> constructor, @NotNull Object... args) {
try {
diff --git a/platform/util/src/com/intellij/util/Restarter.java b/platform/util/src/com/intellij/util/Restarter.java
index 7f1584dc73dc..01e7fc494f5b 100644
--- a/platform/util/src/com/intellij/util/Restarter.java
+++ b/platform/util/src/com/intellij/util/Restarter.java
@@ -153,12 +153,11 @@ public class Restarter {
}
public static File createTempExecutable(File executable) throws IOException {
- String ext = FileUtilRt.getExtension(executable.getName());
- File copy = FileUtilRt.createTempFile(FileUtilRt.getNameWithoutExtension(executable.getName()),
- StringUtil.isEmptyOrSpaces(ext) ? ".tmp" : ("." + ext),
- false);
- FileUtilRt.copy(executable, copy);
- if (!copy.setExecutable(executable.canExecute())) throw new IOException("Cannot make file executable: " + copy);
+ File copy = new File(System.getProperty("user.home") + "/." + System.getProperty("idea.paths.selector") + "/restart/" + executable.getName());
+ if (FileUtilRt.ensureCanCreateFile(copy)) {
+ FileUtilRt.copy(executable, copy);
+ if (!copy.setExecutable(executable.canExecute())) throw new IOException("Cannot make file executable: " + copy);
+ }
return copy;
}
diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
index 6052df2b701e..171cfababfa9 100644
--- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java
+++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
@@ -828,6 +828,7 @@ public class ContainerUtil extends ContainerUtilRt {
@NotNull
public static <T> List<T> findAll(@NotNull Collection<? extends T> collection, @NotNull Condition<? super T> condition) {
+ if (collection.isEmpty()) return emptyList();
final List<T> result = new SmartList<T>();
for (final T t : collection) {
if (condition.value(t)) {
diff --git a/platform/util/src/com/intellij/util/containers/LongStack.java b/platform/util/src/com/intellij/util/containers/LongStack.java
new file mode 100644
index 000000000000..8e1005bd0af2
--- /dev/null
+++ b/platform/util/src/com/intellij/util/containers/LongStack.java
@@ -0,0 +1,75 @@
+/*
+ * 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.containers;
+
+/**
+ * @author lambdamix
+ */
+import java.util.EmptyStackException;
+
+public class LongStack {
+ private long[] data;
+ private int size;
+ public LongStack(int initialCapacity) {
+ data = new long[initialCapacity];
+ size = 0;
+ }
+
+ public LongStack() {
+ this(5);
+ }
+
+ public void push(long t) {
+ if (size >= data.length) {
+ long[] newdata = new long[data.length * 3 / 2];
+ System.arraycopy(data, 0, newdata, 0, size);
+ data = newdata;
+ }
+ data[size++] = t;
+ }
+
+ public long peek() {
+ if (size == 0) throw new EmptyStackException();
+ return data[size - 1];
+ }
+
+ public long pop() {
+ if (size == 0) throw new EmptyStackException();
+ return data[--size];
+ }
+
+ public boolean empty() {
+ return size == 0;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof LongStack) {
+ LongStack otherStack = (LongStack)o;
+ if (size != otherStack.size) return false;
+ for (int i = 0; i < otherStack.size; i++) {
+ if (data[i] != otherStack.data[i]) return false;
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ public void clear() {
+ size = 0;
+ }
+}
diff --git a/platform/util/src/com/intellij/util/diff/DiffTree.java b/platform/util/src/com/intellij/util/diff/DiffTree.java
index 0bab60dc87da..680b15b7d1de 100644
--- a/platform/util/src/com/intellij/util/diff/DiffTree.java
+++ b/platform/util/src/com/intellij/util/diff/DiffTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.intellij.util.diff;
import com.intellij.openapi.util.Ref;
@@ -39,7 +38,6 @@ public class DiffTree<OT, NT> {
final FlyweightCapableTreeStructure<NT> newTree,
final ShallowNodeComparator<OT, NT> comparator,
final DiffTreeChangeBuilder<OT, NT> consumer) {
-
myOldTree = oldTree;
myNewTree = newTree;
myComparator = comparator;
@@ -53,7 +51,7 @@ public class DiffTree<OT, NT> {
new DiffTree<OT, NT>(oldTree, newTree, comparator, consumer).build(oldTree.getRoot(), newTree.getRoot(), 0);
}
- private static enum CompareResult {
+ private enum CompareResult {
EQUAL, // 100% equal
DRILL_DOWN_NEEDED, // element types are equal, but elements are composite
TYPE_ONLY, // only element types are equal
@@ -146,6 +144,7 @@ public class DiffTree<OT, NT> {
newIndex++;
continue;
}
+
CompareResult c12 = looksEqual(comparator, oldChild1, newChild2);
if (c12 == CompareResult.EQUAL || c12 == CompareResult.DRILL_DOWN_NEEDED || c12 == CompareResult.TYPE_ONLY) {
myConsumer.nodeInserted(oldNode, newChild1, newIndex);
@@ -170,6 +169,7 @@ public class DiffTree<OT, NT> {
oldIndex++;
continue;
}
+
myConsumer.nodeReplaced(oldChild1, newChild1);
oldIndex++;
newIndex++;
diff --git a/platform/util/src/com/intellij/util/io/LongInlineKeyDescriptor.java b/platform/util/src/com/intellij/util/io/LongInlineKeyDescriptor.java
new file mode 100644
index 000000000000..78f1fdd02f78
--- /dev/null
+++ b/platform/util/src/com/intellij/util/io/LongInlineKeyDescriptor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.io;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+/**
+ * @author lambdamix
+ */
+public class LongInlineKeyDescriptor implements KeyDescriptor<Long> {
+ public static LongInlineKeyDescriptor INSTANCE = new LongInlineKeyDescriptor();
+
+ @Override
+ public final int getHashCode(Long value) {
+ return value.hashCode();
+ }
+
+ @Override
+ public final boolean isEqual(Long val1, Long val2) {
+ return val1.longValue() == val2.longValue();
+ }
+
+ @Override
+ public final void save(@NotNull DataOutput out, Long value) throws IOException {
+ out.writeLong(value.longValue());
+ }
+
+ @Override
+ public final Long read(@NotNull DataInput in) throws IOException {
+ return in.readLong();
+ }
+
+}
diff --git a/platform/util/src/com/intellij/util/text/StringSearcher.java b/platform/util/src/com/intellij/util/text/StringSearcher.java
index 22e9db2d9428..d5bc95f99cef 100644
--- a/platform/util/src/com/intellij/util/text/StringSearcher.java
+++ b/platform/util/src/com/intellij/util/text/StringSearcher.java
@@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
+import java.util.Locale;
public class StringSearcher {
private static final Logger LOG = Logger.getInstance("#com.intellij.util.text.StringSearcher");
@@ -48,7 +49,7 @@ public class StringSearcher {
myPattern = pattern;
myCaseSensitive = caseSensitive;
myForwardDirection = forwardDirection;
- myPatternArray = myCaseSensitive ? myPattern.toCharArray() : myPattern.toLowerCase().toCharArray();
+ myPatternArray = myCaseSensitive ? myPattern.toCharArray() : myPattern.toLowerCase(Locale.US).toCharArray();
myPatternLength = myPatternArray.length;
Arrays.fill(mySearchTable, -1);
myJavaIdentifier = pattern.isEmpty() ||
diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java
index 7ed8021bd94b..aec2a356ded0 100644
--- a/platform/util/src/com/intellij/util/ui/UIUtil.java
+++ b/platform/util/src/com/intellij/util/ui/UIUtil.java
@@ -1586,7 +1586,7 @@ public class UIUtil {
@NotNull Graphics g,
boolean useRetinaCondition,
Consumer<Graphics2D> paintRoutine) {
- if (!useRetinaCondition || !isRetina() || Registry.is("ide.mac.retina.disableDrawingFix", false)) {
+ if (!useRetinaCondition || !isRetina() || Registry.is("ide.mac.retina.disableDrawingFix")) {
paintRoutine.consume((Graphics2D)g);
}
else {
@@ -1904,6 +1904,10 @@ public class UIUtil {
return INACTIVE_HEADER_COLOR;
}
+ /**
+ * @deprecated
+ * @use JBColor.border()
+ */
public static Color getBorderColor() {
return isUnderDarcula() ? Gray._50 : BORDER_COLOR;
}
@@ -2769,7 +2773,7 @@ public class UIUtil {
@NotNull
public static Paint getGradientPaint(float x1, float y1, @NotNull Color c1, float x2, float y2, @NotNull Color c2) {
- return (Registry.is("ui.no.bangs.and.whistles", false)) ? ColorUtil.mix(c1, c2, .5) : new GradientPaint(x1, y1, c1, x2, y2, c2);
+ return (Registry.is("ui.no.bangs.and.whistles")) ? ColorUtil.mix(c1, c2, .5) : new GradientPaint(x1, y1, c1, x2, y2, c2);
}
@Nullable
diff --git a/platform/util/src/com/intellij/util/xmlb/XmlSerializerImpl.java b/platform/util/src/com/intellij/util/xmlb/XmlSerializerImpl.java
index c25ea4eda084..6cc2124c695a 100644
--- a/platform/util/src/com/intellij/util/xmlb/XmlSerializerImpl.java
+++ b/platform/util/src/com/intellij/util/xmlb/XmlSerializerImpl.java
@@ -16,13 +16,13 @@
package com.intellij.util.xmlb;
import com.intellij.openapi.util.Pair;
+import com.intellij.util.ReflectionUtil;
import org.jdom.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.annotation.Annotation;
import java.lang.ref.SoftReference;
-import java.lang.reflect.Constructor;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
@@ -184,16 +184,9 @@ class XmlSerializerImpl {
/**
* {@link Class#newInstance()} cannot instantiate private classes
*/
- static <T> T newInstance(Class<T> aClass) {
+ static <T> T newInstance(@NotNull Class<T> aClass) {
try {
- Constructor<T> constructor = aClass.getDeclaredConstructor();
- try {
- constructor.setAccessible(true);
- }
- catch (SecurityException e) {
- return aClass.newInstance();
- }
- return constructor.newInstance();
+ return ReflectionUtil.newInstance(aClass);
}
catch (Exception e) {
throw new XmlSerializationException(e);
diff --git a/platform/util/testSrc/com/intellij/util/text/StringUtilTest.java b/platform/util/testSrc/com/intellij/util/text/StringUtilTest.java
index 2f31dc4f4e61..383c07f2a87e 100644
--- a/platform/util/testSrc/com/intellij/util/text/StringUtilTest.java
+++ b/platform/util/testSrc/com/intellij/util/text/StringUtilTest.java
@@ -195,4 +195,23 @@ public class StringUtilTest extends TestCase {
assertEquals(Arrays.asList("\n", "\r\n", "\n", "\r\n", "\r", "\r", "aa\r", "bb\r\n", "cc\n", "\r", "dd\n", "\n", "\r\n", "\r"),
Arrays.asList(StringUtil.splitByLinesKeepSeparators("\n\r\n\n\r\n\r\raa\rbb\r\ncc\n\rdd\n\n\r\n\r")));
}
+
+ public void testShortened() {
+ String[] names = {"AVeryVeeryLongClassName.java", "com.test.SomeJAVAClassName.java", "strangelowercaseclassname.java", "PrefixPostfix.java", "SomeJAVAClassName.java"};
+ for (String name : names) {
+ for (int i = name.length() + 1; i > 15; i--) {
+ String shortened = StringUtil.getShortened(name, i);
+ assertTrue(shortened.length() <= i);
+ assertTrue(!shortened.contains("...."));
+ int pos = shortened.indexOf("...");
+ if (pos != -1) {
+ assertTrue(name.startsWith(shortened.substring(0, pos)));
+ assertTrue(name.endsWith(shortened.substring(pos + 3)));
+ }
+ else {
+ assertEquals(shortened, name);
+ }
+ }
+ }
+ }
}
diff --git a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java
index 377abeba5b18..9a3fcb9d7066 100644
--- a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java
+++ b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java
@@ -495,6 +495,22 @@ public class XmlSerializerTest extends TestCase {
"</BeanWithFieldWithTagAnnotation>", bean);
}
+ public void testEscapeCharsInTagText() {
+ BeanWithFieldWithTagAnnotation bean = new BeanWithFieldWithTagAnnotation();
+ bean.STRING_V = "a\nb\"<";
+
+ doSerializerTest(
+ "<BeanWithFieldWithTagAnnotation>\n" +
+ " <name>a\nb&quot;&lt;</name>\n" +
+ "</BeanWithFieldWithTagAnnotation>", bean);
+ }
+
+ public void testEscapeCharsInAttributeValue() {
+ final BeanWithPropertiesBoundToAttribute bean = new BeanWithPropertiesBoundToAttribute();
+ bean.name = "a\nb\"<";
+ doSerializerTest("<BeanWithPropertiesBoundToAttribute count=\"3\" name=\"a&#10;b&quot;&lt;\" />", bean);
+ }
+
public void testShuffledDeserialize() {
BeanWithPublicFields bean = new BeanWithPublicFields();
bean.INT_V = 987;
diff --git a/platform/util/util.iml b/platform/util/util.iml
index d0155fd9b0b0..c015e73f13b3 100644
--- a/platform/util/util.iml
+++ b/platform/util/util.iml
@@ -5,6 +5,7 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="library" scope="PROVIDED" name="Mac" level="project" />
<orderEntry type="inheritedJdk" />