// Path: net.resheim.eclipse.timekeeper.db/src/main/java/net/resheim/eclipse/timekeeper/db/report/ReportTemplate.java
// public class ReportTemplate implements Serializable {
// 	
// 	private static final long serialVersionUID = 3796302809926743470L;
// 	
// 	String name;
// 	String code;
// 	Type type;
// 	
// 	public enum Type {
// 		/** Plain text */
// 		TEXT,
// 		/** Hyper Text Markup Language */
// 		HTML,
// 		/** Rich Text Format */
// 		RTF
// 	}
// 
// 	public ReportTemplate(String name, Type type, String code) {
// 		super();
// 		this.name = name;
// 		this.setType(type);
// 		this.code = code;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public String getCode() {
// 		return code;
// 	}
// 
// 	public void setCode(String code) {
// 		this.code = code;
// 	}
// 
// 	public Type getType() {
// 		return type;
// 	}
// 
// 	public void setType(Type type) {
// 		this.type = type;
// 	}
// 
// }


import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Enumeration;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.Bundle;
import net.resheim.eclipse.timekeeper.db.report.ReportTemplate;
/*******************************************************************************
 * Copyright © 2018-2019 Torkild U. Resheim
 * 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:
 *     Torkild U. Resheim - initial API and implementation
 *******************************************************************************/
package net.resheim.eclipse.timekeeper.db;




/**
 * Specifies default values for the core Timekeeper preferences.
 */
public class PreferenceInitializer extends AbstractPreferenceInitializer {

	@Override
	public void initializeDefaultPreferences() {
		IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, TimekeeperPlugin.BUNDLE_ID);
		try {
			store.setDefault(TimekeeperPlugin.PREF_DATABASE_LOCATION, TimekeeperPlugin.PREF_DATABASE_LOCATION_SHARED);
			store.setDefault(TimekeeperPlugin.PREF_DATABASE_LOCATION_URL,
					TimekeeperPlugin.getDefault().getSharedLocation());
			// read from the "templates" directory and create a list of templates – all files stored there
			// will be registered.
			Bundle bundle = TimekeeperPlugin.getDefault().getBundle();
			Enumeration<URL> findEntries = bundle.findEntries("templates", "*", true);
// Path: net.resheim.eclipse.timekeeper.db/src/main/java/net/resheim/eclipse/timekeeper/db/report/ReportTemplate.java
// public class ReportTemplate implements Serializable {
// 	
// 	private static final long serialVersionUID = 3796302809926743470L;
// 	
// 	String name;
// 	String code;
// 	Type type;
// 	
// 	public enum Type {
// 		/** Plain text */
// 		TEXT,
// 		/** Hyper Text Markup Language */
// 		HTML,
// 		/** Rich Text Format */
// 		RTF
// 	}
// 
// 	public ReportTemplate(String name, Type type, String code) {
// 		super();
// 		this.name = name;
// 		this.setType(type);
// 		this.code = code;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public String getCode() {
// 		return code;
// 	}
// 
// 	public void setCode(String code) {
// 		this.code = code;
// 	}
// 
// 	public Type getType() {
// 		return type;
// 	}
// 
// 	public void setType(Type type) {
// 		this.type = type;
// 	}
// 
// }


// Path: net.resheim.eclipse.timekeeper.db/src/main/java/net/resheim/eclipse/timekeeper/db/PreferenceInitializer.java
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Enumeration;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.Bundle;
import net.resheim.eclipse.timekeeper.db.report.ReportTemplate;

/*******************************************************************************
 * Copyright © 2018-2019 Torkild U. Resheim
 * 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:
 *     Torkild U. Resheim - initial API and implementation
 *******************************************************************************/
package net.resheim.eclipse.timekeeper.db;




/**
 * Specifies default values for the core Timekeeper preferences.
 */
public class PreferenceInitializer extends AbstractPreferenceInitializer {

	@Override
	public void initializeDefaultPreferences() {
		IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, TimekeeperPlugin.BUNDLE_ID);
		try {
			store.setDefault(TimekeeperPlugin.PREF_DATABASE_LOCATION, TimekeeperPlugin.PREF_DATABASE_LOCATION_SHARED);
			store.setDefault(TimekeeperPlugin.PREF_DATABASE_LOCATION_URL,
					TimekeeperPlugin.getDefault().getSharedLocation());
			// read from the "templates" directory and create a list of templates – all files stored there
			// will be registered.
			Bundle bundle = TimekeeperPlugin.getDefault().getBundle();
			Enumeration<URL> findEntries = bundle.findEntries("templates", "*", true);
			ArrayList<ReportTemplate> templates = new ArrayList<>();