Project

General

Profile

« Previous | Next » 

Revision 84269784

Added by Katja Luther over 7 years ago

ref #5972: the wizard warns the user if the reference is used ssomewhere else

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LabelElement.java
60 60
	public void setForeground(Color color){
61 61
		label.setForeground(color);
62 62
	}
63
	
64
	public void setVisible(boolean setVisible){
65
		label.setVisible(setVisible);
66
	}
63 67
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
15 15
import java.util.Arrays;
16 16
import java.util.List;
17 17

  
18
import org.eclipse.jface.wizard.WizardPage;
18 19
import org.eclipse.swt.SWT;
19 20
import org.eclipse.swt.widgets.Display;
20 21
import org.eclipse.swt.widgets.Label;
......
30 31
import eu.etaxonomy.cdm.model.reference.ReferenceType;
31 32
import eu.etaxonomy.taxeditor.store.CdmStore;
32 33
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
34
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
33 35
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
34 36
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
35 37
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
......
113 115
	@Override
114 116
	protected void createControls(ICdmFormElement formElement,
115 117
			Reference entity, int style) {
118
		ICdmFormElement o = this.getParentElement();
119
		Class clazz=o.getClass();
116 120
		setWarnForReferencingObjects(formElement);
117 121
		
122
		
118 123
		toggleable_cache = formFactory.createToggleableTextField(formElement,
119 124
				"Reference Cache", entity.getTitleCache(),
120 125
				entity.isProtectedTitleCache(), style);
......
615 620
			}else{
616 621
				warnForReferencedObjects.setText(CdmUtils.Nz("The reference is referenced by " + referencingObjectsCount+ " objects, if you change it, it is changed for all these objects"));
617 622
			}
623
			warnForReferencedObjects.setVisible(false);
618 624
		}
619 625
	}
620 626
	
627
	public void setWarnForReferencingObjectsVisible(boolean isVisible){
628
		if (warnForReferencedObjects != null){
629
			warnForReferencedObjects.setVisible(isVisible);
630
		}
631
	}
632

  
633
	
621 634
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java
56 56
		ReferenceDetailElement referenceElement = formFactory.createReferenceDetailElement(rootElement, SWT.NULL);
57 57
		referenceElement.addExceptionHandler(this);
58 58
		referenceElement.setEntity(entity);
59
		
59
		referenceElement.setWarnForReferencingObjectsVisible(true);
60 60
		return referenceElement;
61 61
	}
62 62

  

Also available in: Unified diff