use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.
the class AddFamilyFieldProjectMigrationTask method resetFamily.
/**
* yzhang Comment method "resetFamily".
*
* @param list
*/
private void resetFamily(EList list) {
IComponentsFactory componentsFactory = ComponentsFactoryProvider.getInstance();
Set<IComponent> components = componentsFactory.getComponents();
list.clear();
for (IComponent component : components) {
String[] families = component.getOriginalFamilyName().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
for (String family : families) {
ComponentSetting setting = PropertiesFactory.eINSTANCE.createComponentSetting();
setting.setFamily(family);
setting.setName(component.getName());
setting.setHidden(!component.isVisibleInComponentDefinition());
list.add(setting);
}
}
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
try {
prf.saveProject(repositoryContext.getProject());
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
Aggregations