Lines 102-107
Link Here
|
102 |
import com.ibm.icu.text.DateFormat; |
102 |
import com.ibm.icu.text.DateFormat; |
103 |
import com.ibm.icu.text.SimpleDateFormat; |
103 |
import com.ibm.icu.text.SimpleDateFormat; |
104 |
|
104 |
|
|
|
105 |
/** |
106 |
* The implementation of the log view |
107 |
* @since 1.0.0 |
108 |
*/ |
105 |
public class LogView extends ViewPart implements ILogListener { |
109 |
public class LogView extends ViewPart implements ILogListener { |
106 |
public static final String P_LOG_WARNING = "warning"; //$NON-NLS-1$ |
110 |
public static final String P_LOG_WARNING = "warning"; //$NON-NLS-1$ |
107 |
public static final String P_LOG_ERROR = "error"; //$NON-NLS-1$ |
111 |
public static final String P_LOG_ERROR = "error"; //$NON-NLS-1$ |
Lines 113-118
Link Here
|
113 |
private static final String P_COLUMN_2 = "column3"; //$NON-NLS-1$ |
117 |
private static final String P_COLUMN_2 = "column3"; //$NON-NLS-1$ |
114 |
private static final String P_COLUMN_3 = "column4"; //$NON-NLS-1$ |
118 |
private static final String P_COLUMN_3 = "column4"; //$NON-NLS-1$ |
115 |
public static final String P_ACTIVATE = "activate"; //$NON-NLS-1$ |
119 |
public static final String P_ACTIVATE = "activate"; //$NON-NLS-1$ |
|
|
120 |
public static final String P_SHOW_FILTER_TEXT = "show_filter_text"; //$NON-NLS-1$ |
116 |
public static final String P_ORDER_TYPE = "orderType"; //$NON-NLS-1$ |
121 |
public static final String P_ORDER_TYPE = "orderType"; //$NON-NLS-1$ |
117 |
public static final String P_ORDER_VALUE = "orderValue"; //$NON-NLS-1$ |
122 |
public static final String P_ORDER_VALUE = "orderValue"; //$NON-NLS-1$ |
118 |
|
123 |
|
Lines 159-169
Link Here
|
159 |
private Action fOpenLogAction; |
164 |
private Action fOpenLogAction; |
160 |
private Action fExportAction; |
165 |
private Action fExportAction; |
161 |
|
166 |
|
|
|
167 |
/** |
168 |
* Constructor |
169 |
*/ |
162 |
public LogView() { |
170 |
public LogView() { |
163 |
fLogs = new ArrayList(); |
171 |
fLogs = new ArrayList(); |
164 |
fInputFile = Platform.getLogFileLocation().toFile(); |
172 |
fInputFile = Platform.getLogFileLocation().toFile(); |
165 |
} |
173 |
} |
166 |
|
174 |
|
|
|
175 |
/* (non-Javadoc) |
176 |
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) |
177 |
*/ |
167 |
public void createPartControl(Composite parent) { |
178 |
public void createPartControl(Composite parent) { |
168 |
Composite composite = new Composite(parent, SWT.NONE); |
179 |
Composite composite = new Composite(parent, SWT.NONE); |
169 |
FillLayout layout = new FillLayout(SWT.VERTICAL); |
180 |
FillLayout layout = new FillLayout(SWT.VERTICAL); |
Lines 184-189
Link Here
|
184 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(fTree, IHelpContextIds.LOG_VIEW); |
195 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(fTree, IHelpContextIds.LOG_VIEW); |
185 |
} |
196 |
} |
186 |
|
197 |
|
|
|
198 |
/** |
199 |
* Creates the actions for the viewsite action bars |
200 |
*/ |
187 |
private void createActions() { |
201 |
private void createActions() { |
188 |
IActionBars bars = getViewSite().getActionBars(); |
202 |
IActionBars bars = getViewSite().getActionBars(); |
189 |
|
203 |
|
Lines 220-225
Link Here
|
220 |
|
234 |
|
221 |
fActivateViewAction = createActivateViewAction(); |
235 |
fActivateViewAction = createActivateViewAction(); |
222 |
mgr.add(fActivateViewAction); |
236 |
mgr.add(fActivateViewAction); |
|
|
237 |
|
238 |
mgr.add(createShowTextFilter()); |
223 |
|
239 |
|
224 |
createPropertiesAction(); |
240 |
createPropertiesAction(); |
225 |
|
241 |
|
Lines 252-258
Link Here
|
252 |
Menu menu = popupMenuManager.createContextMenu(fTree); |
268 |
Menu menu = popupMenuManager.createContextMenu(fTree); |
253 |
fTree.setMenu(menu); |
269 |
fTree.setMenu(menu); |
254 |
} |
270 |
} |
255 |
|
271 |
|
256 |
private Action createActivateViewAction() { |
272 |
private Action createActivateViewAction() { |
257 |
Action action = new Action(Messages.LogView_activate) { // |
273 |
Action action = new Action(Messages.LogView_activate) { // |
258 |
public void run() { |
274 |
public void run() { |
Lines 387-393
Link Here
|
387 |
return action; |
403 |
return action; |
388 |
} |
404 |
} |
389 |
|
405 |
|
|
|
406 |
/** |
407 |
* Creates the Show Text Filter view menu action |
408 |
* @return the new action for the Show Text Filter |
409 |
*/ |
410 |
private Action createShowTextFilter() { |
411 |
Action action = new Action(Messages.LogView_show_filter_text) { |
412 |
public void run() { |
413 |
showFilterText(isChecked()); |
414 |
} |
415 |
}; |
416 |
boolean visible = fMemento.getBoolean(P_SHOW_FILTER_TEXT).booleanValue(); |
417 |
action.setChecked(visible); |
418 |
showFilterText(visible); |
419 |
return action; |
420 |
} |
421 |
|
422 |
/** |
423 |
* Shows/hides the filter text control from the filtered tree. This method also sets the |
424 |
* P_SHOW_FILTER_TEXT preference to the visible state |
425 |
* |
426 |
* @param visible if the filter text control should be shown or not |
427 |
*/ |
428 |
private void showFilterText(boolean visible) { |
429 |
fMemento.putBoolean(P_SHOW_FILTER_TEXT, visible); |
430 |
Composite ctrl = fFilteredTree.getFilterControl().getParent(); |
431 |
GridData gd = (GridData) ctrl.getLayoutData(); |
432 |
gd.exclude = !visible; |
433 |
ctrl.setVisible(visible); |
434 |
fFilteredTree.layout(false); |
435 |
} |
436 |
|
390 |
private void createViewer(Composite parent) { |
437 |
private void createViewer(Composite parent) { |
|
|
438 |
|
391 |
fFilteredTree = new FilteredTree(parent, SWT.FULL_SELECTION, new PatternFilter() { |
439 |
fFilteredTree = new FilteredTree(parent, SWT.FULL_SELECTION, new PatternFilter() { |
392 |
|
440 |
|
393 |
protected boolean isLeafMatch(Viewer viewer, Object element) { |
441 |
protected boolean isLeafMatch(Viewer viewer, Object element) { |
Lines 401-407
Link Here
|
401 |
return false; |
449 |
return false; |
402 |
} |
450 |
} |
403 |
}); |
451 |
}); |
404 |
|
|
|
405 |
fTree = fFilteredTree.getViewer().getTree(); |
452 |
fTree = fFilteredTree.getViewer().getTree(); |
406 |
fTree.setLinesVisible(true); |
453 |
fTree.setLinesVisible(true); |
407 |
createColumns(fTree); |
454 |
createColumns(fTree); |
Lines 509-514
Link Here
|
509 |
fTextShell.dispose(); |
556 |
fTextShell.dispose(); |
510 |
LogReader.reset(); |
557 |
LogReader.reset(); |
511 |
fLabelProvider.disconnect(this); |
558 |
fLabelProvider.disconnect(this); |
|
|
559 |
fFilteredTree.dispose(); |
512 |
super.dispose(); |
560 |
super.dispose(); |
513 |
} |
561 |
} |
514 |
|
562 |
|
Lines 786-815
Link Here
|
786 |
} |
834 |
} |
787 |
|
835 |
|
788 |
private void initializeMemento() { |
836 |
private void initializeMemento() { |
789 |
if (fMemento.getString(P_USE_LIMIT) == null) |
837 |
if (fMemento.getString(P_USE_LIMIT) == null) { |
790 |
fMemento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$ |
838 |
fMemento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$ |
791 |
if (fMemento.getInteger(P_LOG_LIMIT) == null) |
839 |
} |
|
|
840 |
if (fMemento.getInteger(P_LOG_LIMIT) == null) { |
792 |
fMemento.putInteger(P_LOG_LIMIT, 50); |
841 |
fMemento.putInteger(P_LOG_LIMIT, 50); |
793 |
if (fMemento.getString(P_LOG_INFO) == null) |
842 |
} |
|
|
843 |
if (fMemento.getString(P_LOG_INFO) == null) { |
794 |
fMemento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$ |
844 |
fMemento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$ |
795 |
if (fMemento.getString(P_LOG_WARNING) == null) |
845 |
} |
|
|
846 |
if (fMemento.getString(P_LOG_WARNING) == null) { |
796 |
fMemento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$ |
847 |
fMemento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$ |
797 |
if (fMemento.getString(P_LOG_ERROR) == null) |
848 |
} |
|
|
849 |
if (fMemento.getString(P_LOG_ERROR) == null) { |
798 |
fMemento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$ |
850 |
fMemento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$ |
799 |
if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null) |
851 |
} |
|
|
852 |
if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null) { |
800 |
fMemento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$ |
853 |
fMemento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$ |
|
|
854 |
} |
801 |
Integer width = fMemento.getInteger(P_COLUMN_1); |
855 |
Integer width = fMemento.getInteger(P_COLUMN_1); |
802 |
if (width == null || width.intValue() == 0) |
856 |
if (width == null || width.intValue() == 0) { |
803 |
fMemento.putInteger(P_COLUMN_1, 300); |
857 |
fMemento.putInteger(P_COLUMN_1, 300); |
|
|
858 |
} |
804 |
width = fMemento.getInteger(P_COLUMN_2); |
859 |
width = fMemento.getInteger(P_COLUMN_2); |
805 |
if (width == null || width.intValue() == 0) |
860 |
if (width == null || width.intValue() == 0) { |
806 |
fMemento.putInteger(P_COLUMN_2, 150); |
861 |
fMemento.putInteger(P_COLUMN_2, 150); |
|
|
862 |
} |
807 |
width = fMemento.getInteger(P_COLUMN_3); |
863 |
width = fMemento.getInteger(P_COLUMN_3); |
808 |
if (width == null || width.intValue() == 0) |
864 |
if (width == null || width.intValue() == 0) { |
809 |
fMemento.putInteger(P_COLUMN_3, 150); |
865 |
fMemento.putInteger(P_COLUMN_3, 150); |
810 |
if (fMemento.getString(P_ACTIVATE) == null) |
866 |
} |
|
|
867 |
if (fMemento.getString(P_ACTIVATE) == null) { |
811 |
fMemento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$ |
868 |
fMemento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$ |
812 |
|
869 |
} |
|
|
870 |
if(fMemento.getBoolean(P_SHOW_FILTER_TEXT) == null) { |
871 |
fMemento.putBoolean(P_SHOW_FILTER_TEXT, true); |
872 |
} |
813 |
fMemento.putInteger(P_ORDER_VALUE, DESCENDING); |
873 |
fMemento.putInteger(P_ORDER_VALUE, DESCENDING); |
814 |
fMemento.putInteger(P_ORDER_TYPE, DATE); |
874 |
fMemento.putInteger(P_ORDER_TYPE, DATE); |
815 |
} |
875 |
} |