/com.plugin.log4j.viewer/src/com/log4jviewer/ui/views/ClearLogsAction.java

https://code.google.com/p/log4j-viewer/ · Java · 32 lines · 20 code · 6 blank · 6 comment · 0 complexity · e9dafe344183f70219b8d60cdfd3dd22 MD5 · raw file

  1. package com.log4jviewer.ui.views;
  2. import org.eclipse.jface.action.IAction;
  3. import org.eclipse.jface.viewers.ISelection;
  4. import org.eclipse.ui.IViewActionDelegate;
  5. import org.eclipse.ui.IViewPart;
  6. /**
  7. * Class represents a handler for 'Clear' button. It removes all logs from log list and clears LogView table.
  8. *
  9. * @author <a href="mailto:rd.ryly@gmail.com">Ruslan Diachenko</a>
  10. */
  11. public class ClearLogsAction implements IViewActionDelegate {
  12. private LogView logView;
  13. @Override
  14. public void run(final IAction action) {
  15. logView.getLogList().clear();
  16. logView.clearLogTable();
  17. }
  18. @Override
  19. public void selectionChanged(final IAction action, final ISelection selection) {
  20. // no code
  21. }
  22. @Override
  23. public void init(final IViewPart view) {
  24. this.logView = (LogView) view;
  25. }
  26. }