blob: 0fe28aa4df4fdc4fc2df5e05c772060a88fb319b [file] [log] [blame]
/***************************************************************************************************
* Copyright (c) 2003, 2005 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
**************************************************************************************************/
package org.eclipse.wst.common.environment;
import org.eclipse.wst.common.environment.uri.IURIScheme;
import org.eclipse.wst.common.environment.uri.URIException;
import org.eclipse.wst.common.internal.environment.eclipse.ConsoleEclipseEnvironment;
/**
*
* This class creates a console environment. It also contains static
* conviences methods for creating an ILog object as well as an Eclipse and
* File Scheme.
*
*/
public class EnvironmentService
{
static private IEnvironment environment;
/**
*
* @return returns an Eclipse console environment.
*/
public static IEnvironment getEclipseConsoleEnvironment()
{
if( environment == null ) environment = new ConsoleEclipseEnvironment();
return environment;
}
/**
*
* @return returns an Eclipse logger.
*/
public static ILog getEclipseLog()
{
IEnvironment environment = getEclipseConsoleEnvironment();
return environment.getLog();
}
/**
*
* @return returns an Eclipse scheme.
*/
public static IURIScheme getEclipseScheme()
{
IEnvironment environment = getEclipseConsoleEnvironment();
IURIScheme scheme = null;
try
{
scheme = environment.getURIFactory().newURIScheme( "platform" );
}
catch( URIException exc )
{
}
return scheme;
}
/**
*
* @return returns a File scheme.
*/
public static IURIScheme getFileScheme()
{
IEnvironment environment = getEclipseConsoleEnvironment();
IURIScheme scheme = null;
try
{
scheme = environment.getURIFactory().newURIScheme( "file" );
}
catch( URIException exc )
{
}
return scheme;
}
}