001: /*******************************************************************************
002: * Copyright (c) 2005, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.internal;
011:
012: import org.eclipse.core.runtime.IProgressMonitor;
013: import org.eclipse.core.runtime.IStatus;
014: import org.eclipse.swt.widgets.Composite;
015: import org.eclipse.ui.IEditorInput;
016: import org.eclipse.ui.IEditorSite;
017: import org.eclipse.ui.internal.part.StatusPart;
018: import org.eclipse.ui.part.EditorPart;
019:
020: /**
021: * This part is shown instead the editors with errors.
022: *
023: * @since 3.3
024: */
025: public class ErrorEditorPart extends EditorPart {
026:
027: private IStatus error;
028:
029: /**
030: * Creates instance of the class
031: */
032: public ErrorEditorPart() {
033: }
034:
035: /**
036: * Creates instance of the class
037: */
038: public ErrorEditorPart(IStatus error) {
039: this .error = error;
040: }
041:
042: /*
043: * (non-Javadoc)
044: *
045: * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
046: */
047: public void doSave(IProgressMonitor monitor) {
048: }
049:
050: /*
051: * (non-Javadoc)
052: *
053: * @see org.eclipse.ui.part.EditorPart#doSaveAs()
054: */
055: public void doSaveAs() {
056: }
057:
058: /*
059: * (non-Javadoc)
060: *
061: * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
062: */
063: public void createPartControl(Composite parent) {
064: if (error != null) {
065: new StatusPart(parent, error);
066: }
067: }
068:
069: /*
070: * (non-Javadoc)
071: *
072: * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
073: * org.eclipse.ui.IEditorInput)
074: */
075: public void init(IEditorSite site, IEditorInput input) {
076: setSite(site);
077: setInput(input);
078: setPartName(input.getName());
079: }
080:
081: /*
082: * (non-Javadoc)
083: *
084: * @see org.eclipse.ui.part.EditorPart#isDirty()
085: */
086: public boolean isDirty() {
087: return false;
088: }
089:
090: /*
091: * (non-Javadoc)
092: *
093: * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
094: */
095: public boolean isSaveAsAllowed() {
096: return false;
097: }
098:
099: /*
100: * (non-Javadoc)
101: *
102: * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
103: */
104: public void setFocus() {
105:
106: }
107:
108: /*
109: * (non-Javadoc)
110: *
111: * @see org.eclipse.ui.part.EditorPart#setPartName(java.lang.String)
112: */
113: public void setPartName(String newName) {
114: super.setPartName(newName);
115: }
116: }
|