[logback-dev] svn commit: r1342 - in logbackRCP/trunk/plugins/LogbackPlugin: . META-INF src/main/java/ch/qos/logback/eclipse/views

noreply.seb at qos.ch noreply.seb at qos.ch
Thu Feb 22 16:26:34 CET 2007


Author: seb
Date: Thu Feb 22 16:26:33 2007
New Revision: 1342

Modified:
   logbackRCP/trunk/plugins/LogbackPlugin/META-INF/MANIFEST.MF
   logbackRCP/trunk/plugins/LogbackPlugin/pom.xml
   logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
   logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LoggingEventLabelProvider.java

Log:
Changed plugin name to Console Plugin
Added a button to clear the console's content
Changed the default pattern to include logger information

Modified: logbackRCP/trunk/plugins/LogbackPlugin/META-INF/MANIFEST.MF
==============================================================================
--- logbackRCP/trunk/plugins/LogbackPlugin/META-INF/MANIFEST.MF	(original)
+++ logbackRCP/trunk/plugins/LogbackPlugin/META-INF/MANIFEST.MF	Thu Feb 22 16:26:33 2007
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
-Bundle-Name: Logback Plug-in
+Bundle-Name: Console Plug-in
 Bundle-SymbolicName: ch.qos.logback.eclipse; singleton:=true
 Bundle-Version: 1.0.0
 Bundle-ClassPath: logbackPlugin.jar,

Modified: logbackRCP/trunk/plugins/LogbackPlugin/pom.xml
==============================================================================
--- logbackRCP/trunk/plugins/LogbackPlugin/pom.xml	(original)
+++ logbackRCP/trunk/plugins/LogbackPlugin/pom.xml	Thu Feb 22 16:26:33 2007
@@ -5,7 +5,7 @@
   <modelVersion>4.0.0</modelVersion>
 
   <groupId>ch.qos.logback.eclipse</groupId>
-  <artifactId>LogbackPlugin</artifactId>
+  <artifactId>ConsolePlugin</artifactId>
   <packaging>zip</packaging>
   <name>Console Plugin for Eclipse</name>
   <version>1.0-SNAPSHOT</version>

Modified: logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
==============================================================================
--- logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java	(original)
+++ logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java	Thu Feb 22 16:26:33 2007
@@ -1,7 +1,12 @@
 package ch.qos.logback.eclipse.views;
 
+import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.console.MessageConsole;
 import org.eclipse.ui.console.TextConsoleViewer;
 import org.eclipse.ui.part.ViewPart;
@@ -23,56 +28,66 @@
   private MessageConsole myConsole;
   private LoggingEventContentProvider provider;
   private LoggingEventLabelProvider labelProvider;
-  
+  private Action clearConsoleAction;
+
   private static String PL_ACTION_MESSAGE = "PatternLayout...";
   private LogbackViewPatternAction patternLayoutAction;
-  
+
   public LogbackView() {
     launchSocketServer();
   }
-  
+
   public void createPartControl(Composite parent) {
-    
-    myConsole = new MessageConsole("My Console", null); 
-    myConsole.setWaterMarks(40000, 100000);
-    
+
+    myConsole = new MessageConsole("My Console", null);
+    myConsole.setWaterMarks(600000, 1000000);
+
     viewer = new TextConsoleViewer(parent, myConsole);
-    
+    viewer.setEditable(false);
+
     provider = new LoggingEventContentProvider();
     labelProvider = new LoggingEventLabelProvider();
     provider.setLabelProvider(labelProvider);
     provider.setConsole(myConsole);
-    
+
     LoggingEventManager.getManager().addLoggingEventManagerListener(provider);
-    
+
     makeActions();
-    //contributeToActionBars();
+    contributeToActionBars();
   }
 
-//  private void contributeToActionBars() {
-//    IActionBars bars = getViewSite().getActionBars();
-//    fillLocalToolBar(bars.getToolBarManager());
-//  }
-//
-//  private void fillLocalToolBar(IToolBarManager manager) {
-////    manager.add(action1);
-////    manager.add(action2);
-//  }
+  private void contributeToActionBars() {
+    IActionBars bars = getViewSite().getActionBars();
+    IToolBarManager manager = bars.getToolBarManager();
+    manager.add(clearConsoleAction);
+  }
 
   private void makeActions() {
-    patternLayoutAction = new LogbackViewPatternAction(viewer, labelProvider.getPatternLayout(), PL_ACTION_MESSAGE);
-//    action1.setText("Action 1");
-//    action1.setToolTipText("Action 1 tooltip");
-//    action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
-//        ISharedImages.IMG_OBJS_INFO_TSK));
-    
+    patternLayoutAction = new LogbackViewPatternAction(viewer, labelProvider.getPatternLayout(),
+        PL_ACTION_MESSAGE);
+
     IMenuManager menu = getViewSite().getActionBars().getMenuManager();
     menu.add(patternLayoutAction);
+
+    clearConsoleAction = new Action() {
+
+      @Override
+      public void run() {
+        super.run();
+        myConsole.clearConsole();
+      }
+    };
+    clearConsoleAction.setText("Clear console");
+    clearConsoleAction.setToolTipText("Clear the console");
+    clearConsoleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+        .getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+
   }
 
-//  private void showMessage(String message) {
-//    MessageDialog.openInformation(getSite().getShell(), "Logback View", message);
-//  }
+  // private void showMessage(String message) {
+  // MessageDialog.openInformation(getSite().getShell(), "Logback View",
+  // message);
+  // }
 
   private void launchSocketServer() {
     new Thread(new SimpleSocketServer()).start();

Modified: logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LoggingEventLabelProvider.java
==============================================================================
--- logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LoggingEventLabelProvider.java	(original)
+++ logbackRCP/trunk/plugins/LogbackPlugin/src/main/java/ch/qos/logback/eclipse/views/LoggingEventLabelProvider.java	Thu Feb 22 16:26:33 2007
@@ -15,7 +15,7 @@
  */
 class LoggingEventLabelProvider extends LabelProvider {
 
-  private static String DEFAULT_PATTERN = "%date %level [%thread] %message";
+  private static String DEFAULT_PATTERN = "%relative %level [%thread] %logger{25} %message";
   private LoggerContext context;
   private PatternLayout patternLayout;
 



More information about the logback-dev mailing list