private void calculateEnabledState(Document doc) {
		// if there was none ...
		if (doc == null) {
			setEnabled(false);
			
		// else if it has no name (e.g., it's a new doc, not yet saved) ...
		} else if (doc.getFileName().equals("")) {
			setEnabled(true);
			
		// else if it has a name, thus it's not a new doc, and it's been modified
		} else if (doc.isModified()) {
			// If we're imported then we can't save.
			if (PropertyContainerUtil.getPropertyAsBoolean(doc.getDocumentInfo(), DocumentInfo.KEY_IMPORTED)) {
				setEnabled(false);
			} else {
				setEnabled(true);
			}
			
		// else it has a name, but has not been modified
		} else {
			setEnabled(false);
		}
	}