[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core ...

Marshall Culpepper mculpepper at jboss.com
Mon Nov 6 16:35:29 EST 2006


  User: mculpepper
  Date: 06/11/06 16:35:29

  Added:       core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core  
                        Trace.java PackagesCorePlugin.java
  Log:
  initial commit of the new "packages" tooling core plugin
  
  Revision  Changes    Path
  1.1      date: 2006/11/06 21:35:29;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/Trace.java
  
  Index: Trace.java
  ===================================================================
  package org.jboss.ide.eclipse.packages.core;
  
  import org.eclipse.core.runtime.Platform;
  
  public class Trace {
  
  	public static final String DEBUG_OPTION_ROOT = "org.jboss.ide.eclipse.packages.core/debug/";
  	public static final String DEBUG_OPTION_STREAM_CLOSE = DEBUG_OPTION_ROOT + "streamClose";
  	
  	public static boolean isDebugging(String option)
  	{
  		return PackagesCorePlugin.getDefault().isDebugging()
  			&& "true".equalsIgnoreCase(Platform.getDebugOption(option));
  	}
  	
  	public static void trace (Class caller, String message)
  	{
  		trace(caller, message, null);
  	}
  	
  	public static void trace (Class caller, String message, String option)
  	{
  		trace(caller, message, null, option);
  	}
  	
  	public static void trace (Class caller, Throwable t)
  	{
  		trace(caller, t, null);
  	}
  	
  	public static void trace (Class caller, Throwable t, String option)
  	{
  		trace(caller, t.getMessage(), t, option);
  	}
  	
  	public static void trace (Class caller, String message, Throwable t, String option)
  	{
  		if (!PackagesCorePlugin.getDefault().isDebugging())
  			return;
  
  		if (option != null) {
  			if (!isDebugging(option))
  				return;
  		}
  		
  		System.out.println("[" + caller.getSimpleName() + "] " + message);
  		
  		if (t != null)
  		{
  			t.printStackTrace();
  		}
  	}
  	
  }
  
  
  
  1.1      date: 2006/11/06 21:35:29;  author: mculpepper;  state: Exp;jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/PackagesCorePlugin.java
  
  Index: PackagesCorePlugin.java
  ===================================================================
  /*
   * JBoss, a division of Red Hat
   * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
  package org.jboss.ide.eclipse.packages.core;
  
  import org.eclipse.core.runtime.Plugin;
  import org.osgi.framework.BundleContext;
  
  /**
   * The activator class controls the plug-in life cycle
   */
  public class PackagesCorePlugin extends Plugin {
  
  	// The plug-in ID
  	public static final String PLUGIN_ID = "org.jboss.ide.eclipse.packages.core";
  
  	// The shared instance
  	private static PackagesCorePlugin plugin;
  	
  	/**
  	 * The constructor
  	 */
  	public PackagesCorePlugin() {
  		plugin = this;
  	}
  
  	/*
  	 * (non-Javadoc)
  	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
  	 */
  	public void start(BundleContext context) throws Exception {
  		super.start(context);
  	}
  
  	/*
  	 * (non-Javadoc)
  	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
  	 */
  	public void stop(BundleContext context) throws Exception {
  		plugin = null;
  		super.stop(context);
  	}
  
  	/**
  	 * Returns the shared instance
  	 *
  	 * @return the shared instance
  	 */
  	public static PackagesCorePlugin getDefault() {
  		return plugin;
  	}
  
  }
  
  
  



More information about the jboss-cvs-commits mailing list