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/logview/DownloadServiceHandler.java (+72 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
	private File fInputFile;
27
	
28
29
	public DownloadServiceHandler(File pInputFile) {
30
		super();
31
		fInputFile = pInputFile;
32
	}
33
	
34
	public DownloadServiceHandler() {
35
		this(Platform.getLogFileLocation().toFile());
36
	}
37
38
39
	/**
40
	 * @see org.eclipse.rwt.service.IServiceHandler#service()
41
	 */
42
	public void service() throws IOException, ServletException {
43
		// Send the file in the response
44
	    HttpServletResponse response = RWT.getResponse();
45
	    response.setContentType( "application/octet-stream" );
46
	    response.setContentLength((int) fInputFile.length() );
47
	    String fileName=fInputFile.getName();
48
	    if(fileName.charAt(0)=='.'){
49
	    	fileName="pde" + fileName;
50
	    }
51
	    String contentDisposition = "attachment; filename=\"" + fileName + '\"';
52
	    response.setHeader( "Content-Disposition", contentDisposition );
53
	    InputStream inputStream=null;
54
	    try {
55
	      inputStream=new FileInputStream(fInputFile);
56
	      int b=inputStream.read();
57
	      while (b!=-1){
58
	    	  response.getOutputStream().write( b );
59
	    	  b=inputStream.read();
60
	      }
61
	     
62
	    } catch( IOException e1 ) {
63
	      MessageDialog.openError(PDERuntimePlugin.getActiveWorkbenchShell(), PDERuntimeMessages.get().LogView_exportLog, e1.toString());
64
	    }finally{
65
	    	if(inputStream!=null){
66
	    		inputStream.close();
67
	    	}
68
	    }
69
70
	}
71
72
}
(-)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 / +148 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-95 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 {
98
	public static final String DOWNLOAD_SERVICE_HANDLER_ID = "downloadLogFile"; //$NON-NLS-1$
99
	
93
	public static final String P_LOG_WARNING = "warning"; //$NON-NLS-1$
100
	public static final String P_LOG_WARNING = "warning"; //$NON-NLS-1$
94
	public static final String P_LOG_ERROR = "error"; //$NON-NLS-1$
101
	public static final String P_LOG_ERROR = "error"; //$NON-NLS-1$
95
	public static final String P_LOG_INFO = "info"; //$NON-NLS-1$
102
	public static final String P_LOG_INFO = "info"; //$NON-NLS-1$
Lines 117-123 Link Here
117
124
118
//	private Clipboard fClipboard;
125
//	private Clipboard fClipboard;
119
126
120
//	private IMemento fMemento;
127
	private IMemento fMemento;
121
	private File fInputFile;
128
	private File fInputFile;
122
	private String fDirectory;
129
	private String fDirectory;
123
130
Lines 145-154 Link Here
145
	private Action fActivateViewAction;
152
	private Action fActivateViewAction;
146
	private Action fOpenLogAction;
153
	private Action fOpenLogAction;
147
	private Action fExportAction;
154
	private Action fExportAction;
155
	
156
	private DownloadServiceHandler fDownloadServiceHandler;
148
157
149
	public LogView() {
158
	public LogView() {
150
		fLogs = new ArrayList();
159
		fLogs = new ArrayList();
151
		fInputFile = Platform.getLogFileLocation().toFile();
160
		fInputFile = Platform.getLogFileLocation().toFile();
161
		fDownloadServiceHandler=new DownloadServiceHandler(fInputFile);
162
		RWT.getServiceManager().registerServiceHandler(DOWNLOAD_SERVICE_HANDLER_ID, fDownloadServiceHandler);
152
	}
163
	}
153
164
154
	public void createPartControl(Composite parent) {
165
	public void createPartControl(Composite parent) {
Lines 233-242 Link Here
233
	private Action createActivateViewAction() {
244
	private Action createActivateViewAction() {
234
		Action action = new Action(PDERuntimeMessages.get().LogView_activate) { //       	
245
		Action action = new Action(PDERuntimeMessages.get().LogView_activate) { //       	
235
			public void run() {
246
			public void run() {
236
//				fMemento.putString(P_ACTIVATE, isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
247
				fMemento.putString(P_ACTIVATE, isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
237
			}
248
			}
238
		};
249
		};
239
//		action.setChecked(fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
250
		action.setChecked(fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
240
		return action;
251
		return action;
241
	}
252
	}
242
253
Lines 391-397 Link Here
391
	private void createColumns(Tree tree) {
402
	private void createColumns(Tree tree) {
392
		fColumn1 = new TreeColumn(tree, SWT.LEFT);
403
		fColumn1 = new TreeColumn(tree, SWT.LEFT);
393
		fColumn1.setText(PDERuntimeMessages.get().LogView_column_message); 
404
		fColumn1.setText(PDERuntimeMessages.get().LogView_column_message); 
394
//		fColumn1.setWidth(fMemento.getInteger(P_COLUMN_1).intValue());
405
		fColumn1.setWidth(fMemento.getInteger(P_COLUMN_1).intValue());
395
		fColumn1.setWidth(300);
406
		fColumn1.setWidth(300);
396
		fColumn1.addSelectionListener(new SelectionAdapter() {
407
		fColumn1.addSelectionListener(new SelectionAdapter() {
397
			public void widgetSelected(SelectionEvent e) {
408
			public void widgetSelected(SelectionEvent e) {
Lines 403-417 Link Here
403
				setComparator(MESSAGE);
414
				setComparator(MESSAGE);
404
				if (!isComparatorSet)
415
				if (!isComparatorSet)
405
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
416
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
406
//				fMemento.putInteger(P_ORDER_VALUE, MESSAGE_ORDER);
417
				fMemento.putInteger(P_ORDER_VALUE, MESSAGE_ORDER);
407
//				fMemento.putInteger(P_ORDER_TYPE, MESSAGE);
418
				fMemento.putInteger(P_ORDER_TYPE, MESSAGE);
408
				setColumnSorting(fColumn1, MESSAGE_ORDER);
419
				setColumnSorting(fColumn1, MESSAGE_ORDER);
409
			}
420
			}
410
		});
421
		});
411
422
412
		fColumn2 = new TreeColumn(tree, SWT.LEFT);
423
		fColumn2 = new TreeColumn(tree, SWT.LEFT);
413
		fColumn2.setText(PDERuntimeMessages.get().LogView_column_plugin); 
424
		fColumn2.setText(PDERuntimeMessages.get().LogView_column_plugin); 
414
//		fColumn2.setWidth(fMemento.getInteger(P_COLUMN_2).intValue());
425
		fColumn2.setWidth(fMemento.getInteger(P_COLUMN_2).intValue());
415
		fColumn2.setWidth(150);
426
		fColumn2.setWidth(150);
416
		fColumn2.addSelectionListener(new SelectionAdapter() {
427
		fColumn2.addSelectionListener(new SelectionAdapter() {
417
			public void widgetSelected(SelectionEvent e) {
428
			public void widgetSelected(SelectionEvent e) {
Lines 423-437 Link Here
423
				setComparator(PLUGIN);
434
				setComparator(PLUGIN);
424
				if (!isComparatorSet)
435
				if (!isComparatorSet)
425
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
436
					((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
426
//				fMemento.putInteger(P_ORDER_VALUE, PLUGIN_ORDER);
437
				fMemento.putInteger(P_ORDER_VALUE, PLUGIN_ORDER);
427
//				fMemento.putInteger(P_ORDER_TYPE, PLUGIN);
438
				fMemento.putInteger(P_ORDER_TYPE, PLUGIN);
428
				setColumnSorting(fColumn2, PLUGIN_ORDER);
439
				setColumnSorting(fColumn2, PLUGIN_ORDER);
429
			}
440
			}
430
		});
441
		});
431
442
432
		fColumn3 = new TreeColumn(tree, SWT.LEFT);
443
		fColumn3 = new TreeColumn(tree, SWT.LEFT);
433
		fColumn3.setText(PDERuntimeMessages.get().LogView_column_date);
444
		fColumn3.setText(PDERuntimeMessages.get().LogView_column_date);
434
//		fColumn3.setWidth(fMemento.getInteger(P_COLUMN_3).intValue());
445
		fColumn3.setWidth(fMemento.getInteger(P_COLUMN_3).intValue());
435
		fColumn3.setWidth(150);
446
		fColumn3.setWidth(150);
436
		fColumn3.addSelectionListener(new SelectionAdapter() {
447
		fColumn3.addSelectionListener(new SelectionAdapter() {
437
			public void widgetSelected(SelectionEvent e) {
448
			public void widgetSelected(SelectionEvent e) {
Lines 440-447 Link Here
440
				fTreeViewer.setComparator(comparator);
451
				fTreeViewer.setComparator(comparator);
441
				setComparator(DATE);
452
				setComparator(DATE);
442
				((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
453
				((EventDetailsDialogAction) fPropertiesAction).setComparator(fComparator);
443
//				fMemento.putInteger(P_ORDER_VALUE, DATE_ORDER);
454
				fMemento.putInteger(P_ORDER_VALUE, DATE_ORDER);
444
//				fMemento.putInteger(P_ORDER_TYPE, DATE);
455
				fMemento.putInteger(P_ORDER_TYPE, DATE);
445
				setColumnSorting(fColumn3, DATE_ORDER);
456
				setColumnSorting(fColumn3, DATE_ORDER);
446
			}
457
			}
447
		});
458
		});
Lines 450-464 Link Here
450
	}
461
	}
451
462
452
	private void initializeViewerSorter() {
463
	private void initializeViewerSorter() {
453
//		byte orderType = fMemento.getInteger(P_ORDER_TYPE).byteValue();
464
		byte orderType = fMemento.getInteger(P_ORDER_TYPE).byteValue();
454
	    byte orderType = DATE;
455
		ViewerComparator comparator = getViewerComparator(orderType);
465
		ViewerComparator comparator = getViewerComparator(orderType);
456
		fTreeViewer.setComparator(comparator);
466
		fTreeViewer.setComparator(comparator);
457
//		if (orderType == MESSAGE )
467
		if (orderType == MESSAGE )
458
//			setColumnSorting(fColumn1, MESSAGE_ORDER);
468
			setColumnSorting(fColumn1, MESSAGE_ORDER);
459
//		else if (orderType == PLUGIN)
469
		else if (orderType == PLUGIN)
460
//			setColumnSorting(fColumn2, PLUGIN_ORDER);
470
			setColumnSorting(fColumn2, PLUGIN_ORDER);
461
//		else if (orderType == DATE)
471
		else if (orderType == DATE)
462
			setColumnSorting(fColumn3, DATE_ORDER);
472
			setColumnSorting(fColumn3, DATE_ORDER);
463
	}
473
	}
464
474
Lines 475-490 Link Here
475
			fTextShell.dispose();	
485
			fTextShell.dispose();	
476
		LogReader.reset();
486
		LogReader.reset();
477
		fLabelProvider.disconnect(this);
487
		fLabelProvider.disconnect(this);
488
		
489
		RWT.getServiceManager().unregisterServiceHandler(DOWNLOAD_SERVICE_HANDLER_ID);
478
		super.dispose();
490
		super.dispose();
479
	}
491
	}
480
492
481
493
482
	private void handleImport() {
494
	private void handleImport() {
483
//		FileDialog dialog = new FileDialog(getViewSite().getShell());
495
		FileDialog dialog = new FileDialog(getViewSite().getShell());
484
//		dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
496
		dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
485
//		if (fDirectory != null)
497
		if (fDirectory != null)
486
//			dialog.setFilterPath(fDirectory);
498
			dialog.setFilterPath(fDirectory);
487
//		handleImportPath(dialog.open());
499
		handleImportPath(dialog.open());
488
	}
500
	}
489
501
490
	public void handleImportPath(String path) {
502
	public void handleImportPath(String path) {
Lines 524-535 Link Here
524
//			File outputFile = new Path(path).toFile();
536
//			File outputFile = new Path(path).toFile();
525
//			fDirectory = outputFile.getParent();
537
//			fDirectory = outputFile.getParent();
526
//			if (outputFile.exists()) {
538
//			if (outputFile.exists()) {
527
//				String message = NLS.bind(PDERuntimeMessages.LogView_confirmOverwrite_message, outputFile.toString());
539
//				String message = PDERuntimeMessages.get().LogView_confirmOverwrite_message;
528
//				if (!MessageDialog.openQuestion(getViewSite().getShell(), PDERuntimeMessages.LogView_exportLog, message)) 
540
//				if (!MessageDialog.openQuestion(getViewSite().getShell(), PDERuntimeMessages.get().LogView_exportLog, message)) 
529
//					return;
541
//					return;
530
//			}
542
//			}
531
//			copy(fInputFile, outputFile);
543
//			copy(fInputFile, outputFile);
532
//		}
544
//		}
545
		
546
		StringBuilder url = new StringBuilder();
547
		url.append( RWT.getRequest().getContextPath() );
548
		url.append( RWT.getRequest().getServletPath() );
549
		url.append( '?' );
550
		url.append( IServiceHandler.REQUEST_PARAM );
551
	    url.append( '=' ).append(DOWNLOAD_SERVICE_HANDLER_ID);
552
		String encodedURL = RWT.getResponse().encodeURL( url.toString() );
553
		
554
		ExternalBrowser.open(DOWNLOAD_SERVICE_HANDLER_ID, encodedURL, SWT.NONE);
533
	}
555
	}
534
556
535
	private void copy(File inputFile, File outputFile) {
557
	private void copy(File inputFile, File outputFile) {
Lines 555-562 Link Here
555
	}
577
	}
556
578
557
	private void handleFilter() {
579
	private void handleFilter() {
558
	     FilterDialog dialog = new FilterDialog(PDERuntimePlugin.getActiveWorkbenchShell(), null);
580
		FilterDialog dialog = new FilterDialog(PDERuntimePlugin.getActiveWorkbenchShell(), fMemento);
559
//		FilterDialog dialog = new FilterDialog(PDERuntimePlugin.getActiveWorkbenchShell(), fMemento);
560
		dialog.create();
581
		dialog.create();
561
		dialog.getShell().setText(PDERuntimeMessages.get().LogView_FilterDialog_title); 
582
		dialog.getShell().setText(PDERuntimeMessages.get().LogView_FilterDialog_title); 
562
		if (dialog.open() == Window.OK)
583
		if (dialog.open() == Window.OK)
Lines 617-624 Link Here
617
		fLogs.clear();
638
		fLogs.clear();
618
		if (!fInputFile.exists())
639
		if (!fInputFile.exists())
619
			return;
640
			return;
620
		LogReader.parseLogFile(fInputFile, fLogs, null);
641
		LogReader.parseLogFile(fInputFile, fLogs, fMemento);
621
//		LogReader.parseLogFile(fInputFile, fLogs, fMemento);
622
	}
642
	}
623
643
624
	public void logging(IStatus status, String plugin) {
644
	public void logging(IStatus status, String plugin) {
Lines 635-642 Link Here
635
655
636
	private void pushStatus(IStatus status) {
656
	private void pushStatus(IStatus status) {
637
		LogEntry entry = new LogEntry(status);
657
		LogEntry entry = new LogEntry(status);
638
		LogReader.addEntry(entry, fLogs, null, true);
658
		LogReader.addEntry(entry, fLogs, fMemento, true);
639
//		LogReader.addEntry(entry, fLogs, fMemento, true);
640
		asyncRefresh();
659
		asyncRefresh();
641
	}
660
	}
642
661
Lines 714-791 Link Here
714
733
715
	public void init(IViewSite site, IMemento memento) throws PartInitException {
734
	public void init(IViewSite site, IMemento memento) throws PartInitException {
716
		super.init(site, memento);
735
		super.init(site, memento);
717
//		if (memento == null)
736
		if (memento == null)
718
//			this.fMemento = XMLMemento.createWriteRoot("LOGVIEW"); //$NON-NLS-1$
737
			this.fMemento = XMLMemento.createWriteRoot("LOGVIEW"); //$NON-NLS-1$
719
//		else
738
		else
720
//			this.fMemento = memento;
739
			this.fMemento = memento;
721
//		readSettings();
740
		readSettings();
722
741
723
		// initialize column ordering 
742
//		 initialize column ordering 
724
//		final byte type = this.fMemento.getInteger(P_ORDER_TYPE).byteValue();
743
		final byte type = this.fMemento.getInteger(P_ORDER_TYPE).byteValue();
725
//		switch (type){
744
		switch (type){
726
//		case DATE:
745
		case DATE:
727
//			DATE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
746
			DATE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
728
//			MESSAGE_ORDER = DESCENDING;
747
			MESSAGE_ORDER = DESCENDING;
729
//			PLUGIN_ORDER = DESCENDING;
748
			PLUGIN_ORDER = DESCENDING;
730
//			break;
749
			break;
731
//		case MESSAGE:
750
		case MESSAGE:
732
//			MESSAGE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
751
			MESSAGE_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
733
//			DATE_ORDER = DESCENDING;
752
			DATE_ORDER = DESCENDING;
734
//			PLUGIN_ORDER = DESCENDING;
753
			PLUGIN_ORDER = DESCENDING;
735
//			break;
754
			break;
736
//		case PLUGIN:
755
		case PLUGIN:
737
//			PLUGIN_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
756
			PLUGIN_ORDER = this.fMemento.getInteger(P_ORDER_VALUE).intValue();
738
//			MESSAGE_ORDER = DESCENDING;
757
			MESSAGE_ORDER = DESCENDING;
739
//			DATE_ORDER = DESCENDING;
758
			DATE_ORDER = DESCENDING;
740
//			break;
759
			break;
741
//		default:
760
		default:
742
			DATE_ORDER = DESCENDING;
761
			DATE_ORDER = DESCENDING;
743
		MESSAGE_ORDER = DESCENDING;
762
		MESSAGE_ORDER = DESCENDING;
744
		PLUGIN_ORDER = DESCENDING;
763
		PLUGIN_ORDER = DESCENDING;
745
//		}
764
		}
746
//		setComparator(fMemento.getInteger(P_ORDER_TYPE).byteValue());
765
		setComparator(fMemento.getInteger(P_ORDER_TYPE).byteValue());
747
		setComparator(DATE);
748
	}
766
	}
749
767
750
	private void initializeMemento() {
768
	private void initializeMemento() {
751
//		if (fMemento.getString(P_USE_LIMIT) == null)
769
		if (fMemento.getString(P_USE_LIMIT) == null)
752
//			fMemento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$
770
			fMemento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$
753
//		if (fMemento.getInteger(P_LOG_LIMIT) == null)
771
		if (fMemento.getInteger(P_LOG_LIMIT) == null)
754
//			fMemento.putInteger(P_LOG_LIMIT, 50);
772
			fMemento.putInteger(P_LOG_LIMIT, 50);
755
//		if (fMemento.getString(P_LOG_INFO) == null)
773
		if (fMemento.getString(P_LOG_INFO) == null)
756
//			fMemento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$
774
			fMemento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$
757
//		if (fMemento.getString(P_LOG_WARNING) == null)
775
		if (fMemento.getString(P_LOG_WARNING) == null)
758
//			fMemento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$
776
			fMemento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$
759
//		if (fMemento.getString(P_LOG_ERROR) == null)
777
		if (fMemento.getString(P_LOG_ERROR) == null)
760
//			fMemento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$
778
			fMemento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$
761
//		if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null)
779
		if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null)
762
//			fMemento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$
780
			fMemento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$
763
//		Integer width = fMemento.getInteger(P_COLUMN_1);
781
		Integer width = fMemento.getInteger(P_COLUMN_1);
764
//		if (width == null || width.intValue() == 0)
782
		if (width == null || width.intValue() == 0)
765
//			fMemento.putInteger(P_COLUMN_1, 300);
783
			fMemento.putInteger(P_COLUMN_1, 300);
766
//		width = fMemento.getInteger(P_COLUMN_2);
784
		width = fMemento.getInteger(P_COLUMN_2);
767
//		if (width == null || width.intValue() == 0)
785
		if (width == null || width.intValue() == 0)
768
//			fMemento.putInteger(P_COLUMN_2, 150);
786
			fMemento.putInteger(P_COLUMN_2, 150);
769
//		width = fMemento.getInteger(P_COLUMN_3);
787
		width = fMemento.getInteger(P_COLUMN_3);
770
//		if (width == null || width.intValue() == 0)
788
		if (width == null || width.intValue() == 0)
771
//			fMemento.putInteger(P_COLUMN_3, 150);
789
			fMemento.putInteger(P_COLUMN_3, 150);
772
//		if (fMemento.getString(P_ACTIVATE) == null)
790
		if (fMemento.getString(P_ACTIVATE) == null)
773
//			fMemento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$
791
			fMemento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$
774
//
792
775
//		fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
793
		fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
776
//		fMemento.putInteger(P_ORDER_TYPE, DATE);
794
		fMemento.putInteger(P_ORDER_TYPE, DATE);
777
	}
795
	}
778
796
779
	public void saveState(IMemento memento) {
797
	public void saveState(IMemento memento) {
780
//		if (this.fMemento == null || memento == null)
798
		if (this.fMemento == null || memento == null)
781
//			return;
799
			return;
782
//		this.fMemento.putInteger(P_COLUMN_1, fColumn1.getWidth());
800
		this.fMemento.putInteger(P_COLUMN_1, fColumn1.getWidth());
783
//		this.fMemento.putInteger(P_COLUMN_2, fColumn2.getWidth());
801
		this.fMemento.putInteger(P_COLUMN_2, fColumn2.getWidth());
784
//		this.fMemento.putInteger(P_COLUMN_3, fColumn3.getWidth());
802
		this.fMemento.putInteger(P_COLUMN_3, fColumn3.getWidth());
785
//		this.fMemento.putString(P_ACTIVATE,
803
		this.fMemento.putString(P_ACTIVATE,
786
//				fActivateViewAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
804
				fActivateViewAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
787
//		memento.putMemento(this.fMemento);
805
		memento.putMemento(this.fMemento);
788
//		writeSettings();
806
		writeSettings();
789
	}
807
	}
790
808
791
	private void addMouseListeners() {
809
	private void addMouseListeners() {
Lines 1019-1044 Link Here
1019
			return;
1037
			return;
1020
		}
1038
		}
1021
		try {
1039
		try {
1022
//			fMemento.putString(P_USE_LIMIT, s.getBoolean(P_USE_LIMIT) ? "true":"false"); //$NON-NLS-1$ //$NON-NLS-2$
1040
			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$
1041
			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$
1042
			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$
1043
			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$
1044
			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));
1045
			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);
1046
			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);
1047
			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);
1048
			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$
1049
			fMemento.putString(P_ACTIVATE, p.getBoolean(P_ACTIVATE) ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
1032
//			int order = p.getInt(P_ORDER_VALUE);
1050
			int order = p.getInt(P_ORDER_VALUE);
1033
//			fMemento.putInteger(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1051
			fMemento.putInteger(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1034
//			fMemento.putInteger(P_ORDER_TYPE, p.getInt(P_ORDER_TYPE));
1052
			fMemento.putInteger(P_ORDER_TYPE, p.getInt(P_ORDER_TYPE));
1035
		} catch (NumberFormatException e) {
1053
		} catch (NumberFormatException e) {
1036
//			fMemento.putInteger(P_LOG_LIMIT, 50);
1054
			fMemento.putInteger(P_LOG_LIMIT, 50);
1037
//			fMemento.putInteger(P_COLUMN_1, 300);
1055
			fMemento.putInteger(P_COLUMN_1, 300);
1038
//			fMemento.putInteger(P_COLUMN_2, 150);
1056
			fMemento.putInteger(P_COLUMN_2, 150);
1039
//			fMemento.putInteger(P_COLUMN_3, 150);
1057
			fMemento.putInteger(P_COLUMN_3, 150);
1040
//			fMemento.putInteger(P_ORDER_TYPE, DATE);
1058
			fMemento.putInteger(P_ORDER_TYPE, DATE);
1041
//			fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
1059
			fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
1042
		}
1060
		}
1043
	}
1061
	}
1044
1062
Lines 1051-1073 Link Here
1051
		IDialogSettings settings = getLogSettings();
1069
		IDialogSettings settings = getLogSettings();
1052
		if (settings == null)
1070
		if (settings == null)
1053
			settings = PDERuntimePlugin.getDefault().getDialogSettings().addNewSection(getClass().getName());
1071
			settings = PDERuntimePlugin.getDefault().getDialogSettings().addNewSection(getClass().getName());
1054
//		settings.put(P_USE_LIMIT, fMemento.getString(P_USE_LIMIT).equals("true")); //$NON-NLS-1$
1072
		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());
1073
		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$
1074
		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$
1075
		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$
1076
		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$
1077
		settings.put(P_SHOW_ALL_SESSIONS, fMemento.getString(P_SHOW_ALL_SESSIONS).equals("true")); //$NON-NLS-1$
1060
	}
1078
	}
1061
1079
1062
	private void writeViewSettings(){
1080
	private void writeViewSettings(){
1063
		Preferences preferences = getLogPreferences();
1081
		Preferences preferences = getLogPreferences();
1064
//		preferences.setValue(P_COLUMN_1, fMemento.getInteger(P_COLUMN_1).intValue());
1082
		preferences.setValue(P_COLUMN_1, fMemento.getInteger(P_COLUMN_1).intValue());
1065
//		preferences.setValue(P_COLUMN_2, fMemento.getInteger(P_COLUMN_2).intValue());
1083
		preferences.setValue(P_COLUMN_2, fMemento.getInteger(P_COLUMN_2).intValue());
1066
//		preferences.setValue(P_COLUMN_3, fMemento.getInteger(P_COLUMN_3).intValue());
1084
		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$
1085
		preferences.setValue(P_ACTIVATE, fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
1068
//		int order = fMemento.getInteger(P_ORDER_VALUE).intValue();
1086
		int order = fMemento.getInteger(P_ORDER_VALUE).intValue();
1069
//		preferences.setValue(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1087
		preferences.setValue(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1070
//		preferences.setValue(P_ORDER_TYPE, fMemento.getInteger(P_ORDER_TYPE).intValue());
1088
		preferences.setValue(P_ORDER_TYPE, fMemento.getInteger(P_ORDER_TYPE).intValue());
1071
	}
1089
	}
1072
1090
1073
	public void sortByDateDescending() {
1091
	public void sortByDateDescending() {
Lines 1075-1084 Link Here
1075
	}
1093
	}
1076
	
1094
	
1077
	protected Job getOpenLogFileJob() {
1095
	protected Job getOpenLogFileJob() {
1096
		final Display display=Display.getDefault();
1078
		final Shell shell = getViewSite().getShell();
1097
		final Shell shell = getViewSite().getShell();
1079
		return new Job(PDERuntimeMessages.get().OpenLogDialog_message) {
1098
		return new Job(PDERuntimeMessages.get().OpenLogDialog_message) {
1080
			protected IStatus run(IProgressMonitor monitor) {
1099
			protected IStatus run(IProgressMonitor monitor) {
1081
				boolean failed = false;
1100
				boolean failed = true;
1082
				if (fInputFile.length() <= LogReader.MAX_FILE_LENGTH) {
1101
				if (fInputFile.length() <= LogReader.MAX_FILE_LENGTH) {
1083
//					failed = !Program.launch(fInputFile.getAbsolutePath());
1102
//					failed = !Program.launch(fInputFile.getAbsolutePath());
1084
//					if (failed) {
1103
//					if (failed) {
Lines 1091-1097 Link Here
1091
				}
1110
				}
1092
				if (failed) {
1111
				if (failed) {
1093
					final OpenLogDialog openDialog = new OpenLogDialog(shell, fInputFile);
1112
					final OpenLogDialog openDialog = new OpenLogDialog(shell, fInputFile);
1094
					Display.getDefault().asyncExec(new Runnable() {
1113
					display.asyncExec(new Runnable() {
1095
						public void run() {
1114
						public void run() {
1096
							openDialog.create();
1115
							openDialog.create();
1097
							openDialog.open();
1116
							openDialog.open();

Return to bug 347957