KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > core > refactoring > FileStatusContext


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.ltk.core.refactoring;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.core.resources.IFile;
16
17 import org.eclipse.jface.text.IRegion;
18
19 /**
20  * A file context can be used to annotate a <code>RefactoringStatusEntry</code> with
21  * detailed information about a problem detected in an <code>IFile</code>.
22  * <p>
23  * Note: this class is not intended to be extended by clients.
24  * </p>
25  *
26  * @since 3.0
27  */

28 public class FileStatusContext extends RefactoringStatusContext {
29
30     private IFile fFile;
31     private IRegion fSourceRegion;
32
33     /**
34      * Creates an status entry context for the given file and source region.
35      *
36      * @param file the file that has caused the problem. Must not be <code>
37      * null</code>
38      * @param region the source region of the problem inside the given file or
39      * <code>null</code> if now source region is known
40      */

41     public FileStatusContext(IFile file, IRegion region) {
42         Assert.isNotNull(file);
43         fFile= file;
44         fSourceRegion= region;
45     }
46
47     /**
48      * Returns the context's file.
49      *
50      * @return the context's file
51      */

52     public IFile getFile() {
53         return fFile;
54     }
55     
56     /**
57      * Returns the context's source region
58      *
59      * @return the context's source region or <code>null</code> if no source region
60      * has been set
61      */

62     public IRegion getTextRegion() {
63         return fSourceRegion;
64     }
65     
66     /* (non-Javadoc)
67      * Method declared on RefactoringStatusContext.
68      */

69     public Object JavaDoc getCorrespondingElement() {
70         return getFile();
71     }
72 }
73
74
Popular Tags