From 1a83576a1a1a7e02340b7779bb2987654ab14e54 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 21 Aug 2014 17:20:43 +0200 Subject: [PATCH 1/5] =?UTF-8?q?cleanup=20clarify=20=E2=80=94=20"delete"=20?= =?UTF-8?q?could=20be=20applicable=20to=20directory=20also?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/stores/OldStreamProviderAdapter.java | 2 +- .../impl/stores/StateStorageManagerImpl.java | 4 +- .../components/impl/stores/StorageUtil.java | 5 +- .../impl/stores/StreamProvider.java | 5 +- .../openapi/options/SchemesManagerImpl.java | 52 ++++++++----------- .../shelf/CompoundShelfFileProcessor.java | 4 +- 6 files changed, 34 insertions(+), 38 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/OldStreamProviderAdapter.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/OldStreamProviderAdapter.java index 574823767d9b..2120030db2c1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/OldStreamProviderAdapter.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/OldStreamProviderAdapter.java @@ -55,7 +55,7 @@ final class OldStreamProviderAdapter extends StreamProvider implements CurrentUs } @Override - public void deleteFile(@NotNull String fileSpec, @NotNull RoamingType roamingType) { + public void delete(@NotNull String fileSpec, @NotNull RoamingType roamingType) { if (myRoamingType == roamingType) { myProvider.deleteFile(fileSpec, roamingType); } diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java index 1b7da8fc2144..334f9eadfd1f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java @@ -615,11 +615,11 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di } @Override - public void deleteFile(@NotNull String fileSpec, @NotNull RoamingType roamingType) { + public void delete(@NotNull String fileSpec, @NotNull RoamingType roamingType) { for (StreamProvider streamProvider : myStreamProviders) { try { if (streamProvider.isEnabled() && streamProvider.isApplicable(fileSpec, roamingType)) { - streamProvider.deleteFile(fileSpec, roamingType); + streamProvider.delete(fileSpec, roamingType); } } catch (Exception e) { diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java index 73aea37d6444..b6df1bda37f0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java @@ -245,6 +245,7 @@ public class StorageUtil { } } + @NotNull public static BufferExposingByteArrayOutputStream documentToBytes(@NotNull Document document, boolean useSystemLineSeparator) throws IOException { BufferExposingByteArrayOutputStream out = new BufferExposingByteArrayOutputStream(512); OutputStreamWriter writer = new OutputStreamWriter(out, CharsetToolkit.UTF8_CHARSET); @@ -271,9 +272,9 @@ public class StorageUtil { } } - public static void deleteContent(@NotNull StreamProvider provider, @NotNull String fileSpec, @NotNull RoamingType type) { + public static void delete(@NotNull StreamProvider provider, @NotNull String fileSpec, @NotNull RoamingType type) { if (provider.isApplicable(fileSpec, type)) { - provider.deleteFile(fileSpec, type); + provider.delete(fileSpec, type); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StreamProvider.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StreamProvider.java index cf77ee377cf1..ec57d8c63601 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StreamProvider.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StreamProvider.java @@ -47,5 +47,8 @@ public abstract class StreamProvider { return Collections.emptyList(); } - public abstract void deleteFile(@NotNull String fileSpec, @NotNull RoamingType roamingType); + /** + * Delete file or directory + */ + public abstract void delete(@NotNull String fileSpec, @NotNull RoamingType roamingType); } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java index 1c7e768c7d83..2db58ea08d94 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java @@ -34,6 +34,7 @@ import com.intellij.openapi.vfs.VirtualFileAdapter; import com.intellij.openapi.vfs.VirtualFileEvent; import com.intellij.openapi.vfs.newvfs.NewVirtualFile; import com.intellij.util.Alarm; +import com.intellij.util.SmartList; import com.intellij.util.UniqueFileNamesProvider; import com.intellij.util.containers.HashSet; import com.intellij.util.text.UniqueNameGenerator; @@ -292,12 +293,13 @@ public class SchemesManagerImpl readSchemesFromProviders() { - Collection result = new ArrayList(); if (myProvider == null || !myProvider.isEnabled()) { - return result; + return Collections.emptyList(); } + Collection result = new SmartList(); for (String subPath : myProvider.listSubFiles(myFileSpec, myRoamingType)) { if (!subPath.equals(DELETED_XML)) { try { @@ -305,6 +307,7 @@ public class SchemesManagerImpl collectAllFileNames() { - HashSet result = new HashSet(); + Set result = new THashSet(); for (T scheme : mySchemes) { if (scheme instanceof ExternalizableScheme) { ExternalInfo externalInfo = ((ExternalizableScheme)scheme).getExternalInfo(); @@ -382,10 +386,6 @@ public class SchemesManagerImpl strings, final String schemeName) { - return UniqueNameGenerator.generateUniqueName(schemeName, strings); - } - private void loadScheme(final E scheme, boolean forceAdd, final String name) { if (scheme != null && (!myDeletedNames.contains(scheme.getName()) || forceAdd)) { T existing = findSchemeByName(scheme.getName()); @@ -469,13 +469,6 @@ public class SchemesManagerImpl Date: Fri, 22 Aug 2014 12:10:12 +0200 Subject: [PATCH 2/5] don't do execs --- .../intellij/xdebugger/impl/frame/XVariablesViewBase.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java index 54fb0e40a8db..a3b44c5b6486 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java @@ -97,7 +97,7 @@ public abstract class XVariablesViewBase extends XDebugView { public void selectionChanged(SelectionEvent e) { final String text = editor.getDocument().getText(e.getNewRange()); final XDebuggerEvaluator evaluator = stackFrame.getEvaluator(); - if (evaluator != null && !StringUtil.isEmpty(text)) { + if (evaluator != null && !StringUtil.isEmpty(text) && !text.contains("exec(")) { evaluator.evaluate(text, new XEvaluationCallbackBase() { @Override public void evaluated(@NotNull XValue result) { @@ -111,7 +111,8 @@ public abstract class XVariablesViewBase extends XDebugView { SimpleColoredComponent component = HintUtil.createInformationComponent(); text.appendToComponent(component); String str = text.toString(); - if ("undefined".equals(str) || str.startsWith("Cannot find local variable") || str.startsWith("Invalid expression")) { + if ("undefined".equals(str) || str.startsWith("Cannot find local variable") + || str.startsWith("Invalid expression")) { return; //todo[kb] this is temporary solution } HintManager.getInstance().hideAllHints(); From ac4005f4db3af580c38ec64cda868f86a0670205 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 22 Aug 2014 14:30:58 +0400 Subject: [PATCH 3/5] focus log expression field if condition is not enabled --- .../impl/breakpoints/ui/XBreakpointActionsPanel.java | 7 +++++++ .../ui/XLightBreakpointPropertiesPanel.java | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java index 36584d1105d4..de4d45f483bf 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java @@ -122,6 +122,13 @@ public class XBreakpointActionsPanel> extends X } } + JComponent getDefaultFocusComponent() { + if (myLogExpressionComboBox != null && myLogExpressionComboBox.getComboBox().isEnabled()) { + return myLogExpressionComboBox.getEditorComponent(); + } + return null; + } + public void dispose() { } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java index 75cbb569ddfd..4e91c27f011d 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java @@ -180,8 +180,15 @@ public class XLightBreakpointPropertiesPanel> i myMainPanel.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent event) { - if (myConditionComboBox != null) { - IdeFocusManager.findInstance().requestFocus(myConditionComboBox.getEditorComponent(), false); + JComponent compToFocus; + if (myConditionComboBox != null && myConditionComboBox.getComboBox().isEnabled()) { + compToFocus = myConditionComboBox.getEditorComponent(); + } + else { + compToFocus = myActionsPanel.getDefaultFocusComponent(); + } + if (compToFocus != null) { + IdeFocusManager.findInstance().requestFocus(compToFocus, false); } } }); From 7dd149e9685aaa8b27d1ad1d310ac6b4ca7674e1 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 22 Aug 2014 12:41:45 +0200 Subject: [PATCH 4/5] rough workaround for ++, --, and = side effects --- .../com/intellij/xdebugger/impl/frame/XVariablesViewBase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java index a3b44c5b6486..d4bd27c30d9b 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesViewBase.java @@ -97,7 +97,8 @@ public abstract class XVariablesViewBase extends XDebugView { public void selectionChanged(SelectionEvent e) { final String text = editor.getDocument().getText(e.getNewRange()); final XDebuggerEvaluator evaluator = stackFrame.getEvaluator(); - if (evaluator != null && !StringUtil.isEmpty(text) && !text.contains("exec(")) { + if (evaluator != null && !StringUtil.isEmpty(text) + && !(text.contains("exec(") || text.contains("++") || text.contains("--") || text.contains("="))) { evaluator.evaluate(text, new XEvaluationCallbackBase() { @Override public void evaluated(@NotNull XValue result) { From fbaf5da92b6b80d75adac8167795660dd9ca3860 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 22 Aug 2014 15:01:49 +0400 Subject: [PATCH 5/5] platform: UI traversal step is in fact headless --- .../src/com/intellij/ide/ui/search/TraverseUIStarter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java b/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java index a442dd1791c7..37248fe8a909 100644 --- a/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java +++ b/platform/lang-impl/src/com/intellij/ide/ui/search/TraverseUIStarter.java @@ -51,7 +51,6 @@ import java.util.TreeSet; */ @SuppressWarnings({"CallToPrintStackTrace", "SynchronizeOnThis"}) public class TraverseUIStarter extends ApplicationStarterEx { - private String OUTPUT_PATH; @NonNls private static final String OPTIONS = "options"; @NonNls private static final String CONFIGURABLE = "configurable"; @NonNls private static final String ID = "id"; @@ -61,9 +60,11 @@ public class TraverseUIStarter extends ApplicationStarterEx { @NonNls private static final String PATH = "path"; @NonNls private static final String HIT = "hit"; + private String OUTPUT_PATH; + @Override public boolean isHeadless() { - return false; + return true; } @Override