KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > launch > SourceNotFoundEditorInput


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.debug.internal.ui.views.launch;
12
13
14 import com.ibm.icu.text.MessageFormat;
15
16 import org.eclipse.core.runtime.PlatformObject;
17 import org.eclipse.debug.core.DebugException;
18 import org.eclipse.debug.core.model.IStackFrame;
19 import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
20 import org.eclipse.debug.ui.DebugUITools;
21 import org.eclipse.debug.ui.IDebugModelPresentation;
22 import org.eclipse.jface.resource.ImageDescriptor;
23 import org.eclipse.ui.IEditorInput;
24 import org.eclipse.ui.IPersistableElement;
25
26 /**
27  * Editor input for a stack frame for which source could not be located.
28  *
29  * @since 2.1
30  */

31 public class SourceNotFoundEditorInput extends PlatformObject implements IEditorInput {
32     
33     /**
34      * Associated stack frame
35      */

36     private IStackFrame fFrame;
37     
38     /**
39      * Stack frame text (cached on creation)
40      */

41     private String JavaDoc fFrameText;
42
43     /**
44      * Constructs an editor input for the given stack frame,
45      * to indicate source could not be found.
46      *
47      * @param frame stack frame
48      */

49     public SourceNotFoundEditorInput(IStackFrame frame) {
50         fFrame = frame;
51         IDebugModelPresentation pres = DebugUITools.newDebugModelPresentation(frame.getModelIdentifier());
52         fFrameText = pres.getText(frame);
53         pres.dispose();
54     }
55
56     /**
57      * @see org.eclipse.ui.IEditorInput#exists()
58      */

59     public boolean exists() {
60         return false;
61     }
62
63     /**
64      * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
65      */

66     public ImageDescriptor getImageDescriptor() {
67         return DebugUITools.getDefaultImageDescriptor(fFrame);
68     }
69
70     /**
71      * @see org.eclipse.ui.IEditorInput#getName()
72      */

73     public String JavaDoc getName() {
74         try {
75             return fFrame.getName();
76         } catch (DebugException e) {
77             return DebugUIViewsMessages.SourceNotFoundEditorInput_Source_Not_Found_1;
78         }
79     }
80
81     /**
82      * @see org.eclipse.ui.IEditorInput#getPersistable()
83      */

84     public IPersistableElement getPersistable() {
85         return null;
86     }
87
88     /**
89      * @see org.eclipse.ui.IEditorInput#getToolTipText()
90      */

91     public String JavaDoc getToolTipText() {
92         return MessageFormat.format(DebugUIViewsMessages.SourceNotFoundEditorInput_Source_not_found_for__0__2,new String JavaDoc[] {fFrameText});
93     }
94
95 }
96
Popular Tags