mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
@ECHO OFF
|
||||
|
||||
:: This script updates your IntelliJ IDEA CE installation from the latest compiled classes. This way you can easily
|
||||
:: upgrade your working IDEA to the latest changes.
|
||||
::
|
||||
:: Before you run the script, ensure you have the following:
|
||||
:: 1. Your project for IntelliJ IDEA CE is fully built (do 'Rebuild Project' if you're not sure)
|
||||
:: 2. WORK_IDEA_HOME points to the directory of IntelliJ IDEA build you want to upgrade
|
||||
:: 3. DEV_IDEA_HOME points to the directory of the project you built at step 1
|
||||
:: 4. You quit IntelliJ IDEA
|
||||
|
||||
IF NOT EXIST "%JAVA_HOME%\bin\java.exe" (
|
||||
ECHO JAVA_HOME must be defined and point to a valid Java installaton
|
||||
EXIT
|
||||
)
|
||||
|
||||
IF NOT EXIST "%WORK_IDEA_HOME%\bin\idea.bat" (
|
||||
@ECHO WORK_IDEA_HOME must be defined and point to build you're updating
|
||||
EXIT
|
||||
)
|
||||
|
||||
IF NOT EXIST "%DEV_IDEA_HOME%\build\update.cmd" (
|
||||
@ECHO DEV_IDEA_HOME must be defined and point to source base your're updating from
|
||||
EXIT
|
||||
)
|
||||
|
||||
ECHO Updating %WORK_IDEA_HOME% from compiled classes at %DEV_IDEA_HOME%
|
||||
|
||||
CD %DEV_IDEA_HOME%
|
||||
|
||||
SET ANT_HOME=%DEV_IDEA_HOME%\lib\ant
|
||||
SET EXEC_ANT="%JAVA_HOME%\bin\java.exe" -Dant.home=%ANT_HOME% -classpath "%ANT_HOME%\lib\ant-launcher.jar" org.apache.tools.ant.launch.Launcher
|
||||
CALL %EXEC_ANT% -f build/update.xml %*
|
||||
|
||||
DEL /Q /S %WORK_IDEA_HOME%\lib
|
||||
DEL /Q /S %WORK_IDEA_HOME%\plugins
|
||||
|
||||
XCOPY %DEV_IDEA_HOME%\bin\win\*.dll %WORK_IDEA_HOME%\bin\ /Q /E /Y
|
||||
XCOPY %DEV_IDEA_HOME%\bin\win\fsnotifier.exe %WORK_IDEA_HOME%\bin\ /Q /E /Y
|
||||
XCOPY %DEV_IDEA_HOME%\bin\win\runnerw.exe %WORK_IDEA_HOME%\bin\ /Q /E /Y
|
||||
XCOPY %DEV_IDEA_HOME%\out\deploy\*.* %WORK_IDEA_HOME%\ /Q /E /Y
|
||||
|
||||
CD /D %WORK_IDEA_HOME%\bin
|
||||
+11
-11
@@ -8,24 +8,24 @@
|
||||
# 2. WORK_IDEA_HOME points to the directory of IntelliJ IDEA build you want to upgrade
|
||||
# 3. DEV_IDEA_HOME points to the directory of the project you built at step 1
|
||||
# 4. You quit IntelliJ IDEA
|
||||
#
|
||||
|
||||
if [ -z "$WORK_IDEA_HOME" ]; then
|
||||
echo "WORK_IDEA_HOME must be defined and point to build you're updating."
|
||||
exit
|
||||
if [ ! -f "$WORK_IDEA_HOME/bin/idea.sh" ]; then
|
||||
echo "WORK_IDEA_HOME must be defined and point to build you're updating."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -z "$DEV_IDEA_HOME" ]; then
|
||||
echo "DEV_IDEA_HOME must be defined and point to source base you're updating from."
|
||||
exit
|
||||
if [ ! -f "$DEV_IDEA_HOME/build/update.sh" ]; then
|
||||
echo "DEV_IDEA_HOME must be defined and point to source base you're updating from."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo Updating $WORK_IDEA_HOME from compiled classes in $DEV_IDEA_HOME
|
||||
echo "Updating $WORK_IDEA_HOME from compiled classes in $DEV_IDEA_HOME"
|
||||
|
||||
ANT_HOME="$DEV_IDEA_HOME/lib/ant"
|
||||
java -Xms64m -Xmx512m -Dant.home="$ANT_HOME" -classpath "$ANT_HOME/lib/ant-launcher.jar" org.apache.tools.ant.launch.Launcher \
|
||||
-f build/update.xml $TARGET
|
||||
|
||||
rm -rf $WORK_IDEA_HOME/lib
|
||||
rm -rf $WORK_IDEA_HOME/plugins
|
||||
|
||||
ant -f update.xml
|
||||
|
||||
cd $DEV_IDEA_HOME
|
||||
cp -R $DEV_IDEA_HOME/out/deploy/* $WORK_IDEA_HOME
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.debugger;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionResult;
|
||||
import com.intellij.execution.configurations.RemoteConnection;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public interface DebugEnvironment {
|
||||
|
||||
@Nullable
|
||||
ExecutionResult createExecutionResult() throws ExecutionException;
|
||||
|
||||
GlobalSearchScope getSearchScope();
|
||||
|
||||
boolean isRemote();
|
||||
|
||||
RemoteConnection getRemoteConnection();
|
||||
|
||||
boolean isPollConnection();
|
||||
|
||||
String getSessionName();
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.debugger;
|
||||
|
||||
import com.intellij.diagnostic.logging.LogFilesManager;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public interface DebugUIEnvironment {
|
||||
|
||||
DebugEnvironment getEnvironment();
|
||||
|
||||
@Nullable
|
||||
RunContentDescriptor getReuseContent();
|
||||
|
||||
@Nullable
|
||||
Icon getIcon();
|
||||
|
||||
void initLogs(RunContentDescriptor content, LogFilesManager logFilesManager);
|
||||
|
||||
void initActions(RunContentDescriptor content, DefaultActionGroup actionGroup);
|
||||
}
|
||||
@@ -54,4 +54,5 @@ public abstract class DebuggerManagerEx extends DebuggerManager {
|
||||
boolean pollConnection
|
||||
) throws ExecutionException;
|
||||
|
||||
public abstract DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.debugger;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionResult;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.filters.ExceptionFilters;
|
||||
import com.intellij.execution.filters.Filter;
|
||||
import com.intellij.execution.filters.TextConsoleBuilder;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public class DefaultDebugEnvironment implements DebugEnvironment {
|
||||
|
||||
private final GlobalSearchScope mySearchScope;
|
||||
private final Executor myExecutor;
|
||||
private final ProgramRunner myRunner;
|
||||
private RunProfileState myState;
|
||||
private final RemoteConnection myRemoteConnection;
|
||||
private final boolean myPollConnection;
|
||||
private final RunProfile myRunProfile;
|
||||
|
||||
public DefaultDebugEnvironment(Project project,
|
||||
Executor executor,
|
||||
ProgramRunner runner,
|
||||
RunProfile runProfile,
|
||||
RunProfileState state,
|
||||
RemoteConnection remoteConnection,
|
||||
boolean pollConnection) {
|
||||
myExecutor = executor;
|
||||
myRunner = runner;
|
||||
myRunProfile = runProfile;
|
||||
myState = state;
|
||||
myRemoteConnection = remoteConnection;
|
||||
myPollConnection = pollConnection;
|
||||
|
||||
Module[] modules = null;
|
||||
if (myRunProfile instanceof ModuleRunProfile) {
|
||||
modules = ((ModuleRunProfile)myRunProfile).getModules();
|
||||
}
|
||||
if (modules == null || modules.length == 0) {
|
||||
mySearchScope = GlobalSearchScope.allScope(project);
|
||||
}
|
||||
else {
|
||||
GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
|
||||
for (int idx = 1; idx < modules.length; idx++) {
|
||||
Module module = modules[idx];
|
||||
scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
|
||||
}
|
||||
mySearchScope = scope;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionResult createExecutionResult() throws ExecutionException {
|
||||
if (myState instanceof CommandLineState) {
|
||||
final TextConsoleBuilder consoleBuilder = ((CommandLineState)myState).getConsoleBuilder();
|
||||
if (consoleBuilder != null) {
|
||||
List<Filter> filters = ExceptionFilters.getFilters(mySearchScope);
|
||||
for (Filter filter : filters) {
|
||||
consoleBuilder.addFilter(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myState.execute(myExecutor, myRunner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlobalSearchScope getSearchScope() {
|
||||
return mySearchScope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRemote() {
|
||||
return myState instanceof RemoteState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteConnection getRemoteConnection() {
|
||||
return myRemoteConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPollConnection() {
|
||||
return myPollConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSessionName() {
|
||||
return myRunProfile.getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.debugger;
|
||||
|
||||
import com.intellij.diagnostic.logging.LogFilesManager;
|
||||
import com.intellij.diagnostic.logging.OutputFileUtil;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.RemoteConnection;
|
||||
import com.intellij.execution.configurations.RunConfigurationBase;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.configurations.RunProfileState;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.execution.runners.RestartAction;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.actions.CloseAction;
|
||||
import com.intellij.ide.actions.ContextHelpAction;
|
||||
import com.intellij.openapi.actionSystem.Constraints;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: michael.golubev
|
||||
*/
|
||||
public class DefaultDebugUIEnvironment implements DebugUIEnvironment {
|
||||
|
||||
private final Project myProject;
|
||||
private final Executor myExecutor;
|
||||
private final ProgramRunner myRunner;
|
||||
private final ExecutionEnvironment myExecutionEnvironment;
|
||||
@Nullable private final RunContentDescriptor myReuseContent;
|
||||
private final RunProfile myRunProfile;
|
||||
private final DebugEnvironment myModelEnvironment;
|
||||
|
||||
public DefaultDebugUIEnvironment(Project project,
|
||||
Executor executor,
|
||||
ProgramRunner runner,
|
||||
ExecutionEnvironment environment,
|
||||
RunProfileState state,
|
||||
@Nullable RunContentDescriptor reuseContent,
|
||||
RemoteConnection remoteConnection,
|
||||
boolean pollConnection) {
|
||||
myProject = project;
|
||||
myExecutor = executor;
|
||||
myRunner = runner;
|
||||
myExecutionEnvironment = environment;
|
||||
myRunProfile = environment.getRunProfile();
|
||||
myModelEnvironment = new DefaultDebugEnvironment(project,
|
||||
executor,
|
||||
runner,
|
||||
myRunProfile,
|
||||
state,
|
||||
remoteConnection,
|
||||
pollConnection);
|
||||
myReuseContent = reuseContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DebugEnvironment getEnvironment() {
|
||||
return myModelEnvironment;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public RunContentDescriptor getReuseContent() {
|
||||
return myReuseContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return myRunProfile.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initLogs(RunContentDescriptor content, LogFilesManager logFilesManager) {
|
||||
ProcessHandler processHandler = content.getProcessHandler();
|
||||
if (myRunProfile instanceof RunConfigurationBase) {
|
||||
RunConfigurationBase runConfiguration = (RunConfigurationBase)myRunProfile;
|
||||
|
||||
logFilesManager.registerFileMatcher(runConfiguration);
|
||||
|
||||
logFilesManager.initLogConsoles(runConfiguration, processHandler);
|
||||
OutputFileUtil.attachDumpListener(runConfiguration, processHandler, content.getExecutionConsole());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActions(RunContentDescriptor content, DefaultActionGroup actionGroup) {
|
||||
ProcessHandler processHandler = content.getProcessHandler();
|
||||
RestartAction restartAction = new RestartAction(myExecutor,
|
||||
myRunner,
|
||||
processHandler,
|
||||
XDebuggerUIConstants.DEBUG_AGAIN_ICON,
|
||||
content,
|
||||
myExecutionEnvironment);
|
||||
actionGroup.add(restartAction, Constraints.FIRST);
|
||||
restartAction.registerShortcut(content.getComponent());
|
||||
|
||||
actionGroup.add(new CloseAction(myExecutor, content, myProject));
|
||||
actionGroup.add(new ContextHelpAction(myExecutor.getHelpId()));
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,7 @@
|
||||
package com.intellij.debugger.engine;
|
||||
|
||||
import com.intellij.Patches;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerInvocationUtil;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.PositionManager;
|
||||
import com.intellij.debugger.*;
|
||||
import com.intellij.debugger.actions.DebuggerActions;
|
||||
import com.intellij.debugger.apiAdapters.ConnectionServiceWrapper;
|
||||
import com.intellij.debugger.apiAdapters.TransportServiceWrapper;
|
||||
@@ -46,13 +43,8 @@ import com.intellij.execution.CantRunException;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionResult;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.CommandLineState;
|
||||
import com.intellij.execution.configurations.RemoteConnection;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.configurations.RunProfileState;
|
||||
import com.intellij.execution.filters.ExceptionFilters;
|
||||
import com.intellij.execution.filters.Filter;
|
||||
import com.intellij.execution.filters.TextConsoleBuilder;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessListener;
|
||||
@@ -764,7 +756,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
|
||||
|
||||
protected void closeProcess(boolean closedByUser) {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
|
||||
|
||||
if (myState.compareAndSet(STATE_INITIAL, STATE_DETACHING) || myState.compareAndSet(STATE_ATTACHED, STATE_DETACHING)) {
|
||||
try {
|
||||
getManagerThread().close();
|
||||
@@ -925,7 +917,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
|
||||
|
||||
myEvaluationDispatcher.getMulticaster().evaluationStarted(suspendContext);
|
||||
beforeMethodInvocation(suspendContext, method);
|
||||
|
||||
|
||||
Object resumeData = null;
|
||||
try {
|
||||
for (final SuspendContextImpl suspendingContext : suspendingContexts) {
|
||||
@@ -1633,33 +1625,37 @@ public abstract class DebugProcessImpl implements DebugProcess {
|
||||
|
||||
@Nullable
|
||||
public ExecutionResult attachVirtualMachine(final Executor executor,
|
||||
final ProgramRunner runner,
|
||||
final DebuggerSession session,
|
||||
final RunProfileState state,
|
||||
final RemoteConnection remoteConnection,
|
||||
boolean pollConnection) throws ExecutionException {
|
||||
final ProgramRunner runner,
|
||||
final DebuggerSession session,
|
||||
final RunProfileState state,
|
||||
final RemoteConnection remoteConnection,
|
||||
boolean pollConnection) throws ExecutionException {
|
||||
return attachVirtualMachine(new DefaultDebugEnvironment(myProject,
|
||||
executor,
|
||||
runner,
|
||||
state.getRunnerSettings().getRunProfile(),
|
||||
state,
|
||||
remoteConnection,
|
||||
pollConnection),
|
||||
session);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ExecutionResult attachVirtualMachine(final DebugEnvironment environment,
|
||||
final DebuggerSession session) throws ExecutionException {
|
||||
mySession = session;
|
||||
myWaitFor.down();
|
||||
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
LOG.assertTrue(isInInitialState());
|
||||
|
||||
myConnection = remoteConnection;
|
||||
myConnection = environment.getRemoteConnection();
|
||||
|
||||
createVirtualMachine(state, pollConnection);
|
||||
createVirtualMachine(environment.getSessionName(), environment.isPollConnection());
|
||||
|
||||
try {
|
||||
synchronized (myProcessListeners) {
|
||||
if (state instanceof CommandLineState) {
|
||||
final TextConsoleBuilder consoleBuilder = ((CommandLineState)state).getConsoleBuilder();
|
||||
if (consoleBuilder != null) {
|
||||
List<Filter> filters = ExceptionFilters.getFilters(session.getSearchScope());
|
||||
for (Filter filter : filters) {
|
||||
consoleBuilder.addFilter(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
myExecutionResult = state.execute(executor, runner);
|
||||
myExecutionResult = environment.createExecutionResult();
|
||||
if (myExecutionResult == null) {
|
||||
fail();
|
||||
return null;
|
||||
@@ -1721,7 +1717,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
|
||||
stop(false);
|
||||
}
|
||||
|
||||
private void createVirtualMachine(final RunProfileState state, final boolean pollConnection) {
|
||||
private void createVirtualMachine(final String sessionName, final boolean pollConnection) {
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
semaphore.down();
|
||||
|
||||
@@ -1763,14 +1759,11 @@ public abstract class DebugProcessImpl implements DebugProcess {
|
||||
// propagate exception only in case we succeded to obtain execution result,
|
||||
// otherwise if the error is induced by the fact that there is nothing to debug, and there is no need to show
|
||||
// this problem to the user
|
||||
final RunProfile runProfile = state.getRunnerSettings().getRunProfile();
|
||||
if (runProfile != null) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, runProfile, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, sessionName, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
|
||||
private final BreakpointManager myBreakpointManager;
|
||||
private final List<NameMapper> myNameMappers = ContainerUtil.createEmptyCOWList();
|
||||
private final List<Function<DebugProcess, PositionManager>> myCustomPositionManagerFactories = new ArrayList<Function<DebugProcess, PositionManager>>();
|
||||
|
||||
|
||||
private final EventDispatcher<DebuggerManagerListener> myDispatcher = EventDispatcher.create(DebuggerManagerListener.class);
|
||||
private final MyDebuggerStateManager myDebuggerStateManager = new MyDebuggerStateManager();
|
||||
|
||||
@@ -182,7 +182,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
|
||||
myBreakpointManager.writeExternal(element);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DebuggerSession attachVirtualMachine(Executor executor,
|
||||
ProgramRunner runner,
|
||||
ModuleRunProfile profile,
|
||||
@@ -190,6 +190,16 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
|
||||
RemoteConnection remoteConnection,
|
||||
boolean pollConnection
|
||||
) throws ExecutionException {
|
||||
return attachVirtualMachine(new DefaultDebugEnvironment(myProject,
|
||||
executor,
|
||||
runner,
|
||||
profile,
|
||||
state,
|
||||
remoteConnection,
|
||||
pollConnection));
|
||||
}
|
||||
|
||||
public DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
final DebugProcessEvents debugProcess = new DebugProcessEvents(myProject);
|
||||
debugProcess.addDebugProcessListener(new DebugProcessAdapter() {
|
||||
@@ -215,9 +225,9 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
|
||||
debugProcess.removeDebugProcessListener(this);
|
||||
}
|
||||
});
|
||||
final DebuggerSession session = new DebuggerSession(profile.getName(), debugProcess);
|
||||
final DebuggerSession session = new DebuggerSession(environment.getSessionName(), debugProcess);
|
||||
|
||||
final ExecutionResult executionResult = session.attach(executor, runner, profile, state, remoteConnection, pollConnection);
|
||||
final ExecutionResult executionResult = session.attach(environment);
|
||||
if (executionResult == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -225,11 +235,11 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
|
||||
getContextManager().setState(DebuggerContextUtil.createDebuggerContext(session, session.getContextManager().getContext().getSuspendContext()), session.getState(), DebuggerSession.EVENT_CONTEXT, null);
|
||||
|
||||
final ProcessHandler processHandler = executionResult.getProcessHandler();
|
||||
|
||||
|
||||
synchronized (mySessions) {
|
||||
mySessions.put(processHandler, session);
|
||||
}
|
||||
|
||||
|
||||
if (!(processHandler instanceof RemoteDebugProcessHandler)) {
|
||||
// add listener only to non-remote process handler:
|
||||
// on Unix systems destroying process does not cause VMDeathEvent to be generated,
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerInvocationUtil;
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.*;
|
||||
import com.intellij.debugger.actions.DebuggerActions;
|
||||
import com.intellij.debugger.engine.*;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
@@ -43,7 +41,6 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
@@ -359,22 +356,28 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ExecutionResult attach(@NotNull final Executor executor, @NotNull final ProgramRunner runner, final ModuleRunProfile profile, final RunProfileState state, final RemoteConnection remoteConnection, final boolean pollConnection) throws ExecutionException {
|
||||
protected ExecutionResult attach(@NotNull final Executor executor,
|
||||
@NotNull final ProgramRunner runner,
|
||||
final ModuleRunProfile profile,
|
||||
final RunProfileState state,
|
||||
final RemoteConnection remoteConnection,
|
||||
final boolean pollConnection) throws ExecutionException {
|
||||
return attach(new DefaultDebugEnvironment(myDebugProcess.getProject(),
|
||||
executor,
|
||||
runner,
|
||||
profile,
|
||||
state,
|
||||
remoteConnection,
|
||||
pollConnection));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ExecutionResult attach(DebugEnvironment environment) throws ExecutionException {
|
||||
RemoteConnection remoteConnection = environment.getRemoteConnection();
|
||||
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(remoteConnection);
|
||||
final String transportName = DebuggerBundle.getTransportName(remoteConnection);
|
||||
final Module[] modules = profile.getModules();
|
||||
if (modules.length == 0) {
|
||||
mySearchScope = GlobalSearchScope.allScope(getProject());
|
||||
}
|
||||
else {
|
||||
GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
|
||||
for (int idx = 1; idx < modules.length; idx++) {
|
||||
Module module = modules[idx];
|
||||
scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
|
||||
}
|
||||
mySearchScope = scope;
|
||||
}
|
||||
final ExecutionResult executionResult = myDebugProcess.attachVirtualMachine(executor, runner, this, state, remoteConnection, pollConnection);
|
||||
mySearchScope = environment.getSearchScope();
|
||||
final ExecutionResult executionResult = myDebugProcess.attachVirtualMachine(environment, this);
|
||||
getContextManager().setState(SESSION_EMPTY_CONTEXT, STATE_WAITING_ATTACH, EVENT_START_WAIT_ATTACH, DebuggerBundle.message("status.waiting.attach", addressDisplayName, transportName));
|
||||
return executionResult;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.DebuggerInvocationUtil;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.*;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextListener;
|
||||
@@ -27,9 +26,7 @@ import com.intellij.debugger.ui.tree.render.BatchEvaluator;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionManager;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.ModuleRunProfile;
|
||||
import com.intellij.execution.configurations.RemoteConnection;
|
||||
import com.intellij.execution.configurations.RemoteState;
|
||||
import com.intellij.execution.configurations.RunProfileState;
|
||||
import com.intellij.execution.executors.DefaultDebugExecutor;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
@@ -103,10 +100,20 @@ public class DebuggerPanelsManager implements ProjectComponent {
|
||||
RunContentDescriptor reuseContent,
|
||||
RemoteConnection remoteConnection,
|
||||
boolean pollConnection) throws ExecutionException {
|
||||
return attachVirtualMachine(new DefaultDebugUIEnvironment(myProject,
|
||||
executor,
|
||||
runner,
|
||||
environment,
|
||||
state,
|
||||
reuseContent,
|
||||
remoteConnection,
|
||||
pollConnection));
|
||||
}
|
||||
|
||||
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(
|
||||
executor, runner, (ModuleRunProfile) environment.getRunProfile(), state, remoteConnection, pollConnection
|
||||
);
|
||||
@Nullable
|
||||
public RunContentDescriptor attachVirtualMachine(DebugUIEnvironment environment) throws ExecutionException {
|
||||
final DebugEnvironment modelEnvironment = environment.getEnvironment();
|
||||
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(modelEnvironment);
|
||||
if (debuggerSession == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -116,16 +123,16 @@ public class DebuggerPanelsManager implements ProjectComponent {
|
||||
debuggerSession.dispose();
|
||||
return null;
|
||||
}
|
||||
if (state instanceof RemoteState) {
|
||||
if (modelEnvironment.isRemote()) {
|
||||
// optimization: that way BatchEvaluator will not try to lookup the class file in remote VM
|
||||
// which is an expensive operation when executed first time
|
||||
debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);
|
||||
}
|
||||
|
||||
final DebuggerSessionTab sessionTab = new DebuggerSessionTab(myProject, debuggerSession.getSessionName(), environment.getRunProfile().getIcon());
|
||||
final DebuggerSessionTab sessionTab = new DebuggerSessionTab(myProject, modelEnvironment.getSessionName(), environment.getIcon());
|
||||
Disposer.register(myProject, sessionTab);
|
||||
RunContentDescriptor runContentDescriptor =
|
||||
sessionTab.attachToSession(debuggerSession, runner, environment);
|
||||
RunContentDescriptor runContentDescriptor = sessionTab.attachToSession(debuggerSession, environment);
|
||||
RunContentDescriptor reuseContent = environment.getReuseContent();
|
||||
if (reuseContent != null) {
|
||||
final ProcessHandler prevHandler = reuseContent.getProcessHandler();
|
||||
if (prevHandler != null) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.DebugUIEnvironment;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.actions.DebuggerActions;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
@@ -30,23 +31,20 @@ import com.intellij.debugger.ui.impl.ThreadsPanel;
|
||||
import com.intellij.debugger.ui.impl.VariablesPanel;
|
||||
import com.intellij.debugger.ui.impl.WatchDebuggerTree;
|
||||
import com.intellij.debugger.ui.impl.watch.*;
|
||||
import com.intellij.execution.*;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.DefaultExecutionResult;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionManager;
|
||||
import com.intellij.execution.ExecutionResult;
|
||||
import com.intellij.execution.executors.DefaultDebugExecutor;
|
||||
import com.intellij.execution.filters.ExceptionFilters;
|
||||
import com.intellij.execution.filters.Filter;
|
||||
import com.intellij.execution.filters.TextConsoleBuilder;
|
||||
import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.execution.runners.RestartAction;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.execution.ui.ExecutionConsoleEx;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.actions.CloseAction;
|
||||
import com.intellij.execution.ui.layout.PlaceInGrid;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.actions.ContextHelpAction;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -80,14 +78,12 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
private final VariablesPanel myVariablesPanel;
|
||||
private final MainWatchPanel myWatchPanel;
|
||||
|
||||
private ProgramRunner myRunner;
|
||||
private volatile DebuggerSession myDebuggerSession;
|
||||
|
||||
private final MyDebuggerStateManager myStateManager = new MyDebuggerStateManager();
|
||||
|
||||
private final FramesPanel myFramesPanel;
|
||||
private ExecutionEnvironment myEnvironment;
|
||||
private RunProfile myConfiguration;
|
||||
private DebugUIEnvironment myEnvironment;
|
||||
|
||||
private final ThreadsPanel myThreadsPanel;
|
||||
private static final String THREAD_DUMP_CONTENT_PREFIX = "Dump";
|
||||
@@ -184,7 +180,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
myUi.addContent(threadsContent, 0, PlaceInGrid.left, true);
|
||||
|
||||
for (Content each : myUi.getContents()) {
|
||||
updateStatus(each);
|
||||
updateStatus(each);
|
||||
}
|
||||
|
||||
myUi.addListener(new ContentManagerAdapter() {
|
||||
@@ -230,13 +226,15 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
|
||||
myUi.removeContent(myUi.findContent(DebuggerContentInfo.CONSOLE_CONTENT), true);
|
||||
|
||||
Content console;
|
||||
Content console = null;
|
||||
if (myConsole instanceof ExecutionConsoleEx) {
|
||||
((ExecutionConsoleEx)myConsole).buildUi(myUi);
|
||||
console = myUi.findContent(DebuggerContentInfo.CONSOLE_CONTENT);
|
||||
LOG.assertTrue(console != null, "Console content was not created");
|
||||
if (console == null) {
|
||||
LOG.debug("Reuse console created with non-debug runner");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (console == null) {
|
||||
console = myUi.createContent(DebuggerContentInfo.CONSOLE_CONTENT, myConsole.getComponent(),
|
||||
XDebuggerBundle.message("debugger.session.tab.console.content.name"),
|
||||
XDebuggerUIConstants.CONSOLE_TAB_ICON, myConsole.getPreferredFocusableComponent());
|
||||
@@ -259,15 +257,9 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
console.setActions(consoleActions, ActionPlaces.DEBUGGER_TOOLBAR, myConsole.getPreferredFocusableComponent());
|
||||
|
||||
initLogConsoles(myConfiguration, myRunContentDescriptor.getProcessHandler(), myConsole);
|
||||
myEnvironment.initLogs(myRunContentDescriptor, getLogManager());
|
||||
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
|
||||
RestartAction restarAction = new RestartAction(executor,
|
||||
myRunner, myRunContentDescriptor.getProcessHandler(), XDebuggerUIConstants.DEBUG_AGAIN_ICON,
|
||||
myRunContentDescriptor, myEnvironment);
|
||||
group.add(restarAction);
|
||||
restarAction.registerShortcut(myUi.getComponent());
|
||||
|
||||
if (executionResult instanceof DefaultExecutionResult) {
|
||||
final AnAction[] actions = ((DefaultExecutionResult)executionResult).getRestartActions();
|
||||
@@ -331,12 +323,11 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
group.addSeparator();
|
||||
|
||||
addActionToGroup(group, PinToolwindowTabAction.ACTION_NAME);
|
||||
group.add(new CloseAction(executor, myRunContentDescriptor, getProject()));
|
||||
group.add(new ContextHelpAction(executor.getHelpId()));
|
||||
|
||||
myEnvironment.initActions(myRunContentDescriptor, group);
|
||||
|
||||
myUi.getOptions().setLeftToolbar(group, ActionPlaces.DEBUGGER_TOOLBAR);
|
||||
|
||||
|
||||
return myRunContentDescriptor;
|
||||
}
|
||||
|
||||
@@ -384,7 +375,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
|
||||
public String getSessionName() {
|
||||
return myConfiguration.getName();
|
||||
return myEnvironment.getEnvironment().getSessionName();
|
||||
}
|
||||
|
||||
public DebuggerStateManager getContextManager() {
|
||||
@@ -427,15 +418,10 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
}
|
||||
|
||||
public RunContentDescriptor attachToSession(final DebuggerSession session, final ProgramRunner runner, final ExecutionEnvironment env)
|
||||
throws ExecutionException {
|
||||
public RunContentDescriptor attachToSession(final DebuggerSession session, DebugUIEnvironment environment) throws ExecutionException {
|
||||
disposeSession();
|
||||
myDebuggerSession = session;
|
||||
myRunner = runner;
|
||||
myEnvironment = env;
|
||||
myConfiguration = env.getRunProfile();
|
||||
|
||||
registerFileMatcher(myConfiguration);
|
||||
myEnvironment = environment;
|
||||
|
||||
session.getContextManager().addListener(new DebuggerContextListener() {
|
||||
public void changeEvent(DebuggerContextImpl newContext, int event) {
|
||||
|
||||
+1
@@ -176,6 +176,7 @@ public class RenameWrongRefFix implements IntentionAction {
|
||||
}
|
||||
}
|
||||
|
||||
items.add(LookupElementBuilder.create(myRefExpr.getReferenceName()));
|
||||
MyScopeProcessor processor = new MyScopeProcessor(myRefExpr);
|
||||
myRefExpr.processVariants(processor);
|
||||
PsiElement[] variants = processor.getVariants();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.patterns;
|
||||
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -32,6 +33,10 @@ public class PlatformPatterns extends StandardPatterns {
|
||||
return new PsiElementPattern.Capture<PsiElement>(PsiElement.class);
|
||||
}
|
||||
|
||||
public static PsiElementPattern.Capture<PsiComment> psiComment() {
|
||||
return new PsiElementPattern.Capture<PsiComment>(PsiComment.class);
|
||||
}
|
||||
|
||||
public static PsiElementPattern.Capture<PomTargetPsiElement> pomElement(final ElementPattern<? extends PomTarget> targetPattern) {
|
||||
return new PsiElementPattern.Capture<PomTargetPsiElement>(PomTargetPsiElement.class).with(new PatternCondition<PomTargetPsiElement>("withPomTarget") {
|
||||
@Override
|
||||
|
||||
+2
-7
@@ -48,7 +48,7 @@ public class CopyPasteIndentProcessor implements CopyPastePostProcessor<IndentTr
|
||||
|
||||
@Override
|
||||
public IndentTransferableData extractTransferableData(Transferable content) {
|
||||
IndentTransferableData indentData = null;
|
||||
IndentTransferableData indentData = new IndentTransferableData(-1);
|
||||
try {
|
||||
final DataFlavor flavor = IndentTransferableData.getDataFlavorStatic();
|
||||
if (flavor != null) {
|
||||
@@ -113,12 +113,7 @@ public class CopyPasteIndentProcessor implements CopyPastePostProcessor<IndentTr
|
||||
}
|
||||
});
|
||||
if (toIndent < 0 || toString.startsWith("\n")) {
|
||||
if (StringUtil.isEmptyOrSpaces(toString) && toString.length() > 0) {
|
||||
toIndent = toString.length();
|
||||
}
|
||||
else {
|
||||
toIndent = caretColumn;
|
||||
}
|
||||
toIndent = caretColumn;
|
||||
}
|
||||
|
||||
// actual difference in indentation level
|
||||
|
||||
@@ -227,7 +227,7 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
|
||||
final Ref<Boolean> indented = new Ref<Boolean>(Boolean.FALSE);
|
||||
for(Map.Entry<CopyPastePostProcessor, TextBlockTransferableData> e: extraData.entrySet()) {
|
||||
//noinspection unchecked
|
||||
e.getKey().processTransferableData(project, editor, bounds, offset, indented, e.getValue());
|
||||
e.getKey().processTransferableData(project, editor, bounds, caretOffset, indented, e.getValue());
|
||||
}
|
||||
|
||||
boolean pastedTextContainsWhiteSpacesOnly =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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,7 +17,7 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class ColoredTreeCellRenderer extends SimpleColoredComponent imp
|
||||
if (UIUtil.isFullRowSelectionLAF()) {
|
||||
setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
|
||||
}
|
||||
else if (UIUtil.isUnderAquaBasedLookAndFeel() && tree.getUI() instanceof MacTreeUI && ((MacTreeUI)tree.getUI()).isWideSelection()) {
|
||||
else if (/*UIUtil.isUnderAquaBasedLookAndFeel() && */tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
|
||||
setPaintFocusBorder(false);
|
||||
//setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public abstract class ColoredTreeCellRenderer extends SimpleColoredComponent imp
|
||||
super.setOpaque(false); // avoid erasing Nimbus focus frame
|
||||
super.setIconOpaque(false);
|
||||
}
|
||||
else if (UIUtil.isUnderAquaBasedLookAndFeel() && tree.getUI() instanceof MacTreeUI && ((MacTreeUI)tree.getUI()).isWideSelection()) {
|
||||
else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
|
||||
super.setOpaque(false); // avoid erasing Nimbus focus frame
|
||||
super.setIconOpaque(false);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public abstract class ColoredTreeCellRenderer extends SimpleColoredComponent imp
|
||||
super.setOpaque(myOpaque || selected && hasFocus || selected && isFocused()); // draw selection background even for non-opaque tree
|
||||
}
|
||||
|
||||
if (tree.getUI() instanceof MacTreeUI) {
|
||||
if (tree.getUI() instanceof WideSelectionTreeUI && UIUtil.isUnderAquaBasedLookAndFeel()) {
|
||||
setMyBorder(null);
|
||||
setIpad(new Insets(0, 2, 0, 2));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
@@ -36,7 +36,7 @@ public class HighlightableCellRenderer extends HighlightableComponent implements
|
||||
setFont(UIUtil.getTreeFont());
|
||||
setIcon(null);
|
||||
|
||||
if (tree.getUI() instanceof MacTreeUI && ((MacTreeUI)tree.getUI()).isWideSelection()) {
|
||||
if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
|
||||
setOpaque(false);
|
||||
myIsSelected = false;
|
||||
myHasFocus = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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,7 +17,7 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.util.ui.MacUIUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -33,7 +33,7 @@ public class JBDefaultTreeCellRenderer extends DefaultTreeCellRenderer {
|
||||
|
||||
public JBDefaultTreeCellRenderer(@NotNull final JTree tree) {
|
||||
MacUIUtil.doNotFillBackground(tree, this);
|
||||
myMacTreeUI = tree.getUI() instanceof MacTreeUI && ((MacTreeUI)tree.getUI()).isWideSelection();
|
||||
myMacTreeUI = tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.intellij.util.ui.AsyncProcessIcon;
|
||||
import com.intellij.util.ui.ComponentWithEmptyText;
|
||||
import com.intellij.util.ui.StatusText;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -96,8 +96,8 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
|
||||
public void setUI(final TreeUI ui) {
|
||||
TreeUI actualUI = ui;
|
||||
if (!isCustomUI()) {
|
||||
if (!(ui instanceof MacTreeUI) && UIUtil.isUnderAquaBasedLookAndFeel()) {
|
||||
actualUI = new MacTreeUI(isMacWideSelection(), !isFileColorsEnabled());
|
||||
if (!(ui instanceof WideSelectionTreeUI) /*&& UIUtil.isUnderAquaBasedLookAndFeel()*/) {
|
||||
actualUI = new WideSelectionTreeUI(isMacWideSelection(), !isFileColorsEnabled());
|
||||
}
|
||||
}
|
||||
super.setUI(actualUI);
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.DoubleClickListener;
|
||||
import com.intellij.ui.treeStructure.treetable.TreeTable;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -106,7 +106,7 @@ public class EditSourceOnDoubleClickHandler {
|
||||
|
||||
@Override
|
||||
public boolean onDoubleClick(MouseEvent e) {
|
||||
final TreePath path = myTree.getUI() instanceof MacTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
|
||||
final TreePath path = myTree.getUI() instanceof WideSelectionTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
|
||||
: myTree.getPathForLocation(e.getX(), e.getY());
|
||||
if (path == null) return false;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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,7 @@ import com.intellij.ide.dnd.DnDAware;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DnDAwareTree extends Tree implements DnDAware {
|
||||
|
||||
public final boolean isOverSelection(final Point point) {
|
||||
final TreeUI ui = getUI();
|
||||
final TreePath path = ui instanceof MacTreeUI && ((MacTreeUI)ui).isWideSelection()
|
||||
final TreePath path = ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection()
|
||||
? getClosestPathForLocation(point.x, point.y) : getPathForLocation(point.x, point.y);
|
||||
if (path == null) return false;
|
||||
return isPathSelected(path);
|
||||
|
||||
@@ -1752,8 +1752,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
*/
|
||||
public void startDumb() {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) return;
|
||||
final EditorComponentImpl component = getContentComponent();
|
||||
final Rectangle rect = component.getVisibleRect();
|
||||
final JComponent component = getContentComponent();
|
||||
final JComponent viewPort = (JComponent)component.getParent();
|
||||
final Rectangle rect = viewPort.getVisibleRect();
|
||||
BufferedImage image = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_RGB);
|
||||
final Graphics2D graphics = image.createGraphics();
|
||||
UISettings.setupAntialiasing(graphics);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -37,7 +37,7 @@ import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.ui.treeStructure.treetable.TreeTableModel;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -97,7 +97,7 @@ public class ActionsTree {
|
||||
myTree.setRootVisible(false);
|
||||
myTree.setShowsRootHandles(true);
|
||||
|
||||
myTree.putClientProperty(MacTreeUI.STRIPED_CLIENT_PROPERTY, Boolean.TRUE);
|
||||
myTree.putClientProperty(WideSelectionTreeUI.STRIPED_CLIENT_PROPERTY, Boolean.TRUE);
|
||||
myTree.setCellRenderer(new KeymapsRenderer());
|
||||
|
||||
myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -131,7 +131,7 @@ public abstract class MultilineTreeCellRenderer extends JComponent implements Tr
|
||||
}
|
||||
|
||||
// fill background
|
||||
if (!(myTree.getUI() instanceof MacTreeUI) || !((MacTreeUI)myTree.getUI()).isWideSelection()) {
|
||||
if (!(myTree.getUI() instanceof WideSelectionTreeUI) || !((WideSelectionTreeUI)myTree.getUI()).isWideSelection()) {
|
||||
g.setColor(bgColor);
|
||||
g.fillRect(borderX, borderY, borderW, borderH);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.intellij.ui;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.TreeModelEvent;
|
||||
@@ -133,13 +133,13 @@ public class TreeExpandableItemsHandler extends AbstractExpandableItemsHandler<I
|
||||
@Override
|
||||
protected Dimension getImageSize(int width, int height) {
|
||||
final TreeUI ui = myComponent.getUI();
|
||||
return new Dimension(width, ui instanceof MacTreeUI && ((MacTreeUI)ui).isWideSelection() ? height - 1 : height);
|
||||
return new Dimension(width, ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection() ? height - 1 : height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFillBackground(final int height, final int width, final Graphics2D g) {
|
||||
final TreeUI ui = myComponent.getUI();
|
||||
super.doFillBackground(ui instanceof MacTreeUI && ((MacTreeUI)ui).isWideSelection() ? height - 1 : height, width, g);
|
||||
super.doFillBackground(ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection() ? height - 1 : height, width, g);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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,7 +20,7 @@ import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.mac.foundation.Foundation;
|
||||
import com.intellij.util.ui.tree.MacTreeUI;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -251,8 +251,8 @@ public class MacUIUtil {
|
||||
|
||||
public static void doNotFillBackground(@NotNull final JTree tree, @NotNull final DefaultTreeCellRenderer renderer) {
|
||||
TreeUI ui = tree.getUI();
|
||||
if (ui instanceof MacTreeUI) {
|
||||
if (((MacTreeUI)ui).isWideSelection()) {
|
||||
if (ui instanceof WideSelectionTreeUI) {
|
||||
if (((WideSelectionTreeUI)ui).isWideSelection()) {
|
||||
renderer.setOpaque(false);
|
||||
try {
|
||||
final Field fillBackground = DefaultTreeCellRenderer.class.getDeclaredField("fillBackground");
|
||||
|
||||
+44
-15
@@ -35,15 +35,16 @@ import java.awt.event.MouseListener;
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class MacTreeUI extends BasicTreeUI {
|
||||
private static final Color DECORATED_ROW_BG_COLOR = new Color(242, 245, 249);
|
||||
public class WideSelectionTreeUI extends BasicTreeUI {
|
||||
@NonNls public static final String SOURCE_LIST_CLIENT_PROPERTY = "mac.ui.source.list";
|
||||
@NonNls public static final String STRIPED_CLIENT_PROPERTY = "mac.ui.striped";
|
||||
|
||||
private static final Icon TREE_COLLAPSED_ICON = UIUtil.getTreeCollapsedIcon();
|
||||
private static final Icon TREE_EXPANDED_ICON = UIUtil.getTreeExpandedIcon();
|
||||
private static final Icon TREE_SELECTED_COLLAPSED_ICON = AllIcons.Mac.Tree_white_right_arrow;
|
||||
private static final Icon TREE_SELECTED_EXPANDED_ICON = AllIcons.Mac.Tree_white_down_arrow;
|
||||
private static final Icon TREE_SELECTED_COLLAPSED_ICON = UIUtil.isUnderAquaBasedLookAndFeel() ? AllIcons.Mac.Tree_white_right_arrow
|
||||
: TREE_COLLAPSED_ICON;
|
||||
private static final Icon TREE_SELECTED_EXPANDED_ICON = UIUtil.isUnderAquaBasedLookAndFeel() ? AllIcons.Mac.Tree_white_down_arrow
|
||||
: TREE_EXPANDED_ICON;
|
||||
|
||||
private static final Border LIST_BACKGROUND_PAINTER = (Border)UIManager.get("List.sourceListBackgroundPainter");
|
||||
private static final Border LIST_SELECTION_BACKGROUND_PAINTER = (Border)UIManager.get("List.sourceListSelectionBackgroundPainter");
|
||||
@@ -54,11 +55,11 @@ public class MacTreeUI extends BasicTreeUI {
|
||||
private boolean myAlwaysPaintRowBackground;
|
||||
private boolean myOldRepaintAllRowValue;
|
||||
|
||||
public MacTreeUI() {
|
||||
public WideSelectionTreeUI() {
|
||||
this(true, true);
|
||||
}
|
||||
|
||||
public MacTreeUI(final boolean wideSelection, boolean alwaysPaintRowBackground) {
|
||||
public WideSelectionTreeUI(final boolean wideSelection, boolean alwaysPaintRowBackground) {
|
||||
myWideSelection = wideSelection;
|
||||
myAlwaysPaintRowBackground = alwaysPaintRowBackground;
|
||||
}
|
||||
@@ -214,7 +215,9 @@ public class MacTreeUI extends BasicTreeUI {
|
||||
final boolean isExpanded,
|
||||
final boolean hasBeenExpanded,
|
||||
final boolean isLeaf) {
|
||||
|
||||
if (!UIUtil.isUnderAquaBasedLookAndFeel()) {
|
||||
super.paintHorizontalPartOfLeg(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,10 +227,16 @@ public class MacTreeUI extends BasicTreeUI {
|
||||
|
||||
@Override
|
||||
protected void paintVerticalPartOfLeg(final Graphics g, final Rectangle clipBounds, final Insets insets, final TreePath path) {
|
||||
if (!UIUtil.isUnderAquaBasedLookAndFeel()) {
|
||||
super.paintVerticalPartOfLeg(g, clipBounds, insets, path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right) {
|
||||
if (!UIUtil.isUnderAquaBasedLookAndFeel()) {
|
||||
super.paintHorizontalLine(g, c, y, left, right);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isWideSelection() {
|
||||
@@ -274,15 +283,15 @@ public class MacTreeUI extends BasicTreeUI {
|
||||
}
|
||||
}
|
||||
else {
|
||||
Color bg = tree.hasFocus() ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground();
|
||||
if (!selected) {
|
||||
bg = background;
|
||||
}
|
||||
//Color bg = tree.hasFocus() ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground();
|
||||
//if (!selected) {
|
||||
// bg = background;
|
||||
//}
|
||||
|
||||
if (myAlwaysPaintRowBackground || selected) {
|
||||
rowGraphics.setColor(bg);
|
||||
rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height - 1);
|
||||
}
|
||||
//if (/*myAlwaysPaintRowBackground || */selected) {
|
||||
// rowGraphics.setColor(bg);
|
||||
// rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height - 1);
|
||||
//}
|
||||
}
|
||||
|
||||
if (shouldPaintExpandControl(path, row, isExpanded, hasBeenExpanded, isLeaf)) {
|
||||
@@ -299,6 +308,9 @@ public class MacTreeUI extends BasicTreeUI {
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
if (myAlwaysPaintRowBackground && myWideSelection) {
|
||||
paintSelectedRows(g, ((JTree)c));
|
||||
}
|
||||
if (myWideSelection) {
|
||||
final int containerWidth = tree.getParent() instanceof JViewport ? tree.getParent().getWidth() : tree.getWidth();
|
||||
final int xOffset = tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewPosition().x : 0;
|
||||
@@ -317,6 +329,23 @@ public class MacTreeUI extends BasicTreeUI {
|
||||
super.paint(g, c);
|
||||
}
|
||||
|
||||
protected void paintSelectedRows(Graphics g, JTree tr) {
|
||||
final Rectangle rect = tr.getVisibleRect();
|
||||
final int firstVisibleRow = tr.getClosestRowForLocation(rect.x, rect.y);
|
||||
final int lastVisibleRow = tr.getClosestRowForLocation(rect.x, rect.y + rect.height);
|
||||
|
||||
for (int row = firstVisibleRow; row <= lastVisibleRow; row++) {
|
||||
if (tr.getSelectionModel().isRowSelected(row)) {
|
||||
final Rectangle bounds = tr.getRowBounds(row);
|
||||
Color color = tr.hasFocus() ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground();
|
||||
if (color != null) {
|
||||
g.setColor(color);
|
||||
g.fillRect(0, bounds.y, tr.getWidth(), bounds.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CellRendererPane createCellRendererPane() {
|
||||
return new CellRendererPane() {
|
||||
@@ -109,6 +109,10 @@ public abstract class DebuggerSessionTabBase implements DebuggerLogConsoleManage
|
||||
}
|
||||
}
|
||||
|
||||
protected LogFilesManager getLogManager() {
|
||||
return myManager;
|
||||
}
|
||||
|
||||
// TODO[oleg]: talk to nick
|
||||
public void setEnvironment(@NotNull final ExecutionEnvironment env) {
|
||||
myEnvironment = env;
|
||||
|
||||
@@ -6,5 +6,7 @@
|
||||
<languageSupport implementation="com.intellij.plugins.intelliLang.inject.JSLanguageInjectionSupport"/>
|
||||
<injectionConfig config="resources/jsInjections.xml"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<patterns.patternClass className="com.intellij.lang.javascript.patterns.JSPatterns" alias="js"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
Reference in New Issue
Block a user