Package org.eclipse.ui

Examples of org.eclipse.ui.IPathEditorInput


  @SuppressWarnings("deprecation")
  private IFile[] getFiles(IWorkbenchPart part) {
    if (!(part instanceof IEditorPart)) return new IFile[] {};
    IEditorInput input = ((IEditorPart) part).getEditorInput();
    if (!(input instanceof IPathEditorInput)) return new IFile[] {};
    IPathEditorInput pathInput = (IPathEditorInput) input;
//    System.out.println(pathInput.getPath());
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    return workspace.getRoot().findFilesForLocation(pathInput.getPath());
  }
View Full Code Here


    @SuppressWarnings("deprecation")
    private IFile[] getFiles(IWorkbenchPart each) {
        if (!(each instanceof IEditorPart)) return new IFile[] {};
        IEditorInput input = ((IEditorPart) each).getEditorInput();
        if (!(input instanceof IPathEditorInput)) return new IFile[] {};
        IPathEditorInput pathInput = (IPathEditorInput) input;
//      System.out.println(pathInput.getPath());
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        return workspace.getRoot().findFilesForLocation(pathInput.getPath());
    }   
View Full Code Here

        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();
          }
        }
      } else if (input instanceof IPathEditorInput) {
        IPathEditorInput pin = (IPathEditorInput) input;
        return pin.getPath().toOSString();
      }
    } catch (Exception e) {
      return null;
    }
View Full Code Here

            writeDocumentContent( document, ( ( FileEditorInput ) element ).getFile(), monitor );
            return;
        }
        else if ( element instanceof IPathEditorInput )
        {
            IPathEditorInput pei = ( IPathEditorInput ) element;
            IPath path = pei.getPath();
            file = path.toFile();
        }
        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
            || elementClassName.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) ) //$NON-NLS-1$
        // The class 'org.eclipse.ui.internal.editors.text.JavaFileEditorInput'
View Full Code Here

    public boolean isModifiable( Object element )
    {
        String elementClassName = element.getClass().getName();
        if ( element instanceof IPathEditorInput )
        {
            IPathEditorInput pei = ( IPathEditorInput ) element;
            File file = pei.getPath().toFile();
            return file.canWrite() || !file.exists(); // Allow to edit new files
        }
        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
            || elementClassName.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) ) //$NON-NLS-1$
        // The class 'org.eclipse.ui.internal.editors.text.JavaFileEditorInput'
View Full Code Here

     */
    public void init( IEditorSite site, IEditorInput input ) throws PartInitException
    {
        if ( input instanceof IPathEditorInput )
        {
            IPathEditorInput pei = ( IPathEditorInput ) input;
            IPath path = pei.getPath();
            File javaIoFile = path.toFile();
            long fileLength = javaIoFile.length();
            if ( fileLength > ( 1 * 1024 * 1024 ) )
            {
                MessageDialog.openError( site.getShell(), Messages.getString( "LdifEditor.LDIFFileIsTooBig" ), //$NON-NLS-1$
View Full Code Here

    {
        File file = null;
        String elementClassName = element.getClass().getName();
        if ( element instanceof IPathEditorInput )
        {
            IPathEditorInput pei = ( IPathEditorInput ) element;
            IPath path = pei.getPath();
            file = path.toFile();
        }
        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
            || elementClassName.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) ) //$NON-NLS-1$
        // The class 'org.eclipse.ui.internal.editors.text.JavaFileEditorInput'
View Full Code Here

    public boolean isModifiable( Object element )
    {
        String elementClassName = element.getClass().getName();
        if ( element instanceof IPathEditorInput )
        {
            IPathEditorInput pei = ( IPathEditorInput ) element;
            File file = pei.getPath().toFile();
            return file.canWrite() || !file.exists(); // Allow to edit new files
        }
        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
            || elementClassName.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) ) //$NON-NLS-1$
        // The class 'org.eclipse.ui.internal.editors.text.JavaFileEditorInput'
View Full Code Here

    protected void doSaveDocument( IProgressMonitor monitor, Object element,
      IDocument document, boolean overwrite )
      throws CoreException {

    if( element instanceof IPathEditorInput ) {
      IPathEditorInput pei = ( IPathEditorInput )element;
      IPath path = pei.getPath();
      File file = path.toFile();

      try {
        file.createNewFile();
View Full Code Here

   * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#isModifiable(java.lang.Object)
   */ 
    public boolean isModifiable( Object element ) {

    if( element instanceof IPathEditorInput ) {
      IPathEditorInput pei = ( IPathEditorInput )element;
      File file = pei.getPath().toFile();
      return file.canWrite() || !file.exists(); // Allow to edit new
      // files
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IPathEditorInput

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.