package es.iiia.sgi.views;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import es.iiia.sgi.handlers.CallRuleEditorHandler;
import es.iiia.sgi.providers.RuleContentProvider;
import es.iiia.sgi.providers.RuleLabelProvider;
import es.iiia.shapeeditor.ShapeGrammarInput;
public class RuleView extends ListView {
public static final String ID = "es.iiia.sgi.views.ruleview";
RuleContentProvider contentProvider;
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
// register help
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, "es.iiia.sgi.rules");
}
@Override
public IStructuredContentProvider getContentProvider() {
if (this.contentProvider == null) {
this.contentProvider = new RuleContentProvider(this.getViewer());
}
return this.contentProvider;
}
@Override
protected String getDoubleClickCommandId() {
return CallRuleEditorHandler.ID;
}
@Override
protected ILabelProvider getLabelProvider() {
return new RuleLabelProvider();
}
public void setContent(ShapeGrammarInput input) {
this.contentProvider.setContent(input);
}
}