From b95ae2420d0ee83d777a02e4ce761cb27e6ea374 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 22 Feb 2016 12:33:46 +0100 Subject: [PATCH] cleanup --- .../xdebugger/impl/XDebugSessionImpl.java | 134 +++++++----------- .../impl/XDebuggerHistoryManager.java | 12 +- .../xdebugger/impl/XDebuggerManagerImpl.java | 16 +-- .../xdebugger/impl/XDebuggerUtilImpl.java | 2 +- .../impl/XDebuggerWatchesManager.java | 12 +- .../actions/AttachToLocalProcessAction.java | 56 +++----- .../impl/actions/MuteBreakpointAction.java | 5 +- .../impl/actions/ViewBreakpointsAction.java | 4 +- .../XDebuggerEvaluateActionHandler.java | 18 +-- .../XDebuggerMuteBreakpointsHandler.java | 7 +- .../XDebuggerRunToCursorActionHandler.java | 10 +- .../XDebuggerToggleActionHandler.java | 13 +- .../XToggleLineBreakpointActionHandler.java | 4 +- .../BreakpointsFavoriteListProvider.java | 9 +- .../RemoveBreakpointGutterIconAction.java | 3 +- .../impl/breakpoints/XBreakpointItem.java | 6 + .../breakpoints/XBreakpointManagerImpl.java | 32 ++--- .../breakpoints/XBreakpointPanelProvider.java | 5 +- .../breakpoints/XLineBreakpointManager.java | 96 +++++-------- .../evaluate/CodeFragmentInputComponent.java | 1 + .../evaluate/XDebuggerEditorLinePainter.java | 25 +--- .../impl/frame/WatchInplaceEditor.java | 9 +- .../impl/frame/XDebugViewSessionListener.java | 9 +- .../impl/frame/XStandaloneVariablesView.java | 11 +- .../xdebugger/impl/ui/DebuggerColorsPage.java | 9 +- .../impl/ui/DebuggerSessionTabBase.java | 68 ++++----- .../xdebugger/impl/ui/DebuggerUIUtil.java | 109 +++++--------- .../impl/ui/ExecutionPointHighlighter.java | 87 +++++------- .../xdebugger/impl/ui/XDebugSessionTab.java | 11 +- .../impl/ui/tree/SetValueInplaceEditor.java | 44 ++---- .../impl/ui/tree/TreeInplaceEditor.java | 79 ++++------- .../xdebugger/impl/ui/tree/XDebuggerTree.java | 19 ++- .../ui/tree/XDebuggerTreeInplaceEditor.java | 8 +- .../impl/ui/tree/XDebuggerTreePanel.java | 10 +- .../impl/ui/tree/XDebuggerTreeRestorer.java | 5 +- .../impl/ui/tree/XInspectDialog.java | 3 +- .../ui/tree/actions/XAddToWatchesAction.java | 16 +-- .../tree/actions/XFetchValueActionBase.java | 11 +- .../tree/actions/XJumpToSourceActionBase.java | 28 ++-- .../impl/ui/tree/actions/XSetValueAction.java | 4 +- 40 files changed, 389 insertions(+), 621 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java index 55881c8374ce..852576c02cec 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -29,7 +29,6 @@ import com.intellij.execution.ui.ConsoleView; import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.execution.ui.RunnerLayoutUi; -import com.intellij.notification.Notification; import com.intellij.notification.NotificationGroup; import com.intellij.notification.NotificationListener; import com.intellij.openapi.Disposable; @@ -48,7 +47,6 @@ import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.ui.AppUIUtil; -import com.intellij.util.Consumer; import com.intellij.util.EventDispatcher; import com.intellij.util.SmartList; import com.intellij.util.containers.SmartHashSet; @@ -76,7 +74,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; @@ -395,12 +392,7 @@ public class XDebugSessionImpl implements XDebugSession { private > void handleBreakpoint(final XBreakpointHandler handler, final B b, final boolean register, final boolean temporary) { if (register) { - boolean active = ApplicationManager.getApplication().runReadAction(new Computable() { - @Override - public Boolean compute() { - return isBreakpointActive(b); - } - }); + boolean active = ApplicationManager.getApplication().runReadAction((Computable)() -> isBreakpointActive(b)); if (active) { synchronized (myRegisteredBreakpoints) { myRegisteredBreakpoints.put(b, new CustomizedBreakpointPresentation()); @@ -567,12 +559,9 @@ public class XDebugSessionImpl implements XDebugSession { myTopFramePosition = null; myActiveNonLineBreakpoint = null; updateExecutionPosition(); - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - if (mySessionTab != null) { - mySessionTab.getUi().clearAttractionBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); - } + UIUtil.invokeLaterIfNeeded(() -> { + if (mySessionTab != null) { + mySessionTab.getUi().clearAttractionBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); } }); myDispatcher.getMulticaster().sessionResumed(); @@ -716,20 +705,12 @@ public class XDebugSessionImpl implements XDebugSession { positionReachedInternal(suspendContext); - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - if (mySessionTab != null) { - if (XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isShowDebuggerOnBreakpoint()) { - mySessionTab.toFront(true, new Runnable() { - @Override - public void run() { - updateExecutionPosition(); - } - }); - } - mySessionTab.getUi().attractBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); + UIUtil.invokeLaterIfNeeded(() -> { + if (mySessionTab != null) { + if (XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isShowDebuggerOnBreakpoint()) { + mySessionTab.toFront(true, this::updateExecutionPosition); } + mySessionTab.getUi().attractBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); } }); @@ -779,18 +760,15 @@ public class XDebugSessionImpl implements XDebugSession { } private void printMessage(final String message, final String hyperLinkText, @Nullable final HyperlinkInfo info) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - myConsoleView.print(message, ConsoleViewContentType.SYSTEM_OUTPUT); - if (info != null) { - myConsoleView.printHyperlink(hyperLinkText, info); - } - else if (hyperLinkText != null) { - myConsoleView.print(hyperLinkText, ConsoleViewContentType.SYSTEM_OUTPUT); - } - myConsoleView.print("\n", ConsoleViewContentType.SYSTEM_OUTPUT); + AppUIUtil.invokeOnEdt(() -> { + myConsoleView.print(message, ConsoleViewContentType.SYSTEM_OUTPUT); + if (info != null) { + myConsoleView.printHyperlink(hyperLinkText, info); } + else if (hyperLinkText != null) { + myConsoleView.print(hyperLinkText, ConsoleViewContentType.SYSTEM_OUTPUT); + } + myConsoleView.print("\n", ConsoleViewContentType.SYSTEM_OUTPUT); }); } @@ -811,12 +789,9 @@ public class XDebugSessionImpl implements XDebugSession { updateExecutionPosition(); if (myShowTabOnSuspend.compareAndSet(true, false)) { - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - initSessionTab(null); - showSessionTab(); - } + UIUtil.invokeLaterIfNeeded(() -> { + initSessionTab(null); + showSessionTab(); }); } @@ -869,46 +844,38 @@ public class XDebugSessionImpl implements XDebugSession { } finally { //noinspection unchecked - myDebugProcess.stopAsync().done(new Consumer() { - @Override - public void consume(Object aVoid) { - if (!myProject.isDisposed()) { - myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); - } + myDebugProcess.stopAsync().done(aVoid -> { + if (!myProject.isDisposed()) { + myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); + } - if (mySessionTab != null) { - ((XWatchesViewImpl)mySessionTab.getWatchesView()).updateSessionData(); - mySessionTab.detachFromSession(); - } - else if (myConsoleView != null) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - Disposer.dispose(myConsoleView); - } - }); - } + if (mySessionTab != null) { + ((XWatchesViewImpl)mySessionTab.getWatchesView()).updateSessionData(); + mySessionTab.detachFromSession(); + } + else if (myConsoleView != null) { + AppUIUtil.invokeOnEdt(() -> Disposer.dispose(myConsoleView)); + } - myTopFramePosition = null; - myCurrentExecutionStack = null; - myCurrentStackFrame = null; - mySuspendContext = null; + myTopFramePosition = null; + myCurrentExecutionStack = null; + myCurrentStackFrame = null; + mySuspendContext = null; - updateExecutionPosition(); + updateExecutionPosition(); - if (myValueMarkers != null) { - myValueMarkers.clear(); - } - if (XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isUnmuteOnStop()) { - mySessionData.setBreakpointsMuted(false); - } - myDebuggerManager.removeSession(XDebugSessionImpl.this); - myDispatcher.getMulticaster().sessionStopped(); - myProject.putUserData(XDebuggerEditorLinePainter.CACHE, null); + if (myValueMarkers != null) { + myValueMarkers.clear(); + } + if (XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isUnmuteOnStop()) { + mySessionData.setBreakpointsMuted(false); + } + myDebuggerManager.removeSession(this); + myDispatcher.getMulticaster().sessionStopped(); + myProject.putUserData(XDebuggerEditorLinePainter.CACHE, null); - synchronized (myRegisteredBreakpoints) { - myRegisteredBreakpoints.clear(); - } + synchronized (myRegisteredBreakpoints) { + myRegisteredBreakpoints.clear(); } }); } @@ -943,12 +910,7 @@ public class XDebugSessionImpl implements XDebugSession { @Override public void reportMessage(@NotNull final String message, @NotNull final MessageType type, @Nullable final HyperlinkListener listener) { - NotificationListener notificationListener = listener == null ? null : new NotificationListener() { - @Override - public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { - listener.hyperlinkUpdate(event); - } - }; + NotificationListener notificationListener = listener == null ? null : (NotificationListener)(notification, event) -> listener.hyperlinkUpdate(event); NOTIFICATION_GROUP.createNotification("", message, type.toNotificationType(), notificationListener).notify(myProject); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java index d6c9025e8b90..6dfa1f1f5f72 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -17,14 +17,17 @@ package com.intellij.xdebugger.impl; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.containers.ContainerUtil; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; /** * @author nik @@ -58,7 +61,6 @@ public class XDebuggerHistoryManager { } public List getRecentExpressions(@NonNls String id) { - LinkedList list = myRecentExpressions.get(id); - return list != null ? list : Collections.emptyList(); + return ContainerUtil.notNullize(myRecentExpressions.get(id)); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java index 291b4e60f9fd..8e7f399072b9 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java @@ -27,7 +27,6 @@ import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.execution.ui.RunContentManager; import com.intellij.execution.ui.RunContentWithExecutorListener; import com.intellij.ide.DataManager; -import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.*; import com.intellij.openapi.editor.Document; @@ -41,6 +40,7 @@ import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.SmartList; +import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBus; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.xmlb.annotations.Property; @@ -59,7 +59,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.*; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicReference; /** @@ -247,12 +250,7 @@ public class XDebuggerManagerImpl extends XDebuggerManager if (descriptor != null) { // in test-mode RunContentWithExecutorListener.contentRemoved events are not sent (see RunContentManagerImpl.showRunContent) // so we make sure the mySessions and mySessionData are cleared correctly when session is disposed - Disposer.register(descriptor, new Disposable() { - @Override - public void dispose() { - mySessions.remove(session.getDebugProcess().getProcessHandler()); - } - }); + Disposer.register(descriptor, () -> mySessions.remove(session.getDebugProcess().getProcessHandler())); } if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode() && XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) { @@ -312,7 +310,7 @@ public class XDebuggerManagerImpl extends XDebuggerManager list.add(processClass.cast(process)); } } - return list == null ? Collections.emptyList() : list; + return ContainerUtil.notNullize(list); } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java index 8fc2d2626c4f..5bf1ef7d5401 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java @@ -489,7 +489,7 @@ public class XDebuggerUtilImpl extends XDebuggerUtil { @Override public > List> getGroupingByFileRuleAsList() { - return Collections.singletonList(this.getGroupingByFileRule()); + return Collections.singletonList(getGroupingByFileRule()); } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerWatchesManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerWatchesManager.java index 4bcc6753925e..0f4d1649025c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerWatchesManager.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerWatchesManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -16,7 +16,6 @@ package com.intellij.xdebugger.impl; import com.intellij.openapi.components.PersistentStateComponent; -import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.annotations.AbstractCollection; import com.intellij.util.xmlb.annotations.Attribute; @@ -69,12 +68,7 @@ public class XDebuggerWatchesManager implements PersistentStateComponent() { - @Override - public XExpression fun(WatchState state) { - return state.toXExpression(); - } - }, new XExpression[0]); + XExpressionState::toXExpression, new XExpression[0]); watches.put(expressionState.myName, expressions); } } @@ -100,7 +94,7 @@ public class XDebuggerWatchesManager implements PersistentStateComponent> HISTORY_KEY = Key.create("AttachToLocalProcessAction.HISTORY_KEY"); @@ -82,23 +84,20 @@ public class AttachToLocalProcessAction extends AnAction { final ListPopup popup = JBPopupFactory.getInstance().createListPopup(step); final JList mainList = ((ListPopupImpl)popup).getList(); - ListSelectionListener listener = new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent event) { - if (event.getValueIsAdjusting()) return; + ListSelectionListener listener = event -> { + if (event.getValueIsAdjusting()) return; - Object item = ((JList)event.getSource()).getSelectedValue(); + Object item = ((JList)event.getSource()).getSelectedValue(); - // if a sub-list is closed, fallback to the selected value from the main list - if (item == null) { - item = mainList.getSelectedValue(); - } + // if a sub-list is closed, fallback to the selected value from the main list + if (item == null) { + item = mainList.getSelectedValue(); + } - if (item instanceof AttachItem) { - String debuggerName = ((AttachItem)item).getSelectedDebugger().getDebuggerDisplayName(); - debuggerName = StringUtil.shortenTextWithEllipsis(debuggerName, 50, 0); - ((ListPopupImpl)popup).setCaption(XDebuggerBundle.message("xdebugger.attach.toLocal.popup.adText", debuggerName)); - } + if (item instanceof AttachItem) { + String debuggerName = ((AttachItem)item).getSelectedDebugger().getDebuggerDisplayName(); + debuggerName = StringUtil.shortenTextWithEllipsis(debuggerName, 50, 0); + ((ListPopupImpl)popup).setCaption(XDebuggerBundle.message("xdebugger.attach.toLocal.popup.adText", debuggerName)); } }; popup.addListSelectionListener(listener); @@ -133,23 +132,13 @@ public class AttachToLocalProcessAction extends AnAction { } ArrayList sortedGroups = new ArrayList(groupWithItems.keySet()); - Collections.sort(sortedGroups, new Comparator() { - @Override - public int compare(XLocalAttachGroup a, XLocalAttachGroup b) { - return a.getOrder() - b.getOrder(); - } - }); + Collections.sort(sortedGroups, (a, b) -> a.getOrder() - b.getOrder()); List currentItems = new ArrayList(); for (final XLocalAttachGroup eachGroup : sortedGroups) { List>> sortedItems = new ArrayList>>(groupWithItems.get(eachGroup)); - Collections.sort(sortedItems, new Comparator>>() { - @Override - public int compare(Pair> a, Pair> b) { - return eachGroup.compare(project, a.first, b.first); - } - }); + Collections.sort(sortedItems, (a, b) -> eachGroup.compare(project, a.first, b.first)); boolean first = true; for (Pair> eachItem : sortedItems) { @@ -208,7 +197,7 @@ public class AttachToLocalProcessAction extends AnAction { @NotNull public static List getHistory(@NotNull Project project) { LinkedHashMap history = project.getUserData(HISTORY_KEY); - return history == null ? Collections.emptyList() + return history == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList(history.values())); } @@ -296,11 +285,8 @@ public class AttachToLocalProcessAction extends AnAction { mySelectedDebugger = selectedDebugger; if (debuggers.size() > 1) { - mySubItems = ContainerUtil.map(debuggers, new Function() { - @Override - public AttachItem fun(XLocalAttachDebugger debugger) { - return new AttachItem(myGroup, false, myProcessInfo, Collections.singletonList(debugger)); - } + mySubItems = ContainerUtil.map(debuggers, debugger -> { + return new AttachItem(myGroup, false, myProcessInfo, Collections.singletonList(debugger)); }); } else { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MuteBreakpointAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MuteBreakpointAction.java index 3ad8698f026f..85687cb8697f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MuteBreakpointAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/MuteBreakpointAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull; * @author nik */ public class MuteBreakpointAction extends ToggleAction { + @Override public boolean isSelected(final AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { @@ -40,6 +41,7 @@ public class MuteBreakpointAction extends ToggleAction { return false; } + @Override public void setSelected(final AnActionEvent e, final boolean state) { Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { @@ -53,6 +55,7 @@ public class MuteBreakpointAction extends ToggleAction { } } + @Override public void update(@NotNull final AnActionEvent e) { super.update(e); Project project = e.getData(CommonDataKeys.PROJECT); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java index 6d8d43e6db21..56fba1289a2e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -40,6 +40,7 @@ public class ViewBreakpointsAction extends AnAction implements AnAction.Transpar myInitialBreakpoint = initialBreakpoint; } + @Override public void actionPerformed(AnActionEvent e) { DataContext dataContext = e.getDataContext(); Project project = CommonDataKeys.PROJECT.getData(dataContext); @@ -56,6 +57,7 @@ public class ViewBreakpointsAction extends AnAction implements AnAction.Transpar myInitialBreakpoint = null; } + @Override public void update(AnActionEvent event){ Presentation presentation = event.getPresentation(); Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerEvaluateActionHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerEvaluateActionHandler.java index 65f0aeadde50..775e452f4e3b 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerEvaluateActionHandler.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerEvaluateActionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -25,7 +25,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.AppUIUtil; -import com.intellij.util.Consumer; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.XSourcePosition; @@ -76,17 +75,10 @@ public class XDebuggerEvaluateActionHandler extends XDebuggerActionHandler { if (text == null) { XValue value = XDebuggerTreeActionBase.getSelectedValue(dataContext); if (value != null) { - value.calculateEvaluationExpression().done(new Consumer() { - @Override - public void consume(final XExpression expression) { - if (expression != null) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - showDialog(session, file, editorsProvider, stackFrame, evaluator, expression); - } - }); - } + value.calculateEvaluationExpression() + .done(expression -> { + if (expression != null) { + AppUIUtil.invokeOnEdt(() -> showDialog(session, file, editorsProvider, stackFrame, evaluator, expression)); } }); return; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerMuteBreakpointsHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerMuteBreakpointsHandler.java index 74bb43f12354..d4f1f87b540a 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerMuteBreakpointsHandler.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerMuteBreakpointsHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -15,8 +15,8 @@ */ package com.intellij.xdebugger.impl.actions.handlers; -import com.intellij.xdebugger.XDebugSession; import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.impl.ui.XDebugSessionData; import org.jetbrains.annotations.Nullable; @@ -24,10 +24,12 @@ import org.jetbrains.annotations.Nullable; * @author nik */ public class XDebuggerMuteBreakpointsHandler extends XDebuggerToggleActionHandler { + @Override protected boolean isEnabled(@Nullable final XDebugSession session, final AnActionEvent event) { return true; } + @Override protected boolean isSelected(@Nullable final XDebugSession session, final AnActionEvent event) { if (session != null) { return session.areBreakpointsMuted(); @@ -41,6 +43,7 @@ public class XDebuggerMuteBreakpointsHandler extends XDebuggerToggleActionHandle return false; } + @Override protected void setSelected(@Nullable final XDebugSession session, final AnActionEvent event, final boolean state) { if (session != null) { session.setBreakpointMuted(state); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerRunToCursorActionHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerRunToCursorActionHandler.java index 66684da99205..856d03c44032 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerRunToCursorActionHandler.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerRunToCursorActionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -15,11 +15,11 @@ */ package com.intellij.xdebugger.impl.actions.handlers; -import com.intellij.xdebugger.impl.actions.XDebuggerSuspendedActionHandler; -import com.intellij.xdebugger.impl.XDebuggerUtilImpl; +import com.intellij.openapi.actionSystem.DataContext; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XSourcePosition; -import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.xdebugger.impl.XDebuggerUtilImpl; +import com.intellij.xdebugger.impl.actions.XDebuggerSuspendedActionHandler; import org.jetbrains.annotations.NotNull; /** @@ -32,10 +32,12 @@ public class XDebuggerRunToCursorActionHandler extends XDebuggerSuspendedActionH myIgnoreBreakpoints = ignoreBreakpoints; } + @Override protected boolean isEnabled(final @NotNull XDebugSession session, final DataContext dataContext) { return super.isEnabled(session, dataContext) && XDebuggerUtilImpl.getCaretPosition(session.getProject(), dataContext) != null; } + @Override protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) { XSourcePosition position = XDebuggerUtilImpl.getCaretPosition(session.getProject(), dataContext); if (position != null) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerToggleActionHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerToggleActionHandler.java index b76970504030..8e827d48d200 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerToggleActionHandler.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XDebuggerToggleActionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -15,11 +15,11 @@ */ package com.intellij.xdebugger.impl.actions.handlers; -import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler; -import com.intellij.xdebugger.XDebuggerManager; -import com.intellij.xdebugger.XDebugSession; -import com.intellij.openapi.project.Project; import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.Project; +import com.intellij.xdebugger.XDebugSession; +import com.intellij.xdebugger.XDebuggerManager; +import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -27,16 +27,19 @@ import org.jetbrains.annotations.Nullable; * @author nik */ public abstract class XDebuggerToggleActionHandler extends DebuggerToggleActionHandler { + @Override public final boolean isEnabled(@NotNull final Project project, final AnActionEvent event) { XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); return isEnabled(session, event); } + @Override public boolean isSelected(@NotNull final Project project, final AnActionEvent event) { XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); return isSelected(session, event); } + @Override public void setSelected(@NotNull final Project project, final AnActionEvent event, final boolean state) { XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); setSelected(session, event, state); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XToggleLineBreakpointActionHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XToggleLineBreakpointActionHandler.java index b9a8beafed14..376eafa6627c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XToggleLineBreakpointActionHandler.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/handlers/XToggleLineBreakpointActionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -44,6 +44,7 @@ public class XToggleLineBreakpointActionHandler extends DebuggerActionHandler { myTemporary = temporary; } + @Override public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) { XLineBreakpointType[] breakpointTypes = XDebuggerUtil.getInstance().getLineBreakpointTypes(); final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager(); @@ -59,6 +60,7 @@ public class XToggleLineBreakpointActionHandler extends DebuggerActionHandler { return false; } + @Override public void perform(@NotNull final Project project, final AnActionEvent event) { Editor editor = event.getData(CommonDataKeys.EDITOR); // do not toggle more than once on the same line diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java index 11be05fd9852..1525374012b6 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsFavoriteListProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -56,12 +56,7 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid private final Set myRulesEnabled = new TreeSet(XBreakpointGroupingRule.PRIORITY_COMPARATOR); - private final SingleAlarm myRebuildAlarm = new SingleAlarm(new Runnable() { - @Override - public void run() { - updateChildren(); - } - }, 100); + private final SingleAlarm myRebuildAlarm = new SingleAlarm(this::updateChildren, 100); private final FavoritesManager myFavoritesManager; public BreakpointsFavoriteListProvider(Project project, FavoritesManager favoritesManager) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/RemoveBreakpointGutterIconAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/RemoveBreakpointGutterIconAction.java index c248038f8d78..ed699ea6bbf6 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/RemoveBreakpointGutterIconAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/RemoveBreakpointGutterIconAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -32,6 +32,7 @@ class RemoveBreakpointGutterIconAction extends DumbAwareAction { copyShortcutFrom(action); } + @Override public void actionPerformed(final AnActionEvent e) { XDebuggerUtil.getInstance().removeBreakpoint(myBreakpoint.getProject(), myBreakpoint); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointItem.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointItem.java index 4616c9901410..9557257ad5e6 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointItem.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointItem.java @@ -52,6 +52,7 @@ class XBreakpointItem extends BreakpointItem { setupGenericRenderer(renderer, false); } + @Override public void setupGenericRenderer(SimpleColoredComponent renderer, boolean plainView) { if (plainView) { renderer.setIcon(getIcon()); @@ -65,6 +66,7 @@ class XBreakpointItem extends BreakpointItem { } } + @Override public String getDisplayText() { return XBreakpointUtil.getShortText(myBreakpoint); } @@ -74,6 +76,7 @@ class XBreakpointItem extends BreakpointItem { return ((XBreakpointBase)myBreakpoint).getUserDescription(); } + @Override public Icon getIcon() { return ((XBreakpointBase)myBreakpoint).getIcon(); } @@ -95,6 +98,7 @@ class XBreakpointItem extends BreakpointItem { } } + @Override public void doUpdateDetailView(DetailView panel, boolean editorOnly) { XBreakpointBase breakpoint = (XBreakpointBase)myBreakpoint; Project project = breakpoint.getProject(); @@ -159,6 +163,7 @@ class XBreakpointItem extends BreakpointItem { public void removed(Project project) { final XBreakpointManagerImpl breakpointManager = getManager(); new WriteAction() { + @Override protected void run(@NotNull final Result result) { breakpointManager.removeBreakpoint(myBreakpoint); } @@ -195,6 +200,7 @@ class XBreakpointItem extends BreakpointItem { } } + @Override public void dispose() { if (myPropertiesPanel != null) { myPropertiesPanel.dispose(); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java index b048d19bfc9c..e9b95b1b2b03 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java @@ -73,12 +73,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta myLineBreakpointManager = new XLineBreakpointManager(project, myDependentBreakpointManager, startupManager); if (!project.isDefault()) { if (!ApplicationManager.getApplication().isUnitTestMode()) { - HttpVirtualFileListener httpVirtualFileListener = new HttpVirtualFileListener() { - @Override - public void fileDownloaded(@NotNull final VirtualFile file) { - updateBreakpointInFile(file); - } - }; + HttpVirtualFileListener httpVirtualFileListener = this::updateBreakpointInFile; HttpFileSystem.getInstance().addFileListener(httpVirtualFileListener, project); } for (XBreakpointType type : XBreakpointUtil.getBreakpointTypes()) { @@ -88,14 +83,11 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta } private void updateBreakpointInFile(final VirtualFile file) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - for (XBreakpointBase breakpoint : getAllBreakpoints()) { - XSourcePosition position = breakpoint.getSourcePosition(); - if (position != null && Comparing.equal(position.getFile(), file)) { - fireBreakpointChanged(breakpoint); - } + ApplicationManager.getApplication().invokeLater(() -> { + for (XBreakpointBase breakpoint : getAllBreakpoints()) { + XSourcePosition position = breakpoint.getSourcePosition(); + if (position != null && Comparing.equal(position.getFile(), file)) { + fireBreakpointChanged(breakpoint); } } }); @@ -249,7 +241,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta public > Collection getBreakpoints(@NotNull final XBreakpointType type) { ApplicationManager.getApplication().assertReadAccessAllowed(); Collection> breakpoints = myBreakpoints.get(type); - Collection regular = breakpoints != null ? Collections.unmodifiableCollection((Collection)breakpoints) : Collections.emptyList(); + Collection regular = breakpoints != null ? Collections.unmodifiableCollection((Collection)breakpoints) : Collections.emptyList(); final XBreakpointBase defaultBreakpoint = myDefaultBreakpoints.get(type); if (defaultBreakpoint == null) return regular; @@ -456,13 +448,9 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta @Nullable private

XBreakpoint

createDefaultBreakpoint(final XBreakpointType, P> type) { - return type.createDefaultBreakpoint(new XBreakpointType.XBreakpointCreator

() { - @NotNull - @Override - public XBreakpoint

createBreakpoint(@Nullable P properties) { - //noinspection unchecked - return XBreakpointManagerImpl.this.createBreakpoint((XBreakpointType, P>)type, properties, false, true); - } + return type.createDefaultBreakpoint(properties -> { + //noinspection unchecked + return createBreakpoint((XBreakpointType, P>)type, properties, false, true); }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointPanelProvider.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointPanelProvider.java index 5a4dc383909e..2624099b144e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointPanelProvider.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointPanelProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -81,10 +81,12 @@ public class XBreakpointPanelProvider extends BreakpointPanelProvider findBreakpoint(@NotNull final Project project, @NotNull final Document document, final int offset) { XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager(); @@ -114,6 +116,7 @@ public class XBreakpointPanelProvider extends BreakpointPanelProvider myDependentBreakpointManager.removeListener(myDependentBreakpointListener)); VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileUrlChangeAdapter() { @Override protected void fileUrlChanged(String oldUrl, String newUrl) { @@ -129,12 +120,9 @@ public class XLineBreakpointManager { public void updateBreakpointsUI() { if (myProject.isDefault()) return; - Runnable runnable = new DumbAwareRunnable() { - @Override - public void run() { - for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) { - breakpoint.updateUI(); - } + Runnable runnable = () -> { + for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) { + breakpoint.updateUI(); } }; @@ -195,12 +183,9 @@ public class XLineBreakpointManager { return; } - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - for (XBreakpoint breakpoint : toRemove) { - XDebuggerManager.getInstance(myProject).getBreakpointManager().removeBreakpoint(breakpoint); - } + ApplicationManager.getApplication().runWriteAction(() -> { + for (XBreakpoint breakpoint : toRemove) { + XDebuggerManager.getInstance(myProject).getBreakpointManager().removeBreakpoint(breakpoint); } }); } @@ -287,44 +272,35 @@ public class XLineBreakpointManager { return; } - PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Runnable() { - @Override - public void run() { - final int line = EditorUtil.yPositionToLogicalLine(editor, mouseEvent); - final Document document = editor.getDocument(); - final VirtualFile file = FileDocumentManager.getInstance().getFile(document); - if (line >= 0 && line < document.getLineCount() && file != null) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - if (!myProject.isDisposed() && myProject.isInitialized() && file.isValid()) { - ActionManagerEx.getInstanceEx().fireBeforeActionPerformed(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT, e.getMouseEvent()); + PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(() -> { + final int line = EditorUtil.yPositionToLogicalLine(editor, mouseEvent); + final Document document = editor.getDocument(); + final VirtualFile file = FileDocumentManager.getInstance().getFile(document); + if (line >= 0 && line < document.getLineCount() && file != null) { + ApplicationManager.getApplication().invokeLater(() -> { + if (!myProject.isDisposed() && myProject.isInitialized() && file.isValid()) { + ActionManagerEx.getInstanceEx().fireBeforeActionPerformed(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT, e.getMouseEvent()); - XBreakpointUtil - .toggleLineBreakpoint(myProject, XSourcePositionImpl.create(file, line), editor, mouseEvent.isAltDown(), false) - .done(new Consumer() { - @Override - public void consume(XLineBreakpoint breakpoint) { - if (!mouseEvent.isAltDown() && mouseEvent.isShiftDown() && breakpoint != null) { - breakpoint.setSuspendPolicy(SuspendPolicy.NONE); - String selection = editor.getSelectionModel().getSelectedText(); - if (selection != null) { - breakpoint.setLogExpression(selection); - } - else { - breakpoint.setLogMessage(true); - } - // edit breakpoint - DebuggerUIUtil - .showXBreakpointEditorBalloon(myProject, mouseEvent.getPoint(), ((EditorEx)editor).getGutterComponentEx(), - false, breakpoint); - } - } - }); - } - } - }); - } + XBreakpointUtil + .toggleLineBreakpoint(myProject, XSourcePositionImpl.create(file, line), editor, mouseEvent.isAltDown(), false) + .done(breakpoint -> { + if (!mouseEvent.isAltDown() && mouseEvent.isShiftDown() && breakpoint != null) { + breakpoint.setSuspendPolicy(SuspendPolicy.NONE); + String selection = editor.getSelectionModel().getSelectedText(); + if (selection != null) { + breakpoint.setLogExpression(selection); + } + else { + breakpoint.setLogMessage(true); + } + // edit breakpoint + DebuggerUIUtil + .showXBreakpointEditorBalloon(myProject, mouseEvent.getPoint(), ((EditorEx)editor).getGutterComponentEx(), + false, breakpoint); + } + }); + } + }); } }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/CodeFragmentInputComponent.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/CodeFragmentInputComponent.java index 0bf0d28dd3e1..7039fd3eaf46 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/CodeFragmentInputComponent.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/CodeFragmentInputComponent.java @@ -64,6 +64,7 @@ public class CodeFragmentInputComponent extends EvaluationInputComponent { mySplitterProportionKey = splitterProportionKey; } + @Override @NotNull protected XDebuggerEditorBase getInputEditor() { return myMultilineEditor; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java index 4691c15b5a61..a7f41e3b8c2e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEditorLinePainter.java @@ -26,7 +26,6 @@ import com.intellij.openapi.util.Key; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.*; -import com.intellij.util.NotNullProducer; import com.intellij.util.containers.ObjectLongHashMap; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerManager; @@ -52,9 +51,9 @@ import java.util.List; */ public class XDebuggerEditorLinePainter extends EditorLinePainter { public static final Key> CACHE = Key.create("debug.inline.variables.cache"); - // we want to limit number of line extentions to avoid very slow painting + // we want to limit number of line extensions to avoid very slow painting // the constant is rather random (feel free to adjust it upon getting a new information) - private static final int LINE_EXTENTIONS_MAX_COUNT = 200; + private static final int LINE_EXTENSIONS_MAX_COUNT = 200; @Override public Collection getLineExtensions(@NotNull Project project, @NotNull VirtualFile file, int lineNumber) { @@ -145,7 +144,7 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter { for (VariableText text : result) { infos.addAll(text.infos); } - return infos.size() > LINE_EXTENTIONS_MAX_COUNT ? infos.subList(0, LINE_EXTENTIONS_MAX_COUNT) : infos; + return infos.size() > LINE_EXTENSIONS_MAX_COUNT ? infos.subList(0, LINE_EXTENSIONS_MAX_COUNT) : infos; } return null; } @@ -170,14 +169,7 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter { public static TextAttributes getNormalAttributes() { TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES); if (attributes == null || attributes.getForegroundColor() == null) { - return new TextAttributes(new JBColor(new NotNullProducer() { - @SuppressWarnings("UseJBColor") - @NotNull - @Override - public Color produce() { - return isDarkEditor() ? new Color(0x3d8065) : Gray._135; - } - }), null, null, null, Font.ITALIC); + return new TextAttributes(new JBColor(() -> isDarkEditor() ? new Color(0x3d8065) : Gray._135), null, null, null, Font.ITALIC); } return attributes; } @@ -185,14 +177,7 @@ public class XDebuggerEditorLinePainter extends EditorLinePainter { public static TextAttributes getChangedAttributes() { TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES_MODIFIED); if (attributes == null || attributes.getForegroundColor() == null) { - return new TextAttributes(new JBColor(new NotNullProducer() { - @SuppressWarnings("UseJBColor") - @NotNull - @Override - public Color produce() { - return isDarkEditor() ? new Color(0xa1830a) : new Color(0xca8021); - } - }), null, null, null, Font.ITALIC); + return new TextAttributes(new JBColor(() -> isDarkEditor() ? new Color(0xa1830a) : new Color(0xca8021)), null, null, null, Font.ITALIC); } return attributes; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java index 58aa30fe2d84..3e97e706f1ec 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -106,12 +106,7 @@ public class WatchInplaceEditor extends XDebuggerTreeInplaceEditor { } private void cancel() { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - cancelEditing(); - } - }); + AppUIUtil.invokeOnEdt(WatchInplaceEditor.this::cancelEditing); } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java index f124078f5a57..f9bdbc188801 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -30,12 +30,7 @@ public class XDebugViewSessionListener extends XDebugSessionAdapter { } private void onSessionEvent(final @NotNull XDebugView.SessionEvent event) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - myDebugView.processSessionEvent(event); - } - }); + AppUIUtil.invokeOnEdt(() -> myDebugView.processSessionEvent(event)); } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XStandaloneVariablesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XStandaloneVariablesView.java index 1cf2283c240a..278fd4495ed1 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XStandaloneVariablesView.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XStandaloneVariablesView.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -34,12 +34,9 @@ public class XStandaloneVariablesView extends XVariablesViewBase { } public void rebuildView() { - AppUIUtil.invokeLaterIfProjectAlive(getTree().getProject(), new Runnable() { - @Override - public void run() { - saveCurrentTreeState(myStackFrame); - buildTreeAndRestoreState(myStackFrame); - } + AppUIUtil.invokeLaterIfProjectAlive(getTree().getProject(), () -> { + saveCurrentTreeState(myStackFrame); + buildTreeAndRestoreState(myStackFrame); }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java index 143e95fbc16b..dd3ad6e3c0ae 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerColorsPage.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -38,16 +38,19 @@ import java.util.Map; * @author max */ public class DebuggerColorsPage implements ColorSettingsPage, DisplayPrioritySortable { + @Override @NotNull public String getDisplayName() { return XDebuggerBundle.message("xdebugger.colors.page.name"); } + @Override @Nullable public Icon getIcon() { return AllIcons.Actions.StartDebugger; } + @Override @NotNull public AttributesDescriptor[] getAttributeDescriptors() { return new AttributesDescriptor[] { @@ -60,6 +63,7 @@ public class DebuggerColorsPage implements ColorSettingsPage, DisplayPrioritySor }; } + @Override @NotNull public ColorDescriptor[] getColorDescriptors() { return new ColorDescriptor[] { @@ -67,17 +71,20 @@ public class DebuggerColorsPage implements ColorSettingsPage, DisplayPrioritySor }; } + @Override @NotNull public SyntaxHighlighter getHighlighter() { return new PlainSyntaxHighlighter(); } + @Override @NonNls @NotNull public String getDemoText() { return " "; } + @Override @Nullable public Map getAdditionalHighlightingTagToDescriptorMap() { return null; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java index ea923753097b..98e93b4d3b21 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -44,8 +44,6 @@ import com.intellij.xdebugger.XDebuggerBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; - /** * @author nik */ @@ -68,12 +66,9 @@ public abstract class DebuggerSessionTabBase extends RunTab { protected void attachNotificationTo(final Content content) { if (myConsole instanceof ObservableConsoleView) { ObservableConsoleView observable = (ObservableConsoleView)myConsole; - observable.addChangeListener(new ObservableConsoleView.ChangeListener() { - @Override - public void contentAdded(final Collection types) { - if (types.contains(ConsoleViewContentType.ERROR_OUTPUT) || types.contains(ConsoleViewContentType.NORMAL_OUTPUT)) { - content.fireAlert(); - } + observable.addChangeListener(types -> { + if (types.contains(ConsoleViewContentType.ERROR_OUTPUT) || types.contains(ConsoleViewContentType.NORMAL_OUTPUT)) { + content.fireAlert(); } }, content); RunProfile profile = getRunProfile(); @@ -97,18 +92,15 @@ public abstract class DebuggerSessionTabBase extends RunTab { public void select() { if (ApplicationManager.getApplication().isUnitTestMode()) return; - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - if (myRunContentDescriptor != null) { - ToolWindow toolWindow = ExecutionManager.getInstance(myProject).getContentManager() - .getToolWindowByDescriptor(myRunContentDescriptor); - Content content = myRunContentDescriptor.getAttachedContent(); - if (toolWindow == null || content == null) return; - ContentManager manager = toolWindow.getContentManager(); - if (ArrayUtil.contains(content, manager.getContents()) && !manager.isSelected(content)) { - manager.setSelectedContent(content); - } + UIUtil.invokeLaterIfNeeded(() -> { + if (myRunContentDescriptor != null) { + ToolWindow toolWindow = ExecutionManager.getInstance(myProject).getContentManager() + .getToolWindowByDescriptor(myRunContentDescriptor); + Content content = myRunContentDescriptor.getAttachedContent(); + if (toolWindow == null || content == null) return; + ContentManager manager = toolWindow.getContentManager(); + if (ArrayUtil.contains(content, manager.getContents()) && !manager.isSelected(content)) { + manager.setSelectedContent(content); } } }); @@ -117,32 +109,26 @@ public abstract class DebuggerSessionTabBase extends RunTab { public void toFront(boolean focus, @Nullable final Runnable onShowCallback) { if (ApplicationManager.getApplication().isUnitTestMode()) return; - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - if (myRunContentDescriptor != null) { - ToolWindow toolWindow = ExecutionManager.getInstance(myProject).getContentManager() - .getToolWindowByDescriptor(myRunContentDescriptor); - if (toolWindow != null) { - if (!toolWindow.isVisible()) { - toolWindow.show(onShowCallback); - } - //noinspection ConstantConditions - toolWindow.getContentManager().setSelectedContent(myRunContentDescriptor.getAttachedContent()); + ApplicationManager.getApplication().invokeLater(() -> { + if (myRunContentDescriptor != null) { + ToolWindow toolWindow = ExecutionManager.getInstance(myProject).getContentManager() + .getToolWindowByDescriptor(myRunContentDescriptor); + if (toolWindow != null) { + if (!toolWindow.isVisible()) { + toolWindow.show(onShowCallback); } + //noinspection ConstantConditions + toolWindow.getContentManager().setSelectedContent(myRunContentDescriptor.getAttachedContent()); } } }); if (focus) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - boolean focusWnd = Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"); - ProjectUtil.focusProjectWindow(myProject, focusWnd); - if (!focusWnd) { - AppIcon.getInstance().requestAttention(myProject, true); - } + ApplicationManager.getApplication().invokeLater(() -> { + boolean focusWnd = Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"); + ProjectUtil.focusProjectWindow(myProject, focusWnd); + if (!focusWnd) { + AppIcon.getInstance().requestAttention(myProject, true); } }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java index ce2901b3dd93..ddd95fc54ace 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java @@ -16,7 +16,6 @@ package com.intellij.xdebugger.impl.ui; import com.intellij.codeInsight.hint.HintUtil; -import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; @@ -26,7 +25,10 @@ import com.intellij.openapi.editor.colors.EditorColorsUtil; import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.*; -import com.intellij.openapi.util.*; +import com.intellij.openapi.util.DimensionService; +import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.Getter; +import com.intellij.openapi.util.Ref; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.openapi.wm.WindowManager; import com.intellij.ui.AppUIUtil; @@ -55,7 +57,10 @@ import org.jetbrains.concurrency.Promise; import javax.swing.*; import java.awt.*; -import java.awt.event.*; +import java.awt.event.ActionEvent; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.MouseEvent; import java.util.concurrent.atomic.AtomicBoolean; public class DebuggerUIUtil { @@ -65,29 +70,18 @@ public class DebuggerUIUtil { } public static void enableEditorOnCheck(final JCheckBox checkbox, final JComponent textfield) { - checkbox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boolean selected = checkbox.isSelected(); - textfield.setEnabled(selected); - } + checkbox.addActionListener(e -> { + boolean selected = checkbox.isSelected(); + textfield.setEnabled(selected); }); textfield.setEnabled(checkbox.isSelected()); } public static void focusEditorOnCheck(final JCheckBox checkbox, final JComponent component) { - final Runnable runnable = new Runnable() { - @Override - public void run() { - component.requestFocus(); - } - }; - checkbox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (checkbox.isSelected()) { - SwingUtilities.invokeLater(runnable); - } + final Runnable runnable = () -> component.requestFocus(); + checkbox.addActionListener(e -> { + if (checkbox.isSelected()) { + SwingUtilities.invokeLater(runnable); } }); } @@ -168,12 +162,9 @@ public class DebuggerUIUtil { .setDimensionServiceKey(project, FULL_VALUE_POPUP_DIMENSION_KEY, false) .setRequestFocus(false); if (callback != null) { - builder.setCancelCallback(new Computable() { - @Override - public Boolean compute() { - callback.setObsolete(); - return true; - } + builder.setCancelCallback(() -> { + callback.setObsolete(); + return true; }); } return builder.createPopup(); @@ -193,18 +184,15 @@ public class DebuggerUIUtil { final Ref isLoading = Ref.create(Boolean.FALSE); final Ref moreOptionsRequested = Ref.create(Boolean.FALSE); - propertiesPanel.setDelegate(new XLightBreakpointPropertiesPanel.Delegate() { - @Override - public void showMoreOptions() { - if (!isLoading.get()) { - propertiesPanel.saveProperties(); - } - if (!balloonRef.isNull()) { - balloonRef.get().hide(); - } - showXBreakpointEditorBalloon(project, point, component, true, breakpoint); - moreOptionsRequested.set(true); + propertiesPanel.setDelegate(() -> { + if (!isLoading.get()) { + propertiesPanel.saveProperties(); } + if (!balloonRef.isNull()) { + balloonRef.get().hide(); + } + showXBreakpointEditorBalloon(project, point, component, true, breakpoint); + moreOptionsRequested.set(true); }); isLoading.set(Boolean.TRUE); @@ -215,13 +203,10 @@ public class DebuggerUIUtil { return; } - Runnable showMoreOptions = new Runnable() { - @Override - public void run() { - propertiesPanel.saveProperties(); - propertiesPanel.dispose(); - BreakpointsDialogFactory.getInstance(project).showDialog(breakpoint); - } + Runnable showMoreOptions = () -> { + propertiesPanel.saveProperties(); + propertiesPanel.dispose(); + BreakpointsDialogFactory.getInstance(project).showDialog(breakpoint); }; final JComponent mainPanel = propertiesPanel.getMainPanel(); @@ -247,12 +232,7 @@ public class DebuggerUIUtil { }); breakpointManager.addBreakpointListener(breakpointListener); - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - IdeFocusManager.findInstance().requestFocus(mainPanel, true); - } - }); + ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.findInstance().requestFocus(mainPanel, true)); } public static Balloon showBreakpointEditor(Project project, final JComponent mainPanel, @@ -294,12 +274,7 @@ public class DebuggerUIUtil { } }; component.addComponentListener(moveListener); - Disposer.register(balloon, new Disposable() { - @Override - public void dispose() { - component.removeComponentListener(moveListener); - } - }); + Disposer.register(balloon, () -> component.removeComponentListener(moveListener)); if (whereToShow == null) { balloon.showInCenterOf(component); @@ -347,25 +322,19 @@ public class DebuggerUIUtil { @Override public void evaluated(@NotNull final String fullValue, @Nullable final Font font) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - myTextArea.setText(fullValue); - if (font != null) { - myTextArea.setFont(font); - } + AppUIUtil.invokeOnEdt(() -> { + myTextArea.setText(fullValue); + if (font != null) { + myTextArea.setFont(font); } }); } @Override public void errorOccurred(@NotNull final String errorMessage) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - myTextArea.setForeground(XDebuggerUIConstants.ERROR_MESSAGE_ATTRIBUTES.getFgColor()); - myTextArea.setText(errorMessage); - } + AppUIUtil.invokeOnEdt(() -> { + myTextArea.setForeground(XDebuggerUIConstants.ERROR_MESSAGE_ATTRIBUTES.getFgColor()); + myTextArea.setText(errorMessage); }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java index 879ea20530c2..f11574d3d604 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -19,7 +19,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ScrollType; -import com.intellij.openapi.editor.colors.EditorColorsListener; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.impl.DocumentMarkupModel; @@ -67,52 +66,41 @@ public class ExecutionPointHighlighter { // Update highlighter colors if global color schema was changed final EditorColorsManager colorsManager = EditorColorsManager.getInstance(); if (colorsManager != null) { // in some debugger tests EditorColorsManager component isn't loaded - colorsManager.addEditorColorsListener(new EditorColorsListener() { - @Override - public void globalSchemeChange(EditorColorsScheme scheme) { - update(false); - } - }, project); + colorsManager.addEditorColorsListener(scheme -> update(false), project); } } public void show(final @NotNull XSourcePosition position, final boolean notTopFrame, @Nullable final GutterIconRenderer gutterIconRenderer) { updateRequested.set(false); - AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() { - @Override - public void run() { - updateRequested.set(false); + AppUIUtil.invokeLaterIfProjectAlive(myProject, () -> { + updateRequested.set(false); - mySourcePosition = position; + mySourcePosition = position; - clearDescriptor(); - myOpenFileDescriptor = XSourcePositionImpl.createOpenFileDescriptor(myProject, position); - if (!XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isScrollToCenter()) { - myOpenFileDescriptor.setScrollType(notTopFrame ? ScrollType.CENTER : ScrollType.MAKE_VISIBLE); - } - //see IDEA-125645 and IDEA-63459 - //myOpenFileDescriptor.setUseCurrentWindow(true); - - myGutterIconRenderer = gutterIconRenderer; - myNotTopFrame = notTopFrame; - - doShow(true); + clearDescriptor(); + myOpenFileDescriptor = XSourcePositionImpl.createOpenFileDescriptor(myProject, position); + if (!XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isScrollToCenter()) { + myOpenFileDescriptor.setScrollType(notTopFrame ? ScrollType.CENTER : ScrollType.MAKE_VISIBLE); } + //see IDEA-125645 and IDEA-63459 + //myOpenFileDescriptor.setUseCurrentWindow(true); + + myGutterIconRenderer = gutterIconRenderer; + myNotTopFrame = notTopFrame; + + doShow(true); }); } public void hide() { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - updateRequested.set(false); + AppUIUtil.invokeOnEdt(() -> { + updateRequested.set(false); - removeHighlighter(); - clearDescriptor(); - myEditor = null; - myGutterIconRenderer = null; - } + removeHighlighter(); + clearDescriptor(); + myEditor = null; + myGutterIconRenderer = null; }); } @@ -136,24 +124,18 @@ public class ExecutionPointHighlighter { public void update(final boolean navigate) { if (updateRequested.compareAndSet(false, true)) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - if (updateRequested.compareAndSet(true, false)) { - doShow(navigate); - } + ApplicationManager.getApplication().invokeLater(() -> { + if (updateRequested.compareAndSet(true, false)) { + doShow(navigate); } }, myProject.getDisposed()); } } public void updateGutterIcon(@Nullable final GutterIconRenderer renderer) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - if (myRangeHighlighter != null && myGutterIconRenderer != null) { - myRangeHighlighter.setGutterIconRenderer(renderer); - } + AppUIUtil.invokeOnEdt(() -> { + if (myRangeHighlighter != null && myGutterIconRenderer != null) { + myRangeHighlighter.setGutterIconRenderer(renderer); } }); } @@ -247,14 +229,11 @@ public class ExecutionPointHighlighter { if (ApplicationManager.getApplication().isUnitTestMode()) return; // need to always invoke later to maintain order of increment/decrement - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - JComponent component = editor.getComponent(); - Object o = component.getClientProperty(EditorImpl.IGNORE_MOUSE_TRACKING); - Integer value = ((o instanceof Integer) ? (Integer)o : 0) + increment; - component.putClientProperty(EditorImpl.IGNORE_MOUSE_TRACKING, value > 0 ? value : null); - } + SwingUtilities.invokeLater(() -> { + JComponent component = editor.getComponent(); + Object o = component.getClientProperty(EditorImpl.IGNORE_MOUSE_TRACKING); + Integer value = ((o instanceof Integer) ? (Integer)o : 0) + increment; + component.putClientProperty(EditorImpl.IGNORE_MOUSE_TRACKING, value > 0 ? value : null); }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java index 0953eb98830b..ce698b4d4511 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -212,12 +212,9 @@ public class XDebugSessionTab extends DebuggerSessionTabBase { } public void rebuildViews() { - AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() { - @Override - public void run() { - for (XDebugView view : myViews) { - view.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED); - } + AppUIUtil.invokeLaterIfProjectAlive(myProject, () -> { + for (XDebugView view : myViews) { + view.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED); } }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java index 96acb2134b4d..9352e3f9db07 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -65,19 +65,11 @@ public class SetValueInplaceEditor extends XDebuggerTreeInplaceEditor { final SetValueInplaceEditor editor = new SetValueInplaceEditor(node, nodeName); if (editor.myModifier != null) { - editor.myModifier.calculateInitialValueEditorText(new XValueModifier.XInitialValueCallback() { - @Override - public void setValue(final String initialValue) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - if (editor.getTree().isShowing()) { - editor.show(initialValue); - } - } - }); + editor.myModifier.calculateInitialValueEditorText(initialValue -> AppUIUtil.invokeOnEdt(() -> { + if (editor.getTree().isShowing()) { + editor.show(initialValue); } - }); + })); } else { editor.show(null); @@ -107,30 +99,22 @@ public class SetValueInplaceEditor extends XDebuggerTreeInplaceEditor { @Override public void valueModified() { if (isDetachedTree(myTree)) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - myTree.rebuildAndRestore(treeState); - } - }); + AppUIUtil.invokeOnEdt(() -> myTree.rebuildAndRestore(treeState)); } XDebuggerUtilImpl.rebuildAllSessionsViews(getProject()); } @Override public void errorOccurred(@NotNull final String errorMessage) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - myTree.rebuildAndRestore(treeState); + AppUIUtil.invokeOnEdt(() -> { + myTree.rebuildAndRestore(treeState); - Editor editor = myExpressionEditor.getEditor(); - if (editor != null) { - HintManager.getInstance().showErrorHint(editor, errorMessage); - } - else { - Messages.showErrorDialog(myTree, errorMessage); - } + Editor editor = myExpressionEditor.getEditor(); + if (editor != null) { + HintManager.getInstance().showErrorHint(editor, errorMessage); + } + else { + Messages.showErrorDialog(myTree, errorMessage); } }); XDebuggerUtilImpl.rebuildAllSessionsViews(getProject()); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java index 6dea5a4edc1d..b95cf4c485db 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -120,12 +120,7 @@ public abstract class TreeInplaceEditor implements AWTEventListener { layeredPane.add(inplaceEditorComponent, new Integer(250)); - myRemoveActions.add(new Runnable() { - @Override - public void run() { - layeredPane.remove(inplaceEditorComponent); - } - }); + myRemoveActions.add(() -> layeredPane.remove(inplaceEditorComponent)); inplaceEditorComponent.validate(); inplaceEditorComponent.paintImmediately(0,0,inplaceEditorComponent.getWidth(),inplaceEditorComponent.getHeight()); @@ -135,22 +130,19 @@ public abstract class TreeInplaceEditor implements AWTEventListener { @Override public void componentResized(ComponentEvent e) { final Project project = getProject(); - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - if (!isShown() || project == null || project.isDisposed()) { - return; - } - JTree tree = getTree(); - JLayeredPane layeredPane = tree.getRootPane().getLayeredPane(); - Rectangle bounds = getEditorBounds(); - if (bounds == null) { - return; - } - Point layeredPanePoint = SwingUtilities.convertPoint(tree, bounds.x, bounds.y, layeredPane); - setInplaceEditorBounds(inplaceEditorComponent, layeredPanePoint.x, layeredPanePoint.y, bounds.width, bounds.height); - inplaceEditorComponent.revalidate(); + ApplicationManager.getApplication().invokeLater(() -> { + if (!isShown() || project == null || project.isDisposed()) { + return; } + JTree tree1 = getTree(); + JLayeredPane layeredPane1 = tree1.getRootPane().getLayeredPane(); + Rectangle bounds1 = getEditorBounds(); + if (bounds1 == null) { + return; + } + Point layeredPanePoint1 = SwingUtilities.convertPoint(tree1, bounds1.x, bounds1.y, layeredPane1); + setInplaceEditorBounds(inplaceEditorComponent, layeredPanePoint1.x, layeredPanePoint1.y, bounds1.width, bounds1.height); + inplaceEditorComponent.revalidate(); }); } @@ -160,12 +152,9 @@ public abstract class TreeInplaceEditor implements AWTEventListener { } }; - final HierarchyListener hierarchyListener = new HierarchyListener() { - @Override - public void hierarchyChanged(HierarchyEvent e) { - if (!tree.isShowing()) { - cancelEditing(); - } + final HierarchyListener hierarchyListener = e -> { + if (!tree.isShowing()) { + cancelEditing(); } }; @@ -173,13 +162,10 @@ public abstract class TreeInplaceEditor implements AWTEventListener { tree.addComponentListener(componentListener); rootPane.addComponentListener(componentListener); - myRemoveActions.add(new Runnable() { - @Override - public void run() { - tree.removeHierarchyListener(hierarchyListener); - tree.removeComponentListener(componentListener); - rootPane.removeComponentListener(componentListener); - } + myRemoveActions.add(() -> { + tree.removeHierarchyListener(hierarchyListener); + tree.removeComponentListener(componentListener); + rootPane.removeComponentListener(componentListener); }); final Disposable disposable = Disposer.newDisposable(); @@ -194,12 +180,7 @@ public abstract class TreeInplaceEditor implements AWTEventListener { cancelEditing(); } }); - myRemoveActions.add(new Runnable() { - @Override - public void run() { - Disposer.dispose(disposable); - } - }); + myRemoveActions.add(() -> Disposer.dispose(disposable)); final JComponent editorComponent = getEditorComponent(); editorComponent.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enterStroke"); @@ -217,20 +198,12 @@ public abstract class TreeInplaceEditor implements AWTEventListener { } }); final Toolkit defaultToolkit = Toolkit.getDefaultToolkit(); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (!isShown()) return; - defaultToolkit.addAWTEventListener(TreeInplaceEditor.this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); - } + SwingUtilities.invokeLater(() -> { + if (!isShown()) return; + defaultToolkit.addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); }); - myRemoveActions.add(new Runnable() { - @Override - public void run() { - defaultToolkit.removeAWTEventListener(TreeInplaceEditor.this); - } - }); + myRemoveActions.add(() -> defaultToolkit.removeAWTEventListener(this)); onShown(); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java index 8fb9b78cc403..bfdb5a7b45f8 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -84,18 +84,15 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa } }, 100, this); - private static final Convertor SPEED_SEARCH_CONVERTER = new Convertor() { - @Override - public String convert(TreePath o) { - String text = null; - if (o != null) { - final Object node = o.getLastPathComponent(); - if (node instanceof XDebuggerTreeNode) { - text = ((XDebuggerTreeNode)node).getText().toString(); - } + private static final Convertor SPEED_SEARCH_CONVERTER = o -> { + String text = null; + if (o != null) { + final Object node = o.getLastPathComponent(); + if (node instanceof XDebuggerTreeNode) { + text = ((XDebuggerTreeNode)node).getText().toString(); } - return StringUtil.notNullize(text); } + return StringUtil.notNullize(text); }; private static final TransferHandler DEFAULT_TRANSFER_HANDLER = new TransferHandler() { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeInplaceEditor.java index 4a427bdb457b..bd2a2a93d4de 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeInplaceEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeInplaceEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -60,6 +60,7 @@ public abstract class XDebuggerTreeInplaceEditor extends TreeInplaceEditor { doOKAction(); } + @Override protected JComponent getPreferredFocusedComponent() { return myExpressionEditor.getPreferredFocusedComponent(); } @@ -68,22 +69,27 @@ public abstract class XDebuggerTreeInplaceEditor extends TreeInplaceEditor { return myNode; } + @Override public Editor getEditor() { return myExpressionEditor.getEditor(); } + @Override public JComponent getEditorComponent() { return myExpressionEditor.getEditorComponent(); } + @Override protected TreePath getNodePath() { return myNode.getPath(); } + @Override protected JTree getTree() { return myNode.getTree(); } + @Override protected Project getProject() { return myNode.getTree().getProject(); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreePanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreePanel.java index d9c87176a414..f0ec58aa6ee0 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreePanel.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreePanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -24,7 +24,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Pair; import com.intellij.ui.ScrollPaneFactory; -import com.intellij.ui.treeStructure.Tree; import com.intellij.xdebugger.XDebuggerBundle; import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; @@ -74,12 +73,7 @@ public class XDebuggerTreePanel implements DnDSource { } private XValueNodeImpl[] getNodesToDrag() { - return myTree.getSelectedNodes(XValueNodeImpl.class, new Tree.NodeFilter() { - @Override - public boolean accept(final XValueNodeImpl node) { - return DebuggerUIUtil.hasEvaluationExpression(node.getValueContainer()); - } - }); + return myTree.getSelectedNodes(XValueNodeImpl.class, node -> DebuggerUIUtil.hasEvaluationExpression(node.getValueContainer())); } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java index bbebe08ec4b8..1796deaa41be 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -117,6 +117,7 @@ public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelecti return false; } + @Override public void nodeLoaded(@NotNull final RestorableStateNode node, final String name) { XDebuggerTreeState.NodeInfo parentInfo = myNode2ParentState.remove(node); if (parentInfo != null) { @@ -134,6 +135,7 @@ public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelecti } } + @Override public void childrenLoaded(@NotNull final XDebuggerTreeNode node, @NotNull final List> children, final boolean last) { XDebuggerTreeState.NodeInfo nodeInfo = myNode2State.get(node); if (nodeInfo != null) { @@ -154,6 +156,7 @@ public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelecti myTree.removeTreeSelectionListener(this); } + @Override public void valueChanged(TreeSelectionEvent e) { if (!myInsideRestoring) { myStopRestoringSelection = true; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java index 9982b61835bd..78716bb40e75 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -29,7 +29,6 @@ import com.intellij.xdebugger.impl.evaluate.quick.XDebuggerInstanceTreeCreator; import com.intellij.xdebugger.impl.evaluate.quick.XDebuggerTreeCreator; import com.intellij.xdebugger.impl.evaluate.quick.common.DebuggerTreeWithHistoryPanel; import com.intellij.xdebugger.impl.frame.XValueMarkers; -import com.intellij.xdebugger.impl.ui.DebuggerUIUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java index a289bbc2717d..58b6930123d4 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -17,13 +17,9 @@ package com.intellij.xdebugger.impl.ui.tree.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.Consumer; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerManager; -import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.impl.XDebugSessionImpl; -import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl; import com.intellij.xdebugger.impl.frame.XWatchesView; import com.intellij.xdebugger.impl.ui.DebuggerUIUtil; import com.intellij.xdebugger.impl.ui.XDebugSessionTab; @@ -43,12 +39,10 @@ class XAddToWatchesAction extends XDebuggerTreeActionBase { protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) { final XWatchesView watchesView = getWatchesView(e); if (watchesView != null) { - node.getValueContainer().calculateEvaluationExpression().done(new Consumer() { - @Override - public void consume(XExpression expression) { - if (expression != null) { - watchesView.addWatchExpression(expression, -1, true); - } + node.getValueContainer().calculateEvaluationExpression() + .done(expression -> { + if (expression != null) { + watchesView.addWatchExpression(expression, -1, true); } }); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java index 6f2cecb76987..e7c840a1b662 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XFetchValueActionBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -163,12 +163,9 @@ public abstract class XFetchValueActionBase extends AnAction { } public void evaluationComplete(final int index, @NotNull final String value) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - values.set(index, value); - finish(); - } + AppUIUtil.invokeOnEdt(() -> { + values.set(index, value); + finish(); }); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceActionBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceActionBase.java index dee03ac5bfbf..a7b119862c87 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceActionBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XJumpToSourceActionBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -20,13 +20,11 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.util.registry.Registry; import com.intellij.ui.AppUIUtil; -import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.frame.XNavigatable; import com.intellij.xdebugger.frame.XValue; import com.intellij.xdebugger.impl.evaluate.XDebuggerEvaluationDialog; import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * @author nik @@ -36,21 +34,15 @@ public abstract class XJumpToSourceActionBase extends XDebuggerTreeActionBase { protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) { XValue value = node.getValueContainer(); final XDebuggerEvaluationDialog dialog = e.getData(XDebuggerEvaluationDialog.KEY); - XNavigatable navigatable = new XNavigatable() { - @Override - public void setSourcePosition(@Nullable final XSourcePosition sourcePosition) { - if (sourcePosition != null) { - final Project project = node.getTree().getProject(); - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - sourcePosition.createNavigatable(project).navigate(true); - if (dialog != null && Registry.is("debugger.close.dialog.on.navigate")) { - dialog.close(DialogWrapper.CANCEL_EXIT_CODE); - } - } - }, project.getDisposed()); - } + XNavigatable navigatable = sourcePosition -> { + if (sourcePosition != null) { + final Project project = node.getTree().getProject(); + AppUIUtil.invokeOnEdt(() -> { + sourcePosition.createNavigatable(project).navigate(true); + if (dialog != null && Registry.is("debugger.close.dialog.on.navigate")) { + dialog.close(DialogWrapper.CANCEL_EXIT_CODE); + } + }, project.getDisposed()); } }; startComputingSourcePosition(value, navigatable); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XSetValueAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XSetValueAction.java index ea323f5d8ca9..d8e954ec4593 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XSetValueAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XSetValueAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -18,7 +18,6 @@ package com.intellij.xdebugger.impl.ui.tree.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.xdebugger.impl.ui.tree.SetValueInplaceEditor; -import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeInplaceEditor; import com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode; import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; import org.jetbrains.annotations.NotNull; @@ -46,6 +45,7 @@ public class XSetValueAction extends XDebuggerTreeActionBase { return super.isEnabled(node, e) && node.getValueContainer().getModifier() != null; } + @Override protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) { SetValueInplaceEditor.show(node, nodeName); }