use of org.talend.repository.model.IRepositoryService in project tdi-studio-se by Talend.
the class TalendJavaSourceViewer method getImports.
private static String getImports() {
//$NON-NLS-1$
String imports = "";
if (!GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryService.class)) {
return imports;
}
IRepositoryService service = (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
IProxyRepositoryFactory repositoryFactory = service.getProxyRepositoryFactory();
Project project = ProjectManager.getInstance().getProject(null);
try {
List<IRepositoryViewObject> routines = repositoryFactory.getAll(ERepositoryObjectType.ROUTINES);
for (IRepositoryViewObject routine : routines) {
if (routine.getProperty().getItem() instanceof RoutineItem && ((RoutineItem) routine.getProperty().getItem()).isBuiltIn()) {
//$NON-NLS-1$ //$NON-NLS-2$
imports += "import routines." + routine.getLabel() + ";\n";
} else {
//$NON-NLS-1$ //$NON-NLS-2$
imports += "import routines." + routine.getLabel() + ";\n";
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
//$NON-NLS-1$
return "";
}
//$NON-NLS-1$
imports += "import routines.system.*;\n";
//$NON-NLS-1$
imports += "import java.text.ParseException;\n";
//$NON-NLS-1$
imports += "import java.text.SimpleDateFormat;\n";
//$NON-NLS-1$
imports += "import java.util.Date;\n";
//$NON-NLS-1$
imports += "import java.util.List;\n";
//$NON-NLS-1$
imports += "import java.math.BigDecimal;\n";
imports += "\n";
imports += "@SuppressWarnings(\"unused\")";
imports += "\n\n";
return imports;
}
use of org.talend.repository.model.IRepositoryService in project tdi-studio-se by Talend.
the class StandAloneTalendJavaEditor method resetItem.
public void resetItem() throws PersistenceException {
if (item.getProperty().eResource() == null || item.eResource() == null) {
IRepositoryService service = CoreRuntimePlugin.getInstance().getRepositoryService();
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
//
// Property updated = factory.getUptodateProperty(getItem().getProperty());
Property updatedProperty = null;
try {
factory.initialize();
IRepositoryViewObject repositoryViewObject = factory.getLastVersion(new Project(ProjectManager.getInstance().getProject(item.getProperty().getItem())), item.getProperty().getId());
if (repositoryViewObject != null) {
updatedProperty = repositoryViewObject.getProperty();
item = (FileItem) updatedProperty.getItem();
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
Aggregations