directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r650057 - in /directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations: ./ META-INF/ lib/ src/main/java/org/apache/directory/studio/apacheds/experimentations/ src/main/resources/
Date Mon, 21 Apr 2008 09:00:49 GMT
Author: pamarcelot
Date: Mon Apr 21 02:00:41 2008
New Revision: 650057

URL: http://svn.apache.org/viewvc?rev=650057&view=rev
Log:
Added some code to write in a Console.
Created a StudioConsoleAppender which redirects log from the Log4J loggers to the Console.

Added:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/log4j-1.2.14.jar
  (with props)
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-api-1.4.3.jar
  (with props)
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-log4j12-1.4.3.jar
  (with props)
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/plugin.xml
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ConsoleDisplayMgr.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Perspective.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/StudioConsoleAppender.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/resources/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/resources/log4j.properties
Modified:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/.classpath
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/META-INF/MANIFEST.MF
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Activator.java

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/.classpath
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/.classpath?rev=650057&r1=650056&r2=650057&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/.classpath
(original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/.classpath
Mon Apr 21 02:00:41 2008
@@ -1,7 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
+	<classpathentry kind="lib" path="lib/slf4j-api-1.4.3.jar"/>
+	<classpathentry kind="lib" path="lib/slf4j-log4j12-1.4.3.jar"/>
 	<classpathentry kind="output" path="target"/>
 </classpath>

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/META-INF/MANIFEST.MF?rev=650057&r1=650056&r2=650057&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/META-INF/MANIFEST.MF
(original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/META-INF/MANIFEST.MF
Mon Apr 21 02:00:41 2008
@@ -1,12 +1,17 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: ApacheDS Plugin Experimentations Plug-in
-Bundle-SymbolicName: org.apache.directory.studio.apacheds.experimentations
+Bundle-SymbolicName: org.apache.directory.studio.apacheds.experimentations;singleton:=true
 Bundle-Version: 0.0.1
 Bundle-Activator: org.apache.directory.studio.apacheds.experimentations.Activator
 Bundle-Vendor: Apache Software Foundation
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.ui.console,
- org.eclipse.jface.text
+ org.eclipse.jface.text,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core
 Eclipse-LazyStart: true
+Bundle-ClassPath: lib/log4j-1.2.14.jar,
+ lib/slf4j-api-1.4.3.jar,
+ lib/slf4j-log4j12-1.4.3.jar

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/log4j-1.2.14.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/log4j-1.2.14.jar?rev=650057&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/log4j-1.2.14.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-api-1.4.3.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-api-1.4.3.jar?rev=650057&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-api-1.4.3.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-log4j12-1.4.3.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-log4j12-1.4.3.jar?rev=650057&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/lib/slf4j-log4j12-1.4.3.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/plugin.xml?rev=650057&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/plugin.xml
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/plugin.xml
Mon Apr 21 02:00:41 2008
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.perspectives">
+      <perspective
+            class="org.apache.directory.studio.apacheds.experimentations.Perspective"
+            id="org.apache.directory.studio.apacheds.experimentations.perspective"
+            name="ApacheDS Experimentations">
+      </perspective>
+   </extension>
+
+</plugin>

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Activator.java?rev=650057&r1=650056&r2=650057&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Activator.java
(original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Activator.java
Mon Apr 21 02:00:41 2008
@@ -1,50 +1,168 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
 package org.apache.directory.studio.apacheds.experimentations;
 
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
+
 /**
  * The activator class controls the plug-in life cycle
  */
-public class Activator extends AbstractUIPlugin {
-
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.apache.directory.studio.apacheds.experimentations";
+public class Activator extends AbstractUIPlugin
+{
 
-	// The shared instance
-	private static Activator plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public Activator() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 Activator getDefault() {
-		return plugin;
-	}
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.apache.directory.studio.apacheds.experimentations";
+    private static Logger logger = Logger.getLogger( Activator.class );
+
+    // The shared instance
+    private static Activator plugin;
+
+    private ConsoleDisplayMgr consoleDisplayMgr;
+
+
+    /**
+     * The constructor
+     */
+    public Activator()
+    {
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+        plugin = this;
+
+        // Configuring Log4J
+        PropertyConfigurator.configure( Platform.getBundle( PLUGIN_ID ).getResource( "log4j.properties"
) ); //$NON-NLS-1$
+        logger.info( "Entering Apache Directory Studio." ); //$NON-NLS-1$
+
+        // Testing the Console capabilities
+        consoleDisplayMgr = new ConsoleDisplayMgr( "Testing Console..." );
+
+        consoleDisplayMgr.println( "MSG_INFORMATION", ConsoleDisplayMgr.MSG_INFORMATION );
+        consoleDisplayMgr.println( "MSG_WARNING", ConsoleDisplayMgr.MSG_WARNING );
+        consoleDisplayMgr.println( "MSG_ERROR", ConsoleDisplayMgr.MSG_ERROR );
+
+        IVMInstallType[] types = JavaRuntime.getVMInstallTypes();
+        for ( int i = 0; i < types.length; i++ )
+        {
+            IVMInstallType type = types[i];
+            IVMInstall[] jres = type.getVMInstalls();
+            for ( IVMInstall vmInstall : jres )
+            {
+                consoleDisplayMgr.println( vmInstall.getId(), ConsoleDisplayMgr.MSG_INFORMATION
);
+                consoleDisplayMgr.println( vmInstall.getName(), ConsoleDisplayMgr.MSG_INFORMATION
);
+                consoleDisplayMgr
+                    .println( vmInstall.getInstallLocation().toString(), ConsoleDisplayMgr.MSG_INFORMATION
);
+                consoleDisplayMgr.println( vmInstall.getVMInstallType().toString(), ConsoleDisplayMgr.MSG_INFORMATION
);
+                consoleDisplayMgr.println( vmInstall.getVMRunner( ILaunchManager.RUN_MODE
).toString(),
+                    ConsoleDisplayMgr.MSG_INFORMATION );
+                System.out.println( vmInstall.getName() );
+            }
+        }
+
+        System.out.println( "*****************" );
+
+        IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
+        System.out.println( vmInstall.getId() );
+        System.out.println( vmInstall.getName() );
+        System.out.println( vmInstall.getInstallLocation() );
+        System.out.println( vmInstall.getVMArguments() );
+        System.out.println( vmInstall.getVMInstallType() );
+        System.out.println( vmInstall.getVMRunner( ILaunchManager.RUN_MODE ) );
+
+        Thread thread = new Thread()
+        {
+            Logger LOGGER = Logger.getLogger( "testLogger" );
+
+
+            @Override
+            public void run()
+            {
+                for ( int i = 0; i < 10; i++ )
+                {
+                    try
+                    {
+                        sleep( 2000 );
+                    }
+                    catch ( InterruptedException e )
+                    {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    }
+                    
+                    
+                    LOGGER.info( "INFO" );
+                    LOGGER.debug( "DEBUG" );
+                    LOGGER.warn( "WARN" );
+                    LOGGER.error( "ERROR" );
+                    LOGGER.fatal( "FATAL" );
+                }
+            }
+
+        };
+
+        thread.start();
+    }
+
+
+    public ConsoleDisplayMgr getConsoleDisplayMgr()
+    {
+        return consoleDisplayMgr;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 Activator getDefault()
+    {
+        return plugin;
+    }
 
 }

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ConsoleDisplayMgr.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ConsoleDisplayMgr.java?rev=650057&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ConsoleDisplayMgr.java
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ConsoleDisplayMgr.java
Mon Apr 21 02:00:41 2008
@@ -0,0 +1 @@
+/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor
license agreements.  See the NOTICE file
 *  distributed with this work for additional information
*  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache
License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
*  with the License.  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
*  
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed
under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language
governing permissions and limitations
 *  under the License. 
 *  
 */
package org.apache.directory.studio.apacheds.experimentations;

import
org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.IDocument;
impo
 rt org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPage;
import
org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import
org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
import
org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;

/**
 * Create an instance of this class in any of your plugin classes.
 * 
 * Use it as follows
...
 * 
 * ConsoleDisplayMgr.getDefault().println("Some error msg", ConsoleDisplayMgr.MSG_ERROR);
* ...
 * ...
 * ConsoleDisplayMgr.getDefault().clear();
 * ...  
 */
public class ConsoleDisplayMgr
{
private static ConsoleDisplayMgr fDefault = null;
	private String fTitle = null;
	private
MessageConsole fMessageConsole = null;
	
	public static final int MSG_INFORMATION = 1;
	public
static final int MSG_ERROR = 2;
	public static final in
 t MSG_WARNING = 3;
		
	public ConsoleDisplayMgr(String messageTitle)
	{		
		fDefault = this;
	fTitle = messageTitle;
	}
	
	public static ConsoleDisplayMgr getDefault() {
		return fDefault;
}	
		
	public void println(String msg, int msgKind)
	{		
		if( msg == null ) return;
		
	
/* if console-view in Java-perspective is not active, then show it and
		 * then display the
message in the console attached to it */		
		if( !displayConsoleView() )
		{
			/*If an exception
occurs while displaying in the console, then just diplay atleast the same in a message-box
*/
			MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Error", msg);
			return;
		}
		
		/* display message on console */	
		getNewMessageConsoleStream(msgKind).println(msg);
			
	}
	
	public void clear()
	{		
		IDocument document = getMessageConsole().getDocument();
	if (document != null) {
			document.set("");
		}			
	}	
		
	private boolean displayConsoleView()
{
		try
		{
			IW
 orkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		if( activeWorkbenchWindow != null )
			{
				IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
			if( activePage != null )
					activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW, null,
IWorkbenchPage.VIEW_VISIBLE);
			}
			
		} catch (PartInitException partEx) {			
			return
false;
		}
		
		return true;
	}
	
	private MessageConsoleStream getNewMessageConsoleStream(int
msgKind)
	{		
		int swtColorId = SWT.COLOR_DARK_GREEN;
		
		switch (msgKind)
		{
			case MSG_INFORMATION:
			swtColorId = SWT.COLOR_DARK_GREEN;				
				break;
			case MSG_ERROR:
				swtColorId = SWT.COLOR_DARK_MAGENTA;
			break;
			case MSG_WARNING:
				swtColorId = SWT.COLOR_DARK_BLUE;
				break;
			default:
			
		}	
		
		MessageConsoleStream msgConsoleStream = getMessageConsole().newMessageStream();
	
//		msgConsoleStream.setColor(Display.getCurrent().getSystemColor(swtColorId));
		return
ms
 gConsoleStream;
	}
	
	private MessageConsole getMessageConsole()
	{
		if( fMessageConsole
== null )
			createMessageConsoleStream(fTitle);	
		
		return fMessageConsole;
	}
		
	private
void createMessageConsoleStream(String title)
	{
		fMessageConsole = new MessageConsole(title,
null); 
		ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[]{ fMessageConsole
});
	}	
}
\ No newline at end of file

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Perspective.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Perspective.java?rev=650057&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Perspective.java
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Perspective.java
Mon Apr 21 02:00:41 2008
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.experimentations;
+
+
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.console.IConsoleConstants;
+
+
+public class Perspective implements IPerspectiveFactory
+{
+
+    public void createInitialLayout( IPageLayout layout )
+    {
+        String editorArea = layout.getEditorArea();
+
+        layout.addView( IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM, 0.66f, editorArea
);
+    }
+}

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/StudioConsoleAppender.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/StudioConsoleAppender.java?rev=650057&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/StudioConsoleAppender.java
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/StudioConsoleAppender.java
Mon Apr 21 02:00:41 2008
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.experimentations;
+
+
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.Level;
+import org.apache.log4j.spi.LoggingEvent;
+
+
+public class StudioConsoleAppender extends AppenderSkeleton
+{
+
+    /* (non-Javadoc)
+     * @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent)
+     */
+    @Override
+    protected void append( LoggingEvent event )
+    {
+        Level level = event.getLevel();
+        Object message = event.getMessage();
+
+        Activator.getDefault().getConsoleDisplayMgr().println( level + " " + message, ConsoleDisplayMgr.MSG_INFORMATION
);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.log4j.AppenderSkeleton#close()
+     */
+    @Override
+    public void close()
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.log4j.AppenderSkeleton#requiresLayout()
+     */
+    @Override
+    public boolean requiresLayout()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/resources/log4j.properties?rev=650057&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/resources/log4j.properties
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/resources/log4j.properties
Mon Apr 21 02:00:41 2008
@@ -0,0 +1,3 @@
+log4j.appender.mylog=org.apache.directory.studio.apacheds.experimentations.StudioConsoleAppender
+
+log4j.rootCategory=WARN, mylog
\ No newline at end of file



Mime
View raw message