1 11 12 package org.eclipse.ui.internal.cheatsheets.composite.parser; 13 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.osgi.util.NLS; 16 import org.eclipse.ui.internal.cheatsheets.Messages; 17 import org.eclipse.ui.internal.cheatsheets.composite.model.AbstractTask; 18 import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetRegistryReader; 19 import org.w3c.dom.Node ; 20 21 public class EditableTaskParseStrategy implements ITaskParseStrategy { 22 23 private boolean editableChildErrorReported; 24 25 public void init() { 26 editableChildErrorReported = false; 27 } 28 29 public boolean parseElementNode(Node childNode, Node parentNode, 30 AbstractTask parentTask, IStatusContainer status) { 31 boolean isElementHandled = true; 32 String nodeName = childNode.getNodeName(); 33 if (CompositeCheatSheetParser.isAbstractTask(nodeName)) { 34 if (!editableChildErrorReported ){ 35 editableChildErrorReported = true; 36 String message = NLS.bind( 37 Messages.ERROR_EDITABLE_TASK_WITH_CHILDREN, 38 (new Object [] { parentTask.getName()})); 39 status.addStatus(IStatus.ERROR, message, null); 40 } 41 } else { 42 isElementHandled = false; 43 } 44 return isElementHandled; 45 } 46 47 public void parsingComplete(AbstractTask parentTask, IStatusContainer status) { 48 if (parentTask.getKind() == null) { 49 String message = NLS.bind( 50 Messages.ERROR_PARSING_TASK_NO_KIND, 51 (new Object [] { parentTask.getName()})); 52 status.addStatus(IStatus.ERROR, message, null); 53 } else if (CheatSheetRegistryReader.getInstance(). 54 findTaskEditor(parentTask.getKind()) == null) { 55 String message = NLS.bind( 56 Messages.ERROR_PARSING_TASK_INVALID_KIND, 57 (new Object [] { parentTask.getKind(), ICompositeCheatsheetTags.TASK, parentTask.getName()})); 58 status.addStatus(IStatus.ERROR, message, null); 59 } 60 } 61 62 } 63 | Popular Tags |