blob: 232d1bbfbbed5d2904e417d9417eab1b0e789e7c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2007 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.dltk.javascript.internal.ui.templates;
import org.eclipse.dltk.javascript.internal.ui.JavaScriptUI;
import org.eclipse.dltk.ui.templates.ScriptTemplateAccess;
import org.eclipse.jface.preference.IPreferenceStore;
/**
* Provides access to Javascript templates
*/
public class JavaScriptTemplateAccess extends ScriptTemplateAccess {
// Template
private static final String CUSTOM_TEMPLATES_KEY = "org.eclipse.dltk.javascript.Templates";
private static JavaScriptTemplateAccess instance;
public static synchronized JavaScriptTemplateAccess getInstance() {
if (instance == null) {
instance = new JavaScriptTemplateAccess();
}
return instance;
}
/*
* @see ScriptTemplateAccess#getPreferenceStore()
*/
protected IPreferenceStore getPreferenceStore() {
return JavaScriptUI.getDefault().getPreferenceStore();
}
@Override
protected String[] getContextTypeIds() {
return new String[] {
JavaScriptUniversalTemplateContextType.CONTEXT_TYPE_ID,
JavaScriptExpressionTemplateContextType.EXPRESSION_CONTEXT_TYPE_ID,
JSDocTemplateContextType.CONTEXT_TYPE_ID };
}
/*
* @see ScriptTemplateAccess#getCustomTemplatesKey()
*/
protected String getCustomTemplatesKey() {
return CUSTOM_TEMPLATES_KEY;
}
}