blob: 16ddf6b7a917ff836ce3a0049e94dea40c27dfc8 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* 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:
* Pierre Allard,
* Regent L'Archeveque,
* Olivier L. Larouche - initial API and implementation
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.common.emf.ui.impl;
import org.eclipse.apogy.common.emf.ApogyCommonEMFFacade;
import org.eclipse.apogy.common.emf.ui.Activator;
import org.eclipse.apogy.common.emf.ui.ApogyCommonEMFUIFactory;
import org.eclipse.apogy.common.emf.ui.ETypedElementToFormatStringMap;
import org.eclipse.apogy.common.emf.ui.preferences.PreferencesConstants;
public class DecimalFormatRegistryCustomImpl extends DecimalFormatRegistryImpl {
// FIXME Should be centralized.
// private static DecimalFormatRegistry instance = null;
//
// public static DecimalFormatRegistry getInstance() {
// if (instance == null) {
// instance = new DecimalFormatRegistryImpl();
// String stringMap = Activator.getDefault().getPreferenceStore()
// .getString(PreferencesConstants.TYPED_ELEMENTS_FORMAT_ID);
// if (!"".equals(stringMap)) {
// EObject object = ApogyCommonEMFFacade.INSTANCE.deserializeString(stringMap,
// PreferencesConstants.TYPED_ELEMENTS_FORMAT_ID);
// if (object instanceof ETypedElementToFormatStringMap) {
// instance.setEntriesMap((ETypedElementToFormatStringMap) object);
// }
// }
// }
//
// return instance;
// }
@Override
public ETypedElementToFormatStringMap getEntriesMap() {
ETypedElementToFormatStringMap map = super.getEntriesMap();
if (map == null) {
map = ApogyCommonEMFUIFactory.eINSTANCE.createETypedElementToFormatStringMap();
setEntriesMap(map);
}
return map;
}
public void save() {
Activator.getDefault().getPreferenceStore().setValue(PreferencesConstants.TYPED_ELEMENTS_FORMAT_ID,
ApogyCommonEMFFacade.INSTANCE.serializeEObject(getEntriesMap(),
PreferencesConstants.TYPED_ELEMENTS_FORMAT_ID));
}
} // DecimalFormatRegistryImpl