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