@Override
      void breakpointChanged(ChromiumLineBreakpoint lineBreakpoint, IMarkerDelta delta) {
        if (ChromiumLineBreakpoint.getIgnoreList().contains(lineBreakpoint)) {
          return;
        }
        Breakpoint sdkBreakpoint = getMap().getSdkBreakpoint(lineBreakpoint);
        if (sdkBreakpoint == null) {
          return;
        }

        Set<MutableProperty> propertyDelta = lineBreakpoint.getChangedProperty(delta);

        if (propertyDelta.isEmpty()) {
          return;
        }

        try {
          ChromiumLineBreakpoint.Helper.updateOnRemote(
              sdkBreakpoint, lineBreakpoint, propertyDelta);
        } catch (RuntimeException e) {
          ChromiumDebugPlugin.log(
              new Exception(
                  "Failed to change breakpoint in "
                      + //$NON-NLS-1$
                      getTargetNameSafe(),
                  e));
        } catch (CoreException e) {
          ChromiumDebugPlugin.log(
              new Exception(
                  "Failed to change breakpoint in "
                      + //$NON-NLS-1$
                      getTargetNameSafe(),
                  e));
        }
      }
      @Override
      void breakpointAdded(ChromiumLineBreakpoint lineBreakpoint) {
        if (ChromiumLineBreakpoint.getIgnoreList().contains(lineBreakpoint)) {
          return;
        }
        IFile file = (IFile) lineBreakpoint.getMarker().getResource();
        VmResourceRef vmResourceRef;
        try {
          vmResourceRef = findVmResourceRefFromWorkspaceFile(file);
        } catch (CoreException e) {
          ChromiumDebugPlugin.log(
              new Exception("Failed to resolve script for the file " + file, e)); // $NON-NLS-1$
          return;
        }
        if (vmResourceRef == null) {
          // Might be a script from a different debug target
          return;
        }

        try {
          createBreakpointOnRemote(lineBreakpoint, vmResourceRef, null, null);
        } catch (CoreException e) {
          ChromiumDebugPlugin.log(
              new Exception(
                  "Failed to create breakpoint in "
                      + //$NON-NLS-1$
                      getTargetNameSafe(),
                  e));
          throw new RuntimeException(e);
        }
      }
Exemplo n.º 3
0
 private static void terminateTarget(DebugTargetImpl target) {
   try {
     target.terminate();
   } catch (DebugException e) {
     ChromiumDebugPlugin.log(e);
   }
 }
 void initProperties(ChromiumExceptionBreakpoint uiBreakpoint) {
   includeCaught = uiBreakpoint.getIncludeCaught();
   try {
     enabled = uiBreakpoint.isEnabled();
   } catch (CoreException e) {
     ChromiumDebugPlugin.log(e);
   }
 }
      @Override
      void breakpointRemoved(ChromiumLineBreakpoint lineBreakpoint, IMarkerDelta delta) {
        if (ChromiumLineBreakpoint.getIgnoreList().contains(lineBreakpoint)) {
          return;
        }

        Breakpoint sdkBreakpoint = getMap().getSdkBreakpoint(lineBreakpoint);
        if (sdkBreakpoint == null) {
          return;
        }

        if (!lineBreakpoint.isEnabled()) {
          return;
        }
        JavascriptVm.BreakpointCallback callback =
            new JavascriptVm.BreakpointCallback() {
              public void failure(String errorMessage) {
                ChromiumDebugPlugin.log(
                    new Exception(
                        "Failed to remove breakpoint in "
                            + //$NON-NLS-1$
                            getTargetNameSafe()
                            + ": "
                            + errorMessage)); //$NON-NLS-1$
              }

              public void success(Breakpoint breakpoint) {}
            };
        try {
          sdkBreakpoint.clear(callback, null);
        } catch (RuntimeException e) {
          ChromiumDebugPlugin.log(
              new Exception(
                  "Failed to remove breakpoint in "
                      + //$NON-NLS-1$
                      getTargetNameSafe(),
                  e));
        }
        getMap().remove(lineBreakpoint);
      }
      public Collection<? extends IBreakpoint> handleBreakpointsHit(
          Collection<? extends Breakpoint> sdkBreakpoints) {
        if (sdkBreakpoints.isEmpty()) {
          return Collections.emptyList();
        }

        Collection<IBreakpoint> uiBreakpoints = new ArrayList<IBreakpoint>(sdkBreakpoints.size());

        for (Breakpoint sdkBreakpoint : sdkBreakpoints) {
          ChromiumLineBreakpoint uiBreakpoint = getMap().getUiBreakpoint(sdkBreakpoint);
          if (uiBreakpoint != null) {
            try {
              uiBreakpoint.silentlyResetIgnoreCount(); // reset ignore count as we've hit it
            } catch (CoreException e) {
              ChromiumDebugPlugin.log(new Exception("Failed to reset breakpoint ignore count", e));
            }

            uiBreakpoints.add(uiBreakpoint);
          }
        }
        return uiBreakpoints;
      }