@Override
	public void checkState() {
		super.checkState();
		if (!isValid()) {
			return;
		}
		String projectValue = projectField.getStringValue();
		String portValue = portField.getStringValue();
		setValid(true);
		if (!projectValue.isEmpty()) {
			IWorkspace workspace = ResourcesPlugin.getWorkspace();
			IWorkspaceRoot workspaceRoot = workspace.getRoot();
			IProject project = workspaceRoot.getProject(projectValue);
			if (!project.exists() || !project.isOpen() || !CdtUtils.isCdtProject(project)) {
				setErrorMessage("Project is not an open CDT project.");
				setValid(false);
				return;
			}
		}
		if (!portValue.isEmpty()) {
			try {
				int portNumber = Integer.parseInt(portValue);
				if (portNumber < 1024 || portNumber > 0xFFFF) {
					setErrorMessage("Port must be between 1024 and 65535.");
					setValid(false);
					return;
				}
			}
			catch (NumberFormatException e) {
				setErrorMessage("Port must be an integer.");
				setValid(false);
				return;
			}
		}
	}
This class represents a preference page that is contributed to the Preferences dialog. By
subclassing {@link FieldEditorPreferencePage}, we can use the field support built into JFace
that allows us to create a page that is small and knows how to save, restore and apply itself.
<p>
This page is used to modify preferences only. They are stored in the preference store that
belongs to the main plug-in class. That way, preferences can be accessed directly via the
preference store.
GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidrasymbollookup/preferences/GhidraSymbolLookupPreferencePage.java