public void reinitialize() { if (reinitializing) return; reinitializing = true; // remove all projects quietly System.out.println("----------------reinitialize---------------"); clear(false); ProjectFactory.getInstance() .setPromptDisabled(true); // prevent remove projects job from prompting to save GraphicManager gm = GraphicManager.getInstance(); Container container = gm == null ? null : gm.getContainer(); instanceFromNewSession(container, false); // reinit ProjectFactory.getInstance().setPromptDisabled(false); // enable prompting again ((DefaultFrameManager) GraphicManager.getInstance().getFrameManager()).cleanUp(true); doExtraReinit(); reinitializing = false; }
*/ public Boolean verifyOpenWritable(Long projectId) { if (projectId == null || projectId == 0) return null; if (ProjectFactory.getInstance().isResourcePoolOpenAndWritable()) { Alert.warn(Messages.getString("Warn.resourcePoolOpen")); return null; } String locker = getLockerName(projectId); boolean openAs = false; if (locker != null) { openAs = (JOptionPane.YES_OPTION == Alert.confirmYesNo(Messages.getStringWithParam("Warn.lockMessage", locker))); if (openAs == false) return null; } return !openAs; }
public static void clear(boolean graphic) { ProjectFactory.getInstance() .setPromptDisabled(true); // prevent remove projects job from prompting to save Job job = ProjectFactory.getInstance().getPortfolio().getRemoveAllProjectsJob(null, false, null); SessionFactory.getInstance().getLocalSession().schedule(job); try { job.waitResult(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (graphic) { GraphicManager gm = GraphicManager.getInstance(); if (gm != null) ((DefaultFrameManager) gm.getFrameManager()).cleanUp(false); } ProjectFactory.getInstance().getPortfolio().getObjectEventManager().removeAll(); ProjectFactory.getInstance().setPromptDisabled(false); // enable prompting again // Singletons, most of them can cause problems when it re-used. // Other singletons shouldn't be problem but have a cleanUp method just in case SessionFactory.cleanUp(); ProjectFactory.cleanUp(); ResourcePoolFactory.cleanUp(); UniqueIdPool.cleanUp(); MainFrame.cleanUp(); GraphicManager.cleanUpStatic(); StartupFactory.cleanUpStatic(); CalendarCatalog.cleanUp(); CalendarDefinition.cleanUp(); CalendarService.cleanUp(); WorkingCalendar.cleanUp(); AdvancedOption.cleanUp(); CalculationOption.cleanUp(); CalendarOption.cleanUp(); EditOption.cleanUp(); GanttOption.cleanUp(); GeneralOption.cleanUp(); ScheduleOption.cleanUp(); TimesheetOption.cleanUp(); FieldConverter.cleanUp(); ActionLists.cleanUp(); CellStyles.cleanUp(); Configuration.cleanUp(); Dictionary.cleanUp(); Factory.cleanUp(); ImportedCalendarService.cleanUp(); // remove dep NotAssignmentFilter.cleanUp(); NotVoidFilter.cleanUp(); HelpUtil.cleanUp(); ZeroFunctor.cleanUp(); NameCellComponent.cleanUp(); ScheduleService.cleanUp(); PageSizes.cleanUp(); ContextStore.cleanUp(); CustomFieldsMapper.cleanUp(); // remove dep }