Logo Search packages:      
Sourcecode: ooeclipseintegration version File versions  Download package

IMarker org::openoffice::ide::eclipse::core::builders::IdlcErrorReader::analyseIdlcError ( String  line  )  [inline, private]

Method that analyses the error line and return the appropriate marker if it is possible.

Parameters:
line error line to analyse
Returns:
the corresponding marker if the line is an idlc error line. code>null if there were problems by creating the marker or if the line isn't a idlc error line.

Definition at line 167 of file IdlcErrorReader.java.

References compiledFile, and R_IDLC_ERROR.

Referenced by readErrors().

                                                   {
            IMarker marker = null;
            
            Pattern pSyntax = Pattern.compile(R_IDLC_ERROR); 
            Matcher mSyntax = pSyntax.matcher(line);
            
            if (!line.startsWith("idlc:") && mSyntax.matches()){ //$NON-NLS-1$
                  IProject project = compiledFile.getProject();
                  
                  boolean error = false;
                  if (null == mSyntax.group(3)){
                        error = true;
                  }
                  
                  // HELP the groups are indexed from 1. 0 is the whole string
                  String filePath = mSyntax.group(1);
                  int lineNo = Integer.parseInt(mSyntax.group(2));
                  String message = mSyntax.group(mSyntax.groupCount());
                  
                  // Get a handle on the bad file
                  // Create a project relative path
                  if (filePath.startsWith(project.getLocation().toOSString())){
                        int pos = project.getLocation().toOSString().length();
                        filePath = filePath.substring(pos);
                  }
                  
                  IFile file = project.getFile(filePath);
                  try {
                        marker = file.createMarker(IMarker.PROBLEM);
                        marker.setAttribute(IMarker.SEVERITY, 
                                          error?IMarker.SEVERITY_ERROR: 
                                                IMarker.SEVERITY_WARNING);
                        marker.setAttribute(IMarker.MESSAGE, message);
                        marker.setAttribute(IMarker.LINE_NUMBER, lineNo);
                        marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
                        
                        // HELP To print an icon in the editor vertical and overview rulers
                        // Set the CHAR_START and CHAR_END attributes. They are relative to the
                        // beginning or the end of the document.
                        
                        // HELP Without specifying the CHAR END and START, the line is well placed
                        // But afterwards, pay attention when the marker should be located under 
                        // the bad words
                        
                        // Try to find the line or word that causes the error
//                      Map positions = getWrongWord(lineNo, message);
//                      
//                      marker.setAttribute(IMarker.CHAR_START, ((Integer)positions.get(IMarker.CHAR_START)).intValue());
//                      marker.setAttribute(IMarker.CHAR_END,  ((Integer)positions.get(IMarker.CHAR_END)).intValue());
                        
                  } catch (CoreException e) {
                        PluginLogger.error(
                                    Messages.getString("IdlcErrorReader.MarkerCreationError") //$NON-NLS-1$
                                          + file.getProjectRelativePath().toString(), e);
                  }
            }
            
            return marker;
      }


Generated by  Doxygen 1.6.0   Back to index