Package org.eclipse.ui

Examples of org.eclipse.ui.IFileEditorInput


   
  public static void validateTMLFile(IFile file) { 
    try {
      TMLDocumentProvider provider = new TMLDocumentProvider();   
      IFileEditorInput input = new FileEditorInput(file);     
      provider.connect(input);
     
      VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(file);
     
      Iterator<MarkingHandler> it = allHandlers.iterator();
View Full Code Here


    try {
      IAdaptable element = getElement();
      if (element instanceof IFile) {
        IFile tmlFile = (IFile) getElement();
        TMLDocumentProvider provider = new TMLDocumentProvider();   
        IFileEditorInput input = new FileEditorInput(tmlFile);     
        provider.connect(input);
       
        if (provider.getDocument(input).getContentType(0).equals(TMLPartitionScanner.TML_METAHEADER)) {
          hasMDHeader = true;
        }
View Full Code Here

 
  protected IFile getInputFile() {
    IEditorInput editorInput = getEditorInput();
    IFile file = null;
    if (editorInput instanceof IFileEditorInput) {
      IFileEditorInput ife = (IFileEditorInput) getEditorInput();
      file = ife.getFile();
    }
    return file;
  }
View Full Code Here

 
 
  public static void doGenericValidation(IFile file) {
    try {
      IDocumentProvider provider = new WGADesignFileDocumentProvider();
      IFileEditorInput input = new FileEditorInput(file);     
      provider.connect(input);
       
      VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(file);
       
      InvalidEncodingMarkingHandler handler = new InvalidEncodingMarkingHandler();
View Full Code Here

   * copied mostly from {@link FileDocumentProvider} bc. getCharsetForNewFile() on {@link FileDocumentProvider} is private !!!
   */
  protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
    if (element instanceof IFileEditorInput) {

      IFileEditorInput input= (IFileEditorInput) element;
      String encoding= null;

      FileInfo info= (FileInfo) getElementInfo(element);
      IFile file= input.getFile();
      encoding= retrieveCharsetForNewFile(file, document, info);
     
      /*
      if (info != null && info.fBOM == IContentDescription.BOM_UTF_16LE && CHARSET_UTF_16.equals(encoding))
        encoding= CHARSET_UTF_16LE;*/
 
View Full Code Here

    //~ Methods

    protected void doRun()
    {
        PerlEditor editor = getEditor();
        IFileEditorInput editorInput = (IFileEditorInput) editor.getEditorInput();
        String filePath = editorInput.getFile().getLocation().makeAbsolute().toString();

        // Display directory dialog
        DirectoryDialog directoryDialog =
            new DirectoryDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                SWT.SAVE);
View Full Code Here

            if (!(editorInput instanceof IFileEditorInput))
            {
                throw new ExecutionException("Editor input must be a file");
            }
            IFileEditorInput fileInput = (IFileEditorInput) editorInput;

            try
            {
                // Save the editor content (if dirty)
                IRunnableWithProgress saveOperation = new IRunnableWithProgress()
                {
                    public void run(IProgressMonitor monitor)
                        throws InvocationTargetException, InterruptedException
                    {
                        if (editorPart.isDirty())
                        {
                            if (MessageDialog.openQuestion(
                                shell,
                                "Save File",
                                "The file contents must be saved before the command can be executed. Do you wish to save now?"))
                            {
                                editorPart.doSave(monitor);
                            }
                            else
                            {
                                throw new InterruptedException();
                            }
                        }
                    }
                };
                new ProgressMonitorDialog(shell).run(false, true, saveOperation);

                // Execute on the file
                IFile file = fileInput.getFile();
                getResourceCommandHandler().execute(new IResource[] { file }, event);
            }
            catch (InvocationTargetException e)
            {
                throw new ExecutionException("Error saving file", e.getTargetException());
View Full Code Here

    private PropertiesForm textPage;

    public IProject getProject()
    {
        IFileEditorInput fileInput = (IFileEditorInput) getEditorInput();
        return fileInput.getFile().getProject();
    }
View Full Code Here

        continue;
      }
      if (!(editorInput instanceof IFileEditorInput)) {
        continue;
      }
      final IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
      final IFile file = fileEditorInput.getFile();
      if (file==null) {
        continue;
      }
      if (file.equals(selectedFile)) {
        aPage.bringToTop(reference.getEditor(true));
View Full Code Here

    }

    protected void setMarker(String type, String message, int priority, int severity)
        throws CoreException
    {
        IFileEditorInput file = (IFileEditorInput) getPage().getEditor().getEditorInput();
        IMarker marker = file.getFile().createMarker(type);
        marker.setAttribute(IMarker.MESSAGE, message);
        marker.setAttribute(IMarker.PRIORITY, priority);
        marker.setAttribute(IMarker.SEVERITY, severity);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IFileEditorInput

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.