Search in sources :

Example 26 with Breakpoint

use of com.google.api.services.clouddebugger.v2.model.Breakpoint in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudDebugHistoricalSnapshots method fireDeleteBreakpoints.

/**
 * Deletes breakpoints asynchronously on a threadpool thread. The user will see these breakpoints
 * gradually disappear.
 */
private void fireDeleteBreakpoints(@NotNull final List<Breakpoint> breakpointsToDelete) {
    for (Breakpoint breakpoint : breakpointsToDelete) {
        getModel().markForDelete(breakpoint.getId());
        process.getBreakpointHandler().deleteBreakpoint(breakpoint);
    }
    getModel().fireTableDataChanged();
}
Also used : Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint)

Example 27 with Breakpoint

use of com.google.api.services.clouddebugger.v2.model.Breakpoint in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudDebugHistoricalSnapshots method getSelection.

@VisibleForTesting
int getSelection() {
    final List<Breakpoint> breakpointList = process.getCurrentBreakpointList();
    int selection = -1;
    if (breakpointList != null) {
        for (int i = 0; i < breakpointList.size(); i++) {
            Breakpoint snapshot = process.getCurrentSnapshot();
            if (snapshot != null && breakpointList.get(i).getId().equals(snapshot.getId())) {
                selection = i;
                break;
            }
        }
    }
    return selection;
}
Also used : Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint) Point(java.awt.Point) RelativePoint(com.intellij.ui.awt.RelativePoint) Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 28 with Breakpoint

use of com.google.api.services.clouddebugger.v2.model.Breakpoint in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudDebugHistoricalSnapshots method getSelectedBreakpoints.

/**
 * Used by delete and clone, this returns the lines the user currently has selected in the
 * snapshot list.
 */
@NotNull
private List<Breakpoint> getSelectedBreakpoints() {
    List<Breakpoint> selectedBreakpoints = new ArrayList<Breakpoint>();
    SnapshotsModel model = (SnapshotsModel) table.getModel();
    int[] selectedRows = table.getSelectedRows();
    for (int selectedRow : selectedRows) {
        selectedBreakpoints.add(model.getBreakpoints().get(selectedRow));
    }
    return selectedBreakpoints;
}
Also used : Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint) ArrayList(java.util.ArrayList) Point(java.awt.Point) RelativePoint(com.intellij.ui.awt.RelativePoint) Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint) NotNull(org.jetbrains.annotations.NotNull)

Example 29 with Breakpoint

use of com.google.api.services.clouddebugger.v2.model.Breakpoint in project google-cloud-intellij by GoogleCloudPlatform.

the class SnapshotsModel method getValueAt.

@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    if (rowIndex < 0 || rowIndex >= breakpoints.size()) {
        return null;
    }
    Breakpoint breakpoint = breakpoints.get(rowIndex);
    switch(columnIndex) {
        case 0:
            if (breakpoint.getStatus() != null && Boolean.TRUE.equals(breakpoint.getStatus().getIsError())) {
                return GoogleCloudToolsIcons.CLOUD_BREAKPOINT_ERROR;
            }
            if (!Boolean.TRUE.equals(breakpoint.getIsFinalState())) {
                return GoogleCloudToolsIcons.CLOUD_BREAKPOINT_CHECKED;
            }
            return GoogleCloudToolsIcons.CLOUD_BREAKPOINT_FINAL;
        case 1:
            if (!Boolean.TRUE.equals(breakpoint.getIsFinalState())) {
                return GctBundle.getString("clouddebug.pendingstatus");
            }
            try {
                return ISODateTimeFormat.dateTime().parseDateTime(breakpoint.getFinalTime()).toDate();
            } catch (IllegalArgumentException iae) {
                return new Date();
            }
        case 2:
            String path = breakpoint.getLocation().getPath();
            int startIndex = path.lastIndexOf('/');
            return path.substring(startIndex >= 0 ? startIndex + 1 : 0) + ":" + breakpoint.getLocation().getLine().toString();
        case 3:
            return breakpoint.getCondition();
        case 4:
            if (snapshots.supportsMoreConfig(breakpoint)) {
                return GctBundle.getString("clouddebug.moreHTML");
            } else {
                return null;
            }
        default:
            return null;
    }
}
Also used : Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint) Date(java.util.Date) Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint)

Aggregations

Breakpoint (com.google.api.services.clouddebugger.v2.model.Breakpoint)27 CloudLineBreakpoint (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointType.CloudLineBreakpoint)11 XLineBreakpoint (com.intellij.xdebugger.breakpoints.XLineBreakpoint)11 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)10 SourceLocation (com.google.api.services.clouddebugger.v2.model.SourceLocation)8 Debugger (com.google.api.services.clouddebugger.v2.Clouddebugger.Debugger)7 ArrayList (java.util.ArrayList)7 XBreakpointManager (com.intellij.xdebugger.breakpoints.XBreakpointManager)4 IOException (java.io.IOException)4 ListBreakpointsResponse (com.google.api.services.clouddebugger.v2.model.ListBreakpointsResponse)3 PluginInfoService (com.google.cloud.tools.intellij.service.PluginInfoService)3 Project (com.intellij.openapi.project.Project)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 XLineBreakpointImpl (com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl)3 Test (org.junit.Test)3 StatusMessage (com.google.api.services.clouddebugger.v2.model.StatusMessage)2 CloudBreakpointHandler (com.google.cloud.tools.intellij.debugger.CloudBreakpointHandler)2 SetBreakpointHandler (com.google.cloud.tools.intellij.debugger.CloudDebugProcessStateController.SetBreakpointHandler)2 RelativePoint (com.intellij.ui.awt.RelativePoint)2 XDebuggerManager (com.intellij.xdebugger.XDebuggerManager)2