Project

General

Profile

« Previous | Next » 

Revision 434b59e1

Added by Patrick Plitzner over 6 years ago

ref #7005 Migrate Tcs import

View differences:

eu.etaxonomy.taxeditor.store/fragment.e4xmi
112 112
    <elements xsi:type="commands:Command" xmi:id="_tBCr8KmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importRisReference" commandName="%wizard.name.24"/>
113 113
    <elements xsi:type="commands:Command" xmi:id="_bLGTMKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importSdd" commandName="%wizard.name.4"/>
114 114
    <elements xsi:type="commands:Command" xmi:id="_2JV9IKnAEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelSpecimen" commandName="%wizard.name.5"/>
115
    <elements xsi:type="commands:Command" xmi:id="_OQ9n8KnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importTcs" commandName="%wizard.name"/>
115 116
  </fragments>
116 117
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
117 118
    <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
......
126 127
    <elements xsi:type="commands:Handler" xmi:id="_96ANIKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.ris.OpenRisImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.ris.OpenRisImportWizard" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
127 128
    <elements xsi:type="commands:Handler" xmi:id="_do2IAKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.sdd.OpenSddImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.sdd.OpenSddImportWizard" command="_bLGTMKmuEeeTAPHmaMLwQQ"/>
128 129
    <elements xsi:type="commands:Handler" xmi:id="_6BmBEKnAEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.specimen.OpenExcelSpecimenImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.excel.specimen.OpenExcelSpecimenImportWizard" command="_2JV9IKnAEeeTAPHmaMLwQQ"/>
130
    <elements xsi:type="commands:Handler" xmi:id="_Q8Z6gKnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.tcs.TcsImportWizardE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.tcs.TcsImportWizardE4" command="_OQ9n8KnCEeeTAPHmaMLwQQ"/>
129 131
  </fragments>
130 132
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
131 133
    <elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="Term Editor">
......
152 154
      <children xsi:type="menu:HandledMenuItem" xmi:id="_0z1o8KmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExcelSpecimen" label="%wizard.name.5" command="_2JV9IKnAEeeTAPHmaMLwQQ"/>
153 155
      <children xsi:type="menu:HandledMenuItem" xmi:id="_pQNeoKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importRisReference" label="%wizard.name.24" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
154 156
      <children xsi:type="menu:HandledMenuItem" xmi:id="_hXY2UKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importSdd" label="%wizard.name.4" command="_bLGTMKmuEeeTAPHmaMLwQQ"/>
157
      <children xsi:type="menu:HandledMenuItem" xmi:id="_X2Xb8KnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importTcs" label="%wizard.name" command="_OQ9n8KnCEeeTAPHmaMLwQQ"/>
155 158
    </elements>
156 159
  </fragments>
157 160
</fragment:ModelFragments>
eu.etaxonomy.taxeditor.store/plugin.xml
409 409
            type="java.util.List">
410 410
      </commandParameterType>
411 411
   </extension>
412
   <extension
413
         point="org.eclipse.ui.importWizards">
414
      <wizard
415
            category="eu.etaxonomy.taxeditor.import.category.cdm"
416
            class="eu.etaxonomy.taxeditor.io.wizard.TcsImportWizard"
417
            id="eu.etaxonomy.taxeditor.io.import.tcs"
418
            name="%wizard.name">
419
      </wizard>
420
   
421
   <!--   <wizard
422
            category="eu.etaxonomy.taxeditor.import.category.cdm"
423
            class="eu.etaxonomy.taxeditor.io.wizard.JaxbImportWizard"
424
            id="eu.etaxonomy.taxeditor.io.import.jaxb"
425
            name="JAXB">
426
      </wizard> -->
427
   <!--   <wizard
428
            category="eu.etaxonomy.taxeditor.import.category.cdm"
429
            class="eu.etaxonomy.taxeditor.io.wizard.BerlinModelImportWizard"
430
            id="eu.etaxonomy.taxeditor.io.import.berlinModel"
431
            name="%wizard.name.0">
432
      </wizard>
433
      <wizard
434
            category="eu.etaxonomy.taxeditor.import.category.cdm"
435
            class="eu.etaxonomy.taxeditor.io.wizard.EndnoteImportWizard"
436
            id="eu.etaxonomy.taxeditor.io.import.endnote"
437
            name="%wizard.name.1">
438
      </wizard>-->
439
   </extension>
440 412
   <extension
441 413
         point="org.eclipse.ui.exportWizards">
442 414
      <category
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/tcs/OpenTcsImportWizard.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.io.e4.tcs;
10

  
11
import eu.etaxonomy.taxeditor.io.e4.AbstractImportWizardE4;
12
import eu.etaxonomy.taxeditor.io.e4.AbstractOpenImportWizard;
13

  
14
/**
15
 * @author pplitzner
16
 * @since Oct 5, 2017
17
 *
18
 */
19
public class OpenTcsImportWizard extends AbstractOpenImportWizard {
20

  
21
    /**
22
     * {@inheritDoc}
23
     */
24
    @Override
25
    protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
26
        return TcsImportWizardE4.class;
27
    }
28

  
29
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/tcs/TcsImportWizardE4.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.io.e4.tcs;
11

  
12
import java.io.File;
13
import java.net.URI;
14

  
15
import javax.inject.Inject;
16

  
17
import org.eclipse.core.runtime.jobs.Job;
18
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
19
import org.eclipse.e4.core.contexts.IEclipseContext;
20
import org.eclipse.e4.ui.workbench.modeling.EPartService;
21

  
22
import eu.etaxonomy.cdm.database.DbSchemaValidation;
23
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
24
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
25
import eu.etaxonomy.taxeditor.io.e4.AbstractImportWizardE4;
26
import eu.etaxonomy.taxeditor.io.e4.ImportFromFileDataSourceWizardPageE4;
27
import eu.etaxonomy.taxeditor.store.CdmStore;
28

  
29
/**
30
 *
31
 * @author pplitzner
32
 * @since Oct 5, 2017
33
 *
34
 */
35
public class TcsImportWizardE4 extends AbstractImportWizardE4<TcsXmlImportConfigurator> {
36

  
37

  
38
    private TcsXmlImportConfigurator configurator;
39

  
40
	private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
41

  
42
	@Inject
43
	public TcsImportWizardE4(IEclipseContext context, EPartService partService) {
44
	    super(context, partService);
45
	}
46

  
47
	/** {@inheritDoc} */
48
	@Override
49
	public boolean performFinish() {
50
	    URI source = dataSourcePage.getUri();
51
	    configurator.setSource(source);
52
	    configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
53

  
54
	    Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
55
	    CdmStore.getImportManager().run(job);
56

  
57
	    return true;
58
	}
59

  
60
	/** {@inheritDoc} */
61
	@Override
62
    public void init() {
63
		configurator = CdmStore.getImportManager().TcsConfigurator();
64
	}
65

  
66
	/** {@inheritDoc} */
67
	@Override
68
	public TcsXmlImportConfigurator getConfigurator() {
69
		return configurator;
70
	}
71

  
72
	/** {@inheritDoc} */
73
	@Override
74
	public void addPages() {
75
		super.addPages();
76
		dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
77
		addPage(dataSourcePage);
78
	}
79
}

Also available in: Unified diff