diff --git a/platform/projectModel-api/src/com/intellij/openapi/application/actions.kt b/platform/projectModel-api/src/com/intellij/openapi/application/actions.kt index 740935fde5a2..64a98aff26b3 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/application/actions.kt +++ b/platform/projectModel-api/src/com/intellij/openapi/application/actions.kt @@ -31,8 +31,7 @@ inline fun runUndoTransparentWriteAction(crossinline runnable: () -> T): T { return result as T } -inline fun runReadAction(crossinline runnable: () -> T): T = ApplicationManager.getApplication().runReadAction( - Computable { runnable() }) +inline fun runReadAction(crossinline runnable: () -> T): T = ApplicationManager.getApplication().runReadAction(Computable { runnable() }) /** * @exclude Internal use only diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/values/Value.kt b/platform/script-debugger/backend/src/org/jetbrains/debugger/values/Value.kt index 7c8ec35576e5..79846ce9395d 100755 --- a/platform/script-debugger/backend/src/org/jetbrains/debugger/values/Value.kt +++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/values/Value.kt @@ -1,3 +1,18 @@ +/* + * 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 org.jetbrains.debugger.values /** @@ -10,4 +25,4 @@ interface Value { * @return a string representation of this value */ val valueString: String? -} +} \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/BasicDebuggerViewSupport.kt b/platform/script-debugger/debugger-ui/src/BasicDebuggerViewSupport.kt index 66053f33f721..f32d3e5e5b70 100644 --- a/platform/script-debugger/debugger-ui/src/BasicDebuggerViewSupport.kt +++ b/platform/script-debugger/debugger-ui/src/BasicDebuggerViewSupport.kt @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * 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. @@ -48,4 +48,8 @@ open class BasicDebuggerViewSupport : MemberFilter, DebuggerViewSupport { node.addChildren(XValueChildrenList.EMPTY, true) } } +} + +interface PresentationProvider { + fun computePresentation(node: XValueNode, icon: Icon): Boolean } \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/VariableView.kt b/platform/script-debugger/debugger-ui/src/VariableView.kt index 35f7c323721b..d81d7c76642c 100644 --- a/platform/script-debugger/debugger-ui/src/VariableView.kt +++ b/platform/script-debugger/debugger-ui/src/VariableView.kt @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * 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. @@ -463,16 +463,18 @@ fun getObjectValueDescription(value: ObjectValue): String { } internal fun trimFunctionDescription(value: Value): String { - val presentableValue = value.valueString ?: return "" + return trimFunctionDescription(value.valueString ?: return "") +} +fun trimFunctionDescription(value: String): String { var endIndex = 0 - while (endIndex < presentableValue.length && !StringUtil.isLineBreak(presentableValue[endIndex])) { + while (endIndex < value.length && !StringUtil.isLineBreak(value[endIndex])) { endIndex++ } - while (endIndex > 0 && Character.isWhitespace(presentableValue[endIndex - 1])) { + while (endIndex > 0 && Character.isWhitespace(value[endIndex - 1])) { endIndex-- } - return presentableValue.substring(0, endIndex) + return value.substring(0, endIndex) } private fun createNumberPresentation(value: String): XValuePresentation { diff --git a/platform/testFramework/src/com/intellij/mock/MockDocument.java b/platform/testFramework/src/com/intellij/mock/MockDocument.java index 2ff2143c8e81..feedde800f0c 100644 --- a/platform/testFramework/src/com/intellij/mock/MockDocument.java +++ b/platform/testFramework/src/com/intellij/mock/MockDocument.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * 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. @@ -15,27 +15,13 @@ */ package com.intellij.mock; -import com.intellij.openapi.Disposable; import com.intellij.openapi.editor.RangeMarker; -import com.intellij.openapi.editor.event.DocumentListener; -import com.intellij.openapi.editor.ex.DocumentEx; -import com.intellij.openapi.editor.ex.EditReadOnlyListener; -import com.intellij.openapi.editor.ex.LineIterator; -import com.intellij.openapi.editor.ex.RangeMarkerEx; -import com.intellij.openapi.util.Key; +import com.intellij.openapi.editor.StandaloneDocumentEx; import com.intellij.openapi.util.TextRange; import com.intellij.util.LocalTimeCounter; -import com.intellij.util.Processor; -import com.intellij.util.containers.HashMap; import org.jetbrains.annotations.NotNull; -import java.beans.PropertyChangeListener; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class MockDocument implements DocumentEx { - private final Map myUserData = new HashMap(); +public class MockDocument extends StandaloneDocumentEx { private StringBuffer myText = new StringBuffer(); private long myModStamp = LocalTimeCounter.currentTime(); @@ -71,18 +57,6 @@ public class MockDocument implements DocumentEx { return getText().toCharArray(); } - @Override - @NotNull - public CharSequence getCharsSequence() { - return getText(); - } - - @NotNull - @Override - public CharSequence getImmutableCharSequence() { - return getText(); - } - @Override public int getTextLength() { return myText.length(); @@ -124,204 +98,29 @@ public class MockDocument implements DocumentEx { myModStamp = LocalTimeCounter.currentTime(); } - @Override - public void moveText(int srcStart, int srcEnd, int dstOffset) { - // TODO den implement - throw new UnsupportedOperationException(); - } - - @Override - public boolean isWritable() { - return false; - } - @Override public long getModificationStamp() { return myModStamp; } - @Override - public void fireReadOnlyModificationAttempt() { - } - - @Override - public void addDocumentListener(@NotNull DocumentListener listener) { - } - - @Override - public void addDocumentListener(@NotNull DocumentListener listener, @NotNull Disposable parentDisposable) { - } - - @Override - public void removeDocumentListener(@NotNull DocumentListener listener) { - } - - @Override - @NotNull - public RangeMarker createRangeMarker(int startOffset, int endOffset) { - throw new UnsupportedOperationException(); - } - - @Override - @NotNull - public RangeMarker createRangeMarker(int startOffset, int endOffset, boolean surviveOnExternalChange) { - throw new UnsupportedOperationException(); - } - - @Override - public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) { - } - - @Override - public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) { - } - - @Override - @SuppressWarnings("unchecked") - public T getUserData(@NotNull Key key) { - return (T)myUserData.get(key); - } - - @Override - @SuppressWarnings("unchecked") - public void putUserData(@NotNull Key key, T value) { - myUserData.put(key, value); - } - - @Override - public void setStripTrailingSpacesEnabled(boolean isEnabled) { - } - - @Override - public int getLineSeparatorLength(int line) { - return 0; - } - - @Override - @NotNull - public LineIterator createLineIterator() { - throw new UnsupportedOperationException(); - } - @Override public void setModificationStamp(long modificationStamp) { myModStamp = modificationStamp; } - @Override - public void setReadOnly(boolean isReadOnly) { - } - @Override public RangeMarker getRangeGuard(int start, int end) { return null; } - @Override - public void startGuardedBlockChecking() { - } - - @Override - public void stopGuardedBlockChecking() { - } - - @Override - @NotNull - public RangeMarker createGuardedBlock(int startOffset, int endOffset) { - throw new UnsupportedOperationException(); - } - - @Override - public void removeGuardedBlock(@NotNull RangeMarker block) { - } - @Override public RangeMarker getOffsetGuard(int offset) { return null; } - @Override - public void addEditReadOnlyListener(@NotNull EditReadOnlyListener listener) { - } - - @Override - public void removeEditReadOnlyListener(@NotNull EditReadOnlyListener listener) { - } - - @Override - public void suppressGuardedExceptions() { - } - - @Override - public void unSuppressGuardedExceptions() { - - } - - @Override - public boolean isInEventsHandling() { - return false; - } - - @Override - public void clearLineModificationFlags() { - } - - @Override - public boolean removeRangeMarker(@NotNull RangeMarkerEx rangeMarker) { - return false; - } - - @Override - public void registerRangeMarker(@NotNull RangeMarkerEx rangeMarker, - int start, - int end, - boolean greedyToLeft, - boolean greedyToRight, - int layer) { - - } - - @Override - public boolean isInBulkUpdate() { - return false; - } - - @Override - public void setInBulkUpdate(boolean value) { - } - - @Override - public void setCyclicBufferSize(int bufferSize) { - } - - @Override - public void setText(@NotNull final CharSequence text) { - } - @Override @NotNull public RangeMarker createRangeMarker(@NotNull final TextRange textRange) { return createRangeMarker(textRange.getStartOffset(), textRange.getEndOffset()); } - - @Override - @NotNull - public List getGuardedBlocks() { - return Collections.emptyList(); - } - - @Override - public boolean processRangeMarkers(@NotNull Processor processor) { - return false; - } - - @Override - public boolean processRangeMarkersOverlappingWith(int start, int end, @NotNull Processor processor) { - return false; - } - - @Override - public int getModificationSequence() { - return 0; - } }