[Title] Added IOConsoleViewer to Package Manager
authordonghyuk.yang <donghyuk.yang@samsung.com>
Fri, 31 May 2013 02:16:12 +0000 (11:16 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Fri, 31 May 2013 02:16:12 +0000 (11:16 +0900)
Change-Id: I5eaa6b7cc5e0918d38d852719a23dd4f8af5d434

org.tizen.nativeplatform/META-INF/MANIFEST.MF
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java

index 08f3e27..73c254c 100644 (file)
@@ -41,6 +41,7 @@ Import-Package: org.eclipse.cdt.debug.core,
  org.eclipse.egit.core;version="0.12.1",
  org.eclipse.egit.core.op;version="0.12.1",
  org.eclipse.egit.ui.internal.sharing;version="0.12.1",
+ org.eclipse.jface.text,
  org.eclipse.jgit.lib;version="0.12.1",
  org.eclipse.jgit.storage.file;version="0.12.1",
  org.eclipse.jgit.transport;version="0.12.1",
index 8853396..3a31cea 100644 (file)
@@ -72,6 +72,8 @@ import org.eclipse.swt.widgets.TabItem;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.internal.console.IOConsoleViewer;
 import org.tizen.common.util.DialogUtil;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
@@ -88,6 +90,7 @@ abstract public class CommonTab {
     protected Combo categoryCombo;
     protected Text filterText;
     protected Text logText;
+    protected IOConsoleViewer logViewer;
     protected String logs = "";
 
     protected final Shell shell;
@@ -131,29 +134,29 @@ abstract public class CommonTab {
 
         createRepositoryGroup(composite);
         createPackageGroup(composite);
-        createLogGroup(composite);
+        createLogSeparator(composite);
+        createLogViewer(composite);
     }
 
-    private void createLogGroup(Composite parent) {
-        Group grpRepo = new Group(parent, SWT.NONE);
-        grpRepo.setText("Log");
-        GridData log_gd = new GridData(GridData.FILL_HORIZONTAL);
-        log_gd.heightHint = 150;
-        grpRepo.setLayoutData(log_gd);
-        grpRepo.setLayout(new GridLayout(1, false));
-
-        createTextArea(grpRepo);
+    private void createLogSeparator(Composite parent) {
+        Label logLabel = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
+        logLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     }
 
-    private void createTextArea(Composite parent) {
-        Composite composite = new Composite(parent, SWT.NONE);
-        GridData gridData = new GridData(GridData.FILL_BOTH);
-        composite.setLayoutData(gridData);
-        composite.setLayout(new GridLayout(1, false));
+    private void createLogViewer(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NONE | SWT.BORDER);
+        GridData log_gd = new GridData(GridData.FILL_BOTH);
+        log_gd.heightHint = 150;
+        composite.setLayoutData(log_gd);
+        composite.setLayout(new FillLayout());
 
-        logText = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER
-                | SWT.READ_ONLY);
-        logText.setLayoutData(new GridData(GridData.FILL_BOTH));
+        MessageConsole c = commander.getOutputReceiver().getMsgConsoleStream().getConsole();
+        logViewer = new IOConsoleViewer(composite, c);
+        // Positions the cursor at the end of the log.
+        int line = logViewer.getTextWidget().getLineCount();
+        if (line > 0) {
+            logViewer.getTextWidget().setTopIndex(line);
+        }
     }
 
     private void createRepositoryGroup(Composite parent) {
@@ -568,9 +571,8 @@ abstract public class CommonTab {
     }
 
     private void createPackageTableColumns(Composite parent) {
-        String[] titles = { "S", "Package Name", "Installed Version", "New Version", "Arch",
-                "Description" };
-        int[] bounds = { 24, 200, 150, 150, 60, 150 };
+        String[] titles = { "S", "Package Name", "Installed Version", "New Version", "Arch", };
+        int[] bounds = { 24, 250, 200, 200, 60 };
 
         TableViewerColumn colSelection = createTableViewerColumn(pkgViewer, titles[0], bounds[0],
                 SWT.NONE);
@@ -629,15 +631,13 @@ abstract public class CommonTab {
                 return arch;
             }
         });
-
-        TableViewerColumn colDescription = createTableViewerColumn(pkgViewer, titles[5], bounds[5],
-                SWT.NONE);
-        colDescription.setLabelProvider(new ColumnLabelProvider() {
-            @Override
-            public String getText(Object element) {
-                return "";
-            }
-        });
+        /*
+         * TableViewerColumn colDescription = createTableViewerColumn(pkgViewer,
+         * titles[5], bounds[5], SWT.NONE); colDescription.setLabelProvider(new
+         * ColumnLabelProvider() {
+         * 
+         * @Override public String getText(Object element) { return ""; } });
+         */
     }
 
     protected void handleRefreshRepositoryButton() {
@@ -842,7 +842,7 @@ abstract public class CommonTab {
     }
 
     protected void updateLog() {
-        logText.setText(logs);
-        logText.setSelection(logText.getText().length());
+        // logText.setText(logs);
+        // logText.setSelection(logText.getText().length());
     }
 }