Revision f6a8dc56
Added by Patrick Plitzner over 10 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity; |
48 | 48 |
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache; |
49 | 49 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
50 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
50 | 51 |
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; |
51 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
52 | 52 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
53 | 53 |
|
54 | 54 |
/** |
... | ... | |
61 | 61 |
public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmBase> extends |
62 | 62 |
FilteredItemsSelectionDialog implements IConversationEnabled { |
63 | 63 |
|
64 |
private ConversationHolder conversation; |
|
64 |
private final ConversationHolder conversation;
|
|
65 | 65 |
|
66 | 66 |
protected List<UuidAndTitleCache<T>> model; |
67 |
private Set<T> transientCdmObjects = new HashSet<T>(); |
|
68 |
private String settings;
|
|
67 |
private final Set<T> transientCdmObjects = new HashSet<T>();
|
|
68 |
private final String settings;
|
|
69 | 69 |
|
70 | 70 |
protected T cdmBaseToBeFiltered; |
71 | 71 |
|
... | ... | |
281 | 281 |
lastCompletedFilter.setAccessible(true); |
282 | 282 |
lastCompletedFilter.set(this, null); |
283 | 283 |
} catch (SecurityException e) { |
284 |
StoreUtil.error(getClass(), e);
|
|
284 |
AbstractUtility.error(getClass(), e);
|
|
285 | 285 |
} catch (NoSuchFieldException e) { |
286 |
StoreUtil.error(getClass(), e);
|
|
286 |
AbstractUtility.error(getClass(), e);
|
|
287 | 287 |
} catch (IllegalArgumentException e) { |
288 |
StoreUtil.error(getClass(), e);
|
|
288 |
AbstractUtility.error(getClass(), e);
|
|
289 | 289 |
} catch (IllegalAccessException e) { |
290 |
StoreUtil.error(getClass(), e);
|
|
290 |
AbstractUtility.error(getClass(), e);
|
|
291 | 291 |
} |
292 | 292 |
|
293 | 293 |
// this also is not the nicest way to do it. |
... | ... | |
316 | 316 |
progressMonitor.worked(1); |
317 | 317 |
} |
318 | 318 |
}else{ |
319 |
StoreUtil.warn(getClass(), "Model for Filtered Selection is null:" + this.getClass().getSimpleName());
|
|
319 |
AbstractUtility.warn(getClass(), "Model for Filtered Selection is null:" + this.getClass().getSimpleName());
|
|
320 | 320 |
} |
321 | 321 |
} |
322 | 322 |
finally { |
... | ... | |
354 | 354 |
@Override |
355 | 355 |
protected Comparator getItemsComparator() { |
356 | 356 |
return new Comparator<UuidAndTitleCache>() { |
357 |
@Override |
|
357 | 358 |
public int compare(UuidAndTitleCache entity1, |
358 | 359 |
UuidAndTitleCache entity2) { |
359 | 360 |
Collator collator = Collator.getInstance(); |
... | ... | |
403 | 404 |
/* |
404 | 405 |
* @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.SelectionHistory#restoreItemFromMemento(org.eclipse.ui.IMemento) |
405 | 406 |
*/ |
407 |
@Override |
|
406 | 408 |
protected Object restoreItemFromMemento(IMemento element) { |
407 | 409 |
return element.getString("resource"); //$NON-NLS-1$ |
408 | 410 |
} |
... | ... | |
410 | 412 |
* @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.SelectionHistory#storeItemToMemento(java.lang.Object, |
411 | 413 |
* org.eclipse.ui.IMemento) |
412 | 414 |
*/ |
415 |
@Override |
|
413 | 416 |
protected void storeItemToMemento(Object item, IMemento element) { |
414 | 417 |
element.putString("resource", item.toString()); //$NON-NLS-1$ |
415 | 418 |
} |
... | ... | |
430 | 433 |
protected abstract AbstractNewEntityWizard getNewEntityWizard(String parameter); |
431 | 434 |
|
432 | 435 |
public class FilteredCdmResourceLabelProvider extends LabelProvider { |
436 |
@Override |
|
433 | 437 |
public String getText(Object element) { |
434 | 438 |
if (element == null) { |
435 | 439 |
return null; |
... | ... | |
444 | 448 |
/** {@inheritDoc} */ |
445 | 449 |
@Override |
446 | 450 |
protected Control createExtendedContentArea(Composite parent) { |
447 |
if(getNewWizardLinkText() != null){ |
|
451 |
String newWizardLinkText = getNewWizardLinkText(); |
|
452 |
if(newWizardLinkText != null){ |
|
448 | 453 |
Link link = new Link(parent, SWT.NONE); |
449 |
link.setText(getNewWizardLinkText());
|
|
454 |
link.setText(newWizardLinkText);
|
|
450 | 455 |
link.addSelectionListener(getNewWizardLinkSelectionListener()); |
451 | 456 |
return link; |
452 | 457 |
} |
... | ... | |
486 | 491 |
* |
487 | 492 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
488 | 493 |
*/ |
494 |
@Override |
|
489 | 495 |
public ConversationHolder getConversationHolder() { |
490 | 496 |
return conversation; |
491 | 497 |
} |
492 | 498 |
|
493 | 499 |
/** {@inheritDoc} */ |
500 |
@Override |
|
494 | 501 |
public void update(CdmDataChangeMap changeEvents) {} |
495 | 502 |
|
496 | 503 |
/** |
Also available in: Unified diff
merged model adaptions to cdmlib 3.2.4 from campanula branch