@Override
	protected void decompilerActionPerformed(DecompilerActionContext context) {
		PluginTool tool = context.getTool();
		final ClangToken tokenAtCursor = context.getTokenAtCursor();
		HighSymbol highSymbol = tokenAtCursor.getHighSymbol(context.getHighFunction());
		Symbol symbol = null;
		if (highSymbol instanceof HighCodeSymbol) {
			symbol = ((HighCodeSymbol) highSymbol).getCodeSymbol();
			if (symbol == null) {
				// Try to get the dynamic symbol
				Address addr = ((HighCodeSymbol) highSymbol).getStorage().getMinAddress();
				SymbolTable symbolTable = context.getProgram().getSymbolTable();
				symbol = symbolTable.getPrimarySymbol(addr);
			}
		}
		if (symbol == null) {
			Msg.showError(this, tool.getToolFrame(), "Rename Failed",
				"Memory storage not found for global variable");
			return;
		}
		AddEditDialog dialog = new AddEditDialog("Rename Global", context.getTool());
		dialog.editLabel(symbol, context.getProgram());
	}
Action triggered from a specific token in the decompiler window to rename a global variable.
The variable is associated with an address. There may already be a symbol in the database
there, in which case the symbol is simply renamed. Otherwise a new symbol is added.
Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RenameGlobalAction.java