blob: 629fa262d17214be08e527da491420e0d67b06c0 [file] [log] [blame]
david_williamscfdb2cd2004-11-11 08:37:49 +00001/*******************************************************************************
2 * Copyright (c) 2001, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Jens Lukowski/Innoopract - initial renaming/restructuring
11 *
12 *******************************************************************************/
david_williams2e7166e2005-04-13 05:28:38 +000013package org.eclipse.wst.sse.core.internal.ltk.modelhandler;
david_williamscfdb2cd2004-11-11 08:37:49 +000014
15import java.util.ArrayList;
16import java.util.Collection;
17import java.util.List;
18
david_williams7a65dc22005-04-09 02:19:50 +000019import org.eclipse.wst.sse.core.internal.document.IDocumentCharsetDetector;
david_williamscfdb2cd2004-11-11 08:37:49 +000020import org.eclipse.wst.sse.core.internal.modelhandler.PluginContributedFactoryReader;
21
david_williams1b045162005-03-17 22:25:26 +000022/**
23 * ISSUE: need to provide this functionality in improved API.
24 */
david_williamscfdb2cd2004-11-11 08:37:49 +000025
26public abstract class AbstractModelHandler implements IModelHandler {
27 private String associatedContentTypeId;
28 private boolean defaultSetting;
29 private String modelHandlerID;
30
david_williamscfdb2cd2004-11-11 08:37:49 +000031 public AbstractModelHandler() {
32 super();
33 }
34
35 /**
36 * These factories are added automatically by model manager
37 */
38 public List getAdapterFactories() {
39 List result = new ArrayList();
40 Collection holdFactories = PluginContributedFactoryReader.getInstance().getFactories(this);
41 if (holdFactories != null) {
42 result.addAll(holdFactories);
43 }
44 return result;
45 }
46
47 public String getAssociatedContentTypeId() {
48 return associatedContentTypeId;
49 }
50
51 public abstract IDocumentCharsetDetector getEncodingDetector();
52
53 public String getId() {
54 return modelHandlerID;
55 }
56
57 public boolean isDefault() {
58 return defaultSetting;
59 }
60
61 protected void setAssociatedContentTypeId(String contentTypeId) {
62 associatedContentTypeId = contentTypeId;
63 }
64
65 public void setDefault(boolean defaultParam) {
66 defaultSetting = defaultParam;
67 }
68
69 protected void setId(String id) {
70 modelHandlerID = id;
71 }
72}