private boolean createFragmentFromView(ProgramNode destNode, AddressSetView view) {

		String name = generateFragmentName(view.getMinAddress());

		// make sure name is not already in use
		ProgramFragment f = listing.getFragment(treeName, name);
		if (f == null) {
			ProgramModule m = listing.getModule(treeName, name);
			if (m != null) {
				name = getNewFragmentName();
			}
		}
		else {
			name = getNewFragmentName();
		}
		ProgramModule destModule = destNode.getModule();
		ProgramFragment newFrag = null;
		try {
			newFrag = destModule.createFragment(name);
			moveRanges(newFrag, view);
			return true;
		}
		catch (DuplicateNameException e) {
			// shouldn't happen
		}
		catch (NotFoundException e) {
			try {
				// remove the new fragment
				destModule.removeChild(name);
				Msg.showError(this, this, "Move Code Units Failed", e.getMessage());
			}
			catch (NotEmptyException exc) {
				// shouldn't happen since we just added the fragment
			}

		}
		return false;
	}
Create a new fragment and move the code units in the view to the
new fragment.
@param destNode destination node that is a module
@param view view containing the addresses of the code units
@return boolean true if move of the code units was successful
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramDnDTree.java