platform/org.eclipse.core.resources/src/org/eclipse/core/resources/ResourcesPlugin.java
equal
deleted
inserted
replaced
16 import org.eclipse.core.runtime.jobs.IJobManager; |
16 import org.eclipse.core.runtime.jobs.IJobManager; |
17 import org.eclipse.core.runtime.jobs.Job; |
17 import org.eclipse.core.runtime.jobs.Job; |
18 import org.osgi.framework.BundleActivator; |
18 import org.osgi.framework.BundleActivator; |
19 import org.osgi.framework.BundleContext; |
19 import org.osgi.framework.BundleContext; |
20 |
20 |
|
21 import java.util.logging.Level; |
|
22 |
21 /** |
23 /** |
22 * The plug-in runtime class for the Resources plug-in. This is |
24 * The plug-in runtime class for the Resources plug-in. This is |
23 * the starting point for all workspace and resource manipulation. |
25 * the starting point for all workspace and resource manipulation. |
24 * A typical sequence of events would be for a dependent plug-in |
26 * A typical sequence of events would be for a dependent plug-in |
25 * to call <code>ResourcesPlugin.getWorkspace()</code>. |
27 * to call <code>ResourcesPlugin.getWorkspace()</code>. |
27 * (if any) to be loaded from disk and initialized. |
29 * (if any) to be loaded from disk and initialized. |
28 * |
30 * |
29 * @noinstantiate This class is not intended to be instantiated by clients. |
31 * @noinstantiate This class is not intended to be instantiated by clients. |
30 */ |
32 */ |
31 public final class ResourcesPlugin extends Plugin { |
33 public final class ResourcesPlugin extends Plugin { |
|
34 |
32 /** |
35 /** |
33 * Unique identifier constant (value <code>"org.eclipse.core.resources"</code>) |
36 * Unique identifier constant (value <code>"org.eclipse.core.resources"</code>) |
34 * for the standard Resources plug-in. |
37 * for the standard Resources plug-in. |
35 */ |
38 */ |
36 public static final String PI_RESOURCES = "org.eclipse.core.resources"; //$NON-NLS-1$ |
39 public static final String PI_RESOURCES = "org.eclipse.core.resources"; //$NON-NLS-1$ |
265 * The workspace managed by the single instance of this |
268 * The workspace managed by the single instance of this |
266 * plug-in runtime class, or <code>null</code> is there is none. |
269 * plug-in runtime class, or <code>null</code> is there is none. |
267 */ |
270 */ |
268 private static Workspace workspace = null; |
271 private static Workspace workspace = null; |
269 |
272 |
|
273 |
|
274 private static final String REFRESH_LOG_ID = ".refresh.log"; |
|
275 private DiagnosticLog refreshLog; |
|
276 |
270 /** |
277 /** |
271 * Constructs an instance of this plug-in runtime class. |
278 * Constructs an instance of this plug-in runtime class. |
272 * <p> |
279 * <p> |
273 * An instance of this plug-in runtime class is automatically created |
280 * An instance of this plug-in runtime class is automatically created |
274 * when the facilities provided by the Resources plug-in are required. |
281 * when the facilities provided by the Resources plug-in are required. |
375 PlatformURLResourceConnection.startup(workspace.getRoot().getLocation()); |
382 PlatformURLResourceConnection.startup(workspace.getRoot().getLocation()); |
376 IStatus result = workspace.open(null); |
383 IStatus result = workspace.open(null); |
377 if (!result.isOK()) |
384 if (!result.isOK()) |
378 getLog().log(result); |
385 getLog().log(result); |
379 } |
386 } |
|
387 |
|
388 public static void writeRefreshLog(String s) { |
|
389 if (!plugin.getPluginPreferences().getBoolean(PI_RESOURCES + REFRESH_LOG_ID)) |
|
390 return; |
|
391 |
|
392 if (plugin.refreshLog == null) { |
|
393 IPath path = getWorkspace().getRoot().getLocation().append("refresh.log"); |
|
394 plugin.refreshLog = new DiagnosticLog("refresh.log", PI_RESOURCES + REFRESH_LOG_ID, path.toOSString()); |
|
395 plugin.refreshLog.getLogger().setLevel(Level.INFO); |
|
396 } |
|
397 |
|
398 plugin.refreshLog.getLogger().info(s); |
|
399 System.out.println(s); |
|
400 } |
380 } |
401 } |