blob: ee4fd6a8208eeeb56bfd66226b1c63c520edfe3b [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,
* Sebastien Gemme - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.core.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class UpdatableCustomImpl extends UpdatableImpl {
private static final Logger Logger = LoggerFactory.getLogger(UpdatableImpl.class);
protected boolean autoUpdateEnabled = getDefaultAutoUpdateEnabled();;
@Override
public void setAutoUpdateEnabled(boolean newAutoUpdateEnabled) {
boolean previousautoUpdateEnabled = getDefaultAutoUpdateEnabled();
super.setAutoUpdateEnabled(newAutoUpdateEnabled);
// If AutoUpdateEnabled has changed from false to true, updates.
if (newAutoUpdateEnabled && !previousautoUpdateEnabled) {
try {
update();
} catch (Throwable t) {
Logger.error(t.getMessage(), t);
}
}
}
@Override
public boolean getDefaultAutoUpdateEnabled() {
return false;
}
} // UpdatableImpl