Package ag.ion.bion.officelayer.desktop

Examples of ag.ion.bion.officelayer.desktop.IFrame


          }
        }       
      });     
     
      System.out.println("Constructing document for test ...");
      IFrame officeFrame = application.getDesktopService().constructNewOfficeFrame(panel);     
      document = application.getDocumentService().constructNewHiddenDocument(IDocument.WRITER);
      System.out.println("Document for test constructed.");
      file = new File("OfficeBeanTest.odt");
      document.getPersistenceService().store(new FileOutputStream(file));
      document.close()
      System.out.println("Loading document for test ...");
      document = application.getDocumentService().loadDocument(officeFrame, new FileInputStream(file), new DocumentDescriptor());
      System.out.println("Document for test loaded.");
      frame.validate();
      officeFrame.getXFrame().getController().suspend(true);
      document.close();

      frame.dispose();
      document.close();
      file.delete();
View Full Code Here


          }
        }
      });

      System.out.println("Constructing document for test ...");
      IFrame officeFrame = application.getDesktopService()
          .constructNewOfficeFrame(panel);
      document = application.getDocumentService()
          .constructNewHiddenDocument(IDocument.WRITER);
      System.out.println("Document for test constructed.");
      file = new File("OfficeBeanTest.odt");
      document.getPersistenceService().store(new FileOutputStream(file));
      document.close();
      System.out.println("Loading document for test ...");
      document = application.getDocumentService().loadDocument(
          officeFrame, new FileInputStream(file),
          new DocumentDescriptor());
      System.out.println("Document for test loaded.");
      frame.validate();
      officeFrame.getXFrame().getController().suspend(true);
      document.close();

      frame.dispose();
      document.close();
      file.delete();
View Full Code Here

          catch (OfficeApplicationException applicationException) {           
          }
        }       
      });
     
      IFrame officeFrame = officeAplication.getDesktopService().constructNewOfficeFrame(panel);
      officeAplication.getDocumentService().constructNewDocument(officeFrame, IDocument.WRITER, DocumentDescriptor.DEFAULT);
      frame.validate();
     
      //Now it is time to disable two commands in the frame
      officeFrame.disableDispatch(GlobalCommands.CLOSE_DOCUMENT);
      officeFrame.disableDispatch(GlobalCommands.QUIT_APPLICATION);
      officeFrame.updateDispatches();
    }
    catch (Throwable throwable) {
      throwable.printStackTrace();
    }
  }
View Full Code Here

      frame.setVisible(true);
      Panel panel = new Panel(new BorderLayout());
      frame.add(panel);
      IOfficeApplication officeApplication = getOfficeApplication(parent.getShell());
      if(officeApplication.isActive()) {
        IFrame officeFrame = officeApplication.getDesktopService().constructNewOfficeFrame(panel);
        setFrame(officeFrame);
       
        //resfresh file if possible
        if(editorInput instanceof IFileEditorInput) {
          IFile fileToRefresh = ((IFileEditorInput)editorInput).getFile();
          fileToRefresh.refreshLocal(0,null);
        }
       
        //get URL of document if possible
        URL documentURL = getURLFromEditorInput(editorInput);
       
        DocumentDescriptor documentDescriptor = new DocumentDescriptor();
        documentDescriptor.setTitle(editorInput.getName());
        if(documentURL != null) {
          documentDescriptor.setURL(documentURL.toString());     
          documentDescriptor.setBaseURL(documentURL.toString());
        }

        isSaveAsAllowed = true;
        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);
        }
        else if(documentURL != null) {
          loadTextDocumentOperation = new LoadDocumentOperation(null,officeApplication, officeFrame, documentURL, documentDescriptor);
        }
       
        try {
          if(loadTextDocumentOperation == null)
            throw new CoreException(
                new Status(
                    IStatus.ERROR,
                    EditorUIPlugin.PLUGIN_ID,
                    IStatus.ERROR,
                    Messages.OfficeEditorAdvisor_error_invalid_editor_input + editorInput.getClass().getName(),
                    null));
          EditorUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().run(true, true, loadTextDocumentOperation);
        }
        catch(InterruptedException interruptedException) {
          //do not consume  
          //TODO: clear the document in the office system
          officeFrame.close();
          frame.dispose();
          composite.dispose();
          composite = new Composite(parent, SWT.EMBEDDED);
          return composite;
        }
View Full Code Here

  public void replaceSaveRoutine(IEditorPart editor,
      ITutorialDocument tutorialDocument) {
    if (!(editor instanceof OfficeEditor))
      return;
    OfficeEditor officeEditor = (OfficeEditor) editor;
    IFrame frame = officeEditor.getFrame();
    frame.addDispatchDelegate(GlobalCommands.SAVE,
        new SaveDispatchDelegate(officeEditor, tutorialDocument));
    frame.updateDispatches();
  }
View Full Code Here

   * @author Andreas Br�ker
   * @date 15.07.2006
   */
  public void run() {
    if(frameProvider != null) {
      IFrame frame = frameProvider.getFrame();
      if(frame != null) {
        try {
          IDispatch dispatch = frame.getDispatch(GlobalCommands.PRINT_DOCUMENT);
          if(dispatch != null)
            dispatch.dispatch();
        }
        catch(Throwable throwable) {
          ErrorDialog.openError(Display.getCurrent().getActiveShell(), Messages.PrintAction_dialog_title_internalError,
View Full Code Here

      if (isDisposed())
        throw new CoreException(new Status(IStatus.ERROR,
            NOAUIPlugin.PLUGIN_ID,
            IStatus.ERROR,
            "Widget disposed", null)); //$NON-NLS-1$
      IFrame newOfficeFrame = officeApplication.getDesktopService().constructNewOfficeFrame(officeAWTFrame);

      if (oldOfficeAWTFrame != null)
        oldOfficeAWTFrame.dispose();
      if (oldOfficeComposite != null)
        oldOfficeComposite.dispose();
View Full Code Here

TOP

Related Classes of ag.ion.bion.officelayer.desktop.IFrame

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.