KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > resources > TestingSupport


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.internal.resources;
12
13 import java.util.Properties JavaDoc;
14 import org.eclipse.core.resources.ResourcesPlugin;
15
16 /**
17  * Provides special internal access to the workspace resource implementation.
18  * This class is to be used for testing purposes only.
19  *
20  * @since 2.0
21  */

22 public class TestingSupport {
23     /**
24      * Returns the save manager's master table.
25      */

26     public static Properties JavaDoc getMasterTable() {
27         return ((Workspace) ResourcesPlugin.getWorkspace()).getSaveManager().getMasterTable();
28     }
29
30     /**
31      * Blocks the calling thread until background snapshot completes.
32      * @since 3.0
33      */

34     public static void waitForSnapshot() {
35         try {
36             ((Workspace) ResourcesPlugin.getWorkspace()).getSaveManager().snapshotJob.join();
37         } catch (InterruptedException JavaDoc e) {
38             e.printStackTrace();
39             throw new RuntimeException JavaDoc("Interrupted while waiting for snapshot"); //$NON-NLS-1$
40
}
41     }
42
43     /*
44      * Class cannot be instantiated.
45      */

46     private TestingSupport() {
47         // not allowed
48
}
49 }
50
Popular Tags