KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > resources > team > FileModificationValidationContext


1 /*******************************************************************************
2  * Copyright (c) 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.core.resources.team;
12
13 import org.eclipse.core.resources.IWorkspace;
14
15 /**
16  * A context that is used in conjunction with the {@link FileModificationValidator}
17  * to indicate that UI-based validation is desired.
18  * <p>
19  * This class is not intended to be instantiated or subclassed by clients.
20  *
21  * @see FileModificationValidator
22  * @since 3.3
23  */

24 public class FileModificationValidationContext {
25
26     /**
27      * Constant that can be passed to {@link IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], Object)}
28      * to indicate that the caller does not have access to a UI context but would still
29      * like to have UI-based validation if possible.
30      */

31     public static final FileModificationValidationContext VALIDATE_PROMPT = new FileModificationValidationContext(null);
32
33     private final Object JavaDoc shell;
34
35     /**
36      * Create a context with the given shell.
37      *
38      * @param shell the shell
39      */

40     FileModificationValidationContext(Object JavaDoc shell) {
41         this.shell = shell;
42     }
43
44     /**
45      * Return the <code>org.eclipse.swt.widgets.Shell</code> that is to be used to
46      * parent any dialogs with the user, or <code>null</code> if there is no UI context
47      * available (declared as an <code>Object</code> to avoid any direct references on the SWT component).
48      * If there is no shell, the {@link FileModificationValidator} may still perform
49      * UI-based validation if they can obtain a Shell from another source.
50      * @return the <code>org.eclipse.swt.widgets.Shell</code> that is to be used to
51      * parent any dialogs with the user, or <code>null</code>
52      */

53     public Object JavaDoc getShell() {
54         return shell;
55     }
56 }
Popular Tags