Repository: NationalSecurityAgency/ghidra
File: Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditExternalReferencePanel.java (Java)

Code before:
		extLabel = new JTextField();
		bottomPanel.add(extLabel);

		bottomPanel.add(new GLabel("Address:", SwingConstants.RIGHT));
		extAddr = new AddressInput();
		bottomPanel.add(extAddr);

		setLayout(new VerticalLayout(5));
		add(topPanel);
		add(bottomPanel);

	}

	private void extProgNameChanged() {
		boolean hasText = (extLibName.getText().trim().length() != 0);
		clearButton.setEnabled(hasText);
		editButton.setEnabled(hasText);
		extLibPath.setText(null);
	}

	private void populateExternalNames() {
		String[] names = fromCodeUnit.getProgram().getExternalManager().getExternalLibraryNames();
		extLibName.clearModel();
		extLibName.addItem(Library.UNKNOWN);
		Arrays.sort(names);
		if (!Library.UNKNOWN.equals(extLibName)) {
			for (String name : names) {
				extLibName.addItem(name);
			}
		}
	}

	private void updateExtLibPath() {
		String name = extLibName.getText().trim();
		String path = null;
		if (name.length() != 0) {
			name = name.trim();
			path = fromCodeUnit.getProgram().getExternalManager().getExternalLibraryPath(name);
		}
		extLibPath.setText(path);
	}

	/**
	 * Pop up the data tree dialog so the user can choose the external program.
	 */
	private void popupProgramChooser() {
		DataTreeDialog d =
			new DataTreeDialog(this.getParent(), "Choose External Program", DataTreeDialog.OPEN);
		final DataTreeDialog dialog = d;
		d.addOkActionListener(new ActionListener() {
			@Override

Review comment (suggestion):
this still isn't correct.  The original code was trying to compare Library.UNKNOWN (ie. ```"<EXTERNAL>"```) to the current element from names.

```java
		for (String name : names) {
			if (Library.UNKNOWN.equals(name)) {
				continue;
			}
			extLibName.addItem(name);
		}
```


Code after:
		extLabel = new JTextField();
		bottomPanel.add(extLabel);

		bottomPanel.add(new GLabel("Address:", SwingConstants.RIGHT));
		extAddr = new AddressInput();
		bottomPanel.add(extAddr);

		setLayout(new VerticalLayout(5));
		add(topPanel);
		add(bottomPanel);

	}

	private void extProgNameChanged() {
		boolean hasText = (extLibName.getText().trim().length() != 0);
		clearButton.setEnabled(hasText);
		editButton.setEnabled(hasText);
		extLibPath.setText(null);
	}

	private void populateExternalNames() {
		String[] names = fromCodeUnit.getProgram().getExternalManager().getExternalLibraryNames();
		extLibName.clearModel();
		extLibName.addItem(Library.UNKNOWN);
		Arrays.sort(names);
		for (String name : names) {
			if (Library.UNKNOWN.equals(name)) {
				continue;
			}
			extLibName.addItem(name);
		}
	}

	private void updateExtLibPath() {
		String name = extLibName.getText().trim();
		String path = null;
		if (name.length() != 0) {
			name = name.trim();
			path = fromCodeUnit.getProgram().getExternalManager().getExternalLibraryPath(name);
		}
		extLibPath.setText(path);
	}

	/**
	 * Pop up the data tree dialog so the user can choose the external program.
	 */
	private void popupProgramChooser() {
		DataTreeDialog d =
			new DataTreeDialog(this.getParent(), "Choose External Program", DataTreeDialog.OPEN);
		final DataTreeDialog dialog = d;
		d.addOkActionListener(new ActionListener() {