本文整理汇总了Java中com.intellij.debugger.impl.DebuggerSession类的典型用法代码示例。如果您正苦于以下问题:Java DebuggerSession类的具体用法?Java DebuggerSession怎么用?Java DebuggerSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DebuggerSession类属于com.intellij.debugger.impl包,在下文中一共展示了DebuggerSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanForModifiedClassesWithProgress
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
private Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClassesWithProgress( List<DebuggerSession> sessions, HotSwapProgressImpl progress )
{
Ref<Map<DebuggerSession, Map<String, HotSwapFile>>> result = Ref.create( null );
ProgressManager.getInstance().runProcess(
() -> {
try
{
result.set( scanForModifiedClasses( sessions, progress ) );
}
finally
{
progress.finished();
}
}, progress.getProgressIndicator() );
return result.get();
}
示例2: scanForModifiedClasses
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
public Map<String, HotSwapFile> scanForModifiedClasses( DebuggerSession session, HotSwapProgress progress )
{
DebuggerManagerThreadImpl.assertIsManagerThread();
Map<String, HotSwapFile> modifiedClasses = new HashMap<>();
List<File> outputRoots = new ArrayList<>();
ApplicationManager.getApplication().runReadAction(
() -> {
VirtualFile[] allDirs = OrderEnumerator.orderEntries( getIjProject() ).getAllSourceRoots();
for( VirtualFile dir : allDirs )
{
outputRoots.add( new File( dir.getPath() ) );
}
} );
long timeStamp = getTimeStamp( session );
for( File root : outputRoots )
{
String rootPath = FileUtil.toCanonicalPath( root.getPath() );
collectModifiedClasses( root, rootPath, modifiedClasses, progress, timeStamp );
}
setTimeStamp( session, System.currentTimeMillis() );
return modifiedClasses;
}
示例3: compilationFinished
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
public void compilationFinished( boolean aborted, int errors, int warnings, CompileContext compileContext )
{
if( getIjProject().isDisposed() )
{
return;
}
if( errors > 0 || aborted )
{
return;
}
List<DebuggerSession> sessions = getHotSwappableDebugSessions();
if( !sessions.isEmpty() )
{
hotSwapSessions( sessions );
}
}
示例4: actionPerformed
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
if (project == null) {
return;
}
DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext();
final DebuggerSession session = context.getDebuggerSession();
if(session != null && session.isAttached()) {
final DebugProcessImpl process = context.getDebugProcess();
if (process != null) {
process.getManagerThread().invoke(new DebuggerCommandImpl() {
protected void action() throws Exception {
final List<ThreadState> threads = ThreadDumpAction.buildThreadStates(process.getVirtualMachineProxy());
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
ExportToTextFileAction.export(project, ThreadDumpPanel.createToFileExporter(project, threads));
}
}, ModalityState.NON_MODAL);
}
});
}
}
}
示例5: canInspect
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
private boolean canInspect(ValueDescriptorImpl descriptor, DebuggerContextImpl context) {
DebuggerSession session = context.getDebuggerSession();
if (session == null || !session.isPaused()) return false;
boolean isField = descriptor instanceof FieldDescriptorImpl;
if(descriptor instanceof WatchItemDescriptor) {
Modifier modifier = ((WatchItemDescriptor)descriptor).getModifier();
if(modifier == null || !modifier.canInspect()) return false;
isField = modifier instanceof Field;
}
if (isField) { // check if possible
if (!context.getDebugProcess().canWatchFieldModification()) {
Messages.showMessageDialog(
context.getProject(),
DebuggerBundle.message("error.modification.watchpoints.not.supported"),
ActionsBundle.actionText(DebuggerActions.INSPECT),
Messages.getInformationIcon()
);
return false;
}
}
return true;
}
示例6: scanForModifiedClassesWithProgress
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
private static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClassesWithProgress(final List<DebuggerSession> sessions,
final HotSwapProgressImpl progress,
final boolean scanWithVFS) {
final Ref<Map<DebuggerSession, Map<String, HotSwapFile>>> result = Ref.create(null);
ProgressManager.getInstance().runProcess(new Runnable() {
public void run() {
try {
result.set(HotSwapManager.scanForModifiedClasses(sessions, progress, scanWithVFS));
}
finally {
progress.finished();
}
}
}, progress.getProgressIndicator());
return result.get();
}
示例7: compilationFinished
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
final Map<String, List<String>> generated = myGeneratedPaths.getAndSet(new HashMap<String, List<String>>());
if (myProject.isDisposed()) {
return;
}
if (errors == 0 && !aborted && myPerformHotswapAfterThisCompilation) {
for (HotSwapVetoableListener listener : myListeners) {
if (!listener.shouldHotSwap(compileContext)) {
return;
}
}
List<DebuggerSession> sessions = getHotSwappableDebugSessions();
if (!sessions.isEmpty()) {
hotSwapSessions(sessions, generated);
}
}
myPerformHotswapAfterThisCompilation = true;
}
示例8: UpdatableDebuggerView
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
protected UpdatableDebuggerView(final Project project, final DebuggerStateManager stateManager) {
setLayout(new BorderLayout());
myProject = project;
myStateManager = stateManager;
final DebuggerContextListener contextListener = new DebuggerContextListener() {
public void changeEvent(@NotNull DebuggerContextImpl newContext, DebuggerSession.Event event) {
UpdatableDebuggerView.this.changeEvent(newContext, event);
}
};
myStateManager.addListener(contextListener);
registerDisposable(new Disposable() {
public void dispose() {
myStateManager.removeListener(contextListener);
}
});
}
示例9: findHotSwappableBlazeDebuggerSession
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
@Nullable
static HotSwappableDebugSession findHotSwappableBlazeDebuggerSession(Project project) {
DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
if (session == null || !session.isAttached()) {
return null;
}
JavaDebugProcess process = session.getProcess().getXdebugProcess();
if (process == null) {
return null;
}
ExecutionEnvironment env = ((XDebugSessionImpl) process.getSession()).getExecutionEnvironment();
if (env == null || ClassFileManifestBuilder.getManifest(env) == null) {
return null;
}
RunProfile runProfile = env.getRunProfile();
if (!(runProfile instanceof BlazeCommandRunConfiguration)) {
return null;
}
return new HotSwappableDebugSession(session, env, (BlazeCommandRunConfiguration) runProfile);
}
示例10: changeEvent
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
@Override
public void changeEvent(@NotNull DebuggerContextImpl debuggerContext, DebuggerSession.Event event) {
switch (event) {
case ATTACHED:
firstPauseAfterStartOrResume = true;
break;
case PAUSE:
if (firstPauseAfterStartOrResume) {
trackingEventManager.addEvent(new DebugEventBase(TrackingEventType.SUSPEND_BREAKPOINT, new Date()));
firstPauseAfterStartOrResume = false;
}
break;
case RESUME:
trackingEventManager.addEvent(new DebugEventBase(TrackingEventType.RESUME_CLIENT, new Date()));
firstPauseAfterStartOrResume = true;
break;
}
}
示例11: loadRenderers
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
private void loadRenderers() {
getManagerThread().invoke(new DebuggerCommandImpl() {
protected void action() throws Exception {
try {
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
for (final NodeRenderer renderer : rendererSettings.getAllRenderers()) {
if (renderer.isEnabled()) {
myRenderers.add(renderer);
}
}
}
finally {
DebuggerInvocationUtil.swingInvokeLater(myProject, new Runnable() {
public void run() {
final DebuggerSession session = mySession;
if (session != null && session.isAttached()) {
session.refresh(true);
}
}
});
}
}
});
}
示例12: isEnabled
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
public boolean isEnabled(final @NotNull Project project, final AnActionEvent event) {
Editor editor = event.getData(PlatformDataKeys.EDITOR);
if (editor == null) {
return false;
}
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
FileTypeManager fileTypeManager = FileTypeManager.getInstance();
if (file == null) {
return false;
}
final VirtualFile virtualFile = file.getVirtualFile();
FileType fileType = virtualFile != null ? virtualFile.getFileType() : null;
if (DebuggerUtils.supportsJVMDebugging(fileType) || DebuggerUtils.supportsJVMDebugging(file)) {
DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(project).getContext().getDebuggerSession();
return debuggerSession != null && debuggerSession.isPaused();
}
return false;
}
示例13: doSmartStep
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
/**
* Override this if you haven't PsiMethod, like in Kotlin.
* @param position
* @param session
* @param fileEditor
* @return false to continue for another handler or for default action (step into)
*/
public boolean doSmartStep(SourcePosition position, final DebuggerSession session, TextEditor fileEditor) {
final List<PsiMethod> methods = findReferencedMethods(position);
if (methods.size() > 0) {
if (methods.size() == 1) {
session.stepInto(true, getSmartStepFilter(methods.get(0)));
}
else {
final PsiMethodListPopupStep popupStep = new PsiMethodListPopupStep(methods, new PsiMethodListPopupStep.OnChooseRunnable() {
public void execute(PsiMethod chosenMethod) {
session.stepInto(true, getSmartStepFilter(chosenMethod));
}
});
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(popupStep);
final RelativePoint point = DebuggerUIUtil.calcPopupLocation(((TextEditor)fileEditor).getEditor(), position.getLine());
popup.show(point);
}
return true;
}
return false;
}
示例14: compilationFinished
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
final Map<String, List<String>> generated = myGeneratedPaths.getAndSet(new HashMap<String, List<String>>());
if (myProject.isDisposed()) {
return;
}
if (errors == 0 && !aborted && myPerformHotswapAfterThisCompilation) {
for (HotSwapVetoableListener listener : myListeners) {
if (!listener.shouldHotSwap(compileContext)) {
return;
}
}
final List<DebuggerSession> sessions = new ArrayList<DebuggerSession>();
Collection<DebuggerSession> debuggerSessions = DebuggerManagerEx.getInstanceEx(myProject).getSessions();
for (final DebuggerSession debuggerSession : debuggerSessions) {
if (debuggerSession.isAttached() && debuggerSession.getProcess().canRedefineClasses()) {
sessions.add(debuggerSession);
}
}
if (!sessions.isEmpty()) {
hotSwapSessions(sessions, generated);
}
}
myPerformHotswapAfterThisCompilation = true;
}
示例15: rebuild
import com.intellij.debugger.impl.DebuggerSession; //导入依赖的package包/类
protected void rebuild(int event) {
myRebuildAlarm.cancelAllRequests();
final boolean isRefresh = event == DebuggerSession.EVENT_REFRESH ||
event == DebuggerSession.EVENT_REFRESH_VIEWS_ONLY ||
event == DebuggerSession.EVENT_THREADS_REFRESH;
if (!isRefresh) {
myPerformFullRebuild.set(true);
}
myRebuildAlarm.addRequest(new Runnable() {
public void run() {
try {
doRebuild(!myPerformFullRebuild.getAndSet(false));
}
catch (VMDisconnectedException e) {
// ignored
}
}
}, 100, ModalityState.NON_MODAL);
}