blob: 7a069dbd36efcb5e98f8d3f495e98f3422e32185 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.tests.api.workbenchpart;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
public class EditorWithDisposeException extends EditorPart {
public void doSave(IProgressMonitor monitor) {
}
public void doSaveAs() {
}
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
if (!(input instanceof IFileEditorInput))
throw new PartInitException("Invalid Input: Must be IFileEditorInput");
setSite(site);
setInput(input);
}
public boolean isDirty() {
return false;
}
public boolean isSaveAsAllowed() {
return false;
}
public void createPartControl(Composite parent) {
parent.setLayout(new FillLayout());
Label testLabel = new Label(parent, SWT.NONE);
testLabel.setText("This editor is supposed to throw an exception when closed");
}
public void setFocus() {
}
public void dispose() {
throw new RuntimeException("This exception was thrown intentionally as part of an error handling test");
}
}