X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.editors.win32%2Fsrc%2Forg%2Fsimantics%2Feditors%2Fwin32%2FOLEEditor.java;h=000082b6992bb1804b4f56965b4cc6418c637141;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=db7752edd1fb8a1e53adc22ce2d46f1e4f982c11;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/OLEEditor.java b/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/OLEEditor.java index db7752edd..000082b69 100644 --- a/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/OLEEditor.java +++ b/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/OLEEditor.java @@ -1,143 +1,143 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.editors.win32; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.ole.win32.OleAutomation; -import org.eclipse.swt.ole.win32.OleClientSite; -import org.eclipse.swt.ole.win32.OleFrame; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.EditorPart; -import org.simantics.editors.win32.ole.EditorDefinition; -import org.simantics.editors.win32.ole.OleController; - - -/** - * OLEEditor is a wrapper for Windows ActiveX components. - * - * @author Marko Luukkainen - * - */ -public class OLEEditor extends EditorPart { - - private OleFrame frame; - private OleClientSite site; - private OleAutomation auto; - private OleController ctrl; - - private Shell fsShell; - - public OLEEditor() { - super(); - } - - @Override - public void doSave(IProgressMonitor monitor) { - - } - - @Override - public void doSaveAs() { - - } - - @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - if (!(input instanceof OLEEditorInput)) - throw new PartInitException("Input must be OLEEditorInput"); - setInput(input); - setSite(site); - - } - - @Override - public boolean isDirty() { - return false; - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - - - @Override - public void createPartControl(Composite parent) { - OLEEditorInput input = (OLEEditorInput)getEditorInput(); - boolean fullscreen = input.isFullscreen(); - if (fullscreen) { - fsShell = new Shell(parent.getDisplay()); - - fsShell.setLayout(new GridLayout(1,false)); - fsShell.setLayout(new FillLayout()); - parent = new Composite(fsShell,SWT.NONE); - fsShell.open(); - fsShell.setFullScreen(true); - parent.setLayout(new FillLayout()); - } - - - EditorDefinition factory = input.getFactory(); - frame = new OleFrame(parent, SWT.NONE); - - if (factory.getProgID() == null || factory.useFileInput()) { - site = new OleClientSite(frame,SWT.NONE,input.getFile()); - } else { - site = new OleClientSite(frame, SWT.NONE, factory.getProgID()); - auto = new OleAutomation(site); - ctrl = factory.createController(frame, site, auto); - ctrl.show(input); - } - - setPartName(site.getProgramID() + " : " + input.getName()); - - if (fullscreen) { - fsShell.layout(true, true); - } - } - - @Override - public void setFocus() { - frame.setFocus(); - } - - /** - * Returns OleController of embedded OLE component. May return null. - * @return - */ - public OleController getController() { - return ctrl; - } - - @Override - public void dispose() { - if (auto != null) - auto.dispose(); - site.dispose(); - if (fsShell != null) - fsShell.dispose(); - if (frame != null) { - frame.dispose(); - } - super.dispose(); - - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.editors.win32; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.ole.win32.OleAutomation; +import org.eclipse.swt.ole.win32.OleClientSite; +import org.eclipse.swt.ole.win32.OleFrame; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.EditorPart; +import org.simantics.editors.win32.ole.EditorDefinition; +import org.simantics.editors.win32.ole.OleController; + + +/** + * OLEEditor is a wrapper for Windows ActiveX components. + * + * @author Marko Luukkainen + * + */ +public class OLEEditor extends EditorPart { + + private OleFrame frame; + private OleClientSite site; + private OleAutomation auto; + private OleController ctrl; + + private Shell fsShell; + + public OLEEditor() { + super(); + } + + @Override + public void doSave(IProgressMonitor monitor) { + + } + + @Override + public void doSaveAs() { + + } + + @Override + public void init(IEditorSite site, IEditorInput input) + throws PartInitException { + if (!(input instanceof OLEEditorInput)) + throw new PartInitException("Input must be OLEEditorInput"); + setInput(input); + setSite(site); + + } + + @Override + public boolean isDirty() { + return false; + } + + @Override + public boolean isSaveAsAllowed() { + return false; + } + + + @Override + public void createPartControl(Composite parent) { + OLEEditorInput input = (OLEEditorInput)getEditorInput(); + boolean fullscreen = input.isFullscreen(); + if (fullscreen) { + fsShell = new Shell(parent.getDisplay()); + + fsShell.setLayout(new GridLayout(1,false)); + fsShell.setLayout(new FillLayout()); + parent = new Composite(fsShell,SWT.NONE); + fsShell.open(); + fsShell.setFullScreen(true); + parent.setLayout(new FillLayout()); + } + + + EditorDefinition factory = input.getFactory(); + frame = new OleFrame(parent, SWT.NONE); + + if (factory.getProgID() == null || factory.useFileInput()) { + site = new OleClientSite(frame,SWT.NONE,input.getFile()); + } else { + site = new OleClientSite(frame, SWT.NONE, factory.getProgID()); + auto = new OleAutomation(site); + ctrl = factory.createController(frame, site, auto); + ctrl.show(input); + } + + setPartName(site.getProgramID() + " : " + input.getName()); + + if (fullscreen) { + fsShell.layout(true, true); + } + } + + @Override + public void setFocus() { + frame.setFocus(); + } + + /** + * Returns OleController of embedded OLE component. May return null. + * @return + */ + public OleController getController() { + return ctrl; + } + + @Override + public void dispose() { + if (auto != null) + auto.dispose(); + site.dispose(); + if (fsShell != null) + fsShell.dispose(); + if (frame != null) { + frame.dispose(); + } + super.dispose(); + + } + +}