Пример #1
0
  /** Loads the buffer via SourceMapper, and maps it in SourceMapper */
  private IBuffer mapSource(
      SourceMapper mapper, ClassFileElementInfo info, IClassFile bufferOwner) {
    char[] contents =
        mapper.findSource(getPart(), info.getEglFileName(), info.getCaseSensitivePackageName());
    // create buffer
    BufferManager bufManager = getBufferManager();
    IBuffer buffer = bufManager.createBuffer(bufferOwner);
    if (buffer == null) return null;
    bufManager.addBuffer(buffer);

    if (contents != null) {
      // set the buffer source
      if (buffer.getCharacters() == null) {
        buffer.setContents(contents);
      }
    } else {
      if (buffer.getCharacters() == null) {
        String result = EGLModelResources.eglarNoSourceAttachmentContent;
        buffer.setContents(result.toCharArray());
      }
    }

    buffer.addBufferChangedListener(this);
    return buffer;
  }
Пример #2
0
 public String getSource() throws EGLModelException {
   IBuffer buffer = getBuffer();
   if (buffer == null) return ""; // $NON-NLS-1$
   return buffer.getContents();
 }