Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IStorage


  }

  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


        indexURL = ((IURIEditorInput) editorInput).getURI();
      } else if (editorInput instanceof IStorageEditorInput) {
        // MS: This is a total hackfest here ... This supports
        // double-clicking an index.eomodeld from
        // inside of a jar
        IStorage storage = ((IStorageEditorInput) editorInput).getStorage();
        Class jarEntryClass = storage.getClass();
        IPath jarEntryPath = (IPath) jarEntryClass.getMethod("getFullPath").invoke(storage);
        Object root = jarEntryClass.getMethod("getPackageFragmentRoot").invoke(storage);
        Class packageFragmentRootClass = root.getClass();
        IResource jarResource = (IResource)packageFragmentRootClass.getMethod("getUnderlyingResource").invoke(root);
        IPath jarPath;
View Full Code Here

            } catch (Throwable t) {
                DroolsEclipsePlugin.log(t);
            }
        } else if (input instanceof IStorageEditorInput) {
            try {
                IStorage storage = ((IStorageEditorInput) input).getStorage();
                setPartName(storage.getName());
                InputStream is = storage.getContents();
                createModel(is);
            } catch (Throwable t) {
                DroolsEclipsePlugin.log(t);
            }
        }
View Full Code Here

   */
  @Override
  public boolean isDocumentSupported(IEditorInput input) {
    if (input instanceof IStorageEditorInput) {
      try {
        IStorage storage = ((IStorageEditorInput) input).getStorage();
        String fileName = storage.getName();
        if (fileName != null) {
          fileName = fileName.toLowerCase(Locale.ENGLISH);
          for (String suffix : SUPPORTED_EXTENSIONS) {
            if (fileName.endsWith(suffix)) {
              return true;
View Full Code Here

  protected void setDocumentContent(IDocument document, IEditorInput element)
      throws CoreException {
    IDiagramDocument diagramDocument = (IDiagramDocument) document;
    TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
    if (element instanceof FileEditorInput) {
      IStorage storage = ((FileEditorInput) element).getStorage();
      Diagram diagram = DiagramIOUtil.load(domain, storage, true,
          getProgressMonitor());
      document.setContent(diagram);
    } else if (element instanceof URIEditorInput) {
      URI uri = ((URIEditorInput) element).getURI();
View Full Code Here

  protected void setDocumentContent(IDocument document, IEditorInput element)
      throws CoreException {
    IDiagramDocument diagramDocument = (IDiagramDocument) document;
    TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
    if (element instanceof FileEditorInput) {
      IStorage storage = ((FileEditorInput) element).getStorage();
      Diagram diagram = DiagramIOUtil.load(domain, storage, true,
          getProgressMonitor());
      document.setContent(diagram);
    } else if (element instanceof URIEditorInput) {
      URI uri = ((URIEditorInput) element).getURI();
View Full Code Here

  protected void setDocumentContent(IDocument document, IEditorInput element)
      throws CoreException {
    IDiagramDocument diagramDocument = (IDiagramDocument) document;
    TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
    if (element instanceof FileEditorInput) {
      IStorage storage = ((FileEditorInput) element).getStorage();
      Diagram diagram = DiagramIOUtil.load(domain, storage, true,
          getProgressMonitor());
      document.setContent(diagram);
    } else if (element instanceof URIEditorInput) {
      URI uri = ((URIEditorInput) element).getURI();
View Full Code Here

  protected void setDocumentContent(IDocument document, IEditorInput element)
      throws CoreException {
    IDiagramDocument diagramDocument = (IDiagramDocument) document;
    TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
    if (element instanceof FileEditorInput) {
      IStorage storage = ((FileEditorInput) element).getStorage();
      Diagram diagram = DiagramIOUtil.load(domain, storage, true,
          getProgressMonitor());
      document.setContent(diagram);
    } else if (element instanceof URIEditorInput) {
      URI uri = ((URIEditorInput) element).getURI();
View Full Code Here

            {
                for( Object resource : ( (IPackageFragment) element ).getNonJavaResources() )
                {
                    if( resource instanceof IStorage )
                    {
                        final IStorage storage = (IStorage) resource;
                       
                        if( storage.getName().equals( localName ) )
                        {
                            return storage.getContents();
                        }
                    }
                }
            }
        }
View Full Code Here

     *        eclipse editor association, defaulting to text editor
     *        if no association is found
     */
    public static void openEditor(String contents, String name) {
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IStorage storage = new StringStorage(contents, name);
        IStorageEditorInput input = new StringInput(storage);
        IWorkbenchPage page = window.getActivePage();
        IEditorDescriptor desc = PlatformUI.getWorkbench().
                                    getEditorRegistry().getDefaultEditor(name);
        // If there is no editor associated with the given file name, we'll just
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.