@Override
	protected void okCallback() {

		String labelText = getText();
		Namespace namespace = getSelectedNamespace();
		SymbolPath symbolPath = getSymbolPath(labelText);
		if (symbolPath == null) {
			Swing.runLater(() -> checkForRemoveLabel());
			return;
		}

		String symbolName = symbolPath.getName();
		if (StringUtils.isBlank(symbolName)) {
			// this is the case of having a namespace without a name, such as "Namespace::"
			setStatusText("Name cannot be blank while changing namespace");
			return;
		}

		// see if the user specified a namespace path and if so, then get the
		// new namespace name from that path
		Namespace parent = getOrCreateNamespaces(symbolPath, namespace);
		if (parent == null) {
			return;
		}

		boolean isCurrentlyEntryPoint = false;
		boolean isCurrentlyPinned = false;
		CompoundCmd<Program> cmd = new CompoundCmd<>(symbol == null ? "Add Label" : "Edit Label");
		if (symbol == null) {
			cmd.add(new AddLabelCmd(addr, symbolName, parent, SourceType.USER_DEFINED));
		}
		else {
			cmd.add(new RenameLabelCmd(symbol, labelText, namespace, SourceType.USER_DEFINED));
			isCurrentlyEntryPoint = symbol.isExternalEntryPoint();
			isCurrentlyPinned = symbol.isPinned();
		}

		if (!tool.execute(cmd, program)) {
			setStatusText(cmd.getStatusMsg());
			return;
		}

		cmd = new CompoundCmd<>(symbol == null ? "Add Label" : "Edit Label");
		if (primaryCheckBox.isEnabled() && primaryCheckBox.isSelected()) {
			cmd.add(new SetLabelPrimaryCmd(addr, symbolName, parent));
		}
		if (entryPointCheckBox.isEnabled() &&
			entryPointCheckBox.isSelected() != isCurrentlyEntryPoint) {
			cmd.add(new ExternalEntryCmd(addr, !isCurrentlyEntryPoint));
		}
		if (pinnedCheckBox.isEnabled() && pinnedCheckBox.isSelected() != isCurrentlyPinned) {
			cmd.add(new PinSymbolCmd(addr, symbolName, !isCurrentlyPinned));
		}

		if (!tool.execute(cmd, program)) {
			setStatusText(cmd.getStatusMsg());
			return;
		}
		updateRecentLabels(symbolName);

		program = null;
		close();
	}
Invokes the dialog to edit an existing label in the given program
@param targetSymbol the symbol(label) to edit
@param targetProgram the program containing the symbol
@param provider the ComponentProvider to parent and center the dialog over.
Ghidra/Features/Base/src/main/java/ghidra/app/util/AddEditDialog.java