1 /******************************************************************************* 2 * Copyright (c) 2006, 2015 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.help.internal.dynamic; 15 16 import org.eclipse.help.internal.UAElement; 17 18 /* 19 * A handler that is notified when the document processor visits a node, 20 * allowing it to process the node and return a result. 21 */ 22 public abstract class ProcessorHandler { 23 24 public static final short UNHANDLED = 0; 25 public static final short HANDLED_CONTINUE = 1; 26 public static final short HANDLED_SKIP = 2; 27 28 private DocumentProcessor processor; 29 30 /* 31 * Will be called for every node visited by the processor, 32 * except those requested to be skipped. 33 */ handle(UAElement element, String id)34 public abstract short handle(UAElement element, String id); 35 36 /* 37 * Returns the processor that is calling this handler. 38 */ getProcessor()39 public DocumentProcessor getProcessor() { 40 return processor; 41 } 42 43 /* 44 * Sets the processor that is calling this handler. This should only 45 * be called by the processor. 46 */ setProcessor(DocumentProcessor processor)47 public void setProcessor(DocumentProcessor processor) { 48 this.processor = processor; 49 } 50 } 51