Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 558636981edf20d569ee0d2a14305c2c3bb361dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*******************************************************************************
 * Copyright (c) 2000, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 * 20070119   161112 makandre@ca.ibm.com - Andrew Mak, WSE: can't find business thru a proxy server that needs basic auth
 * 20070201   154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
 *******************************************************************************/

package org.eclipse.net.internal.core;

import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.net.core.NetCore;
import org.osgi.framework.BundleContext;

public class NetCorePlugin extends Plugin {
	/**
	 * The identifier of the descriptor of this plugin in plugin.xml.
	 */
	public static final String ID = "org.eclipse.net.core"; //$NON-NLS-1$

	/**
	 * The instance of this plugin.
	 */
	private static NetCorePlugin instance;

	/**
	 * Constructor for use by the Eclipse platform only.
	 */
	public NetCorePlugin() {
		super();
		instance = this;
	}

	/**
	 * Returns the instance of this plugin.
	 * @return the singleton instance of this plug-in class
	 */
	static public NetCorePlugin getInstance() {
		return instance;
	}

	public void start(BundleContext context) throws Exception {
		super.start(context);
		((ProxyManager)NetCore.getProxyManager()).initialize();
	}
	
	public static void logError(String message, Throwable exc) {
		IStatus status = new Status(IStatus.ERROR, ID, 0, message, exc);

		getInstance().getLog().log(status);
	}

	public static void logInfo(String message, Throwable exc) {
		IStatus status = new Status(IStatus.INFO, ID, 0, message, exc);

		getInstance().getLog().log(status);
	}

	public org.osgi.service.prefs.Preferences getInstancePreferences() {
		return new InstanceScope().getNode(getBundle().getSymbolicName());
	}
}

Back to the top