diff --git a/build/update.cmd b/build/update.cmd new file mode 100644 index 000000000000..a49d2daf764d --- /dev/null +++ b/build/update.cmd @@ -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 diff --git a/build/update.sh b/build/update.sh index fe6b927b278a..cc2471313c2e 100755 --- a/build/update.sh +++ b/build/update.sh @@ -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 diff --git a/java/debugger/impl/src/com/intellij/debugger/DebugEnvironment.java b/java/debugger/impl/src/com/intellij/debugger/DebugEnvironment.java new file mode 100644 index 000000000000..af8662bfffe8 --- /dev/null +++ b/java/debugger/impl/src/com/intellij/debugger/DebugEnvironment.java @@ -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(); +} diff --git a/java/debugger/impl/src/com/intellij/debugger/DebugUIEnvironment.java b/java/debugger/impl/src/com/intellij/debugger/DebugUIEnvironment.java new file mode 100644 index 000000000000..dbe88aa9f168 --- /dev/null +++ b/java/debugger/impl/src/com/intellij/debugger/DebugUIEnvironment.java @@ -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); +} diff --git a/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java b/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java index 834757b57b84..0384e6e68b1f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java +++ b/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java @@ -54,4 +54,5 @@ public abstract class DebuggerManagerEx extends DebuggerManager { boolean pollConnection ) throws ExecutionException; + public abstract DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException; } diff --git a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java new file mode 100644 index 000000000000..ffb3ee380d0e --- /dev/null +++ b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java @@ -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 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(); + } +} diff --git a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java new file mode 100644 index 000000000000..ccb8dc6e2dad --- /dev/null +++ b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java @@ -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())); + } +} diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index 439311c6fb34..83f1c9dbe005 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -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 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; } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java index 258b10dcfa0e..e44bb5145111 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java @@ -71,7 +71,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx { private final BreakpointManager myBreakpointManager; private final List myNameMappers = ContainerUtil.createEmptyCOWList(); private final List> myCustomPositionManagerFactories = new ArrayList>(); - + private final EventDispatcher 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, diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java index 23a6eaea4caa..e3773a3b7865 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -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; } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java index 041fb2876416..9cb61ef6eaee 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java @@ -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) { diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java index 251434eedaf8..2fc4c0b6caac 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java @@ -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) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java index 1d0d44cd300f..7ce328b63199 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java @@ -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(); diff --git a/platform/lang-api/src/com/intellij/patterns/PlatformPatterns.java b/platform/lang-api/src/com/intellij/patterns/PlatformPatterns.java index 4dc91de5cae9..c617fe6f3ea3 100644 --- a/platform/lang-api/src/com/intellij/patterns/PlatformPatterns.java +++ b/platform/lang-api/src/com/intellij/patterns/PlatformPatterns.java @@ -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.class); } + public static PsiElementPattern.Capture psiComment() { + return new PsiElementPattern.Capture(PsiComment.class); + } + public static PsiElementPattern.Capture pomElement(final ElementPattern targetPattern) { return new PsiElementPattern.Capture(PomTargetPsiElement.class).with(new PatternCondition("withPomTarget") { @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyPasteIndentProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyPasteIndentProcessor.java index 50623697022e..7e38e50aed82 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyPasteIndentProcessor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyPasteIndentProcessor.java @@ -48,7 +48,7 @@ public class CopyPasteIndentProcessor implements CopyPastePostProcessor 0) { - toIndent = toString.length(); - } - else { - toIndent = caretColumn; - } + toIndent = caretColumn; } // actual difference in indentation level diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java index 481c12cdfdca..f4e4d66f8063 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java @@ -227,7 +227,7 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser final Ref indented = new Ref(Boolean.FALSE); for(Map.Entry 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 = diff --git a/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java b/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java index 92c1fe10ed5f..b2605435d345 100644 --- a/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java @@ -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)); } diff --git a/platform/platform-api/src/com/intellij/ui/HighlightableCellRenderer.java b/platform/platform-api/src/com/intellij/ui/HighlightableCellRenderer.java index 392dfcffff36..b35c9a8c9a4d 100644 --- a/platform/platform-api/src/com/intellij/ui/HighlightableCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/HighlightableCellRenderer.java @@ -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; diff --git a/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java b/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java index 1683ac5c36b3..75f368b0f8e2 100644 --- a/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java @@ -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 diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java index 70ece1ad94fd..b67783afd0a3 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java @@ -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); diff --git a/platform/platform-api/src/com/intellij/util/EditSourceOnDoubleClickHandler.java b/platform/platform-api/src/com/intellij/util/EditSourceOnDoubleClickHandler.java index 34791ec8f524..6c0bc76a69ba 100644 --- a/platform/platform-api/src/com/intellij/util/EditSourceOnDoubleClickHandler.java +++ b/platform/platform-api/src/com/intellij/util/EditSourceOnDoubleClickHandler.java @@ -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; diff --git a/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java b/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java index e996c91d73a3..16e25aff0b78 100644 --- a/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java +++ b/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index c62fe597f758..2daebb27e175 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java index b2d944853456..5beb45732455 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ui/MultilineTreeCellRenderer.java b/platform/platform-impl/src/com/intellij/ui/MultilineTreeCellRenderer.java index 91ce8bbf4cd4..1c824224100e 100644 --- a/platform/platform-impl/src/com/intellij/ui/MultilineTreeCellRenderer.java +++ b/platform/platform-impl/src/com/intellij/ui/MultilineTreeCellRenderer.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java b/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java index 6a33df2d5b03..f3f3d39674b5 100644 --- a/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java +++ b/platform/platform-impl/src/com/intellij/ui/TreeExpandableItemsHandler.java @@ -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 - + + + \ No newline at end of file