1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.editors.win32;
\r
14 import java.io.File;
\r
16 import org.eclipse.jface.resource.ImageDescriptor;
\r
17 import org.eclipse.ui.IEditorInput;
\r
18 import org.eclipse.ui.IPersistableElement;
\r
19 import org.simantics.editors.win32.ole.EditorDefinition;
\r
22 * EditorInput for the OLEEditor component.
\r
23 * Input can be configured in two ways:
\r
25 * 1) giving an input file and the system tries to find proper ActiveX component for it.
\r
26 * 2) giving both input file, and ActiveX component's progID.
\r
28 * @author Marko Luukkainen <Marko.Luukkainen@vtt.fi>
\r
31 public class OLEEditorInput implements IEditorInput {
\r
33 private String name;
\r
34 private EditorDefinition factory;
\r
36 private boolean fullscreen;
\r
38 public OLEEditorInput(EditorDefinition factory, File file) {
\r
39 this(factory,file,false);
\r
42 public OLEEditorInput(EditorDefinition factory, File file, boolean fullscreen) {
\r
43 this(factory,file,file.getName(),fullscreen);
\r
46 public OLEEditorInput(EditorDefinition factory, File file, String name, boolean fullscreen) {
\r
47 if (file == null || factory == null || name == null)
\r
48 throw new NullPointerException();
\r
50 this.factory = factory;
\r
51 this.fullscreen = fullscreen;
\r
57 public boolean exists() {
\r
62 public ImageDescriptor getImageDescriptor() {
\r
67 public String getName() {
\r
72 public IPersistableElement getPersistable() {
\r
77 public String getToolTipText() {
\r
81 @SuppressWarnings({ "rawtypes" })
\r
83 public Object getAdapter(Class adapter) {
\r
87 public File getFile() {
\r
91 public EditorDefinition getFactory() {
\r
95 public boolean isFullscreen() {
\r
100 public boolean equals(Object arg0) {
\r
103 if (arg0.getClass() != getClass())
\r
105 OLEEditorInput other = (OLEEditorInput)arg0;
\r
106 return other.file.equals(file);
\r
111 public int hashCode() {
\r
112 return file.hashCode();
\r