[logback-dev] svn commit: r1454 - in logbackPDE/trunk/plugins/ConsolePlugin: . src/main/java/ch/qos/logback/eclipse/dialog src/main/java/ch/qos/logback/eclipse/views

noreply.seb at qos.ch noreply.seb at qos.ch
Fri Mar 23 11:18:13 CET 2007


Author: seb
Date: Fri Mar 23 11:18:13 2007
New Revision: 1454

Modified:
   logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackPreferencesDialog.java
   logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
   logbackPDE/trunk/plugins/ConsolePlugin/todo.txt

Log:
Font name and size are now saved between sessions
Updated toto

Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackPreferencesDialog.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackPreferencesDialog.java	(original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackPreferencesDialog.java	Fri Mar 23 11:18:13 2007
@@ -5,11 +5,9 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;

Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java	(original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java	Fri Mar 23 11:18:13 2007
@@ -17,6 +17,7 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.SWTError;
 import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Menu;
@@ -50,11 +51,17 @@
  */
 
 public class LogbackView extends ViewPart {
+  
+  private static final String TAG_DISPLAY = "display";
+  private static final String TAG_FONTNAME = "fontName";
+  private static final String TAG_FONTSIZE = "fontSize";
 
   public static final String ID = "ch.qos.logback.eclipse.views.LogbackView";
 
   private TableViewer viewer;
   private TableColumn textColumn;
+  private Integer tmpFontSize = null;
+  private String tmpFontName = null;
 
   private LoggingEventContentProvider provider;
   private LoggingEventLabelProvider labelProvider;
@@ -107,6 +114,7 @@
     makeActions();
     contributeToActionBars();
     createContextMenu();
+    updateFont(tmpFontName, tmpFontSize);
   }
 
   private void contributeToActionBars() {
@@ -225,12 +233,26 @@
     EventFilter.saveState(memento);
     labelProvider.saveState(memento);
     server.saveState(memento);
+    IMemento mem = memento.createChild(TAG_DISPLAY);
+    FontData[] fd = viewer.getTable().getFont().getFontData();
+    mem.putString(TAG_FONTNAME, fd[0].getName());
+    mem.putInteger(TAG_FONTSIZE, fd[0].getHeight());
   }
 
   public void init(IViewSite site, IMemento memento) throws PartInitException {
     super.init(site, memento);
     this.memento = memento;
     initServer();
+    if (memento != null) {
+      IMemento mem = memento.getChild(TAG_DISPLAY);
+      if (mem == null)  {
+        return;
+      }
+      
+      tmpFontSize = mem.getInteger(TAG_FONTSIZE);
+      tmpFontName = mem.getString(TAG_FONTNAME);
+    }
+    
   }
 
   public Viewer getViewer() {
@@ -279,7 +301,11 @@
     return viewer.getTable().getFont();
   }
   
-  public void updateFont(String fontName, int fontSize) {
+  public void updateFont(String fontName, Integer fontSize) {
+    if (fontName == null || fontSize == null) {
+      return;
+    }
+    
     Font font = null;
     try {
       font = new Font(Display.getDefault(), fontName, fontSize, SWT.NORMAL);

Modified: logbackPDE/trunk/plugins/ConsolePlugin/todo.txt
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/todo.txt	(original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/todo.txt	Fri Mar 23 11:18:13 2007
@@ -5,6 +5,8 @@
 
 Change the image when the autoScroll button is pressed
 
+Click on the icon to display the stack trace
+
 DONE:
 Allow the user to choose Font and font size
 Stack traces with links



More information about the logback-dev mailing list