public ProjectConfiguration getProjectConfiguration(IProject project) throws InvocationTargetException { ProjectConfiguration prjp = null; try { prjp = (ProjectConfiguration) project.getSessionProperty(USER_PREFERENCE); if (prjp == null || !prjp.getResource().exists()) { prjp = new ProjectConfiguration(project); prjp.getVersion(); // initialize the configuration's version attribute prjp.load(); // initialize this instance from the stored values prjp.passivate(); // store this instance as a property on the IResource } return prjp; } catch (CoreException exc) { throw new InvocationTargetException(exc, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_RETRIEVE, new String[]{project.getName()})); } }
public ProjectConfiguration getProjectConfigurationWithoutMigrate(IProject project) throws InvocationTargetException { ProjectConfiguration prjp = null; try { prjp = (ProjectConfiguration) project.getSessionProperty(USER_PREFERENCE); if (prjp == null || !prjp.getResource().exists()) { prjp = new ProjectConfiguration(project); prjp.getVersion(); // initialize the configuration's version attribute prjp.load(); // initialize this instance from the stored values prjp.passivate(); // store this instance as a property on the IResource } return prjp; } catch (CoreException exc) { throw new InvocationTargetException(exc, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_RETRIEVE, new String[]{project.getName()})); } }
/** * Return true if the given project has the current level of metadata, false otherwise. */ public boolean isMigrated(IProject project) throws InvocationTargetException { if (project == null) { return false; } try { if (project.isAccessible()) { ProjectConfiguration prjp = (ProjectConfiguration) project.getSessionProperty(USER_PREFERENCE); if (prjp != null) { return prjp.isVersionCurrent(); } String serializedPrjp = project.getPersistentProperty(USER_PREFERENCE); if (serializedPrjp != null) { prjp = new ProjectConfiguration(project); prjp.getVersion(); // initialize the configuration's // version attribute return prjp.isVersionCurrent(); } } } catch (CoreException exc) { throw new InvocationTargetException(exc, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_RETRIEVE, new String[]{project.getName()})); } return false; }