@Override
	public void dataTypeReplaced(DataTypeManager dtm, DataTypePath oldPath, DataTypePath newPath,
			DataType newDataType) {

		if (dtm != originalDTM) {
			throw new AssertException("Listener only supports original DTM");
		}

		if (!isLoaded()) {
			return;
		}

		if (!oldPath.equals(originalDataTypePath)) {
			// Check for type which may be referenced by viewComposite
			DataType dt = viewDTM.getDataType(oldPath);
			if (dt == null || !viewDTM.isViewDataTypeFromOriginalDTM(dt)) {
				return;
			}

			if (hasSubDt(viewComposite, oldPath)) {
				String msg = "Replaced data type \"" + oldPath +
					"\", which is a sub-component of \"" + getOriginalDataTypeName() + "\".";
				setStatus(msg, true);
			}
			// NOTE: depending upon event sequence and handling a
			// re-load may have occurred and replacement may be unnecessary
			try {
				viewDTM.withTransaction("Replaced Dependency", () -> {
					viewDTM.clearUndoOnChange();
					viewDTM.replaceDataType(dt, newDataType, true);
				});
			}
			catch (DataTypeDependencyException e) {
				throw new AssertException(e);
			}

			// Clear undo/redo stack to avoid inconsistency with originalDTM
			viewDTM.clearUndo();

			fireTableDataChanged();
			componentDataChanged();
			return;
		}

		consideringReplacedDataType = true;
		try {
			provider.show();

			if (hasChanges) {
				String message = "<html>" + HTMLUtilities.escapeHTML(oldPath.getPath()) +
					" has been replaced outside the editor.<br>" +
					"Discard edits and close?</html>";
				String title = "Close " + getTypeName() + " Editor?";
				int response = OptionDialog.showYesNoDialogWithNoAsDefaultButton(
					provider.getComponent(), title, message);
				if (response != OptionDialog.OPTION_ONE) {
					compositeInfoChanged();
					return;
				}
			}
			else {
				String message = "<html>" + HTMLUtilities.escapeHTML(oldPath.getPath()) +
					" has been replaced outside the editor.</html>";
				Msg.showWarn(this, provider.getComponent(), "Closing " + getTypeName() + " Editor",
					message);
			}

			// fast close, discard any changes
			provider.closeComponent(true);
		}
		finally {
			consideringReplacedDataType = false;
		}
	}
Returns whether the selected component(s) can be moved down (to the next higher index).
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompEditorModel.java