blob: 9c5be6928a255306d2bacfc2fe565873e2b76b18 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
* 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:
* Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 482443
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.common.wizards;
import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.papyrus.infra.nattable.common.messages.Messages;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
/**
* Wizard declaration to display and choose existing Nattable configurations
*/
public class CreateNattableFromCatalogWizard extends Wizard {
/**
* The page which allow to select the table to create.
*/
private ChooseNattableConfigWizardPage page;
/**
* The selected view prototypes in the wizard.
*/
private Map<ViewPrototype, Integer> selectedViewPrototypes;
/**
* The table name by view prototype.
*/
private Map<ViewPrototype, String> tableNames;
/**
* The context of the future table.
*/
private EObject context;
/**
* Constructor.
*
* @param context
* The context of the table to create
*/
public CreateNattableFromCatalogWizard(final EObject context) {
this.context = context;
}
/**
* Enables the finish button when there's at least one selected configuration.
* {@inheritDoc}
*
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override
public boolean performFinish() {
this.selectedViewPrototypes = page.getSelectedViewPrototypes();
this.tableNames = page.getTableNames();
if (this.selectedViewPrototypes != null && this.tableNames != null) {
if (this.selectedViewPrototypes.size() > 0) {
return true;
}
}
return false;
}
/**
* Create and add the unique page to the wizard
*
* @see org.eclipse.jface.wizard.Wizard#addPages()
*
*/
@Override
public void addPages() {
String description = Messages.CreateNattableFromCatalogWizard_0;
page = new ChooseNattableConfigWizardPage(description, context);
page.setTitle(Messages.CreateNattableFromCatalogWizard_1);
page.setDescription(description);
addPage(page);
}
/**
* Declare wizard title
*
* @see org.eclipse.jface.wizard.Wizard#getWindowTitle()
*
* @return
*/
@Override
public String getWindowTitle() {
return Messages.CreateNattableFromCatalogWizard_2;
}
/**
* Getter for selected view prototypes.
*
* @return The selected view prototypes.
*/
public Map<ViewPrototype, Integer> getSelectedViewPrototypes() {
return selectedViewPrototypes;
}
/**
* Getter for the selected table names.
*
* @return The selected table names.
*/
public Map<ViewPrototype, String> getTableNames() {
return tableNames;
}
}
|