Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
08cb4b49
Commit
08cb4b49
authored
9 years ago
by
Michael Golubev
Browse files
Options
Download
Email Patches
Plain Diff
IDEA-144552: UI for managing multiple concurrently used run configurations
- bug fix for merge
parent
69721c6a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java
+4
-4
...src/com/intellij/debugger/impl/GenericDebuggerRunner.java
platform/lang-api/src/com/intellij/execution/DefaultExecutionResult.java
+22
-1
...pi/src/com/intellij/execution/DefaultExecutionResult.java
platform/lang-api/src/com/intellij/execution/ExecutionResultEx.java
+25
-0
...ang-api/src/com/intellij/execution/ExecutionResultEx.java
platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java
+19
-6
...i/src/com/intellij/execution/ui/RunContentDescriptor.java
platform/lang-impl/src/com/intellij/execution/ui/RunContentManagerImpl.java
+24
-3
.../src/com/intellij/execution/ui/RunContentManagerImpl.java
platform/platform-impl/src/com/intellij/ui/content/TabbedPaneContentUI.java
+2
-3
...impl/src/com/intellij/ui/content/TabbedPaneContentUI.java
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewImpl.java
+3
-1
...j/remoteServer/impl/runtime/ui/RemoteServersViewImpl.java
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
+17
-0
...emoteServer/impl/runtime/ui/ServersToolWindowContent.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+10
-0
...pl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
+2
-1
.../src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
with
128 additions
and
19 deletions
+128
-19
java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java
+
4
-
4
View file @
08cb4b49
...
...
@@ -22,10 +22,7 @@ import com.intellij.debugger.engine.DebugProcessImpl;
import
com.intellij.debugger.engine.DebuggerUtils
;
import
com.intellij.debugger.engine.JavaDebugProcess
;
import
com.intellij.debugger.settings.DebuggerSettings
;
import
com.intellij.execution.DefaultExecutionResult
;
import
com.intellij.execution.ExecutionException
;
import
com.intellij.execution.ExecutionResult
;
import
com.intellij.execution.Executor
;
import
com.intellij.execution.*
;
import
com.intellij.execution.configurations.*
;
import
com.intellij.execution.executors.DefaultDebugExecutor
;
import
com.intellij.execution.runners.ExecutionEnvironment
;
...
...
@@ -127,6 +124,9 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
sessionImpl
.
addRestartActions
(((
DefaultExecutionResult
)
executionResult
).
getRestartActions
());
sessionImpl
.
addExtraStopActions
(((
DefaultExecutionResult
)
executionResult
).
getAdditionalStopActions
());
}
if
(
executionResult
instanceof
ExecutionResultEx
)
{
sessionImpl
.
setContentManager
(((
ExecutionResultEx
)
executionResult
).
getContentManager
());
}
return
JavaDebugProcess
.
create
(
session
,
debuggerSession
);
}
}).
getRunContentDescriptor
();
...
...
This diff is collapsed.
Click to expand it.
platform/lang-api/src/com/intellij/execution/DefaultExecutionResult.java
+
22
-
1
View file @
08cb4b49
...
...
@@ -18,6 +18,7 @@ package com.intellij.execution;
import
com.intellij.execution.process.ProcessHandler
;
import
com.intellij.execution.ui.ExecutionConsole
;
import
com.intellij.openapi.actionSystem.AnAction
;
import
com.intellij.ui.content.ContentManager
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
...
...
@@ -27,13 +28,15 @@ import java.util.List;
/**
* @author dyoma
*/
public
class
DefaultExecutionResult
implements
ExecutionResult
{
public
class
DefaultExecutionResult
implements
ExecutionResult
Ex
{
private
final
ExecutionConsole
myConsole
;
private
final
ProcessHandler
myProcessHandler
;
private
AnAction
[]
myActions
;
@NotNull
private
AnAction
[]
myRestartActions
=
AnAction
.
EMPTY_ARRAY
;
private
final
List
<
AnAction
>
myStopActions
=
new
ArrayList
<>();
//private RunnerLayoutUi myUi;
private
ContentManager
myContentManager
;
public
DefaultExecutionResult
()
{
myConsole
=
null
;
...
...
@@ -88,4 +91,22 @@ public class DefaultExecutionResult implements ExecutionResult {
public
ProcessHandler
getProcessHandler
()
{
return
myProcessHandler
;
}
@Override
public
ContentManager
getContentManager
()
{
return
myContentManager
;
}
public
void
setContentManager
(
ContentManager
contentManager
)
{
myContentManager
=
contentManager
;
}
//public void setUi(RunnerLayoutUi ui) {
// myUi = ui;
//}
//
//@Override
//public RunnerLayoutUi getUi() {
// return myUi;
//}
}
This diff is collapsed.
Click to expand it.
platform/lang-api/src/com/intellij/execution/ExecutionResultEx.java
0 → 100644
+
25
-
0
View file @
08cb4b49
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.intellij.execution
;
import
com.intellij.ui.content.ContentManager
;
public
interface
ExecutionResultEx
extends
ExecutionResult
{
ContentManager
getContentManager
();
//RunnerLayoutUi getUi();
}
This diff is collapsed.
Click to expand it.
platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java
+
19
-
6
View file @
08cb4b49
...
...
@@ -17,6 +17,7 @@ package com.intellij.execution.ui;
import
com.intellij.execution.DefaultExecutionResult
;
import
com.intellij.execution.ExecutionResult
;
import
com.intellij.execution.ExecutionResultEx
;
import
com.intellij.execution.configurations.RunProfile
;
import
com.intellij.execution.process.ProcessHandler
;
import
com.intellij.ide.HelpIdProvider
;
...
...
@@ -25,6 +26,7 @@ import com.intellij.openapi.actionSystem.AnAction;
import
com.intellij.openapi.util.Computable
;
import
com.intellij.openapi.util.Disposer
;
import
com.intellij.ui.content.Content
;
import
com.intellij.ui.content.ContentManager
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
...
...
@@ -49,6 +51,8 @@ public class RunContentDescriptor implements Disposable {
@NotNull
private
final
AnAction
[]
myRestartActions
;
private
final
ContentManager
myContentManager
;
@Nullable
private
final
Runnable
myActivationCallback
;
...
...
@@ -58,7 +62,7 @@ public class RunContentDescriptor implements Disposable {
String
displayName
,
@Nullable
Icon
icon
,
@Nullable
Runnable
activationCallback
)
{
this
(
executionConsole
,
processHandler
,
component
,
displayName
,
icon
,
activationCallback
,
null
);
this
(
executionConsole
,
processHandler
,
component
,
displayName
,
icon
,
activationCallback
,
null
,
null
);
}
public
RunContentDescriptor
(
@Nullable
ExecutionConsole
executionConsole
,
...
...
@@ -67,7 +71,8 @@ public class RunContentDescriptor implements Disposable {
String
displayName
,
@Nullable
Icon
icon
,
@Nullable
Runnable
activationCallback
,
@Nullable
AnAction
[]
restartActions
)
{
@Nullable
AnAction
[]
restartActions
,
@Nullable
ContentManager
contentManager
)
{
myExecutionConsole
=
executionConsole
;
myProcessHandler
=
processHandler
;
myComponent
=
component
;
...
...
@@ -80,6 +85,7 @@ public class RunContentDescriptor implements Disposable {
}
myRestartActions
=
restartActions
==
null
?
AnAction
.
EMPTY_ARRAY
:
restartActions
;
myContentManager
=
contentManager
;
}
public
RunContentDescriptor
(
@Nullable
ExecutionConsole
executionConsole
,
...
...
@@ -87,14 +93,14 @@ public class RunContentDescriptor implements Disposable {
@NotNull
JComponent
component
,
String
displayName
,
@Nullable
Icon
icon
)
{
this
(
executionConsole
,
processHandler
,
component
,
displayName
,
icon
,
null
,
null
);
this
(
executionConsole
,
processHandler
,
component
,
displayName
,
icon
,
null
,
null
,
null
);
}
public
RunContentDescriptor
(
@Nullable
ExecutionConsole
executionConsole
,
@Nullable
ProcessHandler
processHandler
,
@NotNull
JComponent
component
,
String
displayName
)
{
this
(
executionConsole
,
processHandler
,
component
,
displayName
,
null
,
null
,
null
);
this
(
executionConsole
,
processHandler
,
component
,
displayName
,
null
,
null
,
null
,
null
);
}
public
RunContentDescriptor
(
@NotNull
RunProfile
profile
,
@NotNull
ExecutionResult
executionResult
,
@NotNull
RunnerLayoutUi
ui
)
{
...
...
@@ -104,8 +110,10 @@ public class RunContentDescriptor implements Disposable {
profile
.
getName
(),
profile
.
getIcon
(),
null
,
executionResult
instanceof
DefaultExecutionResult
?
((
DefaultExecutionResult
)
executionResult
).
getRestartActions
()
:
null
);
executionResult
instanceof
DefaultExecutionResult
?
((
DefaultExecutionResult
)
executionResult
).
getRestartActions
()
:
null
,
executionResult
instanceof
ExecutionResultEx
?
((
ExecutionResultEx
)
executionResult
).
getContentManager
()
:
null
);
myRunnerLayoutUi
=
ui
;
//myRunnerLayoutUi = executionResult instanceof ExecutionResultEx ? ((ExecutionResultEx)executionResult).getUi() : ui;
}
public
Runnable
getActivationCallback
()
{
...
...
@@ -229,8 +237,13 @@ public class RunContentDescriptor implements Disposable {
* @since 14.1
* @return the RunnerLayoutUi instance or null if this tab does not use RunnerLayoutUi for managing its contents.
*/
@Nullable
@Nullable
// TODO: may reuse (currently unused) RunnerLayoutUi instead of ContentManager
public
RunnerLayoutUi
getRunnerLayoutUi
()
{
return
myRunnerLayoutUi
;
}
@Nullable
public
ContentManager
getContentManager
()
{
return
myContentManager
;
}
}
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/execution/ui/RunContentManagerImpl.java
+
24
-
3
View file @
08cb4b49
...
...
@@ -64,9 +64,11 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
public
static
final
Key
<
Boolean
>
ALWAYS_USE_DEFAULT_STOPPING_BEHAVIOUR_KEY
=
Key
.
create
(
"ALWAYS_USE_DEFAULT_STOPPING_BEHAVIOUR_KEY"
);
private
static
final
Logger
LOG
=
Logger
.
getInstance
(
RunContentManagerImpl
.
class
);
private
static
final
Key
<
RunContentDescriptor
>
DESCRIPTOR_KEY
=
Key
.
create
(
"Descriptor"
);
public
static
final
Key
<
Executor
>
EXECUTOR_KEY
=
Key
.
create
(
"Executor"
);
private
final
Project
myProject
;
private
final
Map
<
String
,
ContentManager
>
myToolwindowIdToContentManagerMap
=
new
THashMap
<>();
// TODO: may need to investigate all the usages
private
final
Map
<
String
,
Icon
>
myToolwindowIdToBaseIconMap
=
new
THashMap
<>();
private
final
LinkedList
<
String
>
myToolwindowIdZBuffer
=
new
LinkedList
<>();
...
...
@@ -196,7 +198,7 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
@Override
public
void
hideRunContent
(
@NotNull
final
Executor
executor
,
final
RunContentDescriptor
descriptor
)
{
ApplicationManager
.
getApplication
().
invokeLater
(()
->
{
ToolWindow
toolWindow
=
ToolWindowManager
.
getInstance
(
myProject
).
ge
tToolWindow
(
executor
.
getToolWindowId
()
);
ToolWindow
toolWindow
=
getConten
tToolWindow
(
executor
,
descriptor
);
if
(
toolWindow
!=
null
)
{
toolWindow
.
hide
(
null
);
}
...
...
@@ -254,7 +256,13 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
return
;
}
final
ContentManager
contentManager
=
getContentManagerForRunner
(
executor
);
//RunnerLayoutUi ui = descriptor.getRunnerLayoutUi();
//final ContentManager contentManager = ui == null ? getContentManagerForRunner(executor) : ui.getContentManager();
ContentManager
contentManager
=
descriptor
.
getContentManager
();
if
(
contentManager
==
null
)
{
contentManager
=
getContentManagerForRunner
(
executor
);
}
RunContentDescriptor
oldDescriptor
=
chooseReuseContentForDescriptor
(
contentManager
,
descriptor
,
executionId
,
descriptor
.
getDisplayName
());
final
Content
content
;
if
(
oldDescriptor
==
null
)
{
...
...
@@ -330,7 +338,7 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
}
ApplicationManager
.
getApplication
().
invokeLater
(()
->
{
ToolWindow
window
=
ToolWindowManager
.
getInstance
(
myProject
).
ge
tToolWindow
(
executor
.
getToolWindowId
()
);
ToolWindow
window
=
getConten
tToolWindow
(
executor
,
descriptor
);
// let's activate tool window, but don't move focus
//
// window.show() isn't valid here, because it will not
...
...
@@ -342,6 +350,18 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
},
myProject
.
getDisposed
());
}
private
ToolWindow
getContentToolWindow
(
@NotNull
final
Executor
executor
,
@NotNull
final
RunContentDescriptor
descriptor
)
{
ContentManager
contentManager
=
descriptor
.
getContentManager
();
if
(
contentManager
!=
null
)
{
ToolWindow
contentToolWindow
=
(
ToolWindow
)
DataManager
.
getInstance
().
getDataContext
(
contentManager
.
getComponent
())
.
getData
(
PlatformDataKeys
.
TOOL_WINDOW
.
getName
());
if
(
contentToolWindow
!=
null
)
{
return
contentToolWindow
;
}
}
return
ToolWindowManager
.
getInstance
(
myProject
).
getToolWindow
(
executor
.
getToolWindowId
());
}
@Nullable
@Override
...
...
@@ -458,6 +478,7 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
final
Content
content
=
ContentFactory
.
SERVICE
.
getInstance
().
createContent
(
descriptor
.
getComponent
(),
processDisplayName
,
true
);
content
.
putUserData
(
DESCRIPTOR_KEY
,
descriptor
);
content
.
putUserData
(
ToolWindow
.
SHOW_CONTENT_ICON
,
Boolean
.
TRUE
);
content
.
putUserData
(
EXECUTOR_KEY
,
executor
);
contentManager
.
addContent
(
content
);
new
CloseListener
(
content
,
executor
);
return
content
;
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/ui/content/TabbedPaneContentUI.java
+
2
-
3
View file @
08cb4b49
...
...
@@ -117,11 +117,10 @@ public class TabbedPaneContentUI implements ContentUI, PropertyChangeListener {
}
private
class
MyTabbedPaneWrapper
extends
TabbedPaneWrapper
.
AsJTabbedPane
{
private
class
MyTabbedPaneWrapper
extends
TabbedPaneWrapper
.
AsJTabbedPane
{
//AsJBTabs {
public
MyTabbedPaneWrapper
(
int
tabPlacement
)
{
super
(
tabPlacement
);
//super(null, tabPlacement, TabbedPaneImpl.DEFAULT_PREV_NEXT_SHORTCUTS, TabbedPaneContentUI.this);
}
protected
TabbedPane
createTabbedPane
(
int
tabPlacement
)
{
...
...
This diff is collapsed.
Click to expand it.
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewImpl.java
+
3
-
1
View file @
08cb4b49
...
...
@@ -4,6 +4,7 @@ import com.intellij.openapi.project.Project;
import
com.intellij.openapi.util.text.StringUtil
;
import
com.intellij.openapi.wm.ToolWindow
;
import
com.intellij.openapi.wm.ToolWindowManager
;
import
com.intellij.openapi.wm.impl.ToolWindowImpl
;
import
com.intellij.remoteServer.runtime.ServerConnection
;
import
com.intellij.remoteServer.runtime.ui.RemoteServersView
;
import
com.intellij.util.ui.UIUtil
;
...
...
@@ -32,8 +33,9 @@ public class RemoteServersViewImpl extends RemoteServersView {
}
}
p
rivate
static
ServersToolWindowContent
getServersViewComponent
(
ToolWindow
toolWindow
)
{
p
ublic
static
ServersToolWindowContent
getServersViewComponent
(
ToolWindow
toolWindow
)
{
//todo[nik] register ServersToolWindowContent as project service?
((
ToolWindowImpl
)
toolWindow
).
ensureContentInitialized
();
return
UIUtil
.
findComponentOfType
(
toolWindow
.
getComponent
(),
ServersToolWindowContent
.
class
);
}
...
...
This diff is collapsed.
Click to expand it.
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
+
17
-
0
View file @
08cb4b49
...
...
@@ -24,6 +24,7 @@ import com.intellij.ui.*;
import
com.intellij.ui.components.JBPanelWithEmptyText
;
import
com.intellij.ui.treeStructure.Tree
;
import
com.intellij.util.Alarm
;
import
com.intellij.util.BooleanFunction
;
import
com.intellij.util.ObjectUtils
;
import
org.jetbrains.annotations.NonNls
;
import
org.jetbrains.annotations.NotNull
;
...
...
@@ -325,6 +326,22 @@ public class ServersToolWindowContent extends JPanel implements Disposable, Serv
});
}
public
<
T
>
void
select
(
@NotNull
Class
<
T
>
valueClass
,
@NotNull
BooleanFunction
<
T
>
valueVisitor
)
{
myBuilder
.
getUi
().
queueUpdate
(
myBuilder
.
getRootElement
())
.
doWhenDone
(
new
Runnable
()
{
@Override
public
void
run
()
{
myBuilder
.
select
(
AbstractTreeNode
.
class
,
new
TreeVisitor
<
AbstractTreeNode
>()
{
@Override
public
boolean
visit
(
@NotNull
AbstractTreeNode
node
)
{
T
valueCandidate
=
ObjectUtils
.
tryCast
(
node
.
getValue
(),
valueClass
);
return
valueCandidate
!=
null
&&
valueVisitor
.
fun
(
valueCandidate
);
}
},
null
,
false
);
}
});
}
private
static
boolean
isServerNodeMatch
(
@NotNull
final
ServersTreeStructure
.
RemoteServerNode
node
,
@NotNull
final
ServerConnection
<?>
connection
)
{
return
node
.
getServer
().
equals
(
connection
.
getServer
());
...
...
This diff is collapsed.
Click to expand it.
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+
10
-
0
View file @
08cb4b49
...
...
@@ -46,6 +46,7 @@ import com.intellij.openapi.util.Computable;
import
com.intellij.openapi.util.Disposer
;
import
com.intellij.openapi.wm.ToolWindowId
;
import
com.intellij.ui.AppUIUtil
;
import
com.intellij.ui.content.ContentManager
;
import
com.intellij.util.EventDispatcher
;
import
com.intellij.util.SmartList
;
import
com.intellij.util.containers.SmartHashSet
;
...
...
@@ -113,6 +114,7 @@ public class XDebugSessionImpl implements XDebugSession {
private
final
List
<
AnAction
>
myRestartActions
=
new
SmartList
<>();
private
final
List
<
AnAction
>
myExtraStopActions
=
new
SmartList
<>();
private
final
List
<
AnAction
>
myExtraActions
=
new
SmartList
<>();
private
ContentManager
myContentManager
;
private
ConsoleView
myConsoleView
;
private
final
Icon
myIcon
;
...
...
@@ -214,6 +216,14 @@ public class XDebugSessionImpl implements XDebugSession {
}
}
public
ContentManager
getContentManager
()
{
return
myContentManager
;
}
public
void
setContentManager
(
ContentManager
contentManager
)
{
myContentManager
=
contentManager
;
}
@Override
public
void
rebuildViews
()
{
if
(!
myShowTabOnSuspend
.
get
()
&&
mySessionTab
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
+
2
-
1
View file @
08cb4b49
...
...
@@ -158,7 +158,8 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
}
myRunContentDescriptor
=
new
RunContentDescriptor
(
myConsole
,
session
.
getDebugProcess
().
getProcessHandler
(),
myUi
.
getComponent
(),
session
.
getSessionName
(),
icon
,
myRebuildWatchesRunnable
,
restartActions
);
myUi
.
getComponent
(),
session
.
getSessionName
(),
icon
,
myRebuildWatchesRunnable
,
restartActions
,
session
.
getContentManager
());
Disposer
.
register
(
myRunContentDescriptor
,
this
);
Disposer
.
register
(
myProject
,
myRunContentDescriptor
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help