public void decorate(Object element, IDecoration decoration) {
    if (!(element instanceof IResource)) return;
    IResource resource = (IResource) element;
    if (!resource.exists()) return;
    IProject project = resource.getProject();
    if (project == null) {
      Log.error(
          Messages.getString("ErrorDecorator.PROJECT_FOR")
              + resource.getName()
              + Messages.getString("ErrorDecorator.IS_NULL"),
          new Throwable()); //$NON-NLS-1$ //$NON-NLS-2$
      return;
    }
    try {
      if (!project.isOpen()) return;
      project.open(null);
      if (project.hasNature(LSLProjectNature.ID)) {
        LSLProjectNature nature = (LSLProjectNature) project.getNature(LSLProjectNature.ID);

        if (nature == null) return;

        IMarker[] m =
            resource.findMarkers("lslforge.problem", true, IResource.DEPTH_INFINITE); // $NON-NLS-1$

        if (m == null || m.length == 0) return;
      } else {
        return;
      }
    } catch (CoreException e) {
      Log.error("exception caught trying to determine project nature!", e); // $NON-NLS-1$
      return;
    }

    decoration.addOverlay(descriptor, IDecoration.BOTTOM_LEFT);
  }
Esempio n. 2
0
  public void run() {
    String line = null;

    try {
      while ((line = reader.readLine()) != null) {
        Log.debug("read:" + Util.URIDecode(line)); // $NON-NLS-1$
        TestEvent event = TestEvents.fromXML(Util.URIDecode(line));

        // kludge for the mo'
        if (event instanceof TestCompleteEvent) {
          manager.postTestResult(((TestCompleteEvent) event).getTestResult());
          String cmd = continueText();
          Log.debug("writing: " + cmd); // $NON-NLS-1$
          writeOut(cmd);
        } else if (event instanceof AllCompleteEvent) {
          endSession();
          fireComplete();
          // TODO: this is a place where a debug event would happen
          return;
        } else if (event instanceof TestSuspendedEvent) {
          // TODO: this is where we'd extract the debug info...
          Log.debug("hit a breakpoint... suspending!"); // $NON-NLS-1$
          fireSuspended(((TestSuspendedEvent) event).getScriptState());
          return;
        }
      }
    } catch (IOException e) {
      Log.error(e);
    } catch (RuntimeException e) {
      Log.error(e);
      try {
        endSession();
      } catch (Exception e1) {
      }
    }
  }
Esempio n. 3
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()]);
 }