Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IStorage


    return entry;
  }

  private static String readContents(IndexFileRevision revision)
      throws Exception {
    IStorage storage = revision.getStorage(null);
    InputStream in = storage.getContents();
    ByteBuffer buffer = IO.readWholeStream(in, 10);
    return new String(buffer.array(), 0, buffer.limit(), "UTF-8");
  }
View Full Code Here


    if (editor != null) {
      IEditorInput input = editor.getEditorInput();

      if (input instanceof ExternalStorageEditorInput) {
        ExternalStorageEditorInput external = (ExternalStorageEditorInput) input;
        IStorage storage = external.getStorage();
        if (storage != null) {
          if (storage instanceof ExternalSourceModule) {
            ExternalSourceModule externalSourceModule = (ExternalSourceModule) storage;
            return externalSourceModule;
          }
View Full Code Here

            return registry.getDefaultEditor(file.getName()).getId();
        } else if (element instanceof ILineBreakpoint) {
            String fileName = ((ILineBreakpoint)element).getMarker().getResource().getName();
            return registry.getDefaultEditor(fileName).getId();
        } else if (element instanceof IStorage) {
            IStorage storage = (IStorage)element;
            return registry.getDefaultEditor(storage.getName()).getId();
        } else if (element instanceof URL) {
            URL url = (URL)element;
            return registry.getDefaultEditor(url.getFile()).getId();
        }
        return null;
View Full Code Here

   * @return
   */
  String calculateBaseLocation(IStorageEditorInput input) {
    String location = null;
    try {
      IStorage storage = input.getStorage();
      if (storage != null) {
        IPath storagePath = storage.getFullPath();
        String name = storage.getName();
        if (storagePath != null) {
          // If they are different, the IStorage contract is not
          // being honored
          // (https://bugs.eclipse.org/bugs/show_bug.cgi?id=73098).
          // Favor the name.
View Full Code Here

     *
     */
    String path = null;
    boolean addHash = false;
    try {
      IStorage storage = input.getStorage();
      if (storage != null) {
        IPath storagePath = storage.getFullPath();
        String name = storage.getName();
        // if either the name or storage path are null or they are
        // identical, add a hash to it to guarantee uniqueness
        addHash = storagePath == null
            || storagePath.toString().equals(name);
        if (storagePath != null) {
View Full Code Here

  /**
   * @since 2.3
   */
  @Nullable
  protected IFile getTraceFile(IFile file) {
    IStorage traceFile = fileBasedTraceInformation.getTraceFile(file);
    if (traceFile instanceof IFile) {
      IFile result = (IFile) traceFile;
      syncIfNecessary(result);
      return result;
    }
View Full Code Here

    indexFile(writer, path, contents, "proj1");
  }
 
  private static void indexFile(IndexWriter writer, String path, String contents, String proj) throws CoreException, IOException
  {
    IStorage file1 = new TestStorage(path, contents);
    long time = System.currentTimeMillis() - 1000;
    indexer.indexStorage(writer, file1, proj, time, null);
  }
View Full Code Here

        return null;

      return EditorUtility.getEditorInput(classFile);
    }
   
    IStorage storage = getNonJavaResource(doc);
   
    if( storage == null )
      return null;
   
    return EditorUtility.getEditorInput(storage);
View Full Code Here

  }

  private InputStream openStream(IEditorInput input) throws CoreException,
      IOException {
    if (input instanceof IStorageEditorInput) {
      final IStorage storage = ((IStorageEditorInput) input).getStorage();
      return storage.getContents();
    }
    if (input instanceof IURIEditorInput) {
      final URI uri = ((IURIEditorInput) input).getURI();
      return uri.toURL().openStream();
    }
View Full Code Here

  private IStorage2UriMapper storageToUriMapper;

  public Resource createResource(IEditorInput editorInput) {
    try {
      if (editorInput instanceof IStorageEditorInput) {
        IStorage storage = ((IStorageEditorInput) editorInput).getStorage();
        return createResourceFor(storage);
      }
      throw new IllegalArgumentException("Couldn't create EMF Resource for input " + editorInput);
    } catch (CoreException e) {
      throw new WrappedException(e);
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IStorage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.