KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ErrorEditorPart


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal;
12
13 import org.eclipse.core.runtime.IProgressMonitor;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.ui.IEditorInput;
17 import org.eclipse.ui.IEditorSite;
18 import org.eclipse.ui.internal.part.StatusPart;
19 import org.eclipse.ui.part.EditorPart;
20
21 /**
22  * This part is shown instead the editors with errors.
23  *
24  * @since 3.3
25  */

26 public class ErrorEditorPart extends EditorPart {
27
28     private IStatus error;
29
30     /**
31      * Creates instance of the class
32      */

33     public ErrorEditorPart() {
34     }
35
36     /**
37      * Creates instance of the class
38      */

39     public ErrorEditorPart(IStatus error) {
40         this.error = error;
41     }
42
43     /*
44      * (non-Javadoc)
45      *
46      * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
47      */

48     public void doSave(IProgressMonitor monitor) {
49     }
50
51     /*
52      * (non-Javadoc)
53      *
54      * @see org.eclipse.ui.part.EditorPart#doSaveAs()
55      */

56     public void doSaveAs() {
57     }
58
59     /*
60      * (non-Javadoc)
61      *
62      * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
63      */

64     public void createPartControl(Composite parent) {
65         if (error != null) {
66             new StatusPart(parent, error);
67         }
68     }
69
70     /*
71      * (non-Javadoc)
72      *
73      * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
74      * org.eclipse.ui.IEditorInput)
75      */

76     public void init(IEditorSite site, IEditorInput input) {
77         setSite(site);
78         setInput(input);
79         setPartName(input.getName());
80     }
81
82     /*
83      * (non-Javadoc)
84      *
85      * @see org.eclipse.ui.part.EditorPart#isDirty()
86      */

87     public boolean isDirty() {
88         return false;
89     }
90
91     /*
92      * (non-Javadoc)
93      *
94      * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
95      */

96     public boolean isSaveAsAllowed() {
97         return false;
98     }
99
100     /*
101      * (non-Javadoc)
102      *
103      * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
104      */

105     public void setFocus() {
106
107     }
108
109     /*
110      * (non-Javadoc)
111      *
112      * @see org.eclipse.ui.part.EditorPart#setPartName(java.lang.String)
113      */

114     public void setPartName(String JavaDoc newName) {
115         super.setPartName(newName);
116     }
117 }
118
Popular Tags