package com.darkyen;

import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.*;
import org.jetbrains.annotations.NotNull;

/**
 * Only used to track default settings.
 */
@State(name="DarkyenusTimeTrackerDefaults", storages = {@Storage("darkyenus-time-tracker-defaults.xml")})
public class TimeTrackerDefaultSettingsComponent implements BaseComponent, PersistentStateComponent<TimeTrackerPersistentState> {

	private final TimeTrackerPersistentState defaultState = new TimeTrackerPersistentState();

	@NotNull
	@Override
	public TimeTrackerPersistentState getState() {
		return defaultState;
	}

	public void setDefaultsFrom(@NotNull TimeTrackerPersistentState templateState) {
		this.defaultState.setDefaultsFrom(templateState);
	}

	@Override
	public void loadState(@NotNull TimeTrackerPersistentState state) {
		this.defaultState.setDefaultsFrom(state);
	}

	@NotNull
	@Override
	public String getComponentName() {
		return "DarkyenusTimeTrackerDefaults";
	}

	@NotNull
	public static TimeTrackerDefaultSettingsComponent instance() {
		final Application application = ApplicationManager.getApplication();
		final TimeTrackerDefaultSettingsComponent component = application
				.getComponent(TimeTrackerDefaultSettingsComponent.class);
		if (component == null) {
			return new TimeTrackerDefaultSettingsComponent();
		}
		return component;
	}
}

@@ -1434,11 +1434,193 @@
 nent;%0A%09%7D
+%0A%0A%09// Empty defaults for backwards compatibility%0A%09@Override%0A%09public void initComponent() %7B%7D%0A%0A%09@Override%0A%09public void disposeComponent() %7B%7D%0A%0A%09@Override%0A%09public void noStateLoaded() %7B%7D
 %0A%7D%0A

Add empty implementations of now-default methods for backwards compatibility