Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 347957 | Differences between
and this patch

Collapse All | Expand All

(-)META-INF/MANIFEST.MF (-1 / +4 lines)
Lines 9-16 Link Here
9
Export-Package: org.eclipse.pde.internal.runtime;x-internal:=true,org.eclipse.pde.internal.runtime.logview;x-friends:="org.eclipse.pde.ui",org.eclipse.pde.internal.runtime.registry;x-internal:=true
9
Export-Package: org.eclipse.pde.internal.runtime;x-internal:=true,org.eclipse.pde.internal.runtime.logview;x-friends:="org.eclipse.pde.ui",org.eclipse.pde.internal.runtime.registry;x-internal:=true
10
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
10
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
11
 org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)";resolution:=optional,
11
 org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)";resolution:=optional,
12
 org.eclipse.rap.ui
12
 org.eclipse.rap.ui,
13
 org.eclipse.rap.rwt.supplemental.filedialog;bundle-version="1.4.0"
13
Bundle-RequiredExecutionEnvironment: J2SE-1.4
14
Bundle-RequiredExecutionEnvironment: J2SE-1.4
14
Ant-Version: Apache Ant 1.7.0
15
Ant-Version: Apache Ant 1.7.0
15
Created-By: 1.4.2 (IBM Corporation)
16
Created-By: 1.4.2 (IBM Corporation)
16
Eclipse-LazyStart: true
17
Eclipse-LazyStart: true
18
Import-Package: javax.servlet;version="2.5.0",
19
 javax.servlet.http;version="2.5.0"
(-)src/org/eclipse/pde/internal/runtime/PDERuntimePlugin.java (+17 lines)
Added Link Here
1
### Eclipse Workspace Patch 1.0
2
#P org.eclipse.rap.pde.runtime
3
Index: src/org/eclipse/pde/internal/runtime/logview/LogReader.java
4
===================================================================
5
RCS file: /cvsroot/rt/org.eclipse.rap/sandbox/org.eclipse.rap.pde.runtime/src/org/eclipse/pde/internal/runtime/logview/LogReader.java,v
6
retrieving revision 1.2
7
diff -u -r1.2 LogReader.java
8
--- src/org/eclipse/pde/internal/runtime/logview/LogReader.java	10 Oct 2007 12:28:06 -0000	1.2
Added Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime;
11
package org.eclipse.pde.internal.runtime;
12
12
13
import org.eclipse.pde.internal.runtime.logview.DownloadServiceHandler;
14
import org.eclipse.rwt.RWT;
13
import org.eclipse.swt.widgets.Shell;
15
import org.eclipse.swt.widgets.Shell;
14
import org.eclipse.ui.IWorkbenchPage;
16
import org.eclipse.ui.IWorkbenchPage;
15
import org.eclipse.ui.IWorkbenchWindow;
17
import org.eclipse.ui.IWorkbenchWindow;
Added Link Here
19
21
20
public class PDERuntimePlugin extends AbstractUIPlugin {
22
public class PDERuntimePlugin extends AbstractUIPlugin {
21
	
23
	
24
	public static final String DOWNLOAD_SERVICE_HANDLER_ID = "downloadLogFile"; //$NON-NLS-1$
25
22
	private static PDERuntimePlugin inst;
26
	private static PDERuntimePlugin inst;
27
	
28
	private DownloadServiceHandler fDownloadServiceHandler;
23
29
24
	private BundleContext fContext;
30
	private BundleContext fContext;
25
31
Added Link Here
56
	public void start(BundleContext context) throws Exception {
62
	public void start(BundleContext context) throws Exception {
57
		super.start(context);
63
		super.start(context);
58
		this.fContext = context;
64
		this.fContext = context;
65
		fDownloadServiceHandler=new DownloadServiceHandler();
66
		RWT.getServiceManager().registerServiceHandler(DOWNLOAD_SERVICE_HANDLER_ID, fDownloadServiceHandler);
59
	}
67
	}
60
	
68
	
61
	public BundleContext getBundleContext() {
69
	public BundleContext getBundleContext() {
Added Link Here
68
	public void stop(BundleContext context) throws Exception {
76
	public void stop(BundleContext context) throws Exception {
69
		super.stop(context);
77
		super.stop(context);
70
		inst = null;
78
		inst = null;
79
		RWT.getServiceManager().unregisterServiceHandler(DOWNLOAD_SERVICE_HANDLER_ID);
71
	}
80
	}
72
81
73
}
82
}
(-)src/org/eclipse/pde/internal/runtime/logview/DownloadServiceHandler.java (+61 lines)
Added Link Here
1
/**
2
 * 
3
 */
4
package org.eclipse.pde.internal.runtime.logview;
5
6
import java.io.File;
7
import java.io.FileInputStream;
8
import java.io.IOException;
9
import java.io.InputStream;
10
11
import javax.servlet.ServletException;
12
import javax.servlet.http.HttpServletResponse;
13
14
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.jface.dialogs.MessageDialog;
16
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
17
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
18
import org.eclipse.rwt.RWT;
19
import org.eclipse.rwt.service.IServiceHandler;
20
21
/**
22
 * {@link IServiceHandler} implementation allowing to download platform log file
23
 *
24
 */
25
public class DownloadServiceHandler implements IServiceHandler {
26
27
	/**
28
	 * @see org.eclipse.rwt.service.IServiceHandler#service()
29
	 */
30
	public void service() throws IOException, ServletException {
31
		File inputFile=Platform.getLogFileLocation().toFile();
32
		// Send the file in the response
33
	    HttpServletResponse response = RWT.getResponse();
34
	    response.setContentType( "application/octet-stream" );
35
	    response.setContentLength((int) inputFile.length() );
36
	    String fileName=inputFile.getName();
37
	    if(fileName.charAt(0)=='.'){
38
	    	fileName="pde" + fileName;
39
	    }
40
	    String contentDisposition = "attachment; filename=\"" + fileName + '\"';
41
	    response.setHeader( "Content-Disposition", contentDisposition );
42
	    InputStream inputStream=null;
43
	    try {
44
	      inputStream=new FileInputStream(inputFile);
45
	      int b=inputStream.read();
46
	      while (b!=-1){
47
	    	  response.getOutputStream().write( b );
48
	    	  b=inputStream.read();
49
	      }
50
	     
51
	    } catch( IOException e1 ) {
52
	      MessageDialog.openError(PDERuntimePlugin.getActiveWorkbenchShell(), PDERuntimeMessages.get().LogView_exportLog, e1.toString());
53
	    }finally{
54
	    	if(inputStream!=null){
55
	    		inputStream.close();
56
	    	}
57
	    }
58
59
	}
60
61
}
(-)src/org/eclipse/pde/internal/runtime/logview/LogReader.java (-15 / +16 lines)
Lines 20-25 Link Here
20
import java.util.ArrayList;
20
import java.util.ArrayList;
21
import java.util.Date;
21
import java.util.Date;
22
22
23
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.ui.IMemento;
24
import org.eclipse.ui.IMemento;
24
25
25
class LogReader {
26
class LogReader {
Lines 102-108 Link Here
102
					writer = new PrintWriter(swriter, true);
103
					writer = new PrintWriter(swriter, true);
103
					writerState = SESSION_STATE;
104
					writerState = SESSION_STATE;
104
					updateCurrentSession(session);
105
					updateCurrentSession(session);
105
					if (!currentSession.equals(session) /*&& !memento.getString(LogView.P_SHOW_ALL_SESSIONS).equals("true")*/) //$NON-NLS-1$
106
					if (!currentSession.equals(session) && !memento.getString(LogView.P_SHOW_ALL_SESSIONS).equals("true")) //$NON-NLS-1$
106
						entries.clear();
107
						entries.clear();
107
				} else if (state == ENTRY_STATE) {
108
				} else if (state == ENTRY_STATE) {
108
					LogEntry entry = new LogEntry();
109
					LogEntry entry = new LogEntry();
Lines 167-191 Link Here
167
	public synchronized static void addEntry(LogEntry current, ArrayList entries, IMemento memento, boolean useCurrentSession) {
168
	public synchronized static void addEntry(LogEntry current, ArrayList entries, IMemento memento, boolean useCurrentSession) {
168
		int severity = current.getSeverity();
169
		int severity = current.getSeverity();
169
		boolean doAdd = true;
170
		boolean doAdd = true;
170
//		switch(severity) {
171
		switch(severity) {
171
//			case IStatus.INFO:
172
			case IStatus.INFO:
172
//				doAdd = memento.getString(LogView.P_LOG_INFO).equals("true"); //$NON-NLS-1$
173
				doAdd = memento.getString(LogView.P_LOG_INFO).equals("true"); //$NON-NLS-1$
173
//				break;
174
				break;
174
//			case IStatus.WARNING:
175
			case IStatus.WARNING:
175
//				doAdd = memento.getString(LogView.P_LOG_WARNING).equals("true"); //$NON-NLS-1$
176
				doAdd = memento.getString(LogView.P_LOG_WARNING).equals("true"); //$NON-NLS-1$
176
//				break;
177
				break;
177
//			case IStatus.ERROR:
178
			case IStatus.ERROR:
178
//				doAdd = memento.getString(LogView.P_LOG_ERROR).equals("true"); //$NON-NLS-1$
179
				doAdd = memento.getString(LogView.P_LOG_ERROR).equals("true"); //$NON-NLS-1$
179
//				break;
180
				break;
180
//		}
181
		}
181
		if (doAdd) {
182
		if (doAdd) {
182
			if (useCurrentSession)
183
			if (useCurrentSession)
183
				current.setSession(currentSession);
184
				current.setSession(currentSession);
184
			entries.add(0, current);
185
			entries.add(0, current);
185
			
186
			
186
//			if (memento.getString(LogView.P_USE_LIMIT).equals("true") //$NON-NLS-1$
187
			if (memento.getString(LogView.P_USE_LIMIT).equals("true") //$NON-NLS-1$
187
//				&& entries.size() > memento.getInteger(LogView.P_LOG_LIMIT).intValue())
188
				&& entries.size() > memento.getInteger(LogView.P_LOG_LIMIT).intValue())
188
//				entries.remove(entries.size() - 1);
189
				entries.remove(entries.size() - 1);
189
		}
190
		}
190
	}
191
	}
191
192
(-)src/org/eclipse/pde/internal/runtime/logview/LogView.java (-129 / +140 lines)
Lines 58-63 Link Here
58
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
58
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
59
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
59
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
60
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
60
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
61
import org.eclipse.rwt.RWT;
62
import org.eclipse.rwt.service.IServiceHandler;
63
import org.eclipse.rwt.widgets.ExternalBrowser;
61
import org.eclipse.swt.SWT;
64
import org.eclipse.swt.SWT;
62
import org.eclipse.swt.custom.BusyIndicator;
65
import org.eclipse.swt.custom.BusyIndicator;
63
import org.eclipse.swt.events.DisposeEvent;
66
import org.eclipse.swt.events.DisposeEvent;
Lines 73-78 Link Here
73
import org.eclipse.swt.widgets.Composite;
76
import org.eclipse.swt.widgets.Composite;
74
import org.eclipse.swt.widgets.Display;
77
import org.eclipse.swt.widgets.Display;
75
import org.eclipse.swt.widgets.Event;
78
import org.eclipse.swt.widgets.Event;
79
import org.eclipse.swt.widgets.FileDialog;
76
import org.eclipse.swt.widgets.Menu;
80
import org.eclipse.swt.widgets.Menu;
77
import org.eclipse.swt.widgets.Shell;
81
import org.eclipse.swt.widgets.Shell;
78
import org.eclipse.swt.widgets.Text;
82
import org.eclipse.swt.widgets.Text;
Lines 87-92 Link Here
87
import org.eclipse.ui.IWorkbenchPage;
91
import org.eclipse.ui.IWorkbenchPage;
88
import org.eclipse.ui.PartInitException;
92
import org.eclipse.ui.PartInitException;
89
import org.eclipse.ui.PlatformUI;
93
import org.eclipse.ui.PlatformUI;
94
import org.eclipse.ui.XMLMemento;
90
import org.eclipse.ui.part.ViewPart;
95
import org.eclipse.ui.part.ViewPart;
91
96
92
public class LogView extends ViewPart implements ILogListener {
97
public class LogView extends ViewPart implements ILogListener {
Lines 117-123 Link Here
117
122
118
//	private Clipboard fClipboard;
123
//	private Clipboard fClipboard;
119
124
120
//	private IMemento fMemento;
125
	private IMemento fMemento;
121
	private File fInputFile;
126
	private File fInputFile;
122
	private String fDirectory;
127
	private String fDirectory;
123
128
Lines 233-242 Link Here
233
	private Action createActivateViewAction() {
238
	private Action createActivateViewAction() {
234
		Action action = new Action(PDERuntimeMessages.get().LogView_activate) { //       	
239
		Action action = new Action(PDERuntimeMessages.get().LogView_activate) { //       	
235
			public void run() {
240
			public void run() {
236
//				fMemento.putString(P_ACTIVATE, isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
241
				fMemento.putString(P_ACTIVATE, isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
237
			}
242
			}
238
		};
243
		};
239
//		action.setChecked(fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
244
		action.setChecked(fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
240
		return action;
245
		return action;
241
	}
246
	}
242
247
Lines 391-397 Link Here
391
	private void createColumns(Tree tree) {
396
	private void createColumns(Tree tree) {
392
		fColumn1 = new TreeColumn(tree, SWT.LEFT);
397
		fColumn1 = new TreeColumn(tree, SWT.LEFT);
393
		fColumn1.setText(PDERuntimeMessages.get().LogView_column_message); 
398
		fColumn1.setText(PDERuntimeMessages.get().LogView_column_message); 
394
//		fColumn1.setWidth(fMemento.getInteger(P_COLUMN_1).intValue());
399
		fColumn1.setWidth(fMemento.getInteger(P_COLUMN_1).intValue());
395
		fColumn1.setWidth(300);
400
		fColumn1.setWidth(300);
396
		fColumn1.addSelectionListener(new SelectionAdapter() {
401
		fColumn1.addSelectionListener(new SelectionAdapter() {
397
			public void widgetSelected(SelectionEvent e) {
402
			public void widgetSelected(SelectionEvent e) {
Lines 403-417 Link Here
403
				setComparator(MESSAGE);
408
				setComparator(MESSAGE);
404
				if (!isComparatorSet)
409
				if (!isComparatorSet)
405
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
410
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
406
//				fMemento.putInteger(P_ORDER_VALUE, MESSAGE_ORDER);
411
				fMemento.putInteger(P_ORDER_VALUE, MESSAGE_ORDER);
407
//				fMemento.putInteger(P_ORDER_TYPE, MESSAGE);
412
				fMemento.putInteger(P_ORDER_TYPE, MESSAGE);
408
				setColumnSorting(fColumn1, MESSAGE_ORDER);
413
				setColumnSorting(fColumn1, MESSAGE_ORDER);
409
			}
414
			}
410
		});
415
		});
411
416
412
		fColumn2 = new TreeColumn(tree, SWT.LEFT);
417
		fColumn2 = new TreeColumn(tree, SWT.LEFT);
413
		fColumn2.setText(PDERuntimeMessages.get().LogView_column_plugin); 
418
		fColumn2.setText(PDERuntimeMessages.get().LogView_column_plugin); 
414
//		fColumn2.setWidth(fMemento.getInteger(P_COLUMN_2).intValue());
419
		fColumn2.setWidth(fMemento.getInteger(P_COLUMN_2).intValue());
415
		fColumn2.setWidth(150);
420
		fColumn2.setWidth(150);
416
		fColumn2.addSelectionListener(new SelectionAdapter() {
421
		fColumn2.addSelectionListener(new SelectionAdapter() {
417
			public void widgetSelected(SelectionEvent e) {
422
			public void widgetSelected(SelectionEvent e) {
Lines 423-437 Link Here
423
				setComparator(PLUGIN);
428
				setComparator(PLUGIN);
424
				if (!isComparatorSet)
429
				if (!isComparatorSet)
425
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
430
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
426
//				fMemento.putInteger(P_ORDER_VALUE, PLUGIN_ORDER);
431
				fMemento.putInteger(P_ORDER_VALUE, PLUGIN_ORDER);
427
//				fMemento.putInteger(P_ORDER_TYPE, PLUGIN);
432
				fMemento.putInteger(P_ORDER_TYPE, PLUGIN);
428
				setColumnSorting(fColumn2, PLUGIN_ORDER);
433
				setColumnSorting(fColumn2, PLUGIN_ORDER);
429
			}
434
			}
430
		});
435
		});
431
436
432
		fColumn3 = new TreeColumn(tree, SWT.LEFT);
437
		fColumn3 = new TreeColumn(tree, SWT.LEFT);
433
		fColumn3.setText(PDERuntimeMessages.get().LogView_column_date);
438
		fColumn3.setText(PDERuntimeMessages.get().LogView_column_date);
434
//		fColumn3.setWidth(fMemento.getInteger(P_COLUMN_3).intValue());
439
		fColumn3.setWidth(fMemento.getInteger(P_COLUMN_3).intValue());
435
		fColumn3.setWidth(150);
440
		fColumn3.setWidth(150);
436
		fColumn3.addSelectionListener(new SelectionAdapter() {
441
		fColumn3.addSelectionListener(new SelectionAdapter() {
437
			public void widgetSelected(SelectionEvent e) {
442
			public void widgetSelected(SelectionEvent e) {
Lines 440-447 Link Here
440
				fTreeViewer.setComparator(comparator);
445
				fTreeViewer.setComparator(comparator);
441
				setComparator(DATE);
446
				setComparator(DATE);
442
				((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
447
				((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
443
//				fMemento.putInteger(P_ORDER_VALUE, DATE_ORDER);
448
				fMemento.putInteger(P_ORDER_VALUE, DATE_ORDER);
444
//				fMemento.putInteger(P_ORDER_TYPE, DATE);
449
				fMemento.putInteger(P_ORDER_TYPE, DATE);
445
				setColumnSorting(fColumn3, DATE_ORDER);
450
				setColumnSorting(fColumn3, DATE_ORDER);
446
			}
451
			}
447
		});
452
		});
Lines 450-464 Link Here
450
	}
455
	}
451
456
452
	private void initializeViewerSorter() {
457
	private void initializeViewerSorter() {
453
//		byte orderType = fMemento.getInteger(P_ORDER_TYPE).byteValue();
458
		byte orderType = fMemento.getInteger(P_ORDER_TYPE).byteValue();
454
	    byte orderType = DATE;
455
		ViewerComparator comparator = getViewerComparator(orderType);
459
		ViewerComparator comparator = getViewerComparator(orderType);
456
		fTreeViewer.setComparator(comparator);
460
		fTreeViewer.setComparator(comparator);
457
//		if (orderType == MESSAGE )
461
		if (orderType == MESSAGE )
458
//			setColumnSorting(fColumn1, MESSAGE_ORDER);
462
			setColumnSorting(fColumn1, MESSAGE_ORDER);
459
//		else if (orderType == PLUGIN)
463
		else if (orderType == PLUGIN)
460
//			setColumnSorting(fColumn2, PLUGIN_ORDER);
464
			setColumnSorting(fColumn2, PLUGIN_ORDER);
461
//		else if (orderType == DATE)
465
		else if (orderType == DATE)
462
			setColumnSorting(fColumn3, DATE_ORDER);
466
			setColumnSorting(fColumn3, DATE_ORDER);
463
	}
467
	}
464
468
Lines 480-490 Link Here
480
484
481
485
482
	private void handleImport() {
486
	private void handleImport() {
483
//		FileDialog dialog = new FileDialog(getViewSite().getShell());
487
		FileDialog dialog = new FileDialog(getViewSite().getShell());
484
//		dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
488
		dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
485
//		if (fDirectory != null)
489
		if (fDirectory != null)
486
//			dialog.setFilterPath(fDirectory);
490
			dialog.setFilterPath(fDirectory);
487
//		handleImportPath(dialog.open());
491
		handleImportPath(dialog.open());
488
	}
492
	}
489
493
490
	public void handleImportPath(String path) {
494
	public void handleImportPath(String path) {
Lines 524-535 Link Here
524
//			File outputFile = new Path(path).toFile();
528
//			File outputFile = new Path(path).toFile();
525
//			fDirectory = outputFile.getParent();
529
//			fDirectory = outputFile.getParent();
526
//			if (outputFile.exists()) {
530
//			if (outputFile.exists()) {
527
//				String message = NLS.bind(PDERuntimeMessages.LogView_confirmOverwrite_message, outputFile.toString());
531
//				String message = PDERuntimeMessages.get().LogView_confirmOverwrite_message;
528
//				if (!MessageDialog.openQuestion(getViewSite().getShell(), PDERuntimeMessages.LogView_exportLog, message)) 
532
//				if (!MessageDialog.openQuestion(getViewSite().getShell(), PDERuntimeMessages.get().LogView_exportLog, message)) 
529
//					return;
533
//					return;
530
//			}
534
//			}
531
//			copy(fInputFile, outputFile);
535
//			copy(fInputFile, outputFile);
532
//		}
536
//		}
537
		
538
		StringBuilder url = new StringBuilder();
539
		url.append( RWT.getRequest().getContextPath() );
540
		url.append( RWT.getRequest().getServletPath() );
541
		url.append( '?' );
542
		url.append( IServiceHandler.REQUEST_PARAM );
543
	    url.append( '=' ).append(PDERuntimePlugin.DOWNLOAD_SERVICE_HANDLER_ID);
544
		String encodedURL = RWT.getResponse().encodeURL( url.toString() );
545
		
546
		ExternalBrowser.open(PDERuntimePlugin.DOWNLOAD_SERVICE_HANDLER_ID, encodedURL, SWT.NONE);
533
	}
547
	}
534
548
535
	private void copy(File inputFile, File outputFile) {
549
	private void copy(File inputFile, File outputFile) {
Lines 555-562 Link Here
555
	}
569
	}
556
570
557
	private void handleFilter() {
571
	private void handleFilter() {
558
	     FilterDialog dialog = new FilterDialog(PDERuntimePlugin.getActiveWorkbenchShell(), null);
572
		FilterDialog dialog = new FilterDialog(PDERuntimePlugin.getActiveWorkbenchShell(), fMemento);
559
//		FilterDialog dialog = new FilterDialog(PDERuntimePlugin.getActiveWorkbenchShell(), fMemento);
560
		dialog.create();
573
		dialog.create();
561
		dialog.getShell().setText(PDERuntimeMessages.get().LogView_FilterDialog_title); 
574
		dialog.getShell().setText(PDERuntimeMessages.get().LogView_FilterDialog_title); 
562
		if (dialog.open() == Window.OK)
575
		if (dialog.open() == Window.OK)
Lines 617-624 Link Here
617
		fLogs.clear();
630
		fLogs.clear();
618
		if (!fInputFile.exists())
631
		if (!fInputFile.exists())
619
			return;
632
			return;
620
		LogReader.parseLogFile(fInputFile, fLogs, null);
633
		LogReader.parseLogFile(fInputFile, fLogs, fMemento);
621
//		LogReader.parseLogFile(fInputFile, fLogs, fMemento);
622
	}
634
	}
623
635
624
	public void logging(IStatus status, String plugin) {
636
	public void logging(IStatus status, String plugin) {
Lines 635-642 Link Here
635
647
636
	private void pushStatus(IStatus status) {
648
	private void pushStatus(IStatus status) {
637
		LogEntry entry = new LogEntry(status);
649
		LogEntry entry = new LogEntry(status);
638
		LogReader.addEntry(entry, fLogs, null, true);
650
		LogReader.addEntry(entry, fLogs, fMemento, true);
639
//		LogReader.addEntry(entry, fLogs, fMemento, true);
640
		asyncRefresh();
651
		asyncRefresh();
641
	}
652
	}
642
653
Lines 714-791 Link Here
714
725
715
	public void init(IViewSite site, IMemento memento) throws PartInitException {
726
	public void init(IViewSite site, IMemento memento) throws PartInitException {
716
		super.init(site, memento);
727
		super.init(site, memento);
717
//		if (memento == null)
728
		if (memento == null)
718
//			this.fMemento = XMLMemento.createWriteRoot("LOGVIEW"); //$NON-NLS-1$
729
			this.fMemento = XMLMemento.createWriteRoot("LOGVIEW"); //$NON-NLS-1$
719
//		else
730
		else
720
//			this.fMemento = memento;
731
			this.fMemento = memento;
721
//		readSettings();
732
		readSettings();
722
733
723
		// initialize column ordering 
734
//		 initialize column ordering 
724
//		final byte type = this.fMemento.getInteger(P_ORDER_TYPE).byteValue();
735
		final byte type = this.fMemento.getInteger(P_ORDER_TYPE).byteValue();
725
//		switch (type){
736
		switch (type){
726
//		case DATE:
737
		case DATE:
727
//			DATE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
738
			DATE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
728
//			MESSAGE_ORDER = DESCENDING;
739
			MESSAGE_ORDER = DESCENDING;
729
//			PLUGIN_ORDER = DESCENDING;
740
			PLUGIN_ORDER = DESCENDING;
730
//			break;
741
			break;
731
//		case MESSAGE:
742
		case MESSAGE:
732
//			MESSAGE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
743
			MESSAGE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
733
//			DATE_ORDER = DESCENDING;
744
			DATE_ORDER = DESCENDING;
734
//			PLUGIN_ORDER = DESCENDING;
745
			PLUGIN_ORDER = DESCENDING;
735
//			break;
746
			break;
736
//		case PLUGIN:
747
		case PLUGIN:
737
//			PLUGIN_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
748
			PLUGIN_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
738
//			MESSAGE_ORDER = DESCENDING;
749
			MESSAGE_ORDER = DESCENDING;
739
//			DATE_ORDER = DESCENDING;
750
			DATE_ORDER = DESCENDING;
740
//			break;
751
			break;
741
//		default:
752
		default:
742
			DATE_ORDER = DESCENDING;
753
			DATE_ORDER = DESCENDING;
743
		MESSAGE_ORDER = DESCENDING;
754
		MESSAGE_ORDER = DESCENDING;
744
		PLUGIN_ORDER = DESCENDING;
755
		PLUGIN_ORDER = DESCENDING;
745
//		}
756
		}
746
//		setComparator(fMemento.getInteger(P_ORDER_TYPE).byteValue());
757
		setComparator(fMemento.getInteger(P_ORDER_TYPE).byteValue());
747
		setComparator(DATE);
748
	}
758
	}
749
759
750
	private void initializeMemento() {
760
	private void initializeMemento() {
751
//		if (fMemento.getString(P_USE_LIMIT) == null)
761
		if (fMemento.getString(P_USE_LIMIT) == null)
752
//			fMemento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$
762
			fMemento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$
753
//		if (fMemento.getInteger(P_LOG_LIMIT) == null)
763
		if (fMemento.getInteger(P_LOG_LIMIT) == null)
754
//			fMemento.putInteger(P_LOG_LIMIT, 50);
764
			fMemento.putInteger(P_LOG_LIMIT, 50);
755
//		if (fMemento.getString(P_LOG_INFO) == null)
765
		if (fMemento.getString(P_LOG_INFO) == null)
756
//			fMemento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$
766
			fMemento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$
757
//		if (fMemento.getString(P_LOG_WARNING) == null)
767
		if (fMemento.getString(P_LOG_WARNING) == null)
758
//			fMemento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$
768
			fMemento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$
759
//		if (fMemento.getString(P_LOG_ERROR) == null)
769
		if (fMemento.getString(P_LOG_ERROR) == null)
760
//			fMemento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$
770
			fMemento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$
761
//		if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null)
771
		if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null)
762
//			fMemento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$
772
			fMemento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$
763
//		Integer width = fMemento.getInteger(P_COLUMN_1);
773
		Integer width = fMemento.getInteger(P_COLUMN_1);
764
//		if (width == null || width.intValue() == 0)
774
		if (width == null || width.intValue() == 0)
765
//			fMemento.putInteger(P_COLUMN_1, 300);
775
			fMemento.putInteger(P_COLUMN_1, 300);
766
//		width = fMemento.getInteger(P_COLUMN_2);
776
		width = fMemento.getInteger(P_COLUMN_2);
767
//		if (width == null || width.intValue() == 0)
777
		if (width == null || width.intValue() == 0)
768
//			fMemento.putInteger(P_COLUMN_2, 150);
778
			fMemento.putInteger(P_COLUMN_2, 150);
769
//		width = fMemento.getInteger(P_COLUMN_3);
779
		width = fMemento.getInteger(P_COLUMN_3);
770
//		if (width == null || width.intValue() == 0)
780
		if (width == null || width.intValue() == 0)
771
//			fMemento.putInteger(P_COLUMN_3, 150);
781
			fMemento.putInteger(P_COLUMN_3, 150);
772
//		if (fMemento.getString(P_ACTIVATE) == null)
782
		if (fMemento.getString(P_ACTIVATE) == null)
773
//			fMemento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$
783
			fMemento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$
774
//
784
775
//		fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
785
		fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
776
//		fMemento.putInteger(P_ORDER_TYPE, DATE);
786
		fMemento.putInteger(P_ORDER_TYPE, DATE);
777
	}
787
	}
778
788
779
	public void saveState(IMemento memento) {
789
	public void saveState(IMemento memento) {
780
//		if (this.fMemento == null || memento == null)
790
		if (this.fMemento == null || memento == null)
781
//			return;
791
			return;
782
//		this.fMemento.putInteger(P_COLUMN_1, fColumn1.getWidth());
792
		this.fMemento.putInteger(P_COLUMN_1, fColumn1.getWidth());
783
//		this.fMemento.putInteger(P_COLUMN_2, fColumn2.getWidth());
793
		this.fMemento.putInteger(P_COLUMN_2, fColumn2.getWidth());
784
//		this.fMemento.putInteger(P_COLUMN_3, fColumn3.getWidth());
794
		this.fMemento.putInteger(P_COLUMN_3, fColumn3.getWidth());
785
//		this.fMemento.putString(P_ACTIVATE,
795
		this.fMemento.putString(P_ACTIVATE,
786
//				fActivateViewAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
796
				fActivateViewAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
787
//		memento.putMemento(this.fMemento);
797
		memento.putMemento(this.fMemento);
788
//		writeSettings();
798
		writeSettings();
789
	}
799
	}
790
800
791
	private void addMouseListeners() {
801
	private void addMouseListeners() {
Lines 1019-1044 Link Here
1019
			return;
1029
			return;
1020
		}
1030
		}
1021
		try {
1031
		try {
1022
//			fMemento.putString(P_USE_LIMIT, s.getBoolean(P_USE_LIMIT) ? "true":"false"); //$NON-NLS-1$ //$NON-NLS-2$
1032
			fMemento.putString(P_USE_LIMIT, s.getBoolean(P_USE_LIMIT) ? "true":"false"); //$NON-NLS-1$ //$NON-NLS-2$
1023
//			fMemento.putString(P_LOG_INFO, s.getBoolean(P_LOG_INFO) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1033
			fMemento.putString(P_LOG_INFO, s.getBoolean(P_LOG_INFO) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1024
//			fMemento.putString(P_LOG_WARNING, s.getBoolean(P_LOG_WARNING) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1034
			fMemento.putString(P_LOG_WARNING, s.getBoolean(P_LOG_WARNING) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1025
//			fMemento.putString(P_LOG_ERROR, s.getBoolean(P_LOG_ERROR) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1035
			fMemento.putString(P_LOG_ERROR, s.getBoolean(P_LOG_ERROR) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1026
//			fMemento.putString(P_SHOW_ALL_SESSIONS, s.getBoolean(P_SHOW_ALL_SESSIONS) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1036
			fMemento.putString(P_SHOW_ALL_SESSIONS, s.getBoolean(P_SHOW_ALL_SESSIONS) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1027
//			fMemento.putInteger(P_LOG_LIMIT, s.getInt(P_LOG_LIMIT));
1037
			fMemento.putInteger(P_LOG_LIMIT, s.getInt(P_LOG_LIMIT));
1028
//			fMemento.putInteger(P_COLUMN_1, p.getInt(P_COLUMN_1) > 0 ? p.getInt(P_COLUMN_1) : 300);
1038
			fMemento.putInteger(P_COLUMN_1, p.getInt(P_COLUMN_1) > 0 ? p.getInt(P_COLUMN_1) : 300);
1029
//			fMemento.putInteger(P_COLUMN_2, p.getInt(P_COLUMN_2) > 0 ? p.getInt(P_COLUMN_2) : 150);
1039
			fMemento.putInteger(P_COLUMN_2, p.getInt(P_COLUMN_2) > 0 ? p.getInt(P_COLUMN_2) : 150);
1030
//			fMemento.putInteger(P_COLUMN_3, p.getInt(P_COLUMN_3) > 0 ? p.getInt(P_COLUMN_3) : 150);
1040
			fMemento.putInteger(P_COLUMN_3, p.getInt(P_COLUMN_3) > 0 ? p.getInt(P_COLUMN_3) : 150);
1031
//			fMemento.putString(P_ACTIVATE, p.getBoolean(P_ACTIVATE) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1041
			fMemento.putString(P_ACTIVATE, p.getBoolean(P_ACTIVATE) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1032
//			int order = p.getInt(P_ORDER_VALUE);
1042
			int order = p.getInt(P_ORDER_VALUE);
1033
//			fMemento.putInteger(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1043
			fMemento.putInteger(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1034
//			fMemento.putInteger(P_ORDER_TYPE, p.getInt(P_ORDER_TYPE));
1044
			fMemento.putInteger(P_ORDER_TYPE, p.getInt(P_ORDER_TYPE));
1035
		} catch (NumberFormatException e) {
1045
		} catch (NumberFormatException e) {
1036
//			fMemento.putInteger(P_LOG_LIMIT, 50);
1046
			fMemento.putInteger(P_LOG_LIMIT, 50);
1037
//			fMemento.putInteger(P_COLUMN_1, 300);
1047
			fMemento.putInteger(P_COLUMN_1, 300);
1038
//			fMemento.putInteger(P_COLUMN_2, 150);
1048
			fMemento.putInteger(P_COLUMN_2, 150);
1039
//			fMemento.putInteger(P_COLUMN_3, 150);
1049
			fMemento.putInteger(P_COLUMN_3, 150);
1040
//			fMemento.putInteger(P_ORDER_TYPE, DATE);
1050
			fMemento.putInteger(P_ORDER_TYPE, DATE);
1041
//			fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
1051
			fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
1042
		}
1052
		}
1043
	}
1053
	}
1044
1054
Lines 1051-1073 Link Here
1051
		IDialogSettings settings = getLogSettings();
1061
		IDialogSettings settings = getLogSettings();
1052
		if (settings == null)
1062
		if (settings == null)
1053
			settings = PDERuntimePlugin.getDefault().getDialogSettings().addNewSection(getClass().getName());
1063
			settings = PDERuntimePlugin.getDefault().getDialogSettings().addNewSection(getClass().getName());
1054
//		settings.put(P_USE_LIMIT, fMemento.getString(P_USE_LIMIT).equals("true")); //$NON-NLS-1$
1064
		settings.put(P_USE_LIMIT, fMemento.getString(P_USE_LIMIT).equals("true")); //$NON-NLS-1$
1055
//		settings.put(P_LOG_LIMIT, fMemento.getInteger(P_LOG_LIMIT).intValue());
1065
		settings.put(P_LOG_LIMIT, fMemento.getInteger(P_LOG_LIMIT).intValue());
1056
//		settings.put(P_LOG_INFO, fMemento.getString(P_LOG_INFO).equals("true")); //$NON-NLS-1$
1066
		settings.put(P_LOG_INFO, fMemento.getString(P_LOG_INFO).equals("true")); //$NON-NLS-1$
1057
//		settings.put(P_LOG_WARNING, fMemento.getString(P_LOG_WARNING).equals("true")); //$NON-NLS-1$
1067
		settings.put(P_LOG_WARNING, fMemento.getString(P_LOG_WARNING).equals("true")); //$NON-NLS-1$
1058
//		settings.put(P_LOG_ERROR, fMemento.getString(P_LOG_ERROR).equals("true")); //$NON-NLS-1$
1068
		settings.put(P_LOG_ERROR, fMemento.getString(P_LOG_ERROR).equals("true")); //$NON-NLS-1$
1059
//		settings.put(P_SHOW_ALL_SESSIONS, fMemento.getString(P_SHOW_ALL_SESSIONS).equals("true")); //$NON-NLS-1$
1069
		settings.put(P_SHOW_ALL_SESSIONS, fMemento.getString(P_SHOW_ALL_SESSIONS).equals("true")); //$NON-NLS-1$
1060
	}
1070
	}
1061
1071
1062
	private void writeViewSettings(){
1072
	private void writeViewSettings(){
1063
		Preferences preferences = getLogPreferences();
1073
		Preferences preferences = getLogPreferences();
1064
//		preferences.setValue(P_COLUMN_1, fMemento.getInteger(P_COLUMN_1).intValue());
1074
		preferences.setValue(P_COLUMN_1, fMemento.getInteger(P_COLUMN_1).intValue());
1065
//		preferences.setValue(P_COLUMN_2, fMemento.getInteger(P_COLUMN_2).intValue());
1075
		preferences.setValue(P_COLUMN_2, fMemento.getInteger(P_COLUMN_2).intValue());
1066
//		preferences.setValue(P_COLUMN_3, fMemento.getInteger(P_COLUMN_3).intValue());
1076
		preferences.setValue(P_COLUMN_3, fMemento.getInteger(P_COLUMN_3).intValue());
1067
//		preferences.setValue(P_ACTIVATE, fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
1077
		preferences.setValue(P_ACTIVATE, fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
1068
//		int order = fMemento.getInteger(P_ORDER_VALUE).intValue();
1078
		int order = fMemento.getInteger(P_ORDER_VALUE).intValue();
1069
//		preferences.setValue(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1079
		preferences.setValue(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1070
//		preferences.setValue(P_ORDER_TYPE, fMemento.getInteger(P_ORDER_TYPE).intValue());
1080
		preferences.setValue(P_ORDER_TYPE, fMemento.getInteger(P_ORDER_TYPE).intValue());
1071
	}
1081
	}
1072
1082
1073
	public void sortByDateDescending() {
1083
	public void sortByDateDescending() {
Lines 1075-1084 Link Here
1075
	}
1085
	}
1076
	
1086
	
1077
	protected Job getOpenLogFileJob() {
1087
	protected Job getOpenLogFileJob() {
1088
		final Display display=Display.getDefault();
1078
		final Shell shell = getViewSite().getShell();
1089
		final Shell shell = getViewSite().getShell();
1079
		return new Job(PDERuntimeMessages.get().OpenLogDialog_message) {
1090
		return new Job(PDERuntimeMessages.get().OpenLogDialog_message) {
1080
			protected IStatus run(IProgressMonitor monitor) {
1091
			protected IStatus run(IProgressMonitor monitor) {
1081
				boolean failed = false;
1092
				boolean failed = true;
1082
				if (fInputFile.length() <= LogReader.MAX_FILE_LENGTH) {
1093
				if (fInputFile.length() <= LogReader.MAX_FILE_LENGTH) {
1083
//					failed = !Program.launch(fInputFile.getAbsolutePath());
1094
//					failed = !Program.launch(fInputFile.getAbsolutePath());
1084
//					if (failed) {
1095
//					if (failed) {
Lines 1091-1097 Link Here
1091
				}
1102
				}
1092
				if (failed) {
1103
				if (failed) {
1093
					final OpenLogDialog openDialog = new OpenLogDialog(shell, fInputFile);
1104
					final OpenLogDialog openDialog = new OpenLogDialog(shell, fInputFile);
1094
					Display.getDefault().asyncExec(new Runnable() {
1105
					display.asyncExec(new Runnable() {
1095
						public void run() {
1106
						public void run() {
1096
							openDialog.create();
1107
							openDialog.create();
1097
							openDialog.open();
1108
							openDialog.open();

Return to bug 347957