Package org.eclipse.ui

Examples of org.eclipse.ui.IStorageEditorInput


            InputStream stream = null;
            if (editorInput instanceof FileEditorInput) {
                FileEditorInput input = (FileEditorInput) editorInput;
                stream = input.getFile().getContents();
            } else if (editorInput instanceof IStorageEditorInput) {
                IStorageEditorInput input = (IStorageEditorInput) editorInput;
                stream = input.getStorage().getContents();
            }

            model = new NLGrammarModel();
            DSLMappingFile file = new DSLTokenizedMappingFile();
            file.parseAndLoad( new InputStreamReader( stream ) );
View Full Code Here


    try {
      if (input instanceof FileEditorInput) {
        IFile file = ((FileEditorInput) input).getFile();
        return getStringOfIFileLocation(file);
      } else if (input instanceof IStorageEditorInput) {
        IStorageEditorInput sei = (IStorageEditorInput) input;
        try {
          return sei.getStorage().getFullPath().toOSString();
        } catch (Exception e) {
          if (input instanceof IPathEditorInput) {
            IPathEditorInput pin = (IPathEditorInput) input;
            return pin.getPath().toOSString();
          }
View Full Code Here

        InputStream inputStream = null;
        LoadDocumentOperation loadTextDocumentOperation = null;
       
        //Load document with input stream if it is not a base document
        if(!isBaseDocumentURL(documentURL) && editorInput instanceof IStorageEditorInput) {
          IStorageEditorInput storageEditorInput = (IStorageEditorInput)editorInput;
          boolean readOnly = false;
          IStorage storage = storageEditorInput.getStorage();
          if(storage == null || storage.isReadOnly())
            readOnly = true;
          documentDescriptor.setReadOnly(readOnly);
          inputStream = storageEditorInput.getStorage().getContents();
          if(documentURL != null && documentURL.getFile().endsWith(".xml")) { //$NON-NLS-1$
            setXMLLoadFilter(composite.getShell(),documentDescriptor);        
          }
          loadTextDocumentOperation = new LoadDocumentOperation(null, officeApplication, officeFrame, inputStream, documentDescriptor);
        }
View Full Code Here

      }

    } else if (element instanceof IStorageEditorInput) {

      // a file is in Repository Exploring Perspective (or others?)
      IStorageEditorInput input = (IStorageEditorInput) element;
      document = createHdlDocument(null, null);
      InputStream stream = input.getStorage().getContents();
      setDocumentContent(document, stream, getEncoding(element));

    } else if (element instanceof IPathEditorInput) {

      // Maybe this is not executed on Eclipse 3.3 or later
      // Eclipse 3.2 executed for a file outside of workspace
      IPathEditorInput input = (IPathEditorInput) element;
      document = createHdlDocument(null, null);
      FileInputStream contentStream = null;
      try {
        contentStream = new FileInputStream(input.getPath().toFile());
        setDocumentContent(document, contentStream,
            getEncoding(element));
      } catch (FileNotFoundException e) {
        e.printStackTrace();
        document = null;
View Full Code Here

            InputStream stream = null;
            if (editorInput instanceof FileEditorInput) {
                FileEditorInput input = (FileEditorInput) editorInput;
                stream = input.getFile().getContents();
            } else if (editorInput instanceof IStorageEditorInput) {
                IStorageEditorInput input = (IStorageEditorInput) editorInput;
                stream = input.getStorage().getContents();
            }

            model = new NLGrammarModel();
            DSLMappingFile file = new DSLTokenizedMappingFile();
            file.parseAndLoad( new InputStreamReader( stream ) );
View Full Code Here

  private void open(IStructuredSelection selection) throws IOException,
      PartInitException, InvocationTargetException, InterruptedException {

    for (DFSFile file : filterSelection(DFSFile.class, selection)) {

      IStorageEditorInput editorInput = new DFSFileEditorInput(file);
      targetPart.getSite().getWorkbenchWindow().getActivePage().openEditor(
          editorInput, "org.eclipse.ui.DefaultTextEditor");
    }
  }
View Full Code Here

     *        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
        // use the eclipse text editor as a default
View Full Code Here

            true,
            null);
      } else {
        // Do it "the hard way" by using the WorkspaceRoot as the host for our breakpoint
        // ... quick analysis seems to indicate it's done this way by the JDT "itself" !
        IStorageEditorInput input = (IStorageEditorInput) editor.getEditorInput();
        IStorage storage = input.getStorage();

        for (int i = 0; i < breakpoints.length; i++) {
          IBreakpoint breakpoint = breakpoints[i];
          if (breakpoint instanceof IJavaStratumLineBreakpoint) {
            IJavaStratumLineBreakpoint stratumBreakpoint = (IJavaStratumLineBreakpoint) breakpoint;
View Full Code Here

      return true;
    }

    if (editorPart.getEditorInput() instanceof IStorageEditorInput) {
      try {
        IStorageEditorInput input = (IStorageEditorInput) editorPart.getEditorInput();
        final String name = input.getStorage().getName();
        if (   name.endsWith(".clj")
              || name.endsWith(".cljx")) {
          return true;
        }
      } catch (CoreException e) {
View Full Code Here

    public IAnnotationModel getAnnotationModel(Object element) {
      IAnnotationModel annotationModel = super.getAnnotationModel(element);
      if (annotationModel != null)
        return annotationModel;
      if (element instanceof IStorageEditorInput) {
      IStorageEditorInput input = (IStorageEditorInput) element;
      try {
        return new StorageMarkerAnnotationModel(input.getStorage());
      } catch (CoreException e) {
        throw new RuntimeException(e);
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IStorageEditorInput

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.