//---------------------------------------------------------------------------- /** * Builds controls of the office panel. * * @author Andreas Bröker * @date 28.06.2006 */ private void buildControls() { super.setLayout(new GridLayout(1, false)); // baseComposite = new Composite(this, SWT.EMBEDDED); stackLayout = new StackLayout(); stackLayout.marginHeight = -5; stackLayout.marginWidth = -5; // baseComposite.setLayout(stackLayout); // baseComposite.setBackground(this.getParent().getBackground()); baseComposite = this; // baseComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // if(!showProgressIndicator) // buildProgressIndicator(this); } //---------------------------------------------------------------------------- /** * Activates a new office frame. * * @return new builded office frame * * @throws CoreException if a new office frame can not be activated * * @author Andreas Bröker * @date 28.06.2006 */ private IFrame activateNewFrame() throws CoreException { Control oldOfficeComposite = stackLayout.topControl; Frame oldOfficeAWTFrame = officeAWTFrame; officeComposite = new Composite(baseComposite, SWT.EMBEDDED); officeComposite.setBackground(this.getBackground()); officeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); try { officeAWTFrame = SWT_AWT.new_Frame(officeComposite); officeAWTFrame.setVisible(true); officeAWTFrame.setBackground(Color.GREEN); Panel officeAWTPanel = new Panel(new BorderLayout()); officeAWTPanel.setVisible(true); officeAWTFrame.add(officeAWTPanel, BorderLayout.CENTER); if(!officeApplication.isActive()) { IStatus status = startOfficeApplication(officeApplication); if(status.getSeverity() == IStatus.ERROR) throw new CoreException(status); } 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(officeAWTPanel); newOfficeFrame.disableDispatch(GlobalCommands.CLOSE_DOCUMENT); newOfficeFrame.disableDispatch(GlobalCommands.QUIT_APPLICATION); if(oldOfficeAWTFrame != null) oldOfficeAWTFrame.dispose(); if(oldOfficeComposite != null) oldOfficeComposite.dispose(); // stackLayout.topControl = officeComposite; // baseComposite.layout(); return newOfficeFrame; } catch(Throwable throwable) { throw new CoreException(new Status(IStatus.ERROR, NOAUIPlugin.PLUGIN_ID, IStatus.ERROR, throwable.getMessage(), throwable)); } }