Project

General

Profile

« Previous | Next » 

Revision 4aca5046

Added by Patrick Plitzner almost 7 years ago

ref #6694 Remove wizard pages and plugin configurations

View differences:

eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/wizard/SelectFeatureTreeWizardPage.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
13 13
import java.util.List;
14 14
import java.util.UUID;
15 15

  
16
import org.eclipse.core.runtime.IStatus;
17 16
import org.eclipse.jface.viewers.ISelectionChangedListener;
18 17
import org.eclipse.jface.viewers.IStructuredContentProvider;
19 18
import org.eclipse.jface.viewers.IStructuredSelection;
......
22 21
import org.eclipse.jface.viewers.SelectionChangedEvent;
23 22
import org.eclipse.jface.viewers.StructuredSelection;
24 23
import org.eclipse.jface.viewers.Viewer;
25
import org.eclipse.jface.wizard.WizardDialog;
26 24
import org.eclipse.swt.SWT;
27 25
import org.eclipse.swt.events.SelectionAdapter;
28 26
import org.eclipse.swt.events.SelectionEvent;
......
34 32

  
35 33
import eu.etaxonomy.cdm.print.IXMLEntityFactory;
36 34
import eu.etaxonomy.cdm.print.XMLHelper;
37
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeEditorWizard;
38 35

  
39 36
/**
40 37
 * <p>SelectFeatureTreeWizardPage class.</p>
......
43 40
 * @created Aug 6, 2010
44 41
 * @version 1.0
45 42
 */
46
public class SelectFeatureTreeWizardPage extends AbstractPublishWizardPage 
43
public class SelectFeatureTreeWizardPage extends AbstractPublishWizardPage
47 44
	implements ISelectionChangedListener, IHasPersistableSettings{
48
	
45

  
49 46
	private static final String DIALOG_SETTING_FEATURE_TREE_UUID = "dialogSettingFeatureTreeUuid";
50 47
	private ListViewer viewer;
51 48

  
......
58 55
		super(pageName);
59 56
		setTitle("Select Feature Tree");
60 57
	}
61
	
58

  
62 59
	/* (non-Javadoc)
63 60
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
64 61
	 */
......
66 63
	@Override
67 64
	public void createControl(Composite parent) {
68 65
		setPageComplete(false);
69
		
66

  
70 67
		Composite composite = new Composite(parent, SWT.NULL);
71 68
		composite.setLayout(new GridLayout());
72
		
69

  
73 70
		viewer = new ListViewer(composite);
74 71
		viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
75 72
		viewer.setContentProvider(new FeatureTreeContentProvider());
76 73
		viewer.setLabelProvider(new FeatureTreeLabelProvider());
77
		
74

  
78 75
		viewer.addSelectionChangedListener(this);
79
				
76

  
80 77
		// offer feature tree editor when local
81 78
		if(getConfigurator().isLocal()){
82 79
			final Button button_openFeatureTree = new Button(composite, SWT.PUSH);
83 80
			button_openFeatureTree.setText("Open FeatureTree Editor");
84
			
81

  
85 82
			button_openFeatureTree.addSelectionListener(new SelectionAdapter() {
86 83
				@Override
87 84
				public void widgetSelected(SelectionEvent e) {
88
					FeatureTreeEditorWizard featureTreeEditorDialog = new FeatureTreeEditorWizard();
89
					WizardDialog dialog = new WizardDialog(getShell(), featureTreeEditorDialog);
90
					
91
					if(dialog.open() == IStatus.OK){
92
						refresh();
93
					}
85
				    //FIXME: this wizard page has been removed by implementing #6694
86
				    //If print publishing is used again the selection has to be re-implemented
87

  
88
//					FeatureTreeEditorWizard featureTreeEditorDialog = new FeatureTreeEditorWizard();
89
//					WizardDialog dialog = new WizardDialog(getShell(), featureTreeEditorDialog);
90
//
91
//					if(dialog.open() == IStatus.OK){
92
//						refresh();
93
//					}
94 94
				}
95 95
			});
96 96
		}
97
				
97

  
98 98
		// when using a local factory we can set the input right here
99 99
		if(getConfigurator() != null && getConfigurator().isLocal()){
100 100
			refresh();
101 101
		}
102
		
102

  
103 103
		loadSettings();
104
		
104

  
105 105
		setControl(composite);
106 106
	}
107 107

  
108 108
	@Override
109 109
	public void loadSettings() {
110
		String featureTreeUuidString = getDialogSettingValue(DIALOG_SETTING_FEATURE_TREE_UUID); 
111
		
110
		String featureTreeUuidString = getDialogSettingValue(DIALOG_SETTING_FEATURE_TREE_UUID);
111

  
112 112
		if(featureTreeUuidString != null){
113 113
			setSelectedFeatureTree(featureTreeUuidString);
114
			
114

  
115 115
		}
116 116
	}
117
	
117

  
118 118
	/** {@inheritDoc} */
119 119
	@Override
120 120
	public void selectionChanged(SelectionChangedEvent event) {
121 121
		IStructuredSelection selection = (IStructuredSelection) event.getSelection();
122
		
122

  
123 123
		if(selection.isEmpty()){
124 124
			return;
125 125
		}
126
		
126

  
127 127
		setPageComplete(true);
128
		
129
		
128

  
129

  
130 130
		Element featureTreeElement = (Element) selection.getFirstElement();
131
			
131

  
132 132
		UUID featureTreeUuid = XMLHelper.getUuid(featureTreeElement);
133
		
133

  
134 134
		setFeatureTree(featureTreeUuid.toString());
135 135
	}
136
	
136

  
137 137
	private void setSelectedFeatureTree(String featureTreeUuid){
138 138
		List<Element> input = (ArrayList<Element>) viewer.getInput();
139
		
139

  
140 140
		for(Element element : input){
141 141
			UUID uuid = XMLHelper.getUuid(element);
142 142
			if(uuid.toString().equals(featureTreeUuid)){
......
145 145
			}
146 146
		}
147 147
	}
148
	
148

  
149 149
	public void setFeatureTree(String featureTreeUuidString){
150 150
		putDialogSettingValue(DIALOG_SETTING_FEATURE_TREE_UUID, featureTreeUuidString);
151 151
		UUID featureTreeUuid = UUID.fromString(featureTreeUuidString);
152 152
		getConfigurator().setFeatureTree(featureTreeUuid);
153 153
		setPageComplete(featureTreeUuid != null);
154 154
	}
155
	
155

  
156 156
	/** {@inheritDoc} */
157 157
	@Override
158 158
	public boolean canFlipToNextPage() {
......
174 174
		}
175 175
		viewer.setInput(realFeatureTrees);
176 176
	}
177
	
177

  
178 178
	private class FeatureTreeContentProvider implements IStructuredContentProvider {
179 179

  
180 180
		@Override
......
190 190
			}
191 191
			return new Object[0];
192 192
		}
193
		
193

  
194 194
	}
195
	
195

  
196 196
	private class FeatureTreeLabelProvider extends LabelProvider {
197
		
197

  
198 198
		/*
199 199
		 * (non-Javadoc)
200 200
		 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
......
202 202
		@Override
203 203
		public String getText(Object element) {
204 204
			if(element instanceof Element){
205
				Element xmlElement = (Element) element;			
205
				Element xmlElement = (Element) element;
206 206
				return XMLHelper.getTitleCache(xmlElement);
207 207
			}
208 208
			return "no title cache";
209 209
		}
210
		
210

  
211 211
	}
212 212
}

Also available in: Unified diff