Revision 5aeccadc
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.ui.dialog.selection; |
11 | 11 |
|
12 | 12 |
import java.text.Collator; |
13 |
import java.util.ArrayList; |
|
13 | 14 |
import java.util.Collections; |
14 | 15 |
import java.util.Comparator; |
15 | 16 |
import java.util.HashSet; |
... | ... | |
33 | 34 |
import org.eclipse.swt.events.SelectionEvent; |
34 | 35 |
import org.eclipse.swt.events.SelectionListener; |
35 | 36 |
import org.eclipse.swt.graphics.Cursor; |
37 |
import org.eclipse.swt.widgets.Button; |
|
36 | 38 |
import org.eclipse.swt.widgets.Composite; |
37 |
import org.eclipse.swt.widgets.Control; |
|
38 |
import org.eclipse.swt.widgets.Link; |
|
39 | 39 |
import org.eclipse.swt.widgets.Shell; |
40 | 40 |
|
41 | 41 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
... | ... | |
228 | 228 |
protected void fillContentProvider(IProgressMonitor progressMonitor) |
229 | 229 |
throws CoreException { |
230 | 230 |
try { |
231 |
if (model == null){ |
|
232 |
model = new ArrayList<UuidAndTitleCache<T>>(); |
|
233 |
} |
|
231 | 234 |
if(model != null){ |
232 | 235 |
if (progressMonitor != null){ |
233 | 236 |
progressMonitor.beginTask("Looking for entities", model.size()); |
... | ... | |
250 | 253 |
} |
251 | 254 |
this.refresh(); |
252 | 255 |
}else{ |
256 |
|
|
253 | 257 |
MessagingUtils.warn(getClass(), "Model for Filtered Selection is null:" + this.getClass().getSimpleName()); |
254 | 258 |
} |
255 | 259 |
} |
... | ... | |
348 | 352 |
* |
349 | 353 |
* @return a {@link java.lang.String} object. |
350 | 354 |
*/ |
351 |
protected abstract String getNewWizardLinkText();
|
|
355 |
protected abstract String[] getNewWizardText();
|
|
352 | 356 |
|
353 | 357 |
/** |
354 | 358 |
* <p>getNewEntityWizard</p> |
... | ... | |
377 | 381 |
*/ |
378 | 382 |
/** {@inheritDoc} */ |
379 | 383 |
|
384 |
// @Override |
|
385 |
// protected Control createExtendedContentArea(Composite parent) { |
|
386 |
// String newWizardLinkText = getNewWizardLinkText(); |
|
387 |
//// if(newWizardLinkText != null){ |
|
388 |
//// newButton1 = this.createButton(this.getShell(), new_id, newWizardLinkText, false); |
|
389 |
//// |
|
390 |
//// newButton1.addSelectionListener(getNewWizardLinkSelectionListener()); |
|
391 |
//// return newButton1; |
|
392 |
//// } |
|
393 |
// return null; |
|
394 |
// } |
|
395 |
|
|
380 | 396 |
@Override |
381 |
protected Control createExtendedContentArea(Composite parent) { |
|
382 |
String newWizardLinkText = getNewWizardLinkText(); |
|
383 |
if(newWizardLinkText != null){ |
|
384 |
Link link = new Link(parent, SWT.NONE); |
|
385 |
link.setText(newWizardLinkText); |
|
386 |
link.addSelectionListener(getNewWizardLinkSelectionListener()); |
|
387 |
return link; |
|
388 |
} |
|
389 |
return null; |
|
390 |
} |
|
397 |
protected void createButtonsForButtonBar(Composite parent) { |
|
398 |
String[] newButtonText = getNewWizardText(); |
|
399 |
if (newButtonText!= null){ |
|
400 |
this.newButton1 = createButton(parent, this.new_id, newButtonText[0], false); |
|
401 |
newButton1.addSelectionListener(getNewWizardButtonSelectionListener()); |
|
402 |
if (newButtonText.length > 1){ |
|
403 |
newButton2 = createButton(parent, this.new_id2, newButtonText[1], false); |
|
404 |
newButton2.addSelectionListener(getNewWizardButtonSelectionListener()); |
|
405 |
} |
|
406 |
} |
|
407 |
|
|
408 |
super.createButtonsForButtonBar(parent); |
|
409 |
} |
|
391 | 410 |
|
392 |
protected SelectionListener getNewWizardLinkSelectionListener(){
|
|
411 |
protected SelectionListener getNewWizardButtonSelectionListener(){
|
|
393 | 412 |
return new SelectionAdapter() { |
394 | 413 |
|
395 | 414 |
/* (non-Javadoc) |
... | ... | |
397 | 416 |
*/ |
398 | 417 |
@Override |
399 | 418 |
public void widgetSelected(SelectionEvent e) { |
400 |
|
|
401 |
AbstractNewEntityWizard wizard = getNewEntityWizard(e.text); |
|
419 |
Object source = e.getSource(); |
|
420 |
String text = null; |
|
421 |
if (source instanceof Button){ |
|
422 |
Button sourceButton = (Button) source; |
|
423 |
text = sourceButton.getText(); |
|
424 |
} |
|
425 |
AbstractNewEntityWizard wizard = getNewEntityWizard(text); |
|
402 | 426 |
if(wizard!=null){ |
403 | 427 |
wizard.init(null, null); |
404 | 428 |
if(wizard.getEntity() != null) { |
... | ... | |
457 | 481 |
model.remove(uuidAndTitleCacheToRemove); |
458 | 482 |
} |
459 | 483 |
} |
484 |
@Override |
|
485 |
void createFilterButton(Composite searchAndFilter){ |
|
486 |
//as default no filter button available |
|
487 |
} |
|
460 | 488 |
} |
Also available in: Unified diff
e4 migration of selection dialogs