[Title] logview refactoring #1
authorshingil.kang <shingil.kang@samsung.com>
Wed, 22 May 2013 23:08:25 +0000 (08:08 +0900)
committershingil.kang <shingil.kang@samsung.com>
Thu, 23 May 2013 13:26:59 +0000 (22:26 +0900)
[Desc.] separate filtering module from logtab, apply consistent code convention, fix keyword search algorithm, and so on
[Issue]

Change-Id: I63a9972134deecd140e432faadce566f2d6022c4

org.tizen.common.connection/plugin.xml
org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java
org.tizen.common.connection/src/org/tizen/common/connection/log/LogColors.java
org.tizen.common.connection/src/org/tizen/common/connection/log/LogFilter.java [new file with mode: 0644]
org.tizen.common.connection/src/org/tizen/common/connection/log/LogMessage.java [new file with mode: 0644]
org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java
org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java
org.tizen.common.connection/src/org/tizen/common/connection/log/LogUIMessages.java
org.tizen.common.connection/src/org/tizen/common/connection/log/LogView.java [moved from org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java with 88% similarity]

index 9477616..a99d817 100644 (file)
@@ -56,8 +56,8 @@
             name="%view.log"
             icon="icons/log/logview.gif"
             category="org.tizen.nativeapp.viewCategory"
-            class="org.tizen.common.connection.ui.LogView"
-            id="org.tizen.common.connection.ui.LogView"
+            class="org.tizen.common.connection.log.LogView"
+            id="org.tizen.common.connection.log.LogView"
             allowMultiple = "true">
       </view>
    </extension>
       <perspectiveExtension
             targetID="org.tizen.nativeapp.perspective">
          <view
-               id="org.tizen.common.connection.ui.LogView"
+               id="org.tizen.common.connection.log.LogView"
                ratio="1"
                relationship="stack"
                relative="org.eclipse.ui.views.TaskList">
          </view>
          <viewShortcut
-               id="org.tizen.common.connection.ui.LogView">
+               id="org.tizen.common.connection.log.LogView">
          </viewShortcut>
       </perspectiveExtension>
       <perspectiveExtension
             targetID="org.eclipse.debug.ui.DebugPerspective">
          <view
-               id="org.tizen.common.connection.ui.LogView"
+               id="org.tizen.common.connection.log.LogView"
                ratio="1"
                relationship="stack"
                relative="org.eclipse.ui.views.TaskList">
          </view>
          <viewShortcut
-               id="org.tizen.common.connection.ui.LogView">
+               id="org.tizen.common.connection.log.LogView">
          </viewShortcut>
       </perspectiveExtension>
    </extension>
index d44e1a3..549b020 100755 (executable)
@@ -108,9 +108,9 @@ public class AddViewDialog extends Dialog
             }
             device = tab.getDeviceSerialNumber();
 
-            pidKeyword = tab.getPidFilter();
-            tagKeyword = tab.getTagFilter();
-            msgKeyword = tab.getMsgFilter();
+            pidKeyword = tab.getLogFilter().getPidInput();
+            tagKeyword = tab.getLogFilter().getTagInput();
+            msgKeyword = tab.getLogFilter().getMsgInput();
 
             oldTab = tab;
         }
@@ -214,7 +214,8 @@ public class AddViewDialog extends Dialog
                         break;
                     }
                 }
-            } else
+            }
+            else
             {
                 dCombo.select(0);
                 device = dCombo.getItem(0);
@@ -292,8 +293,8 @@ public class AddViewDialog extends Dialog
                 }
 
                 bOk = true;
-                
-                if ( isEmpty( tabNameText.getText() ) )
+
+                if (isEmpty(tabNameText.getText()))
                 {
                     tabName = TEMPNAME + cnt++;
                 }
@@ -302,7 +303,7 @@ public class AddViewDialog extends Dialog
                     tabName = tabNameText.getText();
                 }
 
-                if ( isEmpty( tagText.getText() ) )
+                if (isEmpty(tagText.getText()))
                 {
                     tagKeyword = null;
                 }
@@ -311,7 +312,7 @@ public class AddViewDialog extends Dialog
                     tagKeyword = tagText.getText();
                 }
 
-                if ( isEmpty( pidText.getText() ) )
+                if (isEmpty(pidText.getText()))
                 {
                     pidKeyword = null;
                 }
@@ -320,7 +321,7 @@ public class AddViewDialog extends Dialog
                     pidKeyword = pidText.getText();
                 }
 
-                if ( isEmpty( msgText.getText() ) )
+                if (isEmpty(msgText.getText()))
                 {
                     msgKeyword = null;
                 }
index 4382d8d..c97407d 100644 (file)
@@ -20,7 +20,8 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Display;
 import org.tizen.common.util.SWTUtil;
 
-public class LogColors {
+public class LogColors
+{
     public Color fatalColor;
     public Color errorColor;
     public Color warningColor;
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogFilter.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogFilter.java
new file mode 100644 (file)
index 0000000..ec7f73f
--- /dev/null
@@ -0,0 +1,270 @@
+package org.tizen.common.connection.log;
+
+import org.tizen.common.util.StringUtil;
+
+public class LogFilter
+{
+    public static final int FILTER_NONE = -1;
+    public static final int FILTER_PID = 0;
+    public static final int FILTER_TAG = 1;
+    public static final int FILTER_MESSAGE = 2;
+    public static final int FILTER_LOG_LEVEL_ALL = 0x3F;
+
+    // log tab dialog keyword
+    private String pidInput;
+    private String tagInput;
+    private String msgInput;
+
+    // log tab dialog keyword filters
+    private String[] pidFilters;
+    private String[] tagFilters;
+    private String[] msgFilters;
+
+    // combo filter
+    private int comboFilter = FILTER_MESSAGE;
+
+    // keyword filter
+    private String keywordFilter = "";
+
+    // log level filter
+    private int logLevelFilter = FILTER_LOG_LEVEL_ALL;
+
+    public String getPidInput()
+    {
+        return pidInput;
+    }
+
+    public String getTagInput()
+    {
+        return tagInput;
+    }
+
+    public String getMsgInput()
+    {
+        return msgInput;
+    }
+
+    public String[] getPidFilters()
+    {
+        return pidFilters;
+    }
+
+    public String[] getTagFilters()
+    {
+        return pidFilters;
+    }
+
+    public String[] getMsgFilters()
+    {
+        return pidFilters;
+    }
+
+    public int getComboFilter()
+    {
+        return comboFilter;
+    }
+
+    public String getKeywordFilter()
+    {
+        return keywordFilter;
+    }
+
+    public int getLogLevelFilter()
+    {
+        return logLevelFilter;
+    }
+
+    public void setPidFilter(String pidInput)
+    {
+        this.pidInput = pidInput;
+        if (pidInput != null)
+        {
+            this.pidFilters = pidInput.split("[\\s,]", 0);
+        }
+        else
+        {
+            this.pidFilters = null;
+        }
+    }
+
+    public void setTagFilter(String tagInput)
+    {
+        this.tagInput = tagInput;
+        if (tagInput != null)
+        {
+            this.tagFilters = tagInput.split("[\\s,]", 0);
+        }
+        else
+        {
+            this.tagFilters = null;
+        }
+    }
+
+    public void setMsgFilter(String msgInput)
+    {
+        this.msgInput = msgInput;
+        if (msgInput != null)
+        {
+            this.msgFilters = msgInput.split("[\\s,]", 0);
+        }
+        else
+        {
+            this.msgFilters = null;
+        }
+    }
+
+    public void setComboFilter(int comboFilter)
+    {
+        this.comboFilter = comboFilter;
+    }
+
+    public void setKeywordFilter(String keywordFilter)
+    {
+        this.keywordFilter = keywordFilter;
+    }
+
+    public void setLogLevelFilter(int logLevelFilter)
+    {
+        this.logLevelFilter = logLevelFilter;
+    }
+
+    /**
+     * Filter with AddTab/EditTab dialog keyword
+     *
+     * @param logMessage
+     * @return
+     */
+    public boolean filteredByDefaultKeyword(LogMessage logMessage)
+    {
+        if (logMessage == null)
+        {
+            return false;
+        }
+
+        if (pidFilters != null || tagFilters != null || msgFilters != null)
+        {
+            if (pidFilters != null)
+            {
+                for (String filter : pidFilters)
+                {
+                    if (!logMessage.data.pidString.contains(filter))
+                    {
+                        return false;
+                    }
+                }
+            }
+
+            if (tagFilters != null)
+            {
+                for (String filter : tagFilters)
+                {
+                    if (!logMessage.data.tag.toLowerCase().contains(filter.toLowerCase()))
+                    {
+                        return false;
+                    }
+                }
+            }
+
+            if (msgFilters != null)
+            {
+                for (String filter : msgFilters)
+                {
+                    if (!logMessage.msg.toLowerCase().contains(filter.toLowerCase()))
+                    {
+                        return false;
+                    }
+                }
+            }
+            return true;
+        }
+        return true;
+    }
+
+    /**
+     * Filter with log level
+     *
+     * @param logMessage
+     * @return
+     */
+    public boolean filteredByLoglevel(LogMessage logMessage)
+    {
+        if (logMessage == null)
+        {
+            return false;
+        }
+
+        if (logLevelFilter != FILTER_LOG_LEVEL_ALL)
+        {
+            int a = 0;
+            a = (logLevelFilter & (0x1 << (logMessage.data.logLevel.ordinal())));
+
+            if (a == 0)
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Filter with keyword
+     *
+     * @param logMessage
+     * @return
+     */
+    public boolean filteredByKeyword(LogMessage logMessage)
+    {
+        if (logMessage == null)
+        {
+            return false;
+        }
+
+        if (StringUtil.isEmpty(keywordFilter))
+        {
+            return true;
+        }
+
+        String msg = null;
+        String filter = keywordFilter.toLowerCase();
+
+        switch (comboFilter) {
+        case FILTER_PID:
+            msg = logMessage.data.pidString;
+            break;
+
+        case FILTER_TAG:
+            msg = logMessage.data.tag.toLowerCase();
+            break;
+
+        case FILTER_MESSAGE:
+            msg = logMessage.msg.toLowerCase();
+            break;
+
+        default:
+            return false;
+        }
+
+        if (msg.contains(filter))
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    /**
+     * Filter with log level and keyword
+     *
+     * @param logMessage
+     * @return
+     */
+    public boolean filteredByLogLevelAndKeyword(LogMessage logMessage)
+    {
+        if (filteredByLoglevel(logMessage) && filteredByKeyword(logMessage))
+            return true;
+        else
+            return false;
+    }
+}
\ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogMessage.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogMessage.java
new file mode 100644 (file)
index 0000000..96fd7f9
--- /dev/null
@@ -0,0 +1,26 @@
+package org.tizen.common.connection.log;
+
+import org.tizen.sdblib.util.LogLevel;
+
+/** message data, separated from content for multi line messages */
+public class LogMessage
+{
+    public LogMessageInfo data;
+    public String msg;
+
+    @Override
+    public String toString()
+    {
+        return data.time + " : " + data.logLevel + " / " + data.tag + " ( " + data.pidString + " : " + data.tidString + " ) : " + msg;
+    }
+}
+
+/** message data, separated from content for multi line messages */
+class LogMessageInfo
+{
+    public LogLevel logLevel;
+    public String pidString;
+    public String tidString;
+    public String tag;
+    public String time;
+}
\ No newline at end of file
index ba0341f..fa97f79 100755 (executable)
@@ -67,7 +67,6 @@ import org.tizen.common.connection.ConnectionPlugin;
 import org.tizen.common.connection.ddmuilib.FileDialogUtils;
 import org.tizen.common.connection.ddmuilib.ITableFocusListener;
 import org.tizen.common.connection.ddmuilib.ITableFocusListener.IFocusedTableActivator;
-import org.tizen.common.connection.ddmuilib.Panel;
 import org.tizen.common.connection.explorer.ConnectionExplorerLabelProvider;
 import org.tizen.common.connection.preference.TizenLogPreferencePage;
 import org.tizen.common.util.DialogUtil;
@@ -80,28 +79,27 @@ import org.tizen.sdblib.SmartDevelopmentBridge;
 import org.tizen.sdblib.IDeviceChangeListener;
 import org.tizen.sdblib.util.LogLevel;
 
-public class LogPanel extends Panel implements IDeviceChangeListener
+public class LogPanel implements IDeviceChangeListener
 {
 
-    //Nothing enabled
+    // Nothing enabled
     public static final int NO_TAB = 0;
-    //Only remove disabled
+    // Only remove disabled
     public static final int DEVICE_TAB = 1;
-    //Everything enabled
+    // Everything enabled
     public static final int ADDITIONAL_TAB = 2;
-    //Only add, edit disabled
+    // Only add, edit disabled
     public static final int DISCONNECTED_TAB = 3;
-    
+
     private final int ENABLE_ADD = 0x0000001;
     private final int ENABLE_REMOVE = 0x0000010;
-    private final int ENABLE_EDIT = 0x0000100; 
+    private final int ENABLE_EDIT = 0x0000100;
     private final int ENABLE_SCROLL_LOCK = 0x0001000;
     private final int ENABLE_EXPORT = 0x0010000;
     private final int ENABLE_CLEAR = 0x0100000;
     private final int ENABLE_LEVEL = 0x1000000;
 
-    private final int[] ENABLE_VIEW_ACTIONS= { ENABLE_ADD, ENABLE_REMOVE, ENABLE_EDIT, 
-            ENABLE_SCROLL_LOCK, ENABLE_EXPORT, ENABLE_CLEAR};
+    private final int[] ENABLE_VIEW_ACTIONS = { ENABLE_ADD, ENABLE_REMOVE, ENABLE_EDIT, ENABLE_SCROLL_LOCK, ENABLE_EXPORT, ENABLE_CLEAR };
 
     private String defaultLogSave;
 
@@ -112,40 +110,15 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     private Action[] levelActions;
     private Action[] viewActions;
-    
+
     private IActionBars actionBars;
 
     private StackLayout stackLayout;
 
     public static List<LogTab> logTabList = new ArrayList<LogTab>();
 
-    /** message data, separated from content for multi line messages */
-    protected static class LogMessageInfo
-    {
-        public LogLevel logLevel;
-        public String pidString;
-        public String tidString;
-        public String tag;
-        public String time;
-    }
-
     private ITableFocusListener globalListener;
 
-    /** message data, separated from content for multi line messages */
-    protected static class LogMessage
-    {
-        public LogMessageInfo data;
-        public String msg;
-
-        @Override
-        public String toString()
-        {
-            return data.time + " : " + data.logLevel + " / " + data.tag + " ( " + data.pidString 
-                       + " : " + data.tidString + " ) : " + msg;
-            
-        }
-    }
-
     /**
      * Create the log panel with some default parameters
      *
@@ -168,7 +141,6 @@ public class LogPanel extends Panel implements IDeviceChangeListener
      * Creates a control capable of displaying some information. This is called
      * once, when the application is initializing, from the UI thread.
      */
-    @Override
     protected Control createControl(Composite p)
     {
         parent = p;
@@ -176,7 +148,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         // create the tab folder
         tabFolder = new TabFolder(parent, SWT.NONE);
         tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
-        //use stack layout
+        // use stack layout
         stackLayout = new StackLayout();
         tabFolder.setLayout(stackLayout);
         tabFolder.addSelectionListener(new SelectionAdapter()
@@ -192,51 +164,38 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         return null;
     }
 
-    @Override
-    protected void postCreation()
-    {
-    }
-
-    /**
-     * Sets the focus to the proper object.
-     */
-    @Override
-    public void setFocus()
-    {
-    }
-
     /**
      * do something when select TabItem
      */
     private void selectTabItem()
     {
         int index = tabFolder.getSelectionIndex();
-        if(index == -1)
+        if (index == -1)
         {
-            return ;
+            return;
         }
         TabItem item = tabFolder.getItem(index);
         LogTab logTab = getSelectionLogTab();
-        if(logTab == null)
+        if (logTab == null)
         {
-            return ;
+            return;
         }
 
         setEnableAndCheckState(logTab);
         stackLayout.topControl = item.getControl();
     }
 
-
     /**
-     * Set action enable state depending on a logTab type.
-     * And then set check state.
+     * Set action enable state depending on a logTab type. And then set check
+     * state.
+     *
      * @param logTab
      */
     private void setEnableAndCheckState(LogTab logTab)
     {
         String serial = logTab.getDeviceSerialNumber();
-        //if device is disconnected, only remove enabled.
-        if(serial == null)
+        // if device is disconnected, only remove enabled.
+        if (serial == null)
         {
             setEnableState(LogPanel.DISCONNECTED_TAB, logTab);
         }
@@ -256,8 +215,11 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     /**
      * When user selects level icons, update level value and filter messages.
-     * @param level level type(Debug, Info, Error..)
-     * @param beChecked is Checked or not
+     *
+     * @param level
+     *            level type(Debug, Info, Error..)
+     * @param beChecked
+     *            is Checked or not
      */
     public void changeLogLevelAndFilterMessages(int level, boolean beChecked)
     {
@@ -268,8 +230,8 @@ public class LogPanel extends Panel implements IDeviceChangeListener
     private void updateLevelMode(int level, boolean setCheck)
     {
         level = (int) Math.pow(2, level);
-        int levelMode = getSelectionLogTab().getLevelMode();
-        
+        int levelMode = getSelectionLogTab().getLogFilter().getLogLevelFilter();
+
         if (setCheck)
         {
             levelMode |= level;
@@ -278,24 +240,27 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         {
             levelMode &= (~level);
         }
-        getSelectionLogTab().setLevelMode(levelMode);
+        getSelectionLogTab().getLogFilter().setLogLevelFilter(levelMode);
     }
 
     /**
-     * Create LogTab and TabItem and
-     * set action and icon status
-     * @param device IDevice to get logs
-     * @param name logtab name
-     * @param isDefault check this is default logtab for device
+     * Create LogTab and TabItem and set action and icon status
+     *
+     * @param device
+     *            IDevice to get logs
+     * @param name
+     *            logtab name
+     * @param isDefault
+     *            check this is default logtab for device
      * @return
      */
     private LogTab createLogTab(String name, IDevice device, boolean isDefault)
     {
         Iterator<LogTab> iter = logTabList.iterator();
-        whileiter.hasNext())
+        while (iter.hasNext())
         {
             LogTab oldTab = iter.next();
-            if(oldTab.getLogTabName().equals(name))
+            if (oldTab.getLogTabName().equals(name))
             {
                 removeTab(oldTab);
                 iter.remove();
@@ -306,12 +271,13 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
         logTabList.add(logTab);
         createTabItem(tabFolder, logTab);
-        
+
         if (isDefault)
         {
             logTab.setDefault();
             setEnableState(LogPanel.DEVICE_TAB, null);
-        } else
+        }
+        else
         {
             setEnableState(LogPanel.ADDITIONAL_TAB, null);
         }
@@ -322,6 +288,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     /**
      * create TabItem and set to LogTab
+     *
      * @param tabFolder
      * @param logTab
      * @return
@@ -342,22 +309,25 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         table.setHeaderVisible(true);
         table.setLinesVisible(true);
 
-        table.addSelectionListener(new SelectionListener(){
+        table.addSelectionListener(new SelectionListener()
+        {
 
             @Override
             public void widgetSelected(SelectionEvent e)
             {
-                String msg = ((LogMessage)e.item.getData()).msg;
-                if(msg == null)
-                    return ;
+                String msg = ((LogMessage) e.item.getData()).msg;
+                if (msg == null)
+                    return;
                 IStatusLineManager statusLineManager = actionBars.getStatusLineManager();
-                if( statusLineManager == null )
-                    return ;
-                statusLineManager.setMessage( msg );
+                if (statusLineManager == null)
+                    return;
+                statusLineManager.setMessage(msg);
             }
+
             @Override
             public void widgetDefaultSelected(SelectionEvent e)
-            {}
+            {
+            }
         });
         if (globalListener != null)
         {
@@ -571,7 +541,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
             if (checkFile.exists())
             {
                 int ret = FileDialogUtils.allowFileOverwrite(fileName);
-                ifret == IDialogConstants.CANCEL_ID)
+                if (ret == IDialogConstants.CANCEL_ID)
                 {
                     again = true;
                 }
@@ -598,8 +568,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         } catch (IOException e)
         {
             return false;
-        } finally {
-               IOUtil.tryClose(writer);
+        } finally
+        {
+            IOUtil.tryClose(writer);
         }
 
         return true;
@@ -611,19 +582,20 @@ public class LogPanel extends Panel implements IDeviceChangeListener
     public void clear()
     {
         LogTab tab = getSelectionLogTab();
-        if ( tab != null)
+        if (tab != null)
         {
             tab.clear();
         }
     }
 
     /**
-     * check whether device is still connected or not
-     * then notify with dialog
+     * check whether device is still connected or not then notify with dialog
      *
-     * @param tab target to check device connection
-     * @param title dialog title
-     * @return  if device is disconnected, return false
+     * @param tab
+     *            target to check device connection
+     * @param title
+     *            dialog title
+     * @return if device is disconnected, return false
      */
     private boolean checkTabConnection(LogTab tab, String title)
     {
@@ -671,16 +643,17 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
                     LogTab newTab = createLogTab(dlg.getName(), device, false);
                     // set filter values from addViewDialog
-                    newTab.setPidFilter(dlg.getPidKeyword());
-                    newTab.setTagFilter(dlg.getTagKeyword());
-                    newTab.setMsgFilter(dlg.getMsgKeyword());
+                    newTab.getLogFilter().setPidFilter(dlg.getPidKeyword());
+                    newTab.getLogFilter().setTagFilter(dlg.getTagKeyword());
+                    newTab.getLogFilter().setMsgFilter(dlg.getMsgKeyword());
 
                     newTab.start();
 
                     break;
                 }
             }
-        } else
+        }
+        else
         {
             return;
         }
@@ -705,7 +678,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
         LogTab tab = logTabList.get(index);
         removeTab(tab);
         logTabList.remove(tab);
-        if(logTabList.isEmpty())
+        if (logTabList.isEmpty())
         {
             setEnableState(NO_TAB, null);
         }
@@ -753,9 +726,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
                         }
                     }
 
-                    oldTab.setPidFilter(dlg.getPidKeyword());
-                    oldTab.setTagFilter(dlg.getTagKeyword());
-                    oldTab.setMsgFilter(dlg.getMsgKeyword());
+                    oldTab.getLogFilter().setPidFilter(dlg.getPidKeyword());
+                    oldTab.getLogFilter().setTagFilter(dlg.getTagKeyword());
+                    oldTab.getLogFilter().setMsgFilter(dlg.getMsgKeyword());
 
                     oldTab.start();
 
@@ -767,10 +740,15 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     /**
      * Create table column has width as same as sample text length
-     * @param parent table
-     * @param header column header text
-     * @param style column style
-     * @param sampleText sample text to measure column width
+     *
+     * @param parent
+     *            table
+     * @param header
+     *            column header text
+     * @param style
+     *            column style
+     * @param sampleText
+     *            sample text to measure column width
      * @return
      */
     public static TableColumn createTableColumn(Table parent, String header, int style, String sampleText)
@@ -791,6 +769,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     /**
      * get selected logtab from tabitem on folder
+     *
      * @return
      */
     public LogTab getSelectionLogTab()
@@ -800,9 +779,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
             int index = tabFolder.getSelectionIndex();
             TabItem item = tabFolder.getItem(index);
 
-            for(LogTab logTab : logTabList)
+            for (LogTab logTab : logTabList)
             {
-                if(logTab.getTabItem() == item)
+                if (logTab.getTabItem() == item)
                 {
                     return logTab;
                 }
@@ -824,7 +803,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
     {
         IDevice[] devices;
         SmartDevelopmentBridge sdbBridge = SmartDevelopmentBridge.getBridge();
-        if(sdbBridge != null)
+        if (sdbBridge != null)
         {
             devices = sdbBridge.getDevices();
         }
@@ -862,16 +841,17 @@ public class LogPanel extends Panel implements IDeviceChangeListener
                         String title = LogUIMessages.Log_Title_View_Device_Disconnected;
                         String message = String.format(LogUIMessages.Log_Message_View_Device_Disconnected, name, name);
                         NotifierDialog.notify(title, message, NotificationType.DISCONNECTED);
-                        forLogTab tab : logTabList)
+                        for (LogTab tab : logTabList)
                         {
-                            if(device.getSerialNumber().equals(tab.getDeviceSerialNumber()))
+                            if (device.getSerialNumber().equals(tab.getDeviceSerialNumber()))
                             {
                                 tab.setDevice(null);
                             }
                         }
                         setEnableState(LogPanel.DISCONNECTED_TAB, null);
 
-                    } else
+                    }
+                    else
                     {
                         SmartDevelopmentBridge.removeDeviceChangeListener(LogPanel.this);
                     }
@@ -897,7 +877,8 @@ public class LogPanel extends Panel implements IDeviceChangeListener
                         {
                             LogTab tab = createLogTab(ConnectionExplorerLabelProvider.getDeviceSerialWithName(device), device, true);
                             tab.start();
-                        } else
+                        }
+                        else
                         {
                             SmartDevelopmentBridge.removeDeviceChangeListener(LogPanel.this);
                         }
@@ -909,6 +890,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     /**
      * Get enabled state for each action with state value.
+     *
      * @param state
      * @param action
      * @return
@@ -921,23 +903,26 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     /**
      * Change actions enabled state
-     * @param state action enabled state
-     * @param oldTab if old tab is not null, re-set oldtab's enable state
+     *
+     * @param state
+     *            action enabled state
+     * @param oldTab
+     *            if old tab is not null, re-set oldtab's enable state
      */
     private void changeEnableState(int state, LogTab oldTab)
     {
-        for(int i = 0; i < viewActions.length; i++)
+        for (int i = 0; i < viewActions.length; i++)
         {
             viewActions[i].setEnabled(getEnabled(state, ENABLE_VIEW_ACTIONS[i]));
         }
 
         boolean check = getEnabled(state, ENABLE_LEVEL);
-        boolean[] bEnable = {false, false, false, false, false, false};
-        //if level is enabled,
-        if(check)
+        boolean[] bEnable = { false, false, false, false, false, false };
+        // if level is enabled,
+        if (check)
         {
             LogLevel level = null;
-            if(oldTab == null)
+            if (oldTab == null)
             {
                 level = LogLevel.getByName(ConnectionPlugin.getDefault().getPreferenceStore().getString(TizenLogPreferencePage.KEY_DEFAULT_LEVEL));
             }
@@ -945,18 +930,18 @@ public class LogPanel extends Panel implements IDeviceChangeListener
             {
                 level = oldTab.getLogLevel();
             }
-            
-            for(int i = level.ordinal(); i < bEnable.length; i++)
+
+            for (int i = level.ordinal(); i < bEnable.length; i++)
             {
                 bEnable[i] = true;
-                if(oldTab == null)
+                if (oldTab == null)
                 {
                     updateLevelMode(i, true);
                 }
             }
         }
 
-        for(int i = 0; i < levelActions.length; i++)
+        for (int i = 0; i < levelActions.length; i++)
         {
             levelActions[i].setEnabled(bEnable[i]);
         }
@@ -968,17 +953,17 @@ public class LogPanel extends Panel implements IDeviceChangeListener
      */
     private void setCheckState(LogTab tab)
     {
-        int levelMode = tab.getLevelMode();
+        int levelMode = tab.getLogFilter().getLogLevelFilter();
         for (int i = 0; i < levelActions.length; i++)
         {
             int a = levelMode & (0x1 << i);
             levelActions[i].setChecked(a == (int) Math.pow(2, i));
         }
 
-        //Scroll lock action is toggle action
+        // Scroll lock action is toggle action
         viewActions[3].setChecked(tab.getScrollLock());
     }
-    
+
     /**
      * Get enabled state for action depending on a logTab type.
      */
@@ -1007,8 +992,9 @@ public class LogPanel extends Panel implements IDeviceChangeListener
     }
 
     /**
-     * Set enabled state for action depending on a logTab type 
-     * (NO_TAB, DEVICE_TAB, ADDITIONAL_TAB).
+     * Set enabled state for action depending on a logTab type (NO_TAB,
+     * DEVICE_TAB, ADDITIONAL_TAB).
+     *
      * @param tabType
      */
     public void setEnableState(int tabType, LogTab tab)
@@ -1019,6 +1005,7 @@ public class LogPanel extends Panel implements IDeviceChangeListener
 
     /**
      * Set scroll locked or unlocked.
+     *
      * @param lock
      */
     public void setScrollLock(boolean lock)
index bf527ec..c25d74b 100755 (executable)
@@ -40,11 +40,10 @@ import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableItem;
 import org.tizen.common.TizenPlatformConstants;
 import org.tizen.common.connection.ConnectionPlugin;
-import org.tizen.common.connection.log.LogPanel.LogMessage;
-import org.tizen.common.connection.log.LogPanel.LogMessageInfo;
 import org.tizen.common.connection.preference.TizenLogPreferencePage;
+import org.tizen.common.connection.log.LogMessage;
+import org.tizen.common.connection.log.LogFilter;
 import org.tizen.common.ui.view.console.AnsicodeAdapter;
-import org.tizen.common.util.StringUtil;
 import org.tizen.common.util.log.Logger;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.receiver.MultiLineReceiver;
@@ -55,27 +54,7 @@ public class LogTab
 
     private static final int STRING_BUFFER_LENGTH = 5000;
 
-    public static final int FILTER_NONE = -1;
-    public static final int FILTER_PID = 0;
-    public static final int FILTER_TAG = 1;
-    public static final int FILTER_MESSAGE = 2;
-
-    public static final int LEVEL_ALL = 0x3F;
-    private int levelMode;
     private LogLevel defaultLevel;
-    
-    //words to filter
-    private String[] pidFilters = null;
-    private String[] tagFilters = null;
-    private String[] msgFilters = null;
-
-    //need to show previous input value when tab dialog is opened
-    private String pidInput = null;
-    private String tagInput = null;
-    private String msgInput = null;
-
-    private int filterCombo = FILTER_MESSAGE;
-    private String filterText = "";
 
     private String logTabName = null;
     private IDevice device = null;
@@ -87,26 +66,32 @@ public class LogTab
 
     private boolean isScrollLocked;
 
-    private static Pattern logPattern = Pattern.compile("^\\[\\s(\\d\\d-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d\\.\\d+)"
-    + "\\s+(\\d*):\\s*(\\d+)\\s([VDIWEF])/(.+)\\s+\\]$");
+    private static Pattern logPattern = Pattern.compile("^\\[\\s(\\d\\d-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d\\.\\d+)" + "\\s+(\\d*):\\s*(\\d+)\\s([VDIWEF])/(.+)\\s+\\]$");
 
-    //Array to keep all messages from device
+    // Array to keep all messages from device
     private final LogMessage[] allMessages = new LogMessage[STRING_BUFFER_LENGTH];
 
-    //List about filtered messages with pidFilters, tagFilters, msgFilters
+    // List about filtered messages with pidFilters, tagFilters, msgFilters
     private final List<LogMessage> filteredMessages = new ArrayList<LogMessage>();
 
-    //List about messages need to added table contents
+    // List about messages need to added table contents
     private final List<LogMessage> newMessages = new ArrayList<LogMessage>();
 
     private LogMessageInfo lastMessageInfo = null;
 
     private boolean isDefault = false;
 
-    //index for allMessages
+    // index for allMessages
     private int indexStart = -1;
     private int indexEnd = -1;
 
+    private LogFilter logFilter = new LogFilter();
+
+    public LogFilter getLogFilter()
+    {
+        return logFilter;
+    }
+
     public LogTab(String pName, IDevice pDevice, LogColors pColors)
     {
         logTabName = pName;
@@ -126,6 +111,7 @@ public class LogTab
 
     /**
      * Get logTab name
+     *
      * @return String
      */
     public String getLogTabName()
@@ -133,83 +119,6 @@ public class LogTab
         return logTabName;
     }
 
-    public void setPidFilter(String pid)
-    {
-        pidInput = pid;
-        if (pid != null)
-        {
-            pidFilters = setFilter(pid.split("[\\s\t,]"));
-        }
-        else
-        {
-            pidFilters = null;
-        }
-    }
-
-    public void setTagFilter(String tag)
-    {
-        tagInput = tag;
-        if (tag != null)
-        {
-            tagFilters = setFilter(tag.split("[\\s\t,]"));
-        }
-        else
-        {
-            tagFilters = null;
-        }
-    }
-
-    public void setMsgFilter(String msg)
-    {
-        msgInput = msg;
-        if (msg != null)
-        {
-            msgFilters = setFilter(msg.split("[\\s\t,]"));
-        }
-        else
-        {
-            msgFilters = null;
-        }
-    }
-
-    private String[] setFilter(String[] array)
-    {
-        ArrayList<String> result = new ArrayList<String>();
-        for (String s : array)
-        {
-            if (s.length() > 0)
-            {
-                result.add(s);
-            }
-        }
-        return result.toArray(new String[(result.size())]);
-    }
-
-    public void setLevelMode(int level)
-    {
-        levelMode = level;
-    }
-
-    public int getLevelMode()
-    {
-        return levelMode;
-    }
-
-    public String getPidFilter()
-    {
-        return pidInput;
-    }
-
-    public String getTagFilter()
-    {
-        return tagInput;
-    }
-
-    public String getMsgFilter()
-    {
-        return msgInput;
-    }
-
     public String getDeviceSerialNumber()
     {
         if (device != null)
@@ -221,7 +130,7 @@ public class LogTab
             return null;
         }
     }
-    
+
     public LogLevel getLogLevel()
     {
         return defaultLevel;
@@ -251,7 +160,7 @@ public class LogTab
     {
         return table;
     }
-    
+
     public void start()
     {
         LogLevel level = LogLevel.getByName(ConnectionPlugin.getDefault().getPreferenceStore().getString(TizenLogPreferencePage.KEY_DEFAULT_LEVEL));
@@ -316,9 +225,11 @@ public class LogTab
     }
 
     /**
-     * Stop current logger and start with new level
-     * It can be lost some log messages in time interval between stop and restart 
-     * @param level start logger with level
+     * Stop current logger and start with new level It can be lost some log
+     * messages in time interval between stop and restart
+     *
+     * @param level
+     *            start logger with level
      */
     public void restart(LogLevel level)
     {
@@ -343,12 +254,12 @@ public class LogTab
                 }
             }
 
-            boolean isValid = filteredByFilterString(newMessage);
+            boolean isValid = logFilter.filteredByDefaultKeyword(newMessage);
 
             if (isValid)
             {
                 filteredMessages.add(newMessage);
-                if(filteredByIconAndText(newMessage))
+                if (logFilter.filteredByLogLevelAndKeyword(newMessage))
                 {
                     newMessages.add(newMessage);
                 }
@@ -361,156 +272,24 @@ public class LogTab
      */
     public void filterMessages()
     {
-        //1. remove table contents
+        // 1. remove table contents
         initialize();
-        //2. filtering
+        // 2. filtering
         synchronized (filteredMessages)
         {
             for (LogMessage logMsg : filteredMessages)
             {
-                if (filteredByIconAndText(logMsg))
+                if (logFilter.filteredByLogLevelAndKeyword(logMsg))
                 {
                     newMessages.add(logMsg);
                 }
             }
-            //3. refill new messages
+            // 3. refill new messages
             flush();
         }
     }
 
     /**
-     * Filter with tab dialog(AddTab, EditTab) input value
-     * @param logMessage
-     * @return
-     */
-    private boolean filteredByFilterString(LogMessage logMessage)
-    {
-        if (logMessage == null)
-        {
-            return false;
-        }
-        if (pidFilters != null || tagFilters != null || msgFilters != null)
-        {
-            if (pidFilters != null)
-            {
-                for (String filter : pidFilters)
-                {
-                    if (logMessage.data.pidString.contains(filter))
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            if (tagFilters != null)
-            {
-                for (String filter : tagFilters)
-                {
-                    if (logMessage.data.tag.toLowerCase().contains(filter.toLowerCase()))
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            if (msgFilters != null)
-            {
-                for (String filter : msgFilters)
-                {
-                    if (logMessage.msg.toLowerCase().contains(filter.toLowerCase()))
-                    {
-                        return true;
-                    }
-                }
-            }
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Filter with level icon on LogView toolbar
-     * @param logMessage
-     * @return
-     */
-    boolean filteredByIconAndText(LogMessage logMessage)
-    {
-        if (logMessage == null)
-        {
-            return false;
-        }
-
-        if (levelMode != LEVEL_ALL)
-        {
-            int a = 0;
-            a = (levelMode & (0x1 << (logMessage.data.logLevel.ordinal())));
-
-            if (a == 0)
-            {
-                return false;
-            }
-        }
-
-        if (filteredByText(logMessage))
-        {
-            return true;
-        }
-        else
-        {
-            return false;
-        }
-    }
-
-    /**
-     * Filter with text and combo input from TabItem bottom
-     * @param logMessage
-     * @return
-     */
-    boolean filteredByText(LogMessage logMessage)
-    {
-        if (logMessage == null)
-        {
-            return false;
-        }
-
-        if (StringUtil.isEmpty(filterText))
-        {
-            return true;
-        }
-
-        String msg = null;
-        String filter = filterText.toLowerCase();
-
-        switch (filterCombo)
-        {
-            case FILTER_PID:
-                msg = logMessage.data.pidString;
-                break;
-    
-            case FILTER_TAG:
-                msg = logMessage.data.tag.toLowerCase();
-                break;
-    
-            case FILTER_MESSAGE:
-                msg = logMessage.msg.toLowerCase();
-                break;
-    
-            default:
-                return false;
-        }
-
-        if( msg.contains(filter))
-        {
-            return true;
-        }
-        else
-        {
-            return false;
-        }
-    }
-
-    /**
      * flush valid messages to table and remove
      */
     public void flush()
@@ -522,10 +301,10 @@ public class LogTab
         try
         {
             int totalCount = table.getItemCount() + newCount;
-            if(totalCount > STRING_BUFFER_LENGTH)
+            if (totalCount > STRING_BUFFER_LENGTH)
             {
                 int removeCount = totalCount - STRING_BUFFER_LENGTH;
-                //remove over than STRING_BUFFER_LENGTH
+                // remove over than STRING_BUFFER_LENGTH
                 for (int i = 0; i < removeCount && table.getItemCount() > 0; i++)
                 {
                     table.remove(0);
@@ -542,11 +321,11 @@ public class LogTab
             Logger.error("LogFilter", e);
         }
 
-        //if isScollLocked is false,  always shows last table item 
-        if(!getScrollLock())
+        // if isScollLocked is false, always shows last table item
+        if (!getScrollLock())
         {
             int count = table.getItemCount();
-            ifcount > 1)
+            if (count > 1)
             {
                 table.showItem(table.getItem(table.getItemCount() - 1));
             }
@@ -585,23 +364,28 @@ public class LogTab
         {
             item.setForeground(colors.fatalColor);
             item.setText(1, "Fatal");
-        } else if (msg.data.logLevel == LogLevel.ERROR)
+        }
+        else if (msg.data.logLevel == LogLevel.ERROR)
         {
             item.setForeground(colors.errorColor);
             item.setText(1, "Error");
-        }else if (msg.data.logLevel == LogLevel.WARN)
+        }
+        else if (msg.data.logLevel == LogLevel.WARN)
         {
             item.setForeground(colors.warningColor);
             item.setText(1, "Warning");
-        } else if (msg.data.logLevel == LogLevel.INFO)
+        }
+        else if (msg.data.logLevel == LogLevel.INFO)
         {
             item.setForeground(colors.infoColor);
             item.setText(1, "Info");
-        } else if (msg.data.logLevel == LogLevel.DEBUG)
+        }
+        else if (msg.data.logLevel == LogLevel.DEBUG)
         {
             item.setForeground(colors.debugColor);
             item.setText(1, "Debug");
-        } else if (msg.data.logLevel == LogLevel.VERBOSE)
+        }
+        else if (msg.data.logLevel == LogLevel.VERBOSE)
         {
             item.setForeground(colors.verboseColor);
             item.setText(1, "Verbose");
@@ -654,7 +438,7 @@ public class LogTab
         if (lines.length > STRING_BUFFER_LENGTH)
         {
             Logger.error("LogTab : Receiving more lines than " + STRING_BUFFER_LENGTH, "");
-            return ;
+            return;
         }
 
         // parse the lines and create LogMessage that are stored in a temporary
@@ -682,7 +466,8 @@ public class LogTab
                         lastMessageInfo.tidString = matcher.group(3);
                         lastMessageInfo.logLevel = LogLevel.getByLetterString(matcher.group(4));
                         lastMessageInfo.tag = matcher.group(5).trim();
-                    } else
+                    }
+                    else
                     {
 
                         if (lastMessageInfo == null)
@@ -755,7 +540,8 @@ public class LogTab
             indexStart = 0;
             messageIndex = indexStart;
             indexEnd = 1;
-        } else
+        }
+        else
         {
             messageIndex = indexEnd;
 
@@ -794,7 +580,8 @@ public class LogTab
             {
                 flush();
             }
-        } else
+        }
+        else
         {
             stop(true);
         }
@@ -809,7 +596,8 @@ public class LogTab
             if (inUiThread)
             {
                 table.removeAll();
-            } else
+            }
+            else
             {
                 // run sync as we need to update right now.
                 syncExec(new Runnable()
@@ -827,15 +615,14 @@ public class LogTab
         }
     }
 
-
     public void setFilterCombo(int index)
     {
-        filterCombo = index;
+        logFilter.setComboFilter(index);
     }
 
     public void setFilterText(String text)
     {
-        filterText = text;
+        logFilter.setKeywordFilter(text);
     }
 
     // remove all filtered messages and tableMessages to refill or fill messages
@@ -849,7 +636,7 @@ public class LogTab
     // buffer and messages clear
     public void clear()
     {
-        synchronized(allMessages)
+        synchronized (allMessages)
         {
             for (int i = 0; i < STRING_BUFFER_LENGTH; i++)
             {
index 656ee5f..c0835b0 100644 (file)
@@ -1,53 +1,56 @@
 /*
-*  Common
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Kangho Kim <kh5225.kim@samsung.com>
-* Hyunsik Noh <hyunsik.noh@samsung.com>
-*
+ *  Common
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Kangho Kim <kh5225.kim@samsung.com>
+ * Hyunsik Noh <hyunsik.noh@samsung.com>
+ *
  * Licensed 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.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
 package org.tizen.common.connection.log;
 
 import org.eclipse.osgi.util.NLS;
 
-public class LogUIMessages extends NLS {
-       private static final String BUNDLE_NAME = LogUIMessages.class.getPackage().getName() + ".LogUIMessages"; //$NON-NLS-1$
+public class LogUIMessages extends NLS
+{
+    private static final String BUNDLE_NAME = LogUIMessages.class.getPackage().getName() + ".LogUIMessages"; //$NON-NLS-1$
 
-       public static String Log;
-       public static String Log_Title_Tab_AddTab_Error;
-       public static String Log_Title_Tab_EditTab_Error;
-       public static String Log_Title_View_Device_Disconnected;
-       public static String Log_Message_Tab_Device_Disconnected;
-       public static String Log_Message_View_Device_Disconnected;
-       public static String Log_Message_View_Filter_Text;
-       public static String Log_Tooltip_View_Filter_Combo;
-       public static String Log_Title_Tab_Export;
-       public static String Log_File_Tab_Export_Postfix;
-       public static String Log_File_Tab_Export_Filter;
-       public static String Log_File_Tab_Export_Filter_Extensions;
+    public static String Log;
+    public static String Log_Title_Tab_AddTab_Error;
+    public static String Log_Title_Tab_EditTab_Error;
+    public static String Log_Title_View_Device_Disconnected;
+    public static String Log_Message_Tab_Device_Disconnected;
+    public static String Log_Message_View_Device_Disconnected;
+    public static String Log_Message_View_Filter_Text;
+    public static String Log_Tooltip_View_Filter_Combo;
+    public static String Log_Title_Tab_Export;
+    public static String Log_File_Tab_Export_Postfix;
+    public static String Log_File_Tab_Export_Filter;
+    public static String Log_File_Tab_Export_Filter_Extensions;
 
-       static {
-               // initialize resource bundle
-               NLS.initializeMessages(BUNDLE_NAME, LogUIMessages.class);
-       }
+    static
+    {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, LogUIMessages.class);
+    }
 
-       private LogUIMessages() {
-       }
+    private LogUIMessages()
+    {
+    }
 }
@@ -23,7 +23,7 @@
  * - S-Core Co., Ltd
  *
  */
-package org.tizen.common.connection.ui;
+package org.tizen.common.connection.log;
 
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
@@ -36,13 +36,11 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.dialogs.PreferencesUtil;
 import org.eclipse.ui.part.ViewPart;
 import org.tizen.common.TizenHelpContextIds;
 import org.tizen.common.connection.ConnectionPlugin;
 import org.tizen.common.connection.log.LogColors;
 import org.tizen.common.connection.log.LogPanel;
-import org.tizen.common.connection.preference.TizenLogPreferencePage;
 import org.tizen.sdblib.util.LogLevel;
 
 /**
@@ -52,7 +50,7 @@ import org.tizen.sdblib.util.LogLevel;
 public final class LogView extends ViewPart
 {
 
-    public static final String ID = "org.tizen.common.connection.ui.LogView"; //$NON-NLS-1$
+    public static final String ID = "org.tizen.common.connection.log.LogView"; //$NON-NLS-1$
 
     private LogPanel logPanel;
     private Composite parent;
@@ -63,16 +61,17 @@ public final class LogView extends ViewPart
     private Action scrollLockAction;
     private Action exportAction;
     private Action clearAction;
-    private Action preferenceAction;
 
     private Action[] viewActions;
     private Action[] levelFilterActions;
-    private final String[] logLevelIcons = { "icons/log/v.png", //$NON-NLS-1S
-            "icons/log/d.png", //$NON-NLS-1S
-            "icons/log/i.png", //$NON-NLS-1S
-            "icons/log/w.png", //$NON-NLS-1S
-            "icons/log/e.png", //$NON-NLS-1S
-            "icons/log/f.png"
+    private final String[] logLevelIcons =
+    {
+        "icons/log/v.png", //$NON-NLS-1S
+        "icons/log/d.png", //$NON-NLS-1S
+        "icons/log/i.png", //$NON-NLS-1S
+        "icons/log/w.png", //$NON-NLS-1S
+        "icons/log/e.png", //$NON-NLS-1S
+        "icons/log/f.png"
     };
 
     private Clipboard clipboard;
@@ -154,15 +153,6 @@ public final class LogView extends ViewPart
         clearAction.setToolTipText("Clear the log");
         clearAction.setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/clear_log.png")); //$NON-NLS-1$
 
-        preferenceAction = new Action("Preference")
-        {
-            @Override
-            public void run()
-            {
-                PreferencesUtil.createPreferenceDialogOn(parent.getShell(), TizenLogPreferencePage.id, null, null).open();
-            }
-        };
-
         final LogLevel[] levels = LogLevel.values();
         levelFilterActions = new Action[logLevelIcons.length];
         for (int i = 0; i < levelFilterActions.length; i++)
@@ -196,15 +186,15 @@ public final class LogView extends ViewPart
             levelFilterActions[i].setToolTipText(name);
             levelFilterActions[i].setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin(logLevelIcons[i]));
         }
-        
+
         IActionBars actionBars = getViewSite().getActionBars();
         // now create the log view
         logPanel = new LogPanel(colors, actionBars);
-        viewActions = new Action[]{addAction, removeAction, editAction, scrollLockAction, exportAction, clearAction};
+        viewActions = new Action[] { addAction, removeAction, editAction, scrollLockAction, exportAction, clearAction };
         logPanel.setActions(levelFilterActions, viewActions);
         placeActions();
         logPanel.setEnableState(LogPanel.NO_TAB, null);
-        logPanel.createPanel(parent);
+        logPanel.createControl(parent);
 
         // setup the copy action
         clipboard = new Clipboard(d);
@@ -243,11 +233,10 @@ public final class LogView extends ViewPart
     @Override
     public void setFocus()
     {
-        if(parent != null)
+        if (parent != null)
         {
             parent.setFocus();
         }
-        logPanel.setFocus();
     }
 
     /**
@@ -264,8 +253,6 @@ public final class LogView extends ViewPart
         menuManager.add(new Separator());
         menuManager.add(exportAction);
         menuManager.add(clearAction);
-//        menuManager.add(new Separator());
-//        menuManager.add(preferenceAction);
 
         // and then in the toolbar
         IToolBarManager toolBarManager = actionBars.getToolBarManager();