1 11 package org.eclipse.team.internal.ui.synchronize; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.jface.viewers.StructuredViewer; 15 import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; 16 import org.eclipse.ui.IActionBars; 17 18 21 public abstract class AbstractViewerAdvisor { 22 23 private ISynchronizePageConfiguration configuration; 24 private StructuredViewer viewer; 25 26 public AbstractViewerAdvisor(ISynchronizePageConfiguration configuration) { 27 this.configuration = configuration; 28 configuration.setProperty(SynchronizePageConfiguration.P_ADVISOR, this); 29 } 30 31 public ISynchronizePageConfiguration getConfiguration() { 32 return configuration; 33 } 34 35 41 protected void initializeViewer(final StructuredViewer viewer) { 42 Assert.isTrue(this.viewer == null, "Can only be initialized once."); Assert.isTrue(validateViewer(viewer)); 44 this.viewer = viewer; 45 } 46 47 54 protected boolean validateViewer(StructuredViewer viewer) { 55 return true; 56 } 57 58 63 public StructuredViewer getViewer() { 64 return viewer; 65 } 66 67 public abstract void setActionBars(IActionBars actionBars); 68 } 69 | Popular Tags |