Examples of IFileEditorInput


Examples of org.eclipse.ui.IFileEditorInput

  }

  protected boolean isSwingComponent() {
    IEditorInput input = getEditorInput();
    if (input instanceof IFileEditorInput) {
      IFileEditorInput file = (IFileEditorInput) input;
      IContentTypeManager contentTypeManager = Platform
          .getContentTypeManager();
      InputStream stream = null;
      try {
        stream = file.getFile().getContents();
        IContentType[] contentTypes = contentTypeManager
            .findContentTypesFor(stream, file.getName());
        for (IContentType contentType : contentTypes) {
          if (contentType.getId().equals(
              VisualSwingContentDescriber.CONTENT_TYPE_ID_VS)) {
            return true;
          }
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

            .getActivePage();
        if (page != null) {
          page.closeEditor(AbstractDesignerEditor.this, false);
          try {
            page.openEditor(input, JAVA_EDITOR_ID);
            IFileEditorInput file_editor_input = (IFileEditorInput) input;
            IFile file = file_editor_input.getFile();
            IDE.setDefaultEditor(file, JAVA_EDITOR_ID);
          } catch (PartInitException e) {
            VisualSwingPlugin.getLogger().error(e);
          }
        }
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

      return Status.OK_STATUS;
    }
  }

  private void createDesignerUI(IProgressMonitor monitor) throws Exception {
    final IFileEditorInput file = (IFileEditorInput) getEditorInput();
    asyncRunnable(new Runnable() {

      public void run() {
        setPartName(file.getName());
        setTitleToolTip(file.getToolTipText());
      }
    });
    ParserFactory factory = ParserFactory.getDefaultParserFactory();
    if (factory == null)
      throw new Exception("No parser factory available!");
    ICompilationUnit unit = JavaCore.createCompilationUnitFrom(file.getFile());
    hostProject = unit.getJavaProject();
    ISourceParser sourceParser = factory.newParser();
    isParsing = true;
    VisualSwingPlugin.setCurrentEditor(this);
    this.designer.setCompilationUnit(unit);
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

    if (super.isDirty()) {
      super.doSave(monitor);
    } else {
      isGeneratingCode = true;
      try {
        IFileEditorInput file = (IFileEditorInput) getEditorInput();
        setPartName(file.getName());
        setTitleToolTip(file.getToolTipText());
        ParserFactory factory = ParserFactory.getDefaultParserFactory();
        if (factory != null) {
          ISourceParser sourceParser = factory.newParser();
          Component root = designer.getRoot();
          if (root != null) {
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

  /*
   * @see AbstractDocumentProvider#createAnnotationModel(Object)
   */
  protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      return new ResourceMarkerAnnotationModel(input.getFile());
    }

    return super.createAnnotationModel(element);
  }
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

   * @see IDocumentProvider#getModificationStamp(Object)
   */
  public long getModificationStamp(Object element) {

    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;
      return computeModificationStamp(input.getFile());
    }

    return super.getModificationStamp(element);
  }
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

   * @since 3.0
   */
  protected void doSynchronize(Object element, IProgressMonitor monitorthrows CoreException {
    if (element instanceof IFileEditorInput) {

      IFileEditorInput input= (IFileEditorInput) element;

      FileInfo info= (FileInfo) getElementInfo(element);
      if (info != null) {

        if (info.fFileSynchronizer != null) {
          info.fFileSynchronizer.uninstall();
          refreshFile(input.getFile(), monitor);
          info.fFileSynchronizer.install();
        } else {
          refreshFile(input.getFile(), monitor);
        }

        handleElementContentChanged((IFileEditorInput) element);
      }
      return;
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

   * @see IDocumentProvider#isDeleted(Object)
   */
  public boolean isDeleted(Object element) {

    if (element instanceof IFileEditorInput) {
      IFileEditorInput input= (IFileEditorInput) element;

      IPath path= input.getFile().getLocation();
      if (path == null)
        return true;

      return !path.toFile().exists();
    }
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

   * @see AbstractDocumentProvider#doSaveDocument(IProgressMonitor, Object, IDocument, boolean)
   */
  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= getCharsetForNewFile(file, document, info);

      Charset charset;
      try {
        charset= Charset.forName(encoding);
View Full Code Here

Examples of org.eclipse.ui.IFileEditorInput

   * @see AbstractDocumentProvider#createElementInfo(Object)
   */
  protected ElementInfo createElementInfo(Object element) throws CoreException {
    if (element instanceof IFileEditorInput) {

      IFileEditorInput input= (IFileEditorInput) element;

      try {
        refreshFile(input.getFile());
      } catch (CoreException x) {
        handleCoreException(x, TextEditorMessages.FileDocumentProvider_createElementInfo);
      }

      IDocument d= null;
      IStatus s= null;

      try {
        d= createDocument(element);
      } catch (CoreException x) {
        handleCoreException(x, TextEditorMessages.FileDocumentProvider_createElementInfo);
        s= x.getStatus();
        d= createEmptyDocument();
      }
     
      // Set the initial line delimiter
      if (d instanceof IDocumentExtension4) {
        String initalLineDelimiter= getLineDelimiterPreference(input.getFile());
        if (initalLineDelimiter != null)
          ((IDocumentExtension4)d).setInitialLineDelimiter(initalLineDelimiter);
      }

      IAnnotationModel m= createAnnotationModel(element);
      FileSynchronizer f= new FileSynchronizer(input);
      f.install();

      FileInfo info= new FileInfo(d, m, f);
      info.fModificationStamp= computeModificationStamp(input.getFile());
      info.fStatus= s;
      info.fEncoding= getPersistedEncoding(element);
      info.fHasBOM= hasBOM(element);

      /*
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.