Package org.eclipse.ui

Examples of org.eclipse.ui.IStorageEditorInput


    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


    }

    private static String getPathForInput(final IEditorInput editorInput) {
        if (editorInput instanceof IStorageEditorInput) {
            final IStorageEditorInput sei = (IStorageEditorInput) editorInput;
            try {
                final IStorage storage = sei.getStorage();
                final IPath p = storage.getFullPath();
                return p.toPortableString();
            } catch (final CoreException e) {
            }
        }
View Full Code Here

        return null;
    }

    private static String getEncodingForInput(final IEditorInput editorInput) {
        if (editorInput instanceof IStorageEditorInput) {
            final IStorageEditorInput sei = (IStorageEditorInput) editorInput;
            try {
                final IStorage storage = sei.getStorage();
                if (storage instanceof IEncodedStorage) {
                    final IEncodedStorage encodedStorage = (IEncodedStorage) storage;
                    return encodedStorage.getCharset();
                }
            } catch (final CoreException e) {
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

        public InputStream getContents() throws CoreException {
          return data;
        }
      };

      IStorageEditorInput storageEditorInput = new IStorageEditorInput() {
        public Object getAdapter(Class adapter) {
          return null;
        }

        public String getToolTipText() {
View Full Code Here

        public void run() {
          IWorkbench wb = PlatformUI.getWorkbench();
          if (wb != null) {
            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            IStorage storage = new StringStorage("NuSMV Results", buf.toString());
            IStorageEditorInput input = new StringInput(storage);
            IWorkbenchPage page = window.getActivePage();
            if (page != null) {
              try {
                page.openEditor(input, "org.eclipse.ui.DefaultTextEditor");
              } catch (PartInitException e) {
View Full Code Here

    IDocument doc= fReference;
    ITextEditor editor= fEditor;

    if (prov instanceof IStorageDocumentProvider && inp instanceof IStorageEditorInput) {

      IStorageEditorInput input= (IStorageEditorInput) inp;
      IStorageDocumentProvider provider= (IStorageDocumentProvider) prov;

      if (doc == null)
        if (force || fDocumentRead)
          doc= new Document();
        else
          return;

      IJobManager jobMgr= Platform.getJobManager();

      try {
        IStorage storage= input.getStorage();
        // check for null for backward compatibility (we used to check before...)
        if (storage == null)
          return;
        fProgressMonitor= monitor;
        ISchedulingRule rule= getSchedulingRule(storage);
View Full Code Here

   * markers.
   */
  class StorageInputDocumentProvider extends StorageDocumentProvider implements IElementStateListener {
    protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
      IAnnotationModel model = null;
      IStorageEditorInput storageInput = (IStorageEditorInput) element;
      String ext = BreakpointRulerAction.getFileExtension(storageInput);
      IContentType[] types = getEditorInputContentTypes(storageInput);
      IResource res = null;
      for (int i = 0; res == null && i < types.length; i++) {
        res = BreakpointProviderBuilder.getInstance().getResource(storageInput, types[i].getId(), ext);
      }
      String id = storageInput.getName();
      if (storageInput.getStorage() != null) {
        IPath fullPath = storageInput.getStorage().getFullPath();
        if (fullPath != null)
          id = fullPath.toString();
        else
          id = storageInput.getName();
      }
      if (res != null)
        model = new StructuredResourceMarkerAnnotationModel(res, id);
      else
        model = new StructuredResourceMarkerAnnotationModel(ResourcesPlugin.getWorkspace().getRoot(), id);
View Full Code Here

        System.out.println("StorageModelProvider: createAnnotationModel for " + ((IStorageEditorInput) element).getStorage().getFullPath()); //$NON-NLS-1$
      else
        System.out.println("StorageModelProvider: createAnnotationModel for " + element); //$NON-NLS-1$
    }
    if (element instanceof IStorageEditorInput) {
      IStorageEditorInput input = (IStorageEditorInput) element;
      String contentType = (getModel(input) != null ? getModel(input).getContentTypeIdentifier() : null);
      String ext = BreakpointRulerAction.getFileExtension((IEditorInput) element);
      IResource res = BreakpointProviderBuilder.getInstance().getResource(input, contentType, ext);
      String id = input.getName();
      if (input.getStorage() != null && input.getStorage().getFullPath() != null) {
        id = input.getStorage().getFullPath().toString();
      }
      // we can only create a resource marker annotationmodel off of a
      // valid resource
      if (res != null)
        model = new StructuredResourceMarkerAnnotationModel(res, id);
View Full Code Here

        System.out.println("StorageModelProvider: createAnnotationModel for " + ((IStorageEditorInput) element).getStorage().getFullPath()); //$NON-NLS-1$
      else
        System.out.println("StorageModelProvider: createAnnotationModel for " + element); //$NON-NLS-1$
    }
    if (element instanceof IStorageEditorInput) {
      IStorageEditorInput input = (IStorageEditorInput) element;
      String contentType = (getModel(input) != null ? getModel(input).getContentTypeIdentifier() : null);
      String ext = BreakpointRulerAction.getFileExtension((IEditorInput) element);
      IResource res = BreakpointProviderBuilder.getInstance().getResource(input, contentType, ext);
      String id = input.getName();
      if (input.getStorage() != null && input.getStorage().getFullPath() != null) {
        id = input.getStorage().getFullPath().toString();
      }
      // we can only create a resource marker annotationmodel off of a
      // valid resource
      if (res != null)
        model = new StructuredResourceMarkerAnnotationModel(res, id);
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.