Skip to main content
summaryrefslogtreecommitdiffstats
blob: 940e24bf2596dc9d8352cc82d3d99462e19e001b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.Import;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactType;

/**
 * @author Robert A. Fisher
 */
public abstract class WordOutlineContentHandler implements IWordOutlineContentHandler {
   protected WordOutlineExtractor extractor;
   protected ArtifactType headingDescriptor;
   protected ArtifactType mainDescriptor;
   private String name;

   public WordOutlineContentHandler() {
      this.extractor = null;
      this.headingDescriptor = null;
      this.mainDescriptor = null;
      this.name = null;
   }

   /**
    * Returns the name that was in the extension point. Clients may re-implement this method.
    */
   public String getName() {
      if (name == null) {
         throw new IllegalStateException("Not yet initialized");
      }
      return name;
   }

   /**
    * Setup the name from the extension point.
    */
   public final void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
      name = config.getAttribute("name");
      if (name == null || name.equals("")) {
         name = "<no name>";
      }
   }

   /**
    * Get rid of references setup in init. Subclasses should extend this method if any other resources should be
    * released.
    */
   public void dispose() {
      extractor = null;
      headingDescriptor = null;
      mainDescriptor = null;
   }

   /**
    * Save off references. Subclasses should extend this method if anyother resources need to be setup.
    */
   public void init(WordOutlineExtractor extractor, ArtifactType headingDescriptor, ArtifactType mainDescriptor) {
      this.extractor = extractor;
      this.headingDescriptor = headingDescriptor;
      this.mainDescriptor = mainDescriptor;
   }
}

Back to the top