View | Details | Raw Unified | Return to bug 207344 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/views/log/LogSession.java (-26 / +8 lines)
Lines 11-32 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.ui.internal.views.log;
12
package org.eclipse.ui.internal.views.log;
13
13
14
import java.io.PrintWriter;
14
import java.text.ParseException;
15
import java.text.ParseException;
15
import java.util.ArrayList;
16
import java.util.Date;
16
import java.util.Date;
17
import java.util.List;
18
19
import org.eclipse.core.runtime.PlatformObject;
20
import org.eclipse.jface.resource.ImageDescriptor;
21
import org.eclipse.ui.model.IWorkbenchAdapter;
22
17
23
import com.ibm.icu.text.SimpleDateFormat;
18
import com.ibm.icu.text.SimpleDateFormat;
24
19
25
public class LogSession extends PlatformObject implements IWorkbenchAdapter {
20
public class LogSession extends AbstractEntry {
26
	private String sessionData;
21
	private String sessionData;
27
	private Date date;
22
	private Date date;
28
	private List entries = new ArrayList();
23
	
29
30
	/**
24
	/**
31
	 * Constructor for LogSession.
25
	 * Constructor for LogSession.
32
	 */
26
	 */
Lines 63-86 Link Here
63
		String dateBuffer = line.substring(0, delim).trim();
57
		String dateBuffer = line.substring(0, delim).trim();
64
		setDate(dateBuffer);
58
		setDate(dateBuffer);
65
	}
59
	}
66
	
67
	public List getEntries() {
68
		return entries;
69
	}
70
60
71
	public Object[] getChildren(Object o) {
61
	public void write(PrintWriter writer) {
72
		return getEntries().toArray(new LogEntry[getEntries().size()]);
62
		writer.write(sessionData);
73
	}
63
	}
74
64
	
75
	public ImageDescriptor getImageDescriptor(Object object) {
65
	public String toString() {
76
		return null;
66
		return Messages.LogViewLabelProvider_Session; // TODO maybe toString is not the best place for static...
77
	}
78
79
	public String getLabel(Object o) {
80
		return null;
81
	}
82
83
	public Object getParent(Object o) {
84
		return null;
85
	}
67
	}
86
}
68
}
(-)src/org/eclipse/ui/internal/views/log/LogViewLabelProvider.java (-25 / +25 lines)
Lines 18-26 Link Here
18
import org.eclipse.jface.viewers.LabelProvider;
18
import org.eclipse.jface.viewers.LabelProvider;
19
import org.eclipse.swt.graphics.Image;
19
import org.eclipse.swt.graphics.Image;
20
20
21
import com.ibm.icu.text.DateFormat;
22
import com.ibm.icu.text.SimpleDateFormat;
23
24
public class LogViewLabelProvider
21
public class LogViewLabelProvider
25
	extends LabelProvider
22
	extends LabelProvider
26
	implements ITableLabelProvider {
23
	implements ITableLabelProvider {
Lines 49-55 Link Here
49
		}
46
		}
50
	}
47
	}
51
	public Image getColumnImage(Object element, int columnIndex) {
48
	public Image getColumnImage(Object element, int columnIndex) {
52
		if (element instanceof LogSession) {
49
		if (element instanceof Group) {
53
			return (columnIndex == 0) ? hierarchicalImage : null;
50
			return (columnIndex == 0) ? hierarchicalImage : null;
54
		}
51
		}
55
		
52
		
Lines 70-107 Link Here
70
	}
67
	}
71
	
68
	
72
	public String getColumnText(Object element, int columnIndex) {
69
	public String getColumnText(Object element, int columnIndex) {
73
		if (element instanceof LogSession) {
70
		if (element instanceof Group) {
74
			LogSession entry = (LogSession) element;
71
			Group entry = (Group) element;
75
			if (columnIndex == 0) {
72
			if (columnIndex == 0) {
76
				return Messages.LogViewLabelProvider_Session;
73
				return entry.toString();
77
			} else if (columnIndex == 2) {
74
			} else if (columnIndex == 2) {
78
				if (entry.getDate() != null) {
75
				/*if (entry.getDate() != null) { TODO Get date if Group 
79
					DateFormat formatter = new SimpleDateFormat(LogEntry.F_DATE_FORMAT);
76
					DateFormat formatter = new SimpleDateFormat(LogEntry.F_DATE_FORMAT);
80
					return formatter.format(entry.getDate()); 
77
					return formatter.format(entry.getDate()); 
81
				}
78
				}*/
82
			}
79
			}
83
			return null;
80
			return null;
84
		}
81
		}
85
		
82
		
86
		LogEntry entry = (LogEntry) element;
83
		if (element instanceof LogEntry) {
87
		switch (columnIndex) {
84
			LogEntry entry = (LogEntry) element;
88
		case 0:
85
			switch (columnIndex) {
89
			if (entry.getMessage() != null) {
86
			case 0:
90
				String message = entry.getMessage();
87
				if (entry.getMessage() != null) {
91
				if (message.length() > MAX_LABEL_LENGTH) {
88
					String message = entry.getMessage();
92
					String warning = Messages.LogViewLabelProvider_truncatedMessage;
89
					if (message.length() > MAX_LABEL_LENGTH) {
93
					StringBuffer sb = new StringBuffer(message.substring(0, MAX_LABEL_LENGTH - warning.length()));
90
						String warning = Messages.LogViewLabelProvider_truncatedMessage;
94
					sb.append(warning);
91
						StringBuffer sb = new StringBuffer(message.substring(0, MAX_LABEL_LENGTH - warning.length()));
95
					return sb.toString();
92
						sb.append(warning);
93
						return sb.toString();
94
					}
95
					return entry.getMessage();
96
				}
96
				}
97
				return entry.getMessage();
97
			case 1:
98
				if (entry.getPluginId() != null)
99
					return entry.getPluginId();
100
			case 2:
101
				return entry.getFormattedDate();
98
			}
102
			}
99
		case 1:
100
			if (entry.getPluginId() != null)
101
				return entry.getPluginId();
102
		case 2:
103
			return entry.getFormattedDate();
104
		}
103
		}
104
		
105
		return ""; //$NON-NLS-1$
105
		return ""; //$NON-NLS-1$
106
	}
106
	}
107
107
(-)src/org/eclipse/ui/internal/views/log/LogView.java (-7 / +83 lines)
Lines 27-32 Link Here
27
import java.lang.reflect.InvocationTargetException;
27
import java.lang.reflect.InvocationTargetException;
28
import java.util.ArrayList;
28
import java.util.ArrayList;
29
import java.util.Comparator;
29
import java.util.Comparator;
30
import java.util.HashMap;
31
import java.util.Iterator;
32
import java.util.List;
33
import java.util.Map;
30
34
31
import org.eclipse.core.runtime.ILogListener;
35
import org.eclipse.core.runtime.ILogListener;
32
import org.eclipse.core.runtime.IProgressMonitor;
36
import org.eclipse.core.runtime.IProgressMonitor;
Lines 116-121 Link Here
116
	public static final String P_SHOW_FILTER_TEXT = "show_filter_text"; //$NON-NLS-1$
120
	public static final String P_SHOW_FILTER_TEXT = "show_filter_text"; //$NON-NLS-1$
117
	public static final String P_ORDER_TYPE = "orderType"; //$NON-NLS-1$
121
	public static final String P_ORDER_TYPE = "orderType"; //$NON-NLS-1$
118
	public static final String P_ORDER_VALUE = "orderValue"; //$NON-NLS-1$
122
	public static final String P_ORDER_VALUE = "orderValue"; //$NON-NLS-1$
123
	public static final String P_GROUP_BY = "groupBy"; //$NON-NLS-1$
119
124
120
	private int MESSAGE_ORDER;
125
	private int MESSAGE_ORDER;
121
	private int PLUGIN_ORDER;
126
	private int PLUGIN_ORDER;
Lines 127-133 Link Here
127
	public static int ASCENDING = 1;
132
	public static int ASCENDING = 1;
128
	public static int DESCENDING = -1;
133
	public static int DESCENDING = -1;
129
134
130
	private ArrayList fLogs;
135
	public static final int GROUP_BY_NONE = 0;
136
	public static final int GROUP_BY_SESSION = 1;
137
	public static final int GROUP_BY_PLUGIN = 2;
138
	
139
	private List fLogs;
131
140
132
	private Clipboard fClipboard;
141
	private Clipboard fClipboard;
133
142
Lines 664-671 Link Here
664
	public void fillContextMenu(IMenuManager manager) {
673
	public void fillContextMenu(IMenuManager manager) {
665
	}
674
	}
666
675
667
	public LogSession[] getLogs() {
676
	public AbstractEntry[] getLogs() { // TODO rename to getElements, reconsider this method!
668
		return (LogSession[]) fLogs.toArray(new LogSession[fLogs.size()]);
677
		return (AbstractEntry[]) fLogs.toArray(new AbstractEntry[fLogs.size()]);
669
	}
678
	}
670
679
671
	protected void handleClear() {
680
	protected void handleClear() {
Lines 703-709 Link Here
703
		fLogs.clear();
712
		fLogs.clear();
704
		if (!fInputFile.exists())
713
		if (!fInputFile.exists())
705
			return;
714
			return;
706
		LogReader.parseLogFile(fInputFile, fLogs, fMemento);
715
		
716
		List result = new ArrayList();
717
		LogReader.parseLogFile(fInputFile, result, fMemento);
718
		group(result); // TODO make parseLogFile a function and have loa local var
719
	}
720
	
721
	private void group(List entries) {
722
		fLogs.clear();
723
724
		if (fMemento.getInteger(P_GROUP_BY).intValue() == GROUP_BY_NONE) {
725
			fLogs.addAll(entries);
726
		} else {
727
			Map groups = new HashMap();
728
			
729
			for (Iterator i = entries.iterator(); i.hasNext(); ) {
730
				LogEntry entry = (LogEntry) i.next();
731
				Group group = getGroup(groups, entry);
732
				group.addChild(entry);
733
			}
734
		}
735
	}
736
	
737
	/**
738
	 * Returns group appropriate for the entry. Group depends on P_GROUP_BY
739
	 * preference, or is null if grouping is disabled (GROUP_BY_NONE), or group
740
	 * could not be determined. May create group if it haven't existed before.
741
	 * 
742
	 * @param entry entry to be grouped
743
	 * @return group or null if grouping is disabled
744
	 */
745
	protected Group getGroup(Map groups, LogEntry entry) {
746
747
		Object elementGroupId = null;
748
749
		switch (fMemento.getInteger(P_GROUP_BY).intValue()) {
750
		case GROUP_BY_PLUGIN:
751
			elementGroupId = entry.getPluginId();
752
			break;
753
754
		case GROUP_BY_SESSION:
755
			elementGroupId = entry.getSession();
756
			break;
757
758
		default: // grouping is disabled
759
			return null;
760
		}
761
762
		if (elementGroupId == null) { // could not determine group
763
			return null;
764
		}
765
766
		Group group = (Group) groups.get(elementGroupId);
767
		if (group == null) {
768
			group = new Group(elementGroupId);
769
			groups.put(elementGroupId, group);
770
			fLogs.add(group);
771
		}
772
		
773
		return group;
707
	}
774
	}
708
775
709
	public void logging(IStatus status, String plugin) {
776
	public void logging(IStatus status, String plugin) {
Lines 723-729 Link Here
723
		if (fLogs.isEmpty()) {
790
		if (fLogs.isEmpty()) {
724
			fLogs.add(new LogSession());
791
			fLogs.add(new LogSession());
725
		}
792
		}
726
		LogReader.addEntry(entry, ((LogSession)fLogs.get(fLogs.size() - 1)).getEntries(), fMemento, true);
793
		LogReader.addEntry(entry, getCurrentSession(), fMemento, true);
727
		asyncRefresh();
794
		asyncRefresh();
728
	}
795
	}
729
796
Lines 875-880 Link Here
875
		}
942
		}
876
		fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
943
		fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
877
		fMemento.putInteger(P_ORDER_TYPE, DATE);
944
		fMemento.putInteger(P_ORDER_TYPE, DATE);
945
		if (fMemento.getInteger(P_GROUP_BY) == null) {
946
			fMemento.putInteger(P_GROUP_BY, GROUP_BY_NONE);
947
		}
878
	}
948
	}
879
949
880
	public void saveState(IMemento memento) {
950
	public void saveState(IMemento memento) {
Lines 1017-1024 Link Here
1017
		}
1087
		}
1018
	}
1088
	}
1019
1089
1020
	private int getNumberOfParents(LogEntry entry){
1090
	private int getNumberOfParents(AbstractEntry entry){
1021
		LogEntry parent = (LogEntry)entry.getParent(entry);
1091
		AbstractEntry parent = (AbstractEntry)entry.getParent(entry);
1022
		if (parent ==null)
1092
		if (parent ==null)
1023
			return 0;
1093
			return 0;
1024
		return 1 + getNumberOfParents(parent);
1094
		return 1 + getNumberOfParents(parent);
Lines 1176-1181 Link Here
1176
			fMemento.putInteger(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1246
			fMemento.putInteger(P_ORDER_VALUE, order == 0 ? DESCENDING : order);
1177
			fMemento.putInteger(P_ORDER_TYPE, p.getInt(P_ORDER_TYPE));
1247
			fMemento.putInteger(P_ORDER_TYPE, p.getInt(P_ORDER_TYPE));
1178
			fMemento.putBoolean(P_SHOW_FILTER_TEXT, p.getBoolean(P_SHOW_FILTER_TEXT));
1248
			fMemento.putBoolean(P_SHOW_FILTER_TEXT, p.getBoolean(P_SHOW_FILTER_TEXT));
1249
			fMemento.putInteger(P_GROUP_BY, p.getInt(P_GROUP_BY));
1179
		} catch (NumberFormatException e) {
1250
		} catch (NumberFormatException e) {
1180
			fMemento.putInteger(P_LOG_LIMIT, 50);
1251
			fMemento.putInteger(P_LOG_LIMIT, 50);
1181
			fMemento.putInteger(P_COLUMN_1, 300);
1252
			fMemento.putInteger(P_COLUMN_1, 300);
Lines 1183-1188 Link Here
1183
			fMemento.putInteger(P_COLUMN_3, 150);
1254
			fMemento.putInteger(P_COLUMN_3, 150);
1184
			fMemento.putInteger(P_ORDER_TYPE, DATE);
1255
			fMemento.putInteger(P_ORDER_TYPE, DATE);
1185
			fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
1256
			fMemento.putInteger(P_ORDER_VALUE, DESCENDING);
1257
			fMemento.putInteger(P_GROUP_BY, GROUP_BY_NONE);
1186
		}
1258
		}
1187
	}
1259
	}
1188
1260
Lines 1251-1254 Link Here
1251
	protected File getLogFile() {
1323
	protected File getLogFile() {
1252
		return fInputFile;
1324
		return fInputFile;
1253
	}
1325
	}
1326
	
1327
	private LogSession getCurrentSession() {
1328
		return ((LogSession)fLogs.get(fLogs.size() - 1)); // TODO If in grouping, it may be not a LogSession, but Group
1329
	}
1254
}
1330
}
(-)src/org/eclipse/ui/internal/views/log/LogEntry.java (-35 / +4 lines)
Lines 13-36 Link Here
13
import java.io.PrintWriter;
13
import java.io.PrintWriter;
14
import java.io.StringWriter;
14
import java.io.StringWriter;
15
import java.text.ParseException;
15
import java.text.ParseException;
16
import java.util.ArrayList;
17
import java.util.Date;
16
import java.util.Date;
18
import java.util.StringTokenizer;
17
import java.util.StringTokenizer;
19
18
20
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.IStatus;
21
import org.eclipse.core.runtime.PlatformObject;
22
import org.eclipse.jface.resource.ImageDescriptor;
20
import org.eclipse.jface.resource.ImageDescriptor;
23
import org.eclipse.ui.model.IWorkbenchAdapter;
21
import org.eclipse.ui.model.IWorkbenchAdapter;
24
22
25
import com.ibm.icu.text.SimpleDateFormat;
23
import com.ibm.icu.text.SimpleDateFormat;
26
24
27
public class LogEntry extends PlatformObject implements IWorkbenchAdapter {
25
public class LogEntry extends AbstractEntry {
28
	
26
	
29
	public static final String F_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
27
	public static final String F_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
30
	private static final SimpleDateFormat F_SDF = new SimpleDateFormat(F_DATE_FORMAT);
28
	private static final SimpleDateFormat F_SDF = new SimpleDateFormat(F_DATE_FORMAT);
31
	
29
	
32
	private ArrayList children;
33
	private LogEntry parent;
34
	private String pluginId;
30
	private String pluginId;
35
	private int severity;
31
	private int severity;
36
	private int code;
32
	private int code;
Lines 85-105 Link Here
85
	public String getSeverityText() {
81
	public String getSeverityText() {
86
		return getSeverityText(severity);
82
		return getSeverityText(severity);
87
	}
83
	}
88
	public boolean hasChildren() {
84
	
89
		return children != null && children.size() > 0;
90
	}
91
	public String toString() {
85
	public String toString() {
92
		return getSeverityText();
86
		return getSeverityText();
93
	}
87
	}
94
	/**
88
	
95
	 * @see IWorkbenchAdapter#getChildren(Object)
96
	 */
97
	public Object[] getChildren(Object parent) {
98
		if (children == null)
99
			return new Object[0];
100
		return children.toArray();
101
	}
102
103
	/**
89
	/**
104
	 * @see IWorkbenchAdapter#getImageDescriptor(Object)
90
	 * @see IWorkbenchAdapter#getImageDescriptor(Object)
105
	 */
91
	 */
Lines 114-130 Link Here
114
		return getSeverityText();
100
		return getSeverityText();
115
	}
101
	}
116
102
117
	/**
118
	 * @see IWorkbenchAdapter#getParent(Object)
119
	 */
120
	public Object getParent(Object obj) {
121
		return parent;
122
	}
123
124
	void setParent(LogEntry parent) {
125
		this.parent = parent;
126
	}
127
128
	private String getSeverityText(int severity) {
103
	private String getSeverityText(int severity) {
129
		switch (severity) {
104
		switch (severity) {
130
			case IStatus.ERROR :
105
			case IStatus.ERROR :
Lines 279-297 Link Here
279
		}
254
		}
280
		IStatus[] schildren = status.getChildren();
255
		IStatus[] schildren = status.getChildren();
281
		if (schildren.length > 0) {
256
		if (schildren.length > 0) {
282
			children = new ArrayList();
283
			for (int i = 0; i < schildren.length; i++) {
257
			for (int i = 0; i < schildren.length; i++) {
284
				LogEntry child = new LogEntry(schildren[i]);
258
				LogEntry child = new LogEntry(schildren[i]);
285
				addChild(child);
259
				addChild(child);
286
			}
260
			}
287
		}
261
		}
288
	}
262
	}
289
	void addChild(LogEntry child) {
263
	
290
		if (children == null)
291
			children = new ArrayList();
292
		children.add(child);
293
		child.setParent(this);
294
	}
295
	public void write(PrintWriter writer) {
264
	public void write(PrintWriter writer) {
296
		if (session != null)
265
		if (session != null)
297
			writer.println(session.getSessionData());
266
			writer.println(session.getSessionData());
(-)src/org/eclipse/ui/internal/views/log/EventDetailsDialogAction.java (-1 / +1 lines)
Lines 81-87 Link Here
81
		
81
		
82
		//get initial selection
82
		//get initial selection
83
		IAdaptable element = (IAdaptable) getStructuredSelection().getFirstElement();
83
		IAdaptable element = (IAdaptable) getStructuredSelection().getFirstElement();
84
		if ((element == null) || (element instanceof LogSession))
84
		if ((element == null) || (! (element instanceof AbstractEntry)))
85
			return;
85
			return;
86
		
86
		
87
		propertyDialog = new EventDetailsDialog(shell, element, provider, comparator);
87
		propertyDialog = new EventDetailsDialog(shell, element, provider, comparator);
(-)src/org/eclipse/ui/internal/views/log/LogViewContentProvider.java (-11 / +2 lines)
Lines 11-18 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.ui.internal.views.log;
12
package org.eclipse.ui.internal.views.log;
13
13
14
import java.util.List;
15
16
import org.eclipse.jface.viewers.ITreeContentProvider;
14
import org.eclipse.jface.viewers.ITreeContentProvider;
17
import org.eclipse.jface.viewers.Viewer;
15
import org.eclipse.jface.viewers.Viewer;
18
16
Lines 25-35 Link Here
25
	public void dispose() {
23
	public void dispose() {
26
	}
24
	}
27
	public Object[] getChildren(Object element) {
25
	public Object[] getChildren(Object element) {
28
		if (element instanceof LogSession) {
26
		return ((AbstractEntry) element).getChildren(element);
29
			List entries = ((LogSession) element).getEntries();
30
			return entries.toArray(new LogEntry[entries.size()]);
31
		}
32
		return ((LogEntry) element).getChildren(element);
33
	}
27
	}
34
	public Object[] getElements(Object element) {
28
	public Object[] getElements(Object element) {
35
		return logView.getLogs();
29
		return logView.getLogs();
Lines 41-50 Link Here
41
		return ((LogEntry) element).getParent(element);
35
		return ((LogEntry) element).getParent(element);
42
	}
36
	}
43
	public boolean hasChildren(Object element) {
37
	public boolean hasChildren(Object element) {
44
		if (element instanceof LogSession) {
38
		return ((AbstractEntry) element).getChildren(element).length > 0;
45
			return ((LogSession) element).getEntries().size() > 0;
46
		}
47
		return ((LogEntry) element).hasChildren();
48
	}
39
	}
49
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
40
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
50
	}
41
	}
(-)src/org/eclipse/ui/internal/views/log/EventDetailsDialog.java (-59 / +126 lines)
Lines 15-22 Link Here
15
import java.io.PrintWriter;
15
import java.io.PrintWriter;
16
import java.io.StringWriter;
16
import java.io.StringWriter;
17
import java.text.Collator;
17
import java.text.Collator;
18
import java.util.ArrayList;
18
import java.util.Arrays;
19
import java.util.Arrays;
19
import java.util.Collections;
20
import java.util.Comparator;
20
import java.util.Comparator;
21
import java.util.Date;
21
import java.util.Date;
22
import java.util.List;
22
import java.util.List;
Lines 29-34 Link Here
29
import org.eclipse.jface.viewers.ISelection;
29
import org.eclipse.jface.viewers.ISelection;
30
import org.eclipse.jface.viewers.ISelectionProvider;
30
import org.eclipse.jface.viewers.ISelectionProvider;
31
import org.eclipse.jface.viewers.IStructuredSelection;
31
import org.eclipse.jface.viewers.IStructuredSelection;
32
import org.eclipse.jface.viewers.ITreeContentProvider;
32
import org.eclipse.jface.viewers.StructuredSelection;
33
import org.eclipse.jface.viewers.StructuredSelection;
33
import org.eclipse.jface.viewers.TreeViewer;
34
import org.eclipse.jface.viewers.TreeViewer;
34
import org.eclipse.swt.SWT;
35
import org.eclipse.swt.SWT;
Lines 49-60 Link Here
49
import org.eclipse.ui.PlatformUI;
50
import org.eclipse.ui.PlatformUI;
50
51
51
public class EventDetailsDialog extends TrayDialog {
52
public class EventDetailsDialog extends TrayDialog {
52
	private LogEntry entry, parentEntry;
53
	private AbstractEntry entry;
54
	private AbstractEntry parentEntry; // parent of the entry
55
	private AbstractEntry[] entryChildren; // children of the entry
56
	
53
	private LogViewLabelProvider labelProvider;
57
	private LogViewLabelProvider labelProvider;
54
	private static int COPY_ID = 22;
55
	private TreeViewer provider;
58
	private TreeViewer provider;
56
	private int elementNum, totalElementCount;
59
	
57
	private LogEntry[] entryChildren;
60
	private static int COPY_ID = 22;
61
	
62
	private int elementNum; // number of selected element
63
	private int totalElementCount; // number of all elements
64
	
58
	private int childIndex = 0;
65
	private int childIndex = 0;
59
	private boolean isOpen;
66
	private boolean isOpen;
60
	private boolean isLastChild;
67
	private boolean isLastChild;
Lines 93-99 Link Here
93
		this.provider = (TreeViewer) provider;
100
		this.provider = (TreeViewer) provider;
94
		labelProvider = (LogViewLabelProvider)this.provider.getLabelProvider();
101
		labelProvider = (LogViewLabelProvider)this.provider.getLabelProvider();
95
		labelProvider.connect(this);
102
		labelProvider.connect(this);
96
		this.entry = (LogEntry)selection;
103
		this.entry = (AbstractEntry)selection;
97
		this.comparator = comparator;
104
		this.comparator = comparator;
98
		setShellStyle(SWT.MODELESS | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.CLOSE | SWT.BORDER | SWT.TITLE);
105
		setShellStyle(SWT.MODELESS | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.CLOSE | SWT.BORDER | SWT.TITLE);
99
		clipboard = new Clipboard(parentShell.getDisplay());
106
		clipboard = new Clipboard(parentShell.getDisplay());
Lines 107-113 Link Here
107
	private void initialize() {
114
	private void initialize() {
108
		elementNum = getParentElementNum();
115
		elementNum = getParentElementNum();
109
		resetTotalElementCount();
116
		resetTotalElementCount();
110
		parentEntry = (LogEntry) entry.getParent(entry);
117
		parentEntry = (AbstractEntry) entry.getParent(entry);
111
		if (isChild(entry)){
118
		if (isChild(entry)){
112
			setEntryChildren(parentEntry);
119
			setEntryChildren(parentEntry);
113
			resetChildIndex();
120
			resetChildIndex();
Lines 117-132 Link Here
117
	}
124
	}
118
	
125
	
119
	private void resetChildIndex() {
126
	private void resetChildIndex() {
127
		if (! (entry instanceof AbstractEntry)) {
128
			return;
129
		}
130
		
131
		if (entryChildren == null)
132
			return;
133
		
134
		LogEntry thisEntry = (LogEntry) entry;
135
		
120
		for (int i = 0; i < entryChildren.length; i++) {
136
		for (int i = 0; i < entryChildren.length; i++) {
121
			if (equal(entryChildren[i].getMessage(), entry.getMessage())
137
			if (entryChildren[i] instanceof LogEntry) {
122
					&& equal(entryChildren[i].getDate(), entry.getDate())
138
			
123
					&& equal(entryChildren[i].getPluginId(), entry
139
				LogEntry logEntry = (LogEntry) entryChildren[i];
124
							.getPluginId())
140
				
125
					&& entryChildren[i].getSeverity() == entry.getSeverity()
141
				if (equal(logEntry.getMessage(), thisEntry.getMessage())
126
					&& equal(entryChildren[i].getSeverityText(), entry
142
						&& equal(logEntry.getDate(), thisEntry.getDate())
127
							.getSeverityText())) {
143
						&& equal(logEntry.getPluginId(), thisEntry
128
				childIndex = i;
144
								.getPluginId())
129
				break;
145
						&& logEntry.getSeverity() == thisEntry.getSeverity()
146
						&& equal(logEntry.getSeverityText(), thisEntry
147
								.getSeverityText())) {
148
					childIndex = i;
149
					break;
150
				}
130
			}
151
			}
131
		}
152
		}
132
	}
153
	}
Lines 144-150 Link Here
144
		return d1.equals(d2);
165
		return d1.equals(d2);
145
	}
166
	}
146
167
147
	private boolean isChild(LogEntry entry) {
168
	private boolean isChild(AbstractEntry entry) {
148
		return entry.getParent(entry) != null;
169
		return entry.getParent(entry) != null;
149
	}
170
	}
150
	
171
	
Lines 306-313 Link Here
306
			updateProperties();
327
			updateProperties();
307
			return;
328
			return;
308
		}
329
		}
309
		if (selectedEntry instanceof LogEntry) {
330
		if (selectedEntry instanceof AbstractEntry) {
310
			entry = (LogEntry)selectedEntry;
331
			entry = (AbstractEntry)selectedEntry;
311
			initialize();
332
			initialize();
312
			updateProperties();
333
			updateProperties();
313
		}
334
		}
Lines 325-331 Link Here
325
	
346
	
326
	public void updateProperties() {	
347
	public void updateProperties() {	
327
		if (isChild(entry)){
348
		if (isChild(entry)){
328
			parentEntry = (LogEntry) entry.getParent(entry);
349
			parentEntry = (AbstractEntry) entry.getParent(entry);
329
			setEntryChildren(parentEntry);
350
			setEntryChildren(parentEntry);
330
			resetChildIndex();
351
			resetChildIndex();
331
			if (childIndex == entryChildren.length - 1)
352
			if (childIndex == entryChildren.length - 1)
Lines 334-354 Link Here
334
355
335
		resetTotalElementCount();
356
		resetTotalElementCount();
336
		
357
		
337
		String strDate = entry.getFormattedDate();
358
		LogSession session = null;
338
		dateLabel.setText(strDate);
359
		
339
		severityImageLabel.setImage(labelProvider.getColumnImage(entry, 0));
360
		if (entry instanceof LogEntry) {
340
		severityLabel.setText(entry.getSeverityText());
361
			LogEntry logEntry = (LogEntry) entry;
341
		msgText.setText(entry.getMessage() != null ? entry.getMessage() : ""); //$NON-NLS-1$
362
			
342
		String stack = entry.getStack();
363
			String strDate = logEntry.getFormattedDate();
343
		if (stack != null) {
364
			dateLabel.setText(strDate);
344
			stackTraceText.setText(stack);
365
			severityImageLabel.setImage(labelProvider.getColumnImage(entry, 0));
345
		} else {
366
			severityLabel.setText(logEntry.getSeverityText());
346
			stackTraceText.setText(Messages.EventDetailsDialog_noStack);
367
			msgText.setText(logEntry.getMessage() != null ? logEntry.getMessage() : ""); //$NON-NLS-1$
368
			String stack = logEntry.getStack();
369
			if (stack != null) {
370
				stackTraceText.setText(stack);
371
			} else {
372
				stackTraceText.setText(Messages.EventDetailsDialog_noStack);
373
			}
374
			session = logEntry.getSession();
375
			
376
		} else if (entry instanceof LogSession) {
377
			session = (LogSession) entry;
378
			
379
			dateLabel.setText(""); //$NON-NLS-1$
380
			severityImageLabel.setImage(null);
381
			severityLabel.setText(""); //$NON-NLS-1$
382
			msgText.setText(""); //$NON-NLS-1$
383
			stackTraceText.setText(""); //$NON-NLS-1$
347
		}
384
		}
348
		LogSession session = entry.getSession();
385
		
349
		if (session != null && session.getSessionData() != null)
386
		if (session != null && session.getSessionData() != null)
350
			sessionDataText.setText(session.getSessionData());
387
			sessionDataText.setText(session.getSessionData());
351
388
		
352
		updateButtons();
389
		updateButtons();
353
	}
390
	}
354
	
391
	
Lines 363-377 Link Here
363
		}
400
		}
364
	}
401
	}
365
	
402
	
366
	private void findNextSelectedChild(LogEntry originalEntry){
403
	private void findNextSelectedChild(AbstractEntry originalEntry){
367
		if (isChild (parentEntry)){
404
		if (isChild (parentEntry)){
368
			// we're at the end of the child list; find next parent
405
			// we're at the end of the child list; find next parent
369
			// to select.  If the parent is a child at the end of the child
406
			// to select.  If the parent is a child at the end of the child
370
			// list, find its next parent entry to select, etc.
407
			// list, find its next parent entry to select, etc.
371
			
408
			
372
			entry = parentEntry;
409
			entry = parentEntry;
373
			setEntryChildren((LogEntry)parentEntry.getParent(parentEntry));
410
			setEntryChildren((AbstractEntry)parentEntry.getParent(parentEntry));
374
			parentEntry = (LogEntry)parentEntry.getParent(parentEntry);
411
			parentEntry = (AbstractEntry)parentEntry.getParent(parentEntry);
375
			resetChildIndex();
412
			resetChildIndex();
376
			isLastChild = childIndex == entryChildren.length-1;
413
			isLastChild = childIndex == entryChildren.length-1;
377
			if (isLastChild){
414
			if (isLastChild){
Lines 386-400 Link Here
386
		}
423
		}
387
	}
424
	}
388
	
425
	
389
	private boolean nextChildExists(LogEntry originalEntry, LogEntry originalParent, LogEntry[] originalEntries){
426
	private boolean nextChildExists(AbstractEntry originalEntry, AbstractEntry originalParent, AbstractEntry[] originalEntries){
390
		if (isChild (parentEntry)){
427
		if (isChild (parentEntry)){
391
			// we're at the end of the child list; find next parent
428
			// we're at the end of the child list; find next parent
392
			// to select.  If the parent is a child at the end of the child
429
			// to select.  If the parent is a child at the end of the child
393
			// list, find its next parent entry to select, etc.
430
			// list, find its next parent entry to select, etc.
394
			
431
			
395
			entry = parentEntry;
432
			entry = parentEntry;
396
			setEntryChildren((LogEntry)parentEntry.getParent(parentEntry));
433
			setEntryChildren((AbstractEntry)parentEntry.getParent(parentEntry));
397
			parentEntry = (LogEntry)parentEntry.getParent(parentEntry);
434
			parentEntry = (AbstractEntry)parentEntry.getParent(parentEntry);
398
			resetChildIndex();
435
			resetChildIndex();
399
			if (childIndex == entryChildren.length-1){
436
			if (childIndex == entryChildren.length-1){
400
				nextChildExists(originalEntry, originalParent, originalEntries);
437
				nextChildExists(originalEntry, originalParent, originalEntries);
Lines 413-451 Link Here
413
		return false;
450
		return false;
414
		
451
		
415
	}
452
	}
453
	
454
	/**
455
	 * Sets entry children (Prev-Next navigable) to top-level elements
456
	 */
416
	private void setEntryChildren(){
457
	private void setEntryChildren(){
417
		Object[] children = ((LogViewContentProvider)provider.getContentProvider()).getElements(null);
458
		AbstractEntry[] children = getElements();
418
459
419
		if (comparator != null)
460
		if (comparator != null)
420
			Arrays.sort(children, comparator);
461
			Arrays.sort(children, comparator);
421
		entryChildren = new LogEntry[children.length];
462
		entryChildren = new AbstractEntry[children.length];
422
		
463
		
423
		System.arraycopy(children,0,entryChildren,0,children.length);
464
		System.arraycopy(children,0,entryChildren,0,children.length);
424
	}
465
	}
425
	
466
	
426
	private void resetTotalElementCount(){
467
	private void resetTotalElementCount(){
427
		totalElementCount = entry.getSession().getEntries().size();
468
		AbstractEntry parent = ((AbstractEntry)entry.getParent(entry));
469
		if (parent == null) {
470
			totalElementCount = getElements().length;
471
		} else {
472
			totalElementCount = parent.getChildren(parent).length;
473
		}
428
	}
474
	}
429
	
475
	
430
	private void setEntryChildren(LogEntry entry){
476
	/**
431
		LogSession session = entry.getSession();
477
	 * Sets entry children (Prev-Next navigable) to children of given entry
432
		if (session == null)
478
	 */
433
			return;
479
	private void setEntryChildren(AbstractEntry entry){
480
		Object[] children = entry.getChildren(entry);
434
		
481
		
435
		List children = session.getEntries();
436
		if (comparator != null)
482
		if (comparator != null)
437
			Collections.sort(children, comparator);
483
			Arrays.sort(children, comparator);
438
		entryChildren = (LogEntry[])children.toArray(new LogEntry[children.size()]);
484
		
485
		List result = new ArrayList();
486
		for (int i = 0; i < children.length; i++) {
487
			if (children[i] instanceof AbstractEntry) {
488
				result.add(children[i]);
489
			}
490
		}
491
		
492
		entryChildren = (AbstractEntry[])result.toArray(new AbstractEntry[result.size()]);
439
	}
493
	}
440
494
	
495
	/**
496
	 * Returns number of children of current parent node.
497
	 * @return
498
	 */
441
	private int getParentElementNum(){
499
	private int getParentElementNum(){
442
		LogEntry itemEntry = (LogEntry)((IStructuredSelection)provider.getSelection()).getFirstElement();
500
		AbstractEntry itemEntry = (AbstractEntry)((IStructuredSelection)provider.getSelection()).getFirstElement();
443
		itemEntry = getRootEntry(itemEntry);
501
502
		//itemEntry = getRootEntry(itemEntry);
503
		
504
		AbstractEntry itemParent = (AbstractEntry) itemEntry.getParent(itemEntry);
505
		if (itemParent != null) {
506
			setEntryChildren(itemEntry);
507
		} else {
508
			setEntryChildren(); // if at top level, the children are top-level
509
		}
444
		
510
		
445
		setEntryChildren(itemEntry);
446
		for (int i = 0; i<entryChildren.length; i++){
511
		for (int i = 0; i<entryChildren.length; i++){
447
			try {
512
			try {
448
				LogEntry littleEntry = entryChildren[i];
513
				AbstractEntry littleEntry = entryChildren[i];
449
				if (itemEntry.equals(littleEntry)){
514
				if (itemEntry.equals(littleEntry)){
450
					return i;
515
					return i;
451
				}
516
				}
Lines 456-467 Link Here
456
		return 0;
521
		return 0;
457
	}
522
	}
458
	
523
	
459
	private LogEntry getRootEntry(LogEntry entry){
460
		if (!isChild(entry))
461
			return entry;
462
		return getRootEntry((LogEntry)entry.getParent(entry));
463
	}
464
	
465
	public SashForm getSashForm(){
524
	public SashForm getSashForm(){
466
		return sashForm;
525
		return sashForm;
467
	}
526
	}
Lines 696-699 Link Here
696
		s.put("sashWidth1", sashWeights[0]); //$NON-NLS-1$
755
		s.put("sashWidth1", sashWeights[0]); //$NON-NLS-1$
697
		s.put("sashWidth2", sashWeights[1]); //$NON-NLS-1$
756
		s.put("sashWidth2", sashWeights[1]); //$NON-NLS-1$
698
	}
757
	}
758
	
759
	/**
760
	 * Utility method to get all top level elements of the Log View
761
	 * @return top level elements of the Log View
762
	 */
763
	private AbstractEntry[] getElements() {
764
		return (AbstractEntry[])((ITreeContentProvider)provider.getContentProvider()).getElements(null);
765
	}
699
}
766
}
(-)src/org/eclipse/ui/internal/views/log/LogReader.java (-8 / +39 lines)
Lines 38-44 Link Here
38
	
38
	
39
	private static LogSession currentSession;
39
	private static LogSession currentSession;
40
		
40
		
41
	public static void parseLogFile(File file, ArrayList sessions, IMemento memento) {
41
	public static void parseLogFile(File file, List entries, IMemento memento) {
42
		if (memento.getString(LogView.P_USE_LIMIT).equals("true") //$NON-NLS-1$
42
		if (memento.getString(LogView.P_USE_LIMIT).equals("true") //$NON-NLS-1$
43
				&& memento.getInteger(LogView.P_LOG_LIMIT).intValue() == 0)
43
				&& memento.getInteger(LogView.P_LOG_LIMIT).intValue() == 0)
44
			return;
44
			return;
Lines 112-130 Link Here
112
					updateCurrentSession(session);
112
					updateCurrentSession(session);
113
					// if current session is most recent and not showing all sessions
113
					// if current session is most recent and not showing all sessions
114
					if (currentSession.equals(session) && !memento.getString(LogView.P_SHOW_ALL_SESSIONS).equals("true")) //$NON-NLS-1$
114
					if (currentSession.equals(session) && !memento.getString(LogView.P_SHOW_ALL_SESSIONS).equals("true")) //$NON-NLS-1$
115
						sessions.clear();
115
						entries.clear();
116
					sessions.add(currentSession);
117
				} else if (state == ENTRY_STATE) {
116
				} else if (state == ENTRY_STATE) {
118
					if (currentSession == null) { // create fake session if there was no any
117
					if (currentSession == null) { // create fake session if there was no any
119
						currentSession = new LogSession();
118
						currentSession = new LogSession();
120
						sessions.add(currentSession);
121
					}
119
					}
122
					LogEntry entry = new LogEntry();
120
					LogEntry entry = new LogEntry();
123
					entry.setSession(currentSession);
121
					entry.setSession(currentSession);
124
					entry.processEntry(line);
122
					entry.processEntry(line);
125
					setNewParent(parents, entry, 0);
123
					setNewParent(parents, entry, 0);
126
					current = entry;
124
					current = entry;
127
					addEntry(current, currentSession.getEntries(), memento, false);
125
					addEntry(current, entries, memento, false);
128
				} else if (state == SUBENTRY_STATE) {
126
				} else if (state == SUBENTRY_STATE) {
129
					if (parents.size() > 0) {
127
					if (parents.size() > 0) {
130
						LogEntry entry = new LogEntry();
128
						LogEntry entry = new LogEntry();
Lines 199-209 Link Here
199
		if (doAdd) {
197
		if (doAdd) {
200
			if (useCurrentSession)
198
			if (useCurrentSession)
201
				current.setSession(currentSession);
199
				current.setSession(currentSession);
200
			
202
			entries.add(0, current);
201
			entries.add(0, current);
203
			
202
			
204
			if (memento.getString(LogView.P_USE_LIMIT).equals("true") //$NON-NLS-1$
203
			if (memento.getString(LogView.P_USE_LIMIT).equals("true")) {//$NON-NLS-1$
205
				&& entries.size() > memento.getInteger(LogView.P_LOG_LIMIT).intValue())
204
				int limit = memento.getInteger(LogView.P_LOG_LIMIT).intValue();
206
				entries.remove(entries.size() - 1);
205
				if (entries.size() > limit) {
206
					entries.remove(entries.size() - 1);
207
				}
208
			}
209
		}
210
	}
211
	
212
	// TODO Merge two addEntry methods into one
213
	public synchronized static void addEntry(LogEntry current, LogSession session, IMemento memento, boolean useCurrentSession) {
214
		int severity = current.getSeverity();
215
		boolean doAdd = true;
216
		switch(severity) {
217
			case IStatus.INFO:
218
				doAdd = memento.getString(LogView.P_LOG_INFO).equals("true"); //$NON-NLS-1$
219
				break;
220
			case IStatus.WARNING:
221
				doAdd = memento.getString(LogView.P_LOG_WARNING).equals("true"); //$NON-NLS-1$
222
				break;
223
			case IStatus.ERROR:
224
				doAdd = memento.getString(LogView.P_LOG_ERROR).equals("true"); //$NON-NLS-1$
225
				break;
226
		}
227
		if (doAdd) {
228
			if (useCurrentSession)
229
				current.setSession(currentSession);
230
			
231
			
232
			session.addChild(current);
233
			
234
			if (memento.getString(LogView.P_USE_LIMIT).equals("true")) {//$NON-NLS-1$
235
				int limit = memento.getInteger(LogView.P_LOG_LIMIT).intValue();
236
				session.addChild(current, limit);
237
			}
207
		}
238
		}
208
	}
239
	}
209
240
(-)src/org/eclipse/ui/internal/views/log/FilterDialog.java (+24 lines)
Lines 21-26 Link Here
21
import org.eclipse.swt.layout.GridData;
21
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.layout.GridLayout;
22
import org.eclipse.swt.layout.GridLayout;
23
import org.eclipse.swt.widgets.Button;
23
import org.eclipse.swt.widgets.Button;
24
import org.eclipse.swt.widgets.Combo;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Group;
27
import org.eclipse.swt.widgets.Group;
Lines 39-44 Link Here
39
	private Button infoButton;
40
	private Button infoButton;
40
	private Button showAllButton;
41
	private Button showAllButton;
41
	private IMemento memento;
42
	private IMemento memento;
43
	private Combo groupByCombo;
44
	
45
	private static final String[] groupByItems = new String[] { // groupByItems must have the same order as their respective LogView.GROUP_BY_* consts
46
		"None", "Session", "Plug-in" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // TODO EXTERNALIZE
47
	};
42
48
43
	public FilterDialog(Shell parentShell, IMemento memento) {
49
	public FilterDialog(Shell parentShell, IMemento memento) {
44
		super(parentShell);
50
		super(parentShell);
Lines 50-55 Link Here
50
		createEventTypesGroup(container);
56
		createEventTypesGroup(container);
51
		createLimitSection(container);
57
		createLimitSection(container);
52
		createSessionSection(container);
58
		createSessionSection(container);
59
		createGroupBySection(container);
53
		
60
		
54
		Dialog.applyDialogFont(container);
61
		Dialog.applyDialogFont(container);
55
		return container;
62
		return container;
Lines 136-141 Link Here
136
		}
143
		}
137
	}
144
	}
138
	
145
	
146
	protected void createGroupBySection(Composite parent) {
147
		Composite container = new Composite(parent, SWT.NONE);
148
		container.setLayout(new GridLayout());
149
		container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
150
151
		Label label = new Label(container, SWT.NONE);
152
		label.setText("Group by"); //$NON-NLS-1$ //TODO EXTERNALIZE
153
154
		groupByCombo = new Combo(container, SWT.NONE);
155
		groupByCombo.setItems(groupByItems);
156
157
		Integer value = memento.getInteger(LogView.P_GROUP_BY);
158
		groupByCombo.select(value == null ? LogView.GROUP_BY_NONE : value
159
				.intValue());
160
	}
161
	
139
	protected void createButtonsForButtonBar(Composite parent) {
162
	protected void createButtonsForButtonBar(Composite parent) {
140
		okButton = createButton(
163
		okButton = createButton(
141
				parent,
164
				parent,
Lines 156-161 Link Here
156
		memento.putString(LogView.P_LOG_LIMIT, limitText.getText());
179
		memento.putString(LogView.P_LOG_LIMIT, limitText.getText());
157
		memento.putString(LogView.P_USE_LIMIT, limit.getSelection() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
180
		memento.putString(LogView.P_USE_LIMIT, limit.getSelection() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
158
		memento.putString(LogView.P_SHOW_ALL_SESSIONS, showAllButton.getSelection() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
181
		memento.putString(LogView.P_SHOW_ALL_SESSIONS, showAllButton.getSelection() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
182
		memento.putInteger(LogView.P_GROUP_BY, groupByCombo.getSelectionIndex());
159
		super.okPressed();
183
		super.okPressed();
160
	}
184
	}
161
185
(-)src/org/eclipse/ui/internal/views/log/AbstractEntry.java (+74 lines)
Added Link Here
1
package org.eclipse.ui.internal.views.log;
2
3
import java.io.PrintWriter;
4
import java.util.ArrayList;
5
import java.util.List;
6
7
import org.eclipse.core.runtime.PlatformObject;
8
import org.eclipse.jface.resource.ImageDescriptor;
9
import org.eclipse.ui.model.IWorkbenchAdapter;
10
11
/**
12
 * 
13
 *
14
 */
15
public abstract class AbstractEntry extends PlatformObject implements IWorkbenchAdapter {
16
17
	private List children;
18
	private Object parent;
19
	
20
	public void addChild(AbstractEntry child) {
21
		if (children == null) {
22
			children = new ArrayList();
23
		}
24
		children.add(0, child);
25
		child.setParent(this);
26
	}
27
	
28
	public void addChild(AbstractEntry child, int limit) {
29
		addChild(child);
30
		if (children.size() > limit) {
31
			children.remove(children.size() - 1);
32
		}
33
	}
34
	
35
	/**
36
	 * @see IWorkbenchAdapter#getChildren(Object)
37
	 */
38
	public Object[] getChildren(Object parent) {
39
		if (children == null)
40
			return new Object[0];
41
		return children.toArray();
42
	}
43
	
44
	public boolean hasChildren() {
45
		return children != null && children.size() > 0;
46
	}
47
48
	/**
49
	 * @see IWorkbenchAdapter#getImageDescriptor(Object)
50
	 */
51
	public ImageDescriptor getImageDescriptor(Object object) {
52
		return null;
53
	}
54
55
	/**
56
	 * @see IWorkbenchAdapter#getLabel(Object)
57
	 */
58
	public String getLabel(Object o) {
59
		return null;
60
	}
61
62
	/**
63
	 * @see IWorkbenchAdapter#getParent(Object)
64
	 */
65
	public Object getParent(Object o) {
66
		return parent;
67
	}
68
	
69
	public void setParent(AbstractEntry parent) {
70
		this.parent = parent;
71
	}
72
73
	public abstract void write(PrintWriter writer);
74
}
(-)src/org/eclipse/ui/internal/views/log/Group.java (+28 lines)
Added Link Here
1
package org.eclipse.ui.internal.views.log;
2
3
import java.io.PrintWriter;
4
5
public class Group extends AbstractEntry {
6
7
	private Object groupId;
8
	
9
	public Group(Object groupId) {
10
		this.groupId = groupId;
11
	}
12
	
13
	public void write(PrintWriter writer) {
14
		// empty
15
	}
16
	
17
	public int hashCode() {
18
		return groupId.hashCode();
19
	}
20
21
	public boolean equals(Object o) {
22
		return groupId.equals(o);
23
	}
24
	
25
	public String toString() {
26
		return groupId.toString();
27
	}
28
}

Return to bug 207344