use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class ImportProjectsUtilities method afterImportAs.
/**
* DOC smallet Comment method "afterImportAs".
*
* @param newName
* @param technicalName
* @throws InvocationTargetException
*/
private static Project afterImportAs(String newName, String technicalName) throws InvocationTargetException {
// Rename in ".project" and "talendProject" or "talend.project"
// TODO SML Optimize
final IWorkspace workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace();
IContainer containers = (IProject) workspace.getRoot().findMember(new Path(technicalName));
IResource file2 = containers.findMember(IProjectDescription.DESCRIPTION_FILE_NAME);
try {
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
replaceInFile("<name>.*</name>", file2.getLocation().toOSString(), "<name>" + technicalName + "</name>");
// TDI-19269
final IProject project = workspace.getRoot().getProject(technicalName);
XmiResourceManager xmiManager = new XmiResourceManager();
try {
final Project loadProject = xmiManager.loadProject(project);
loadProject.setTechnicalLabel(technicalName);
loadProject.setLabel(newName);
loadProject.setLocal(true);
loadProject.setId(0);
loadProject.setUrl(null);
loadProject.setCreationDate(null);
loadProject.setDescription("");
loadProject.setType(null);
// ADD xqliu 2012-03-12 TDQ-4771 clear the list of Folders
if (loadProject.getFolders() != null) {
loadProject.getFolders().clear();
}
// ~ TDQ-4771
xmiManager.saveResource(loadProject.eResource());
return loadProject;
} catch (PersistenceException e) {
//
}
} catch (IOException e) {
throw new InvocationTargetException(e);
}
return null;
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class ExportProjectsAsAction method getRoutineFromProject.
/**
* DOC bqian Comment method "getRouineFromProject".
*
* @param project
*/
private RootContainer<String, IRepositoryViewObject> getRoutineFromProject(Project project) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
RootContainer<String, IRepositoryViewObject> routines = null;
try {
routines = factory.getRoutineFromProject(project);
} catch (PersistenceException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
ExceptionHandler.process(e);
}
return routines;
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class ReadRoutineAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
protected void doRun() {
if (repositoryNode == null && getSelection() != null) {
repositoryNode = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
}
RoutineItem routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
Property updatedProperty = null;
try {
updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(routineItem)), routineItem.getProperty().getId()).getProperty();
// repositoryNode.getObject().setProperty(updatedProperty);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
try {
openRoutineEditor(routineItem, true);
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class TOSLoginComposite method readProject.
public Project[] readProject() {
ProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
Project[] projects = null;
try {
projects = repositoryFactory.readProject();
} catch (PersistenceException e1) {
e1.printStackTrace();
} catch (BusinessException e1) {
e1.printStackTrace();
}
return projects;
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class NameSection method beforeSave.
@Override
protected void beforeSave() {
IStatus status = evaluateTextField();
if (status.getSeverity() != IStatus.ERROR) {
String text = nameText.getText();
if (!text.equals(getObject().getLabel())) {
if (getType() == ERepositoryObjectType.FOLDER) {
IPath path = RepositoryNodeUtilities.getPath(getNode());
try {
ERepositoryObjectType type = getNode().getContentType();
getRepositoryFactory().renameFolder(type, path, text);
// TDI-21143 : Studio repository view : remove all refresh call to repo view
// IRepositoryView view = RepositoryManagerHelper.findRepositoryView();
// if (view != null) {
// view.refresh();
// }
} catch (PersistenceException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
return;
}
}
// getObject().setLabel(text);
}
}
}
Aggregations