// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.io;
import eu.etaxonomy.cdm.io.common.IIoConfigurator;
/**
- * <p>Abstract AbstractIOHandler class.</p>
- *
+ * <p>
+ * Abstract AbstractIOHandler class.
+ * </p>
+ *
* @author n.hoffmann
* @created Sep 11, 2009
* @version 1.0
public abstract class AbstractIOManager<CONFIGURATOR extends IIoConfigurator> {
protected CdmApplicationController applicationController;
-
+
public static enum TYPE {
BerlinModel, Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd
}
/**
- * <p>Constructor for AbstractIOHandler.</p>
- *
- * @param applicationController a {@link eu.etaxonomy.cdm.api.application.CdmApplicationController} object.
- * @param <CONFIGURATOR> a CONFIGURATOR object.
+ * <p>
+ * Constructor for AbstractIOHandler.
+ * </p>
+ *
+ * @param applicationController
+ * a
+ * {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
+ * object.
+ * @param <CONFIGURATOR>
+ * a CONFIGURATOR object.
*/
- protected AbstractIOManager(CdmApplicationController applicationController){
+ protected AbstractIOManager(CdmApplicationController applicationController) {
this.applicationController = applicationController;
}
-
+
/**
* Starts the IO process
- *
- * @param configurator a CONFIGURATOR object.
+ *
+ * @param configurator
+ * a CONFIGURATOR object.
*/
- public void run(final CONFIGURATOR configurator){
+ public void run(final CONFIGURATOR configurator) {
// create job
Job job = createIOJob(configurator);
// configure the job
job.setUser(true);
// schedule job
job.schedule();
-
+
}
-
+
/**
- * <p>createIOJob</p>
- *
- * @param configurator a CONFIGURATOR object.
+ * <p>
+ * createIOJob
+ * </p>
+ *
+ * @param configurator
+ * a CONFIGURATOR object.
* @return a {@link org.eclipse.core.runtime.jobs.Job} object.
*/
protected abstract Job createIOJob(CONFIGURATOR configurator);
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.io;
import eu.etaxonomy.taxeditor.store.StoreUtil;
/**
- * <p>ExportHandler class.</p>
- *
+ * <p>
+ * ExportHandler class.
+ * </p>
+ *
* @author n.hoffmann
* @created Sep 11, 2009
* @version 1.0
*/
-public class ExportManager extends AbstractIOManager<IExportConfigurator>{
-
+public class ExportManager extends AbstractIOManager<IExportConfigurator> {
+
/**
*
* @param applicationController
*/
- private ExportManager(CdmApplicationController applicationController){
+ private ExportManager(CdmApplicationController applicationController) {
super(applicationController);
}
-
+
/**
- * <p>NewInstance</p>
- *
- * @param applicationController a {@link eu.etaxonomy.cdm.api.application.CdmApplicationController} object.
+ * <p>
+ * NewInstance
+ * </p>
+ *
+ * @param applicationController
+ * a
+ * {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
+ * object.
* @return a {@link eu.etaxonomy.taxeditor.io.ExportManager} object.
*/
- public static ExportManager NewInstance(CdmApplicationController applicationController){
+ public static ExportManager NewInstance(
+ CdmApplicationController applicationController) {
return new ExportManager(applicationController);
}
-
+
/**
- * <p>createIOJob</p>
- *
- * @param configurator a {@link eu.etaxonomy.cdm.io.common.IExportConfigurator} object.
+ * <p>
+ * createIOJob
+ * </p>
+ *
+ * @param configurator
+ * a {@link eu.etaxonomy.cdm.io.common.IExportConfigurator}
+ * object.
* @return a {@link org.eclipse.core.runtime.jobs.Job} object.
*/
- protected Job createIOJob(final IExportConfigurator configurator){
-
+ @Override
+ protected Job createIOJob(final IExportConfigurator configurator) {
+
Assert.isNotNull(configurator, "Configuration may not be null");
-
+
final Display display = Display.getCurrent();
-
- Job job = new Job("Export: " + configurator.getClass().getSimpleName()){
+
+ Job job = new Job("Export: " + configurator.getClass().getSimpleName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask("Exporting database. This will take some time.", 100);
+ monitor.beginTask(
+ "Exporting database. This will take some time.", 100);
monitor.worked(10);
-
+
display.asyncExec(new Runnable() {
-
+
@Override
public void run() {
// terminate any open transactions
- IConversationEnabled activePart = (IConversationEnabled) StoreUtil.getActivePage().getActivePart();
+ IConversationEnabled activePart = (IConversationEnabled) StoreUtil
+ .getActivePage().getActivePart();
activePart.getConversationHolder().commit(false);
}
});
-
+
monitor.worked(10);
-
+
CdmDefaultExport<IExportConfigurator> exporter = new CdmDefaultExport<IExportConfigurator>();
- configurator.setProgressMonitor(CdmProgressMonitorAdapter.CreateSubMonitor(monitor, 80));
+ configurator.setProgressMonitor(CdmProgressMonitorAdapter
+ .CreateSubMonitor(monitor, 80));
exporter.setCdmAppController(applicationController);
monitor.worked(10);
-
- try{
+
+ try {
exporter.invoke(configurator);
monitor.worked(60);
- }catch(RuntimeException e){
- StoreUtil.errorDialog("Error exporting data", this, "An error occured while" +
- "exporting to destination '" + configurator.getDestinationNameString() + "'.\n" +
- "Please check error log for details.", e);
+ } catch (RuntimeException e) {
+ StoreUtil.errorDialog("Error exporting data", this,
+ "An error occured while"
+ + "exporting to destination '"
+ + configurator.getDestinationNameString()
+ + "'.\n"
+ + "Please check error log for details.", e);
}
-
+
display.asyncExec(new Runnable() {
-
+
@Override
public void run() {
// terminate any open transactions
- IConversationEnabled activePart = (IConversationEnabled) StoreUtil.getActivePage().getActivePart();
- // restarting transaction and committing it to trigger change listener
+ IConversationEnabled activePart = (IConversationEnabled) StoreUtil
+ .getActivePage().getActivePart();
+ // restarting transaction and committing it to trigger
+ // change listener
// TODO verify correct behaviour
activePart.getConversationHolder().startTransaction();
activePart.getConversationHolder().commit();
}
});
monitor.worked(10);
-
+
return Status.OK_STATUS;
}
};
-
+
return job;
}
-
+
/**
* @param jaxb
* @return
*/
private IIoConfigurator getConfigurator(TYPE type) {
Assert.isNotNull(type, "Type should not be null");
-
- switch (type){
- case Jaxb:
- return JaxbExportConfigurator.NewInstance(null, null);
- case Sdd:
- return SDDExportConfigurator.NewInstance(null, null, null);
- default:
- StoreUtil.notImplementedMessage(this);
- throw new IllegalArgumentException("Export not supported yet");
+
+ switch (type) {
+ case Jaxb:
+ return JaxbExportConfigurator.NewInstance(null, null);
+ case Sdd:
+ return SDDExportConfigurator.NewInstance(null, null, null);
+ default:
+ StoreUtil.notImplementedMessage(this);
+ throw new IllegalArgumentException("Export not supported yet");
}
}
-
+
/**
- * <p>JaxbConfigurator</p>
- *
+ * <p>
+ * JaxbConfigurator
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator} object.
*/
- public final JaxbExportConfigurator JaxbConfigurator() { return (JaxbExportConfigurator) getConfigurator(TYPE.Jaxb); }
+ public final JaxbExportConfigurator JaxbConfigurator() {
+ return (JaxbExportConfigurator) getConfigurator(TYPE.Jaxb);
+ }
/**
- * <p>SddConfigurator</p>
- *
- * @return a {@link eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator} object.
+ * <p>
+ * SddConfigurator
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator}
+ * object.
*/
- public final SDDExportConfigurator SddConfigurator() { return (SDDExportConfigurator) getConfigurator(TYPE.Sdd); }
+ public final SDDExportConfigurator SddConfigurator() {
+ return (SDDExportConfigurator) getConfigurator(TYPE.Sdd);
+ }
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.preference;
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeEditorWizard;
/**
- * <p>FeatureTreePreferences class.</p>
- *
+ * <p>
+ * FeatureTreePreferences class.
+ * </p>
+ *
* @author n.hoffmann
* @created Aug 5, 2010
* @version 1.0
IWorkbenchPreferencePage {
/**
- * <p>Constructor for FeatureTreePreferences.</p>
+ * <p>
+ * Constructor for FeatureTreePreferences.
+ * </p>
*/
public FeatureTreePreferences() {
}
/**
- * <p>Constructor for FeatureTreePreferences.</p>
- *
- * @param title a {@link java.lang.String} object.
+ * <p>
+ * Constructor for FeatureTreePreferences.
+ * </p>
+ *
+ * @param title
+ * a {@link java.lang.String} object.
*/
public FeatureTreePreferences(String title) {
super(title);
}
/**
- * <p>Constructor for FeatureTreePreferences.</p>
- *
- * @param title a {@link java.lang.String} object.
- * @param image a {@link org.eclipse.jface.resource.ImageDescriptor} object.
+ * <p>
+ * Constructor for FeatureTreePreferences.
+ * </p>
+ *
+ * @param title
+ * a {@link java.lang.String} object.
+ * @param image
+ * a {@link org.eclipse.jface.resource.ImageDescriptor} object.
*/
public FeatureTreePreferences(String title, ImageDescriptor image) {
super(title, image);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
/** {@inheritDoc} */
@Override
public void init(IWorkbench workbench) {
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+ * .swt.widgets.Composite)
*/
/** {@inheritDoc} */
@Override
protected Control createContents(Composite parent) {
-
+
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
-
+
final Button button_openFeatureTree = new Button(composite, SWT.PUSH);
button_openFeatureTree.setText("Open FeatureTree Editor");
-
+
button_openFeatureTree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FeatureTreeEditorWizard featureTreeEditorDialog = new FeatureTreeEditorWizard();
- WizardDialog dialog = new WizardDialog(getShell(), featureTreeEditorDialog);
-
+ WizardDialog dialog = new WizardDialog(getShell(),
+ featureTreeEditorDialog);
+
dialog.open();
}
});
-
+
return composite;
}
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.preference;
public class MobotOpenUrlPreferences extends PreferencePage implements
IWorkbenchPreferencePage {
-
private String openUrlServiceAccessPoint;
private String openUrlImageMaxWidth;
private String openUrlImageMaxHeight;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(PreferencesUtil.getPreferenceStore());
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+ * .swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
final GridLayout gridLayout = new GridLayout();
container.setLayout(gridLayout);
-
+
creatOpenUrlServiceAccessPoint(container);
-
+
createOpenUrlImageSize(container);
-
+
return container;
}
-
+
/**
* @param container
*/
private void createOpenUrlImageSize(Composite container) {
- openUrlImageMaxWidth = getPreferenceStore().getString(IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH);
- openUrlImageMaxHeight = getPreferenceStore().getString(IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT);
-
+ openUrlImageMaxWidth = getPreferenceStore().getString(
+ IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH);
+ openUrlImageMaxHeight = getPreferenceStore().getString(
+ IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT);
+
Composite composite = new Composite(container, SWT.NULL);
final GridLayout gridLayout = new GridLayout(2, false);
composite.setLayout(gridLayout);
-
+
final CLabel labelWidth = new CLabel(composite, SWT.NULL);
labelWidth.setText("Image Maximum Width: ");
-
+
final Text textWidth = new Text(composite, SWT.BORDER);
textWidth.setText(openUrlImageMaxWidth);
textWidth.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
+
textWidth.addModifyListener(new ModifyListener() {
-
+
public void modifyText(ModifyEvent e) {
openUrlImageMaxWidth = textWidth.getText();
}
});
-
+
final CLabel labelHeight = new CLabel(composite, SWT.NULL);
labelHeight.setText("Image Maximum Height: ");
-
+
final Text textHeight = new Text(composite, SWT.BORDER);
textHeight.setText(openUrlImageMaxHeight);
textHeight.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
+
textHeight.addModifyListener(new ModifyListener() {
-
+
public void modifyText(ModifyEvent e) {
openUrlImageMaxHeight = textHeight.getText();
}
}
private void creatOpenUrlServiceAccessPoint(Composite composite) {
- openUrlServiceAccessPoint = getPreferenceStore().getString(IPreferenceKeys.OPENURL_ACCESS_POINT);
-
+ openUrlServiceAccessPoint = getPreferenceStore().getString(
+ IPreferenceKeys.OPENURL_ACCESS_POINT);
+
final CLabel label = new CLabel(composite, SWT.NULL);
label.setText("Mobot Open Url Service Access Point:");
-
+
final Text text = new Text(composite, SWT.BORDER);
text.setText(openUrlServiceAccessPoint);
text.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
+
text.addModifyListener(new ModifyListener() {
-
+
public void modifyText(ModifyEvent e) {
openUrlServiceAccessPoint = text.getText();
}
});
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.PreferencePage#performOk()
*/
@Override
public boolean performOk() {
- getPreferenceStore().setValue(IPreferenceKeys.OPENURL_ACCESS_POINT, openUrlServiceAccessPoint);
- getPreferenceStore().setValue(IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH, openUrlImageMaxWidth);
- getPreferenceStore().setValue(IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT, openUrlImageMaxHeight);
-
+ getPreferenceStore().setValue(IPreferenceKeys.OPENURL_ACCESS_POINT,
+ openUrlServiceAccessPoint);
+ getPreferenceStore().setValue(IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH,
+ openUrlImageMaxWidth);
+ getPreferenceStore().setValue(IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT,
+ openUrlImageMaxHeight);
+
return super.performOk();
}
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.preference;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.List;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
- * <p>NomenclaturalCodePreferences class.</p>
- *
+ * <p>
+ * NomenclaturalCodePreferences class.
+ * </p>
+ *
* @author p.ciardelli
* @created 16.09.2008
* @version 1.0
*/
-public class NomenclaturalCodePreferences extends PreferencePage implements
- IWorkbenchPreferencePage {
-
- /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.nome"{trunked}</code> */
- public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.nomenclatural";
-
- private NomenclaturalCode preferredCode;
+public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
- private Map<NomenclaturalCode, Button> buttons = new HashMap<NomenclaturalCode, Button>();
-
- /**
- * <p>Constructor for NomenclaturalCodePreferences.</p>
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
+ * ()
*/
- public NomenclaturalCodePreferences() {
- super();
- setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified.");
+ @Override
+ protected void createFieldEditors() {
+
+ addField(new RadioGroupFieldEditor(
+ IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY,
+ "Available Codes", 1, getLabelAndValues(),
+ getFieldEditorParent(), true));
+
}
/**
- * {@inheritDoc}
- *
- * Create contents of the preference page
+ * @return
*/
- @Override
- public Control createContents(Composite parent) {
-
- Composite container = new Composite(parent, SWT.NULL);
- container.setLayout(new GridLayout());
-
- for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) {
- Button button = new Button(container, SWT.RADIO);
- button.setText(NomenclaturalCodeHelper.getDescription(code));
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- preferredCode = code;
- }
- });
- buttons.put(code, button);
- }
-
- preferredCode = PreferencesUtil.getPreferredNomenclaturalCode();
- if (preferredCode == null) {
- preferredCode = NomenclaturalCodeHelper.getDefaultCode();
- PreferencesUtil.setPreferredNomenclaturalCode(preferredCode);
+ private String[][] getLabelAndValues() {
+ List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
+ .getSupportedCodes();
+ String[][] labelAndValues = new String[supportedCodes.size()][2];
+ for (int i = 0; i < supportedCodes.size(); i++) {
+ labelAndValues[i][0] = NomenclaturalCodeHelper
+ .getDescription(supportedCodes.get(i));
+ labelAndValues[i][1] = PreferencesUtil
+ .getPreferenceKey(supportedCodes.get(i));
}
- setButton(preferredCode);
-
- return container;
+ return labelAndValues;
}
/**
* {@inheritDoc}
- *
+ *
* Initialize the preference page
*/
public void init(IWorkbench workbench) {
- setPreferenceStore(TaxeditorStorePlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * <p>performDefaults</p>
- */
- protected void performDefaults() {
- setButton(NomenclaturalCodeHelper.getDefaultCode());
- }
-
- /**
- * <p>performOk</p>
- *
- * @return a boolean.
- */
- public boolean performOk() {
- PreferencesUtil.setPreferredNomenclaturalCode(preferredCode);
- return true;
- }
-
- private void setButton(NomenclaturalCode preferredCode) {
- this.preferredCode = preferredCode;
- for (NomenclaturalCode code : buttons.keySet()) {
- buttons.get(code).setSelection(code.equals(preferredCode));
- }
+ setPreferenceStore(TaxeditorStorePlugin.getDefault()
+ .getPreferenceStore());
+ setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified.");
}
+
}
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.preference;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
- * <p>PreferencesUtil class.</p>
- *
+ * <p>
+ * PreferencesUtil class.
+ * </p>
+ *
* @author p.ciardelli
* @author n.hoffmann
* @created 05.12.2008
* @version 1.0
*/
-public class PreferencesUtil implements IPreferenceKeys{
+public class PreferencesUtil implements IPreferenceKeys {
/**
*
*/
public static final String PREFERRED_TERMS_CHANGE = "preferred_terms";
-
-
/**
- * <p>getPreferenceStore</p>
- *
+ * <p>
+ * getPreferenceStore
+ * </p>
+ *
* @return a {@link org.eclipse.jface.preference.IPreferenceStore} object.
*/
public static IPreferenceStore getPreferenceStore() {
return TaxeditorStorePlugin.getDefault().getPreferenceStore();
}
-
+
/**
- * <p>setPreferredNomenclaturalCode</p>
- *
- * @param preferredCode a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
+ * <p>
+ * setPreferredNomenclaturalCode
+ * </p>
+ *
+ * @param preferredCode
+ * a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode}
+ * object.
*/
- public static void setPreferredNomenclaturalCode(NomenclaturalCode preferredCode) {
- getPreferenceStore().setValue(PREFERRED_NOMENCLATURAL_CODE_KEY, getPreferenceKey(preferredCode));
+ public static void setPreferredNomenclaturalCode(
+ NomenclaturalCode preferredCode) {
+ getPreferenceStore().setValue(PREFERRED_NOMENCLATURAL_CODE_KEY,
+ getPreferenceKey(preferredCode));
}
-
+
/**
- * <p>getPreferredNomenclaturalCode</p>
- *
+ * <p>
+ * getPreferredNomenclaturalCode
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
*/
public static NomenclaturalCode getPreferredNomenclaturalCode() {
-
+
for (NomenclaturalCode code : NomenclaturalCodeHelper.getAllCodes()) {
- String preferredCode = getPreferenceStore().getString(PREFERRED_NOMENCLATURAL_CODE_KEY);
+ String preferredCode = getPreferenceStore().getString(
+ PREFERRED_NOMENCLATURAL_CODE_KEY);
if (getPreferenceKey(code).equals(preferredCode)) {
return code;
}
}
return null;
}
-
+
/**
* Get the match strategy for the given class that was stored in preferences
* or the default strategy if it was not stored in preferences
- *
- * @param clazz a {@link java.lang.Class} object.
+ *
+ * @param clazz
+ * a {@link java.lang.Class} object.
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
*/
- public static IMatchStrategy getMatchStrategy(Class clazz){
+ public static IMatchStrategy getMatchStrategy(Class clazz) {
String className = clazz.getName();
- if(getPreferenceStore().getBoolean(MATCH_STRATEGY_PREFIX + className)){
+ if (getPreferenceStore().getBoolean(MATCH_STRATEGY_PREFIX + className)) {
IMatchStrategy matchStrategy = getDefaultMatchStrategy(clazz);
-
- for(String fieldName : matchStrategy.getMatchFieldPropertyNames()){
- String matchModeName = getPreferenceStore().getString(getMatchStrategyFieldName(className, fieldName));
+
+ for (String fieldName : matchStrategy.getMatchFieldPropertyNames()) {
+ String matchModeName = getPreferenceStore().getString(
+ getMatchStrategyFieldName(className, fieldName));
MatchMode matchMode = MatchMode.valueOf(matchModeName);
try {
matchStrategy.setMatchMode(fieldName, matchMode);
throw new RuntimeException(e);
}
}
-
+
return matchStrategy;
}
return getDefaultMatchStrategy(clazz);
}
-
+
/**
* Stores a matchStrategy into the preference store.
- *
- * @param matchStrategy a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
+ *
+ * @param matchStrategy
+ * a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy}
+ * object.
*/
- public static void setMatchStrategy(IMatchStrategy matchStrategy){
+ public static void setMatchStrategy(IMatchStrategy matchStrategy) {
String className = matchStrategy.getMatchClass().getName();
getPreferenceStore().setValue(MATCH_STRATEGY_PREFIX + className, true);
-
+
Set<String> matchFields = matchStrategy.getMatchFieldPropertyNames();
-
- for(String fieldName : matchFields){
- getPreferenceStore().setValue(getMatchStrategyFieldName(className, fieldName),
+
+ for (String fieldName : matchFields) {
+ getPreferenceStore().setValue(
+ getMatchStrategyFieldName(className, fieldName),
matchStrategy.getMatchMode(fieldName).name());
}
}
-
+
/**
* Helper method to create the preference property for a match field.
*
* @param fieldName
* @return
*/
- private static String getMatchStrategyFieldName(String className, String fieldName){
- return MATCH_STRATEGY_PREFIX + className + "." + fieldName;
+ private static String getMatchStrategyFieldName(String className,
+ String fieldName) {
+ return MATCH_STRATEGY_PREFIX + className + "." + fieldName;
}
-
+
/**
* Returns the default match strategy for a given class.
- *
- * @param clazz a {@link java.lang.Class} object.
+ *
+ * @param clazz
+ * a {@link java.lang.Class} object.
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
*/
- public static IMatchStrategy getDefaultMatchStrategy(Class clazz){
+ public static IMatchStrategy getDefaultMatchStrategy(Class clazz) {
return DefaultMatchStrategy.NewInstance(clazz);
}
-
-
+
/**
- * <p>getDateFormatPattern</p>
- *
+ * <p>
+ * getDateFormatPattern
+ * </p>
+ *
* @return a {@link java.lang.String} object.
*/
- public static String getDateFormatPattern(){
+ public static String getDateFormatPattern() {
// TODO make this configurable in properties
String pattern = "Y-M-d H:m";
return pattern;
}
-
+
/**
- * <p>addTermToPreferredTerms</p>
- *
- * @param term a T object.
- * @param <T> a T object.
+ * <p>
+ * addTermToPreferredTerms
+ * </p>
+ *
+ * @param term
+ * a T object.
+ * @param <T>
+ * a T object.
*/
- public static <T extends TermBase> void addTermToPreferredTerms(T term){
+ public static <T extends TermBase> void addTermToPreferredTerms(T term) {
-// VocabularyEnum vocabulary = VocabularyEnum.getVocabularyEnum(term.getClass());
-//
-// getPreferenceStore().setValue(getPreferenceKey(term), VocabularyStore.getTermVocabulary(vocabulary).getTerms().contains(term));
-//
-// firePreferencesChanged(term.getClass());
+ // VocabularyEnum vocabulary =
+ // VocabularyEnum.getVocabularyEnum(term.getClass());
+ //
+ // getPreferenceStore().setValue(getPreferenceKey(term),
+ // VocabularyStore.getTermVocabulary(vocabulary).getTerms().contains(term));
+ //
+ // firePreferencesChanged(term.getClass());
}
-
+
/**
* Construct a unique key using the CdmBase object's uuid
*
*/
private static String getPreferenceKey(ICdmBase cdmBase) {
cdmBase = (ICdmBase) HibernateProxyHelper.deproxy(cdmBase);
-
- String key = cdmBase.getClass().getName()
- . concat(".")
- . concat(cdmBase.getUuid().toString());
+
+ String key = cdmBase.getClass().getName().concat(".")
+ .concat(cdmBase.getUuid().toString());
if (key.contains("javassist")) {
StoreUtil.info("proxy");
}
* @param cdmBase
* @return
*/
- private static String getPreferenceKey(IDefinedTerm definedTerm) {
+ public static String getPreferenceKey(IDefinedTerm definedTerm) {
definedTerm = (IDefinedTerm) HibernateProxyHelper.deproxy(definedTerm);
- String key = definedTerm.getClass().getName()
- . concat(".")
- . concat(definedTerm.getUuid().toString());
+ String key = definedTerm.getClass().getName().concat(".")
+ .concat(definedTerm.getUuid().toString());
if (key.contains("javassist")) {
- StoreUtil.warn(PreferencesUtil.class, "Trying to persist a preference based on a proxy class.");
+ StoreUtil.warn(PreferencesUtil.class,
+ "Trying to persist a preference based on a proxy class.");
}
return key;
}
-
+
/**
* Retrieves search preferences from the preference store
- *
+ *
* @return an {@link ITaxonServiceConfigurator} to pass to search methods
*/
public static ITaxonServiceConfigurator getSearchConfigurator() {
ITaxonServiceConfigurator configurator = initializeSearchConfigurator();
-
- configurator.setDoTaxa(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_TAXA));
- configurator.setDoSynonyms(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_SYNONYMS));
- configurator.setDoNamesWithoutTaxa(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_NAMES));
- configurator.setDoTaxaByCommonNames(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES));
+
+ configurator.setDoTaxa(getPreferenceStore().getBoolean(
+ TAXON_SERVICE_CONFIGURATOR_TAXA));
+ configurator.setDoSynonyms(getPreferenceStore().getBoolean(
+ TAXON_SERVICE_CONFIGURATOR_SYNONYMS));
+ configurator.setDoNamesWithoutTaxa(getPreferenceStore().getBoolean(
+ TAXON_SERVICE_CONFIGURATOR_NAMES));
+ configurator.setDoTaxaByCommonNames(getPreferenceStore().getBoolean(
+ TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES));
return configurator;
}
-
+
/**
* create new preferences, setting all search options to true
- *
- * @return a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object.
+ *
+ * @return a
+ * {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator}
+ * object.
*/
- public static ITaxonServiceConfigurator initializeSearchConfigurator(){
- ITaxonServiceConfigurator configurator = TaxonServiceConfiguratorImpl.NewInstance();
-
+ public static ITaxonServiceConfigurator initializeSearchConfigurator() {
+ ITaxonServiceConfigurator configurator = TaxonServiceConfiguratorImpl
+ .NewInstance();
+
configurator.setDoTaxa(true);
configurator.setDoSynonyms(true);
configurator.setDoNamesWithoutTaxa(true);
configurator.setDoTaxaByCommonNames(true);
-
- configurator.setTaxonPropertyPath(Arrays.asList("$",
- "titleCache", "name", "name.$", "relationsFromThisTaxon.$"));
-
- configurator.setSynonymPropertyPath(Arrays.asList("$",
- "titleCache", "name", "name.$", "synonymRelations.relatedTo.*"));
-
- // DEFAULT VALUES
- // match mode is a simple like, actually all other match modes are kind of bogus
- configurator.setMatchMode(eu.etaxonomy.cdm.persistence.query.MatchMode.LIKE);
+
+ configurator.setTaxonPropertyPath(Arrays.asList("$", "titleCache",
+ "name", "name.$", "relationsFromThisTaxon.$"));
+
+ configurator.setSynonymPropertyPath(Arrays.asList("$", "titleCache",
+ "name", "name.$", "synonymRelations.relatedTo.*"));
+
+ // DEFAULT VALUES
+ // match mode is a simple like, actually all other match modes are kind
+ // of bogus
+ configurator
+ .setMatchMode(eu.etaxonomy.cdm.persistence.query.MatchMode.LIKE);
// we set page number and size here as this should always be unlimited
configurator.setPageNumber(0);
// TODO currently limit results to 10000
configurator.setPageSize(10000);
-
+
return configurator;
}
-
+
/**
* Store search preferences
- *
- * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object.
+ *
+ * @param configurator
+ * a
+ * {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator}
+ * object.
*/
- public static void setSearchConfigurator(ITaxonServiceConfigurator configurator){
- getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_TAXA, configurator.isDoTaxa());
- getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_SYNONYMS, configurator.isDoSynonyms());
- getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_NAMES, configurator.isDoNamesWithoutTaxa());
- getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES, configurator.isDoTaxaByCommonNames());
+ public static void setSearchConfigurator(
+ ITaxonServiceConfigurator configurator) {
+ getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_TAXA,
+ configurator.isDoTaxa());
+ getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_SYNONYMS,
+ configurator.isDoSynonyms());
+ getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_NAMES,
+ configurator.isDoNamesWithoutTaxa());
+ getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES,
+ configurator.isDoTaxaByCommonNames());
}
/**
- * <p>firePreferencesChanged</p>
- *
- * @param clazz a {@link java.lang.Class} object.
+ * <p>
+ * firePreferencesChanged
+ * </p>
+ *
+ * @param clazz
+ * a {@link java.lang.Class} object.
*/
public static void firePreferencesChanged(Class clazz) {
- getPreferenceStore().firePropertyChangeEvent(PREFERRED_TERMS_CHANGE, null, clazz);
+ getPreferenceStore().firePropertyChangeEvent(PREFERRED_TERMS_CHANGE,
+ null, clazz);
}
/**
*/
public static void setDefaults() {
getPreferenceStore().setDefault(TAXON_SERVICE_CONFIGURATOR_TAXA, true);
- getPreferenceStore().setDefault(TAXON_SERVICE_CONFIGURATOR_SYNONYMS, true);
- getPreferenceStore().setDefault(EDIT_MAP_SERVICE_ACCES_POINT, "http://edit.br.fgov.be/edit_wp5/v1/areas.php");
- getPreferenceStore().setDefault(SHOULD_CONNECT_AT_STARTUP, true);
- getPreferenceStore().setDefault(OPENURL_ACCESS_POINT, "http://www.biodiversitylibrary.org/openurl");
+ getPreferenceStore().setDefault(TAXON_SERVICE_CONFIGURATOR_SYNONYMS,
+ true);
+ getPreferenceStore().setDefault(EDIT_MAP_SERVICE_ACCES_POINT,
+ "http://edit.br.fgov.be/edit_wp5/v1/areas.php");
+ getPreferenceStore().setDefault(SHOULD_CONNECT_AT_STARTUP, true);
+ getPreferenceStore().setDefault(OPENURL_ACCESS_POINT,
+ "http://www.biodiversitylibrary.org/openurl");
getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_WIDTH, "1000");
getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_HEIGHT, "1000");
}
/**
- * <p>checkNomenclaturalCode</p>
+ * <p>
+ * checkNomenclaturalCode
+ * </p>
*/
- public static void checkNomenclaturalCode() {
+ public static void checkNomenclaturalCode() {
// First time Editor is opened, no nomenclatural code has been set
if (PreferencesUtil.getPreferredNomenclaturalCode() == null) {
StoreUtil.info("No nomencatural code set.");
-
+
Shell shell = StoreUtil.getShell();
-
+
// Query user re: preferred nom. code
Dialog dialog = new InitNomenclaturalCodePrefDialog(shell);
dialog.open();
-
+
// Short message confirming user's choice
- NomenclaturalCode code = PreferencesUtil.getPreferredNomenclaturalCode();
- MessageDialog.openInformation(shell, "Nomenclatural code set",
- "The following has been set as your preferred nomenclatural code:\n\n\t" +
- NomenclaturalCodeHelper.getDescription(code) + "\n\nYou can change the nomenclatural code at any time in the \"Preferences\" menu.");
+ NomenclaturalCode code = PreferencesUtil
+ .getPreferredNomenclaturalCode();
+ MessageDialog
+ .openInformation(
+ shell,
+ "Nomenclatural code set",
+ "The following has been set as your preferred nomenclatural code:\n\n\t"
+ + NomenclaturalCodeHelper
+ .getDescription(code)
+ + "\n\nYou can change the nomenclatural code at any time in the \"Preferences\" menu.");
}
}
/**
- * <p>getMapServiceAccessPoint</p>
- *
+ * <p>
+ * getMapServiceAccessPoint
+ * </p>
+ *
* @return a {@link java.lang.String} object.
*/
public static String getMapServiceAccessPoint() {
}
/**
- * <p>shouldConnectAtStartUp</p>
- *
+ * <p>
+ * shouldConnectAtStartUp
+ * </p>
+ *
* @return a boolean.
*/
public static boolean shouldConnectAtStartUp() {
}
/**
- * <p>getDefaultFeatureTreeForTextualDescription</p>
- *
+ * <p>
+ * getDefaultFeatureTreeForTextualDescription
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.model.description.FeatureTree} object.
*/
public static FeatureTree getDefaultFeatureTreeForTextualDescription() {
- String uuidString = getPreferenceStore().getString(FEATURE_TREE_DEFAULT_TEXT);
- return CdmUtils.isEmpty(uuidString) ? null : CdmStore.getService(IFeatureTreeService.class).load(UUID.fromString(uuidString));
+ String uuidString = getPreferenceStore().getString(
+ FEATURE_TREE_DEFAULT_TEXT);
+ return CdmUtils.isEmpty(uuidString) ? null : CdmStore.getService(
+ IFeatureTreeService.class).load(UUID.fromString(uuidString));
}
/**
- * <p>getDefaultFeatureTreeForStructuredDescription</p>
- *
+ * <p>
+ * getDefaultFeatureTreeForStructuredDescription
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.model.description.FeatureTree} object.
*/
public static FeatureTree getDefaultFeatureTreeForStructuredDescription() {
- String uuidString = getPreferenceStore().getString(FEATURE_TREE_DEFAULT_STRUCTURE);
- return CdmUtils.isEmpty(uuidString) ? null : CdmStore.getService(IFeatureTreeService.class).load(UUID.fromString(uuidString));
+ String uuidString = getPreferenceStore().getString(
+ FEATURE_TREE_DEFAULT_STRUCTURE);
+ return CdmUtils.isEmpty(uuidString) ? null : CdmStore.getService(
+ IFeatureTreeService.class).load(UUID.fromString(uuidString));
}
/**
- * <p>setSortRanksHierarchichally</p>
- *
- * @param selection a boolean.
+ * <p>
+ * setSortRanksHierarchichally
+ * </p>
+ *
+ * @param selection
+ * a boolean.
*/
public static void setSortRanksHierarchichally(boolean selection) {
getPreferenceStore().setValue(SORT_RANKS_HIERARCHICHALLY, selection);
- }
-
+ }
+
/**
- * <p>getSortRanksHierarchichally</p>
- *
+ * <p>
+ * getSortRanksHierarchichally
+ * </p>
+ *
* @return a boolean.
*/
- public static boolean getSortRanksHierarchichally(){
+ public static boolean getSortRanksHierarchichally() {
return getPreferenceStore().getBoolean(SORT_RANKS_HIERARCHICHALLY);
}
public static boolean isMultilanguageTextEditingCapability() {
- return getPreferenceStore().getBoolean(MULTILANGUAGE_TEXT_EDITING_CAPABILITY);
+ return getPreferenceStore().getBoolean(
+ MULTILANGUAGE_TEXT_EDITING_CAPABILITY);
}
-
- public static Language getGlobalLanguage(){
- String languageUuidString = getPreferenceStore().getString(GLOBAL_LANGUAGE_UUID);
-
- if(CdmUtils.isEmpty(languageUuidString)){
+
+ public static Language getGlobalLanguage() {
+ String languageUuidString = getPreferenceStore().getString(
+ GLOBAL_LANGUAGE_UUID);
+
+ if (CdmUtils.isEmpty(languageUuidString)) {
return Language.DEFAULT();
}
-
+
UUID languageUuid = UUID.fromString(languageUuidString);
- return (Language) CdmStore.getService(ITermService.class).load(languageUuid);
+ return (Language) CdmStore.getService(ITermService.class).load(
+ languageUuid);
}
-
- public static void setGlobalLanguage(Language language){
- getPreferenceStore().setValue(GLOBAL_LANGUAGE_UUID, language.getUuid().toString());
+
+ public static void setGlobalLanguage(Language language) {
+ getPreferenceStore().setValue(GLOBAL_LANGUAGE_UUID,
+ language.getUuid().toString());
CdmStore.setDefaultLanguage(language);
}
* @return
*/
public static Map<MarkerType, Boolean> getEditMarkerTypePreferences() {
- List<MarkerType> markerTypes = CdmStore.getTermManager().getPreferredMarkerTypes();
-
+ List<MarkerType> markerTypes = CdmStore.getTermManager()
+ .getPreferredMarkerTypes();
+
Map<MarkerType, Boolean> result = new HashMap<MarkerType, Boolean>();
-
- for(MarkerType markerType : markerTypes){
+
+ for (MarkerType markerType : markerTypes) {
String name = getMarkerTypeEditingPreferenceKey(markerType);
Boolean value = getPreferenceStore().getBoolean(name);
-
+
result.put(markerType, value);
}
-
+
return result;
}
*/
public static void setEditMarkerTypePreferences(
Map<MarkerType, Boolean> markerTypeEditingMap) {
- for(MarkerType markerType : markerTypeEditingMap.keySet()){
+ for (MarkerType markerType : markerTypeEditingMap.keySet()) {
String name = getMarkerTypeEditingPreferenceKey(markerType);
- getPreferenceStore().setValue(name, markerTypeEditingMap.get(markerType));
+ getPreferenceStore().setValue(name,
+ markerTypeEditingMap.get(markerType));
}
-
+
}
-
- private static String getMarkerTypeEditingPreferenceKey(MarkerType markerType){
+
+ private static String getMarkerTypeEditingPreferenceKey(
+ MarkerType markerType) {
markerType = (MarkerType) HibernateProxyHelper.deproxy(markerType);
return markerType.getClass().getName() + EDIT_MARKER_TYPE_PREFIX;
}
-
+
/**
- * <p>setEditMarkerTypePreference</p>
- *
- * @param input a {@link org.eclipse.ui.IEditorInput} object.
- * @param markerType a {@link eu.etaxonomy.cdm.model.common.MarkerType} object.
- * @param edit a boolean.
+ * <p>
+ * setEditMarkerTypePreference
+ * </p>
+ *
+ * @param input
+ * a {@link org.eclipse.ui.IEditorInput} object.
+ * @param markerType
+ * a {@link eu.etaxonomy.cdm.model.common.MarkerType} object.
+ * @param edit
+ * a boolean.
*/
- public static void setEditMarkerTypePreference(MarkerType markerType, boolean edit) {
- getPreferenceStore().setValue(getMarkerTypeEditingPreferenceKey(markerType), edit);
+ public static void setEditMarkerTypePreference(MarkerType markerType,
+ boolean edit) {
+ getPreferenceStore().setValue(
+ getMarkerTypeEditingPreferenceKey(markerType), edit);
}
/**
* @return
*/
public static DerivedUnitFacadeConfigurator getDerivedUnitConfigurator() {
- DerivedUnitFacadeConfigurator configurator = DerivedUnitFacadeConfigurator.NewInstance();
+ DerivedUnitFacadeConfigurator configurator = DerivedUnitFacadeConfigurator
+ .NewInstance();
configurator.setMoveDerivedUnitMediaToGallery(true);
configurator.setMoveFieldObjectMediaToGallery(true);
return configurator;
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.preference;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
/**
- * <p>TaxonomicEditorGeneralPreferences class.</p>
- *
+ * <p>
+ * TaxonomicEditorGeneralPreferences class.
+ * </p>
+ *
* @author n.hoffmann
* @created Sep 1, 2009
* @version 1.0
*/
-public class TaxonomicEditorGeneralPreferences extends PreferencePage implements
- IWorkbenchPreferencePage {
-
- boolean showUuidInSupplementalView;
-
- private String editMapServiceAccessPoint;
-
- private boolean shouldConnectAtStartup;
-
- private boolean shouldExpandSectionWhenDataAvailable;
+public class TaxonomicEditorGeneralPreferences extends
+ FieldEditorPreferencePage implements IWorkbenchPreferencePage {
- private boolean shouldShowExperimentalFeatures;
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
+ * ()
*/
- /** {@inheritDoc} */
@Override
- protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- final GridLayout gridLayout = new GridLayout();
- container.setLayout(gridLayout);
-
- createShowUuidInSupplementalView(container);
- createMapServiceAccessPoint(container);
- createShouldConnectAtStartUp(container);
- createShouldExpandSectionWhenDataAvailable(container);
-
- createShowExperimentalFeatures(container);
-
- return container;
- }
-
-
- private void createShouldExpandSectionWhenDataAvailable(Composite container) {
- shouldExpandSectionWhenDataAvailable = getPreferenceStore().getBoolean(IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE);
-
- final Composite composite = createComposite(container);
-
- final Button button = new Button(composite, SWT.CHECK);
- button.setText("Should expand sections when data is available (Details View)");
-
- button.setSelection(shouldExpandSectionWhenDataAvailable);
-
- button.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- shouldExpandSectionWhenDataAvailable = button.getSelection();
- }
- });
-
- }
+ protected void createFieldEditors() {
+ addField(new BooleanFieldEditor(PreferencesUtil.SHOW_DEBUG_INFORMATION,
+ "Show UUID and object ID in supplemental data view.",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(
+ IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE,
+ "Should expand sections when data is available (Details View)",
+ getFieldEditorParent()));
+ addField(new StringFieldEditor(
+ IPreferenceKeys.EDIT_MAP_SERVICE_ACCES_POINT,
+ "EDIT Map Service Access Point:", getFieldEditorParent()));
+ addField(new BooleanFieldEditor(
+ IPreferenceKeys.SHOULD_CONNECT_AT_STARTUP,
+ "Connect to last used datasource when launching",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(
+ IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES,
+ "Show experimental features", getFieldEditorParent()));
- private void createMapServiceAccessPoint(Composite composite) {
- editMapServiceAccessPoint = PreferencesUtil.getMapServiceAccessPoint();
-
-// Composite composite = createComposite(parent);
-
- final CLabel label = new CLabel(composite, SWT.NULL);
- label.setText("EDIT Map Service Access Point:");
-
- final Text text = new Text(composite, SWT.BORDER);
- text.setText(editMapServiceAccessPoint);
- text.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- text.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- editMapServiceAccessPoint = text.getText();
- }
- });
}
-
-
- private void createShowUuidInSupplementalView(Composite parent){
- showUuidInSupplementalView = getPreferenceStore().getBoolean(PreferencesUtil.SHOW_DEBUG_INFORMATION);
-
- final Composite composite = createComposite(parent);
-
- final Button button_toggle = new Button(composite, SWT.CHECK);
-
-
- button_toggle.setText("Show UUID and object ID in supplemental data view.");
-
- button_toggle.setSelection(showUuidInSupplementalView);
-
-
- button_toggle.addSelectionListener(new SelectionAdapter(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- showUuidInSupplementalView = button_toggle.getSelection();
- }
- });
-
- }
-
- private void createShouldConnectAtStartUp(Composite parent){
- shouldConnectAtStartup = getPreferenceStore().getBoolean(IPreferenceKeys.SHOULD_CONNECT_AT_STARTUP);
-
- final Composite composite = createComposite(parent);
-
- final Button button_toggle = new Button(composite, SWT.CHECK);
-
-
- button_toggle.setText("Connect to last used datasource when launching.");
-
- button_toggle.setSelection(shouldConnectAtStartup);
-
-
- button_toggle.addSelectionListener(new SelectionAdapter(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- shouldConnectAtStartup = button_toggle.getSelection();
- }
- });
- }
-
- /**
- * @param container
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
- private void createShowExperimentalFeatures(Composite parent) {
- shouldShowExperimentalFeatures = getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES);
- final Composite composite = createComposite(parent);
-
- final Button button_toggle = new Button(composite, SWT.CHECK);
-
-
- button_toggle.setText("Show experimental features-");
-
- button_toggle.setSelection(shouldShowExperimentalFeatures);
-
-
- button_toggle.addSelectionListener(new SelectionAdapter(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- shouldShowExperimentalFeatures = button_toggle.getSelection();
- }
- });
- }
-
- private Composite createComposite(Composite parent){
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
- composite.setLayout(new RowLayout(SWT.HORIZONTAL));
- return composite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- /** {@inheritDoc} */
+ @Override
public void init(IWorkbench workbench) {
setPreferenceStore(PreferencesUtil.getPreferenceStore());
}
- /** {@inheritDoc} */
- @Override
- public boolean performOk() {
-
- getPreferenceStore().setValue(IPreferenceKeys.SHOW_DEBUG_INFORMATION, showUuidInSupplementalView);
- getPreferenceStore().setValue(IPreferenceKeys.EDIT_MAP_SERVICE_ACCES_POINT, editMapServiceAccessPoint);
- getPreferenceStore().setValue(IPreferenceKeys.SHOULD_CONNECT_AT_STARTUP, shouldConnectAtStartup);
- getPreferenceStore().setValue(IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE, shouldExpandSectionWhenDataAvailable);
- getPreferenceStore().setValue(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES, shouldShowExperimentalFeatures);
-
- return super.performOk();
- }
-
}
/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
package eu.etaxonomy.taxeditor.store;
import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
/**
- * This implementation of ICdmDataRepository depends on hibernate sessions to store the data correctly
- * for the current session. No state is held in this class.
- *
- * Only methods that either get or manipulate data are exposed here. So this class acts as a facade
- * for the methods in cdmlib-service.
- *
+ * This implementation of ICdmDataRepository depends on hibernate sessions to
+ * store the data correctly for the current session. No state is held in this
+ * class.
+ *
+ * Only methods that either get or manipulate data are exposed here. So this
+ * class acts as a facade for the methods in cdmlib-service.
+ *
* @author n.hoffmann
* @created 17.03.2009
* @version 1.0
*/
-public class CdmStore{
-
- private static final Resource DEFAULT_APPLICATION_CONTEXT = new ClassPathResource("/eu/etaxonomy/cdm/editorApplicationContext.xml", TaxeditorStorePlugin.class);
+public class CdmStore {
+
+ private static final Resource DEFAULT_APPLICATION_CONTEXT = new ClassPathResource(
+ "/eu/etaxonomy/cdm/editorApplicationContext.xml",
+ TaxeditorStorePlugin.class);
private static final DbSchemaValidation DEFAULT_DB_SCHEMA_VALIDATION = DbSchemaValidation.VALIDATE;
-
+
private static CdmStore instance;
-
- private CdmApplicationController applicationController;
-
- private static LoginManager loginManager;
-
- private static ImportManager importManager;
-
- private static ExportManager exportManager;
-
- private static ContextManager contextManager;
-
+
+ private final CdmApplicationController applicationController;
+
+ private static LoginManager loginManager = new LoginManager();
+
+ private static ContextManager contextManager = new ContextManager();;
+
private static TermManager termManager = new TermManager();
-
- private static SearchManager searchManager;
-
- private static EditorManager editorManager;
-
+
+ private static SearchManager searchManager = new SearchManager();
+
+ private static EditorManager editorManager = new EditorManager();
+
private static CdmStoreConnector job;
-
+
private Language language;
-
+
private ICdmDataSource cdmDatasource;
-
+
private boolean isConnected;
-
+
/**
- * <p>getDefault</p>
- *
+ * <p>
+ * getDefault
+ * </p>
+ *
* @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
*/
- protected static CdmStore getDefault(){
- if(instance != null && instance.isConnected){
+ protected static CdmStore getDefault() {
+ if (instance != null && instance.isConnected) {
return instance;
- }else if(instance == null || !instance.isConnected){
-
- StoreUtil.warningDialog("Application is not connected to a datastore", instance, "The requested operation is only available when " +
- "connected to a datasource. You may choose a datasource to connect to or create a new one in the datasource view.");
-
+ } else if (instance == null || !instance.isConnected) {
+
+ StoreUtil
+ .warningDialog(
+ "Application is not connected to a datastore",
+ instance,
+ "The requested operation is only available when "
+ + "connected to a datasource. You may choose a datasource to connect to or create a new one in the datasource view.");
+
StoreUtil.showView(CdmDataSourceViewPart.ID);
-
- }
-
+
+ }
+
throw new RuntimeException();
}
-
+
/**
* Initialize the with the last edited datasource
*/
public static void connect() {
-
- ICdmDataSource datasource = CdmDataSourceRepository.getCurrentDataSource();
-
+
+ ICdmDataSource datasource = CdmDataSourceRepository
+ .getCurrentDataSource();
+
connect(datasource);
}
-
+
/**
* Initialize with a specific datasource
- *
- * @param datasource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
+ *
+ * @param datasource
+ * a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
*/
public static void connect(ICdmDataSource datasource) {
- connect(datasource, DEFAULT_DB_SCHEMA_VALIDATION, DEFAULT_APPLICATION_CONTEXT);
+ connect(datasource, DEFAULT_DB_SCHEMA_VALIDATION,
+ DEFAULT_APPLICATION_CONTEXT);
}
-
+
/**
* Initialize and provide
*
* @param dbSchemaValidation
* @param applicationContextBean
*/
- private static void connect(final ICdmDataSource datasource, final DbSchemaValidation dbSchemaValidation, final Resource applicationContextBean){
+ private static void connect(final ICdmDataSource datasource,
+ final DbSchemaValidation dbSchemaValidation,
+ final Resource applicationContextBean) {
StoreUtil.info("Connecting to datasource: " + datasource);
-
- job = new CdmStoreConnector(Display.getDefault(), datasource, dbSchemaValidation, applicationContextBean);
+
+ job = new CdmStoreConnector(Display.getDefault(), datasource,
+ dbSchemaValidation, applicationContextBean);
job.setUser(true);
job.setPriority(Job.BUILD);
job.schedule();
-
+
}
- public static boolean isConnecting(){
+ public static boolean isConnecting() {
return job != null && job.getState() == Job.RUNNING;
}
/**
* Closes the current application context
- *
- * @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
+ *
+ * @param monitor
+ * a {@link org.eclipse.core.runtime.IProgressMonitor} object.
*/
- public static void close(final IProgressMonitor monitor){
- Display.getDefault().asyncExec(new Runnable(){
- /* (non-Javadoc)
+ public static void close(final IProgressMonitor monitor) {
+ Display.getDefault().asyncExec(new Runnable() {
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
getContextManager().notifyContextAboutToStop(monitor);
- if((monitor == null || (!monitor.isCanceled()) && isActive())){
+ if ((monitor == null || (!monitor.isCanceled()) && isActive())) {
getContextManager().notifyContextStop(monitor);
- if(instance.getApplicationController() != null){
+ if (instance.getApplicationController() != null) {
instance.getApplicationController().close();
}
instance.close();
isConnected = false;
cdmDatasource = null;
}
-
- static void setInstance(CdmApplicationController applicationController, ICdmDataSource dataSource){
+
+ static void setInstance(CdmApplicationController applicationController,
+ ICdmDataSource dataSource) {
instance = new CdmStore(applicationController, dataSource);
}
-
- private CdmStore(CdmApplicationController applicationController, ICdmDataSource dataSource){
+
+ private CdmStore(CdmApplicationController applicationController,
+ ICdmDataSource dataSource) {
this.applicationController = applicationController;
this.cdmDatasource = dataSource;
isConnected = true;
}
-
+
/**
- * All calls to the datastore require
+ * All calls to the datastore require
*
* @return
*/
- private CdmApplicationController getApplicationController(){
- try{
+ private CdmApplicationController getApplicationController() {
+ try {
return applicationController;
- }catch(Exception e){
+ } catch (Exception e) {
StoreUtil.error(CdmStore.class, e);
}
return null;
}
-
+
/**
- * <p>getCurrentApplicationController</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.application.CdmApplicationController} object.
+ * <p>
+ * getCurrentApplicationController
+ * </p>
+ *
+ * @return a
+ * {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
+ * object.
*/
- public static CdmApplicationController getCurrentApplicationController(){
- if(getDefault() != null){
+ public static CdmApplicationController getCurrentApplicationController() {
+ if (getDefault() != null) {
return getDefault().getApplicationController();
}
return null;
*/
/**
- * Creates a new conversation, binds resources to the conversation and
- * start a transaction for this conversation.
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ * Creates a new conversation, binds resources to the conversation and start
+ * a transaction for this conversation.
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
*/
public static ConversationHolder createConversation() {
- ConversationHolder conversation = getCurrentApplicationController().NewConversation();
-
+ ConversationHolder conversation = getCurrentApplicationController()
+ .NewConversation();
+
conversation.startTransaction();
return conversation;
}
-
+
/**
- * Generic method that will return an implementation of the given service interface
- * or <code>null</code> if the
+ * Generic method that will return an implementation of the given service
+ * interface or <code>null</code> if the
*
* @param <T>
* @param serviceClass
* @return
*/
- public static <T extends IService> T getService(Class<T> serviceClass){
- ICdmApplicationConfiguration controller = getCurrentApplicationController();
-
- Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
-
+ public static <T extends IService> T getService(Class<T> serviceClass) {
+ ICdmApplicationConfiguration configuration = getCurrentApplicationController();
+
+ Method[] methods = ICdmApplicationConfiguration.class
+ .getDeclaredMethods();
+
T service = null;
-
- for(Method method : methods){
+
+ for (Method method : methods) {
Type type = method.getGenericReturnType();
-
- if(type.equals(serviceClass)){
+
+ if (type.equals(serviceClass)) {
try {
- service = (T) method.invoke(controller, null);
+ service = (T) method.invoke(configuration, null);
break;
} catch (IllegalArgumentException e) {
StoreUtil.error(CdmStore.class, e);
}
}
}
-
+
return service;
}
-
+
/**
- * <p>getAuthenticationManager</p>
- *
- * @return a {@link org.springframework.security.authentication.ProviderManager} object.
+ * <p>
+ * getAuthenticationManager
+ * </p>
+ *
+ * @return a
+ * {@link org.springframework.security.authentication.ProviderManager}
+ * object.
*/
- public static ProviderManager getAuthenticationManager() { return getCurrentApplicationController().getAuthenticationManager();}
-
+ public static ProviderManager getAuthenticationManager() {
+ return getCurrentApplicationController().getAuthenticationManager();
+ }
+
/**
- * <p>getGeoService</p>
- *
+ * <p>
+ * getGeoService
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.ext.geo.IEditGeoService} object.
*/
- public static IEditGeoService getGeoService(){
- return (IEditGeoService) getCurrentApplicationController().getBean("editGeoService");
+ public static IEditGeoService getGeoService() {
+ return (IEditGeoService) getCurrentApplicationController().getBean(
+ "editGeoService");
}
-
+
/*
* LANGUAGE
*/
-
+
/**
- * <p>getDefaultLanguage</p>
- *
+ * <p>
+ * getDefaultLanguage
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.model.common.Language} object.
*/
- public static Language getDefaultLanguage(){
- if(getDefault().getLanguage() == null){
+ public static Language getDefaultLanguage() {
+ if (getDefault().getLanguage() == null) {
getDefault().setLanguage(PreferencesUtil.getGlobalLanguage());
}
return getDefault().getLanguage();
}
/**
- * <p>setDefaultLanguage</p>
- *
- * @param language a {@link eu.etaxonomy.cdm.model.common.Language} object.
+ * <p>
+ * setDefaultLanguage
+ * </p>
+ *
+ * @param language
+ * a {@link eu.etaxonomy.cdm.model.common.Language} object.
*/
- public static void setDefaultLanguage(Language language){
+ public static void setDefaultLanguage(Language language) {
getDefault().setLanguage(language);
}
-
+
/**
* @return the language
*/
}
/**
- * @param language the language to set
+ * @param language
+ * the language to set
*/
private void setLanguage(Language language) {
this.language = language;
}
-
+
/*
* LOGIN
*/
-
+
/**
- * <p>Getter for the field <code>loginManager</code>.</p>
- *
+ * <p>
+ * Getter for the field <code>loginManager</code>.
+ * </p>
+ *
* @return a {@link eu.etaxonomy.taxeditor.store.LoginManager} object.
*/
- public static LoginManager getLoginManager(){
- if(loginManager == null){
- loginManager = new LoginManager();
- }
+ public static LoginManager getLoginManager() {
return loginManager;
}
-
+
/**
- * <p>Getter for the field <code>contextManager</code>.</p>
- *
+ * <p>
+ * Getter for the field <code>contextManager</code>.
+ * </p>
+ *
* @return a {@link eu.etaxonomy.taxeditor.store.ContextManager} object.
*/
- public static ContextManager getContextManager(){
- if(contextManager == null){
- contextManager = new ContextManager();
- }
+ public static ContextManager getContextManager() {
return contextManager;
}
-
- public static TermManager getTermManager(){
+
+ public static TermManager getTermManager() {
return termManager;
}
-
- public static SearchManager getSearchManager(){
- if(searchManager == null){
- searchManager = new SearchManager();
- }
+
+ public static SearchManager getSearchManager() {
return searchManager;
}
-
+
public static EditorManager getEditorManager() {
- if(editorManager == null){
- editorManager = new EditorManager();
- }
-
return editorManager;
}
-
+
/*
* IMPORT/EXPORT FACTORIES
*/
-
+
/**
- * <p>Getter for the field <code>importHandler</code>.</p>
- *
+ * <p>
+ * Getter for the field <code>importHandler</code>.
+ * </p>
+ *
* @return a {@link eu.etaxonomy.taxeditor.io.ImportManager} object.
*/
- public static ImportManager getImportManager(){
- if(importManager == null){
- importManager = ImportManager.NewInstance(getCurrentApplicationController());
- }
- return importManager;
+ public static ImportManager getImportManager() {
+ return ImportManager.NewInstance(getCurrentApplicationController());
}
-
+
/**
- * <p>Getter for the field <code>exportHandler</code>.</p>
- *
+ * <p>
+ * Getter for the field <code>exportHandler</code>.
+ * </p>
+ *
* @return a {@link eu.etaxonomy.taxeditor.io.ExportManager} object.
*/
- public static ExportManager getExportManager(){
- if(exportManager == null){
- exportManager = ExportManager.NewInstance(getCurrentApplicationController());
- }
- return exportManager;
+ public static ExportManager getExportManager() {
+ return ExportManager.NewInstance(getCurrentApplicationController());
}
-
+
/**
* Whether this CdmStore is currently connected to a datasource
- *
+ *
* @return a boolean.
*/
- public static boolean isActive(){
+ public static boolean isActive() {
return instance != null && instance.isConnected;
}
/**
- * <p>getDataSource</p>
- *
+ * <p>
+ * getDataSource
+ * </p>
+ *
* @return a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
*/
- public static ICdmDataSource getDataSource(){
- if(isActive()){
+ public static ICdmDataSource getDataSource() {
+ if (isActive()) {
return instance.getDatasource();
}
return null;
}
-
+
/**
* @return
*/