/**
  * Searches for an existing line breakpoint on the specified line in the current type that does
  * not match the id of the specified marker
  *
  * @param resource the resource to care about
  * @param typeName the name of the type the breakpoint is in
  * @param lineNumber the number of the line the breakpoint is on
  * @param currentmarker the current marker we are comparing to see if it will be moved onto an
  *     existing one
  * @return an existing line breakpoint on the current line of the given resource and type if there
  *     is one
  * @throws CoreException
  * @since 3.4
  */
 private IErlangBreakpoint lineBreakpointExists(
     final IResource resource, final int lineNumber, final IMarker currentmarker)
     throws CoreException {
   final IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
   final IBreakpoint[] breakpoints =
       manager.getBreakpoints(ErlDebugConstants.ID_ERLANG_DEBUG_MODEL);
   final String markerType = currentmarker.getType();
   for (int i = 0; i < breakpoints.length; i++) {
     if (!(breakpoints[i] instanceof IErlangBreakpoint)) {
       continue;
     }
     final IErlangBreakpoint breakpoint = (IErlangBreakpoint) breakpoints[i];
     final IMarker marker = breakpoint.getMarker();
     if (marker != null
         && marker.exists()
         && marker.getType().equals(markerType)
         && currentmarker.getId() != marker.getId()) {
       if (marker instanceof ErlangLineBreakpoint) {
         final ErlangLineBreakpoint erlangLineBreakpoint = (ErlangLineBreakpoint) marker;
         if (erlangLineBreakpoint.getLineNumber() == lineNumber) {
           return erlangLineBreakpoint;
         }
       }
     }
   }
   return null;
 }
 /**
  * Looks up the {@link IJavaScriptLineBreakpoint} that is associated with the given marker.
  * Returns <code>null</code> if one does not exist
  *
  * @param resource
  * @param typeName
  * @param lineNumber
  * @param currentmarker
  * @param useid if the id of the markers should be compared
  * @return the {@link IJavaScriptLineBreakpoint} for the given marker or <code>null</code> if one
  *     does not exist
  * @throws CoreException
  */
 IJavaScriptLineBreakpoint lineBreakpointExists(
     IResource resource, String typeName, int lineNumber, IMarker currentmarker, boolean useid)
     throws CoreException {
   String modelId = JavaScriptDebugModel.MODEL_ID;
   IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
   IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
   for (int i = 0; i < breakpoints.length; i++) {
     if ((breakpoints[i] instanceof IJavaScriptLineBreakpoint)) {
       IJavaScriptLineBreakpoint breakpoint = (IJavaScriptLineBreakpoint) breakpoints[i];
       if (breakpoint.getLineNumber() == lineNumber) {
         IMarker marker = breakpoint.getMarker();
         if (marker != null
             && marker.exists()
             && marker.getType().equals(IJavaScriptLineBreakpoint.MARKER_ID)
             && pathsEqual(breakpoint.getScriptPath(), typeName)
             && resource.equals(marker.getResource())) {
           if (useid) {
             if (currentmarker.getId() != marker.getId()) {
               return breakpoint;
             }
             return null;
           }
           return breakpoint;
         }
       }
     }
   }
   return null;
 }
  /**
   * Provide the initialization of the listeners additions. The Window, Part, and Document Listener
   * are added. Note that sensor shell should be instantiated before this method is called because
   * <code>processActivity()</code> method uses sensor shell instance.
   */
  private void registerListeners() {
    IWorkbench workbench = EclipseSensorPlugin.getInstance().getWorkbench();

    // :RESOLVED: JULY 1, 2003
    // Supports the multiple window for sensor collection.
    IWorkbenchWindow[] activeWindows = workbench.getWorkbenchWindows();

    // Check if window listener is not added yet. Otherwise multi instances are notified.
    if (this.windowListener == null) {
      this.windowListener = new WindowListenerAdapter();
      workbench.addWindowListener(new WindowListenerAdapter());
    }

    for (int i = 0; i < activeWindows.length; i++) {
      IWorkbenchPage activePage = activeWindows[i].getActivePage();
      activePage.addPartListener(new PartListenerAdapter());
      IEditorPart activeEditorPart = activePage.getActiveEditor();

      // Adds this EclipseSensorPlugin instance to IDocumentListener
      // only when activeEditorPart is the instance of ITextEditor
      // so that null case is also ignored.
      if (activeEditorPart instanceof ITextEditor) {
        // Sets activeTextEditor. Otherwise a first activated file would not be recorded.
        this.activeTextEditor = (ITextEditor) activeEditorPart;
        // Gets opened file since the initial opened file is not notified from IPartListener.
        URI fileResource = EclipseSensor.this.getFileResource(this.activeTextEditor);

        Map<String, String> keyValueMap = new HashMap<String, String>();
        keyValueMap.put(EclipseSensorConstants.SUBTYPE, "Open");
        keyValueMap.put(EclipseSensorConstants.UNIT_TYPE, EclipseSensorConstants.FILE);
        keyValueMap.put(
            EclipseSensorConstants.UNIT_NAME, EclipseSensor.this.extractFileName(fileResource));
        this.addDevEvent(
            EclipseSensorConstants.DEVEVENT_EDIT,
            fileResource,
            keyValueMap,
            "Opened " + fileResource.toString());

        IDocumentProvider provider = this.activeTextEditor.getDocumentProvider();
        IDocument document = provider.getDocument(activeEditorPart.getEditorInput());

        // Initially sets active buffer and threshold buffer.
        // Otherwise a first activated buffer would not be recorded.
        this.activeBufferSize = document.getLength();
        this.thresholdBufferSize = document.getLength();
        document.addDocumentListener(new DocumentListenerAdapter());
      }
    }

    // Handles breakpoint set/unset event.
    IBreakpointManager bpManager = DebugPlugin.getDefault().getBreakpointManager();
    bpManager.addBreakpointListener(new BreakPointerSensor(this));

    // Listens to debug event.
    DebugPlugin.getDefault().addDebugEventListener(new DebugSensor(this));

    // Creates instance to handle build error.
    this.buildErrorSensor = new BuildErrorSensor(this);
  }
  /**
   * @param resource may be the file open in the editor or the workspace root (if it is an external
   *     file)
   * @param document is the document opened in the editor
   * @param externalFileEditorInput is not-null if this is an external file
   * @param info is the vertical ruler info (only used if this is not an external file)
   * @param onlyIncludeLastLineActivity if only the markers that are in the last mouse-click should
   *     be included
   * @return the markers that correspond to the markers from the current editor.
   */
  @SuppressWarnings({"unchecked", "rawtypes"})
  public static List<Tuple<IMarker, IBreakpoint>> getMarkersAndBreakpointsFromEditorResource(
      IResource resource,
      IDocument document,
      IEditorInput externalFileEditorInput,
      int lastLineActivity,
      boolean onlyIncludeLastLineActivity,
      IAnnotationModel annotationModel) {
    List<Tuple<IMarker, IBreakpoint>> breakpoints = new ArrayList<Tuple<IMarker, IBreakpoint>>();

    try {
      List<IMarker> markers = new ArrayList<IMarker>();
      boolean isExternalFile = false;

      markers.addAll(
          Arrays.asList(
              resource.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE)));
      markers.addAll(
          Arrays.asList(
              resource.findMarkers(
                  PyBreakpoint.PY_CONDITIONAL_BREAK_MARKER, true, IResource.DEPTH_INFINITE)));

      if (!(resource instanceof IFile)) {
        // it was created from an external file
        isExternalFile = true;
      }

      IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
      for (IMarker marker : markers) {
        if (marker == null) {
          continue;
        }
        IBreakpoint breakpoint = breakpointManager.getBreakpoint(marker);
        if (breakpoint != null && breakpointManager.isRegistered(breakpoint)) {
          Position pos = PyMarkerUtils.getMarkerPosition(document, marker, annotationModel);

          if (!isExternalFile) {
            if (!onlyIncludeLastLineActivity) {
              breakpoints.add(new Tuple(marker, breakpoint));
            } else if (includesRulerLine(pos, document, lastLineActivity)) {
              breakpoints.add(new Tuple(marker, breakpoint));
            }
          } else {

            if (isInSameExternalEditor(marker, externalFileEditorInput)) {
              if (!onlyIncludeLastLineActivity) {
                breakpoints.add(new Tuple(marker, breakpoint));
              } else if (includesRulerLine(pos, document, lastLineActivity)) {
                breakpoints.add(new Tuple(marker, breakpoint));
              }
            }
          }
        }
      }
    } catch (CoreException x) {
      PydevDebugPlugin.log(IStatus.ERROR, "Unexpected getMarkers error (recovered properly)", x);
    }
    return breakpoints;
  }
  public void initListeners() {
    IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
    breakpointManager.addBreakpointListener(debugTargetState.getBreakpointListner());
    breakpointManager.addBreakpointManagerListener(workspaceRelations.getBreakpointHandler());
    workspaceRelations.getBreakpointHandler().initBreakpointManagerListenerState(breakpointManager);

    workspaceRelations.startInitialization();
  }
 private void setAndConfirmBreakpoint(NonRootModelElement st) {
   Selection.getInstance().setSelection(new StructuredSelection(st));
   ActivityEditor editor = DebugUITestUtilities.openActivityEditorForSelectedElement();
   editor.setFocus();
   DebugUITestUtilities.setBreakpointAtLine(editor, 2);
   IBreakpointManager bpm = DebugPlugin.getDefault().getBreakpointManager();
   IBreakpoint[] bps = bpm.getBreakpoints();
   assertTrue("Breakpoint not set", bps.length == 1);
 }
 @Override
 public void disconnect(IDocument document) {
   if (document instanceof DisassemblyDocument) {
     final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
     bpMgr.removeBreakpointListener(this);
     document.removeDocumentListener(this);
     fCatchup = null;
   }
   super.disconnect(document);
 }
 @Override
 public void connect(IDocument document) {
   super.connect(document);
   if (document instanceof DisassemblyDocument) {
     final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
     addBreakpoints(bpMgr.getBreakpoints());
     bpMgr.addBreakpointListener(this);
     document.addDocumentListener(this);
   }
 }
  public void threadTerminated() {
    IBreakpointManager manager = getBreakpointManager();

    manager.removeBreakpointListener(target);
    manager.removeBreakpointManagerListener(this);

    if (bpPathMapper instanceof IScriptBreakpointPathMapperExtension) {
      ((IScriptBreakpointPathMapperExtension) bpPathMapper).clearCache();
    }
  }
示例#10
0
 protected void collectBrakePoint(IResource resource) throws CoreException {
   fBreakpoints = new BucketMap<IResource, IBreakpoint>(6);
   fBreakpointAttributes = new HashMap<IBreakpoint, Map<String, Object>>(6);
   final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
   IMarker[] markers =
       resource.findMarkers(IBreakpoint.LINE_BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
   for (IMarker marker : markers) {
     IResource markerResource = marker.getResource();
     IBreakpoint breakpoint = breakpointManager.getBreakpoint(marker);
     if (breakpoint != null) {
       fBreakpoints.add(markerResource, breakpoint);
       fBreakpointAttributes.put(breakpoint, breakpoint.getMarker().getAttributes());
     }
   }
 }
示例#11
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.ui.texteditor.IMarkerUpdater#updateMarker(org.eclipse.core
  * .resources.IMarker, org.eclipse.jface.text.IDocument,
  * org.eclipse.jface.text.Position)
  */
 public boolean updateMarker(
     final IMarker marker, final IDocument document, final Position position) {
   if (position.isDeleted()) {
     return false;
   }
   try {
     final int line = MarkerUtilities.getLineNumber(marker);
     final int newLine = document.getLineOfOffset(position.getOffset()) + 1;
     if (line == newLine) {
       return true;
     }
     final IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
     final IBreakpoint breakpoint = manager.getBreakpoint(marker);
     if (breakpoint == null) {
       return false;
     }
     if (breakpoint instanceof ErlangLineBreakpoint) {
       final ErlangLineBreakpoint erlangLineBreakpoint = (ErlangLineBreakpoint) breakpoint;
       final ErlangDebugTarget target = erlangLineBreakpoint.getTarget();
       erlangLineBreakpoint.remove(target);
       MarkerUtilities.setLineNumber(marker, newLine);
       erlangLineBreakpoint.install(target);
       return true;
     }
     // if there exists a breakpoint on the line remove this one
     if (isLineBreakpointMarker(marker)) {
       ensureRanges(document, marker, line);
       return lineBreakpointExists(marker.getResource(), line, marker) == null;
     }
     // if the line info is a valid location with an invalid line
     // number,
     // a line breakpoint must be removed
     if (isLineBreakpointMarker(marker) && line == -1) {
       return false;
     }
     MarkerUtilities.setLineNumber(marker, line);
     if (isLineBreakpointMarker(marker)) {
       ensureRanges(document, marker, line);
     }
     return true;
   } catch (final BadLocationException e) {
     ErlLogger.error(e);
   } catch (final CoreException e) {
     ErlLogger.error(e);
   }
   return false;
 }
示例#12
0
 /**
  * Returns the <code>IRubyBreakpoint</code> from the specified <code>IMember</code>
  *
  * @param element the element to get the breakpoint from
  * @return the current breakpoint from the element or <code>null</code>
  */
 protected IRubyBreakpoint getMethodBreakpoint(IMember element) {
   IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
   IBreakpoint[] breakpoints =
       breakpointManager.getBreakpoints(RdtDebugModel.getModelIdentifier());
   if (element instanceof IMethod) {
     IMethod method = (IMethod) element;
     for (int i = 0; i < breakpoints.length; i++) {
       IBreakpoint breakpoint = breakpoints[i];
       if (breakpoint instanceof IRubyMethodBreakpoint) {
         IRubyMethodBreakpoint methodBreakpoint = (IRubyMethodBreakpoint) breakpoint;
         IMember container = null;
         try {
           container = BreakpointUtils.getMember(methodBreakpoint);
         } catch (CoreException e) {
           RdtDebugUiPlugin.log(e);
           return null;
         }
         if (container == null) {
           try {
             if (method
                     .getDeclaringType()
                     .getFullyQualifiedName()
                     .equals(methodBreakpoint.getTypeName())
                 && method.getElementName().equals(methodBreakpoint.getMethodName())) {
               return methodBreakpoint;
             }
           } catch (CoreException e) {
             RdtDebugUiPlugin.log(e);
           }
         } else {
           if (container instanceof IMethod) {
             if (method
                 .getDeclaringType()
                 .getFullyQualifiedName()
                 .equals(container.getDeclaringType().getFullyQualifiedName())) {
               if (method.isSimilar((IMethod) container)) {
                 return methodBreakpoint;
               }
             }
           }
         }
       }
     }
   }
   return null;
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.action.IAction#run()
  */
 public void run() {
   try {
     /*
      * Test if there are any markers at the current position.
      * if there are any, remove breakpointmarker, otherwise create a
      * new one.
      */
     List list = getMarkers();
     if (list.isEmpty()) {
       // create new markers
       IDocument document = getDocument();
       int lineNumber = getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
       if (lineNumber >= document.getNumberOfLines()) {
         return;
       }
       try {
         IRegion line = document.getLineInformation(lineNumber);
         ITextSelection selection =
             new TextSelection(document, line.getOffset(), line.getLength());
         // fBreakpointAdapter.toggleLineBreakpoints(fTextEditor, selection);
         fBreakpointAdapter.toggleBreakpoints(fTextEditor, selection);
       } catch (BadLocationException e) {
         // likely document is folded so you cannot get the line information of the folded line
       }
     } else {
       // remove existing breakpoints of any type
       IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
       Iterator iterator = list.iterator();
       while (iterator.hasNext()) {
         IMarker marker = (IMarker) iterator.next();
         IBreakpoint breakpoint = manager.getBreakpoint(marker);
         if (breakpoint != null) {
           breakpoint.delete();
         }
       }
     }
   } catch (CoreException e) {
     // JDIDebugUIPlugin.errorDialog(ActionMessages.getString("ManageBreakpointRulerAction.error.adding.message1"), e); //$NON-NLS-1$
     // JDIDebugUIPlugin.errorDialog(ActionMessages.ManageBreakpointRulerAction_error_adding_message1, e);
     // This message may not make sense FIXME
     JDIDebugUIPlugin.errorDialog(
         ActionMessages.ManageMethodBreakpointActionDelegate_methodNonAvailable, e);
   }
 }
 /**
  * Returns a Java line breakpoint that is already registered with the breakpoint manager for a
  * type with the given name at the given line number.
  *
  * @param typeName fully qualified type name
  * @param lineNumber line number
  * @return a Java line breakpoint that is already registered with the breakpoint manager for a
  *     type with the given name at the given line number or <code>null</code> if no such
  *     breakpoint is registered
  * @exception CoreException if unable to retrieve the associated marker attributes (line number).
  */
 public static IJavaLineBreakpoint findStratumBreakpoint(IResource resource, int lineNumber)
     throws CoreException {
   String modelId = JDT_DEBUG_PLUGIN_ID;
   String markerType = "org.eclipse.jdt.debug.javaStratumLineBreakpointMarker";
   IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
   IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
   for (int i = 0; i < breakpoints.length; i++) {
     if (!(breakpoints[i] instanceof IJavaLineBreakpoint)) {
       continue;
     }
     IJavaLineBreakpoint breakpoint = (IJavaLineBreakpoint) breakpoints[i];
     IMarker marker = breakpoint.getMarker();
     if (marker != null && marker.exists() && marker.getType().equals(markerType)) {
       if (breakpoint.getLineNumber() == lineNumber && resource.equals(marker.getResource())) {
         return breakpoint;
       }
     }
   }
   return null;
 }
示例#15
0
 public static List<String> addBreakpointProjectsAndModules(
     final Collection<IProject> projects, final Collection<String> interpretedModules2) {
   final IBreakpointManager bpm = DebugPlugin.getDefault().getBreakpointManager();
   final List<String> result = Lists.newArrayList(interpretedModules2);
   for (final IBreakpoint bp : bpm.getBreakpoints(ErlDebugConstants.ID_ERLANG_DEBUG_MODEL)) {
     final IMarker m = bp.getMarker();
     final IResource r = m.getResource();
     final String name = r.getName();
     if (ModuleKind.hasErlExtension(name)) {
       final IProject p = r.getProject();
       if (projects.contains(p)) {
         final String s = p.getName() + ":" + name;
         if (!result.contains(s)) {
           result.add(s);
         }
       }
     }
   }
   return result;
 }
示例#16
0
  /**
   * Adds the breakpoints associated with a container.
   *
   * @param container the container we're interested in (usually workspace root)
   */
  private void addBreakpointsFor(IContainer container) {
    try {
      IMarker[] markers =
          container.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE);
      IMarker[] condMarkers =
          container.findMarkers(
              PyBreakpoint.PY_CONDITIONAL_BREAK_MARKER, true, IResource.DEPTH_INFINITE);
      IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();

      for (IMarker marker : markers) {
        PyBreakpoint brk = (PyBreakpoint) breakpointManager.getBreakpoint(marker);
        breakpointAdded(brk);
      }

      for (IMarker marker : condMarkers) {
        PyBreakpoint brk = (PyBreakpoint) breakpointManager.getBreakpoint(marker);
        breakpointAdded(brk);
      }
    } catch (Throwable t) {
      PydevDebugPlugin.errorDialog("Error setting breakpoints", t);
    }
  }
示例#17
0
 private BreakpointData[] createBreakpointData() {
   IBreakpointManager bpm = getBreakpointManager();
   IBreakpoint[] breakpoints = bpm.getBreakpoints(LSLDebugTarget.LSLFORGE);
   LinkedList<BreakpointData> list = new LinkedList<BreakpointData>();
   for (int i = 0; i < breakpoints.length; i++) {
     try {
       if (breakpoints[i] instanceof LSLLineBreakpoint) {
         LSLLineBreakpoint bp = (LSLLineBreakpoint) breakpoints[i];
         int line = bp.getLineNumber();
         IMarker marker = bp.getMarker();
         IResource resource = marker.getResource();
         IFile file = (IFile) resource.getAdapter(IFile.class);
         if (file == null) continue;
         if (!marker.getAttribute(IBreakpoint.ENABLED, false)) continue;
         IPath fullPath = file.getLocation();
         list.add(new BreakpointData(fullPath.toOSString(), line));
       }
     } catch (CoreException e) {
       Log.error(e);
     }
   }
   return list.toArray(new BreakpointData[list.size()]);
 }
  /**
   * Returns a list of markers that exist at the current ruler location.
   *
   * @return a list of markers that exist at the current ruler location
   */
  protected List getMarkers() {

    List breakpoints = new ArrayList();

    IResource resource = getResource();
    IDocument document = getDocument();
    AbstractMarkerAnnotationModel model = getAnnotationModel();

    if (model != null) {
      try {

        IMarker[] markers = null;
        if (resource instanceof IFile)
          markers =
              resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
        else {
          IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
          markers = root.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
        }

        if (markers != null) {
          IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
          for (int i = 0; i < markers.length; i++) {
            IBreakpoint breakpoint = breakpointManager.getBreakpoint(markers[i]);
            if (breakpoint != null
                && breakpointManager.isRegistered(breakpoint)
                && includesRulerLine(model.getMarkerPosition(markers[i]), document))
              breakpoints.add(markers[i]);
          }
        }
      } catch (CoreException x) {
        JDIDebugUIPlugin.log(x.getStatus());
      }
    }
    return breakpoints;
  }
 private void deleteAllPlatformBreakpoints() throws Exception {
   IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
   for (IBreakpoint b : bm.getBreakpoints()) {
     bm.removeBreakpoint(b, true);
   }
 }
 /* (non-Javadoc)
  * @see org.eclipse.ui.texteditor.IMarkerUpdater#updateMarker(org.eclipse.core.resources.IMarker, org.eclipse.jface.text.IDocument, org.eclipse.jface.text.Position)
  */
 public boolean updateMarker(IMarker marker, IDocument document, Position position) {
   if (position.isDeleted()) {
     return false;
   }
   IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
   IBreakpoint breakpoint = manager.getBreakpoint(marker);
   if (breakpoint == null) {
     return false;
   }
   IFile file = (IFile) marker.getResource();
   if (JavaScriptCore.isJavaScriptLikeFileName(file.getName())) {
     IJavaScriptUnit unit = JavaScriptCore.createCompilationUnitFrom(file);
     if (unit == null) {
       return false;
     }
     JavaScriptUnit jsunit =
         JavaScriptPlugin.getDefault().getASTProvider().getAST(unit, ASTProvider.WAIT_YES, null);
     try {
       BreakpointLocationFinder finder =
           new BreakpointLocationFinder(
               jsunit, document.getLineOfOffset(position.getOffset()) + 1, true);
       jsunit.accept(finder);
       if (finder.getLocation() == BreakpointLocationFinder.UNKNOWN) {
         return false;
       }
       int line = finder.getLineNumber();
       if (MarkerUtilities.getLineNumber(marker) == line) {
         // if there exists a breakpoint on the line remove this one
         if (isLineBreakpoint(marker)) {
           ensureRanges(document, marker, line);
           return lineBreakpointExists(
                   marker.getResource(),
                   ((IJavaScriptLineBreakpoint) breakpoint).getScriptPath(),
                   line,
                   marker,
                   true)
               == null;
         }
         return true;
       }
       if (isLineBreakpoint(marker) & line == -1) {
         return false;
       }
       if (lineBreakpointExists(
               marker.getResource(),
               ((IJavaScriptLineBreakpoint) breakpoint).getScriptPath(),
               line,
               marker,
               false)
           != null) {
         return false;
       }
       MarkerUtilities.setLineNumber(marker, line);
       if (isLineBreakpoint(marker)) {
         ensureRanges(document, marker, line);
       }
       return true;
     } catch (BadLocationException ble) {
       JavaScriptDebugUIPlugin.log(ble);
     } catch (CoreException e) {
       JavaScriptDebugUIPlugin.log(e);
     }
   }
   return true;
 }
 synchronized void init(IBreakpointManager breakpointManager) {
   sendRequest(breakpointManager.isEnabled());
 }
 @Override
 synchronized void initEnablement(IBreakpointManager breakpointManager) {
   breakpointsEnabled = breakpointManager.isEnabled();
 }
 private void catchupWithBreakpoints() {
   removeAllAnnotations(false);
   final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
   addBreakpoints(bpMgr.getBreakpoints());
 }
  private void threadAccepted() {
    IBreakpointManager manager = getBreakpointManager();

    manager.addBreakpointListener(target);
    manager.addBreakpointManagerListener(this);
  }