Hi Troy,
I've been trying to learn about the namespace "stuff" for a wee while and this is what I've come up with.
Once I find the Something to replace I then add a "use Joomla\CMS\Something;" at the top of the file where I want to use it. For example; in your first image you need to add "use Joomla\CMS\Factory;" and then drop the J from your statement to become $doc = Factory::getDocument();
Here is a list of the regular ones I use:
use Joomla\CMS\Component\Router\RouterBase; //in the component router (site)
use Joomla\CMS\MVC\Controller\BaseController; // in the component controller (site)
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Installer;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\MVC\Model\FormModel;
use Joomla\CMS\MVC\Model\ItemModel;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Categories\Categories;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin;
use Joomla\CMS\Plugin\CMSPlugin; // extends CMSPlugin replaces JPlugin
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\Helper\TagsHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\User\UserHelper;
use Joomla\CMS\Access\Access;
use Joomla\Data\DataObject;
use Joomla\Utilities\ArrayHelper;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Folder;
use Joomla\Filesystem\Path;
use Joomla\Registry\Registry;
use Joomla\Event\Dispatcher;
If you have defined "use Joomla\Filesystem\Folder;" or "use Joomla\Filesystem\File;" then you don't need to jimport('joomla.filesystem.folder); etc.
I don't use phpstorm so there are some things in your code that I assume are placed there by phpstorm, but the way I use enqueueMessage is:
use Joomla\CMS\Factory; // at the top of the file
Factory::getApplication()->enqueueMessage(Text::_('COM_MYCOMPONENT_ITEM_DELETED_SUCCESSFULLY'), 'success');
Now if someone notices anything I'm doing wrong in the above, then please say so, but I hope this helps. Cheers.
Glenn