use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class ImportItemWizardPage method performFinish.
public boolean performFinish() {
final List<ItemRecord> itemRecords = new ArrayList<ItemRecord>();
final List<ItemRecord> checkedItemRecords = getCheckedElements();
itemRecords.addAll(checkedItemRecords);
itemRecords.addAll(getHadoopSubrecords(itemRecords));
for (ItemRecord itemRecord : itemRecords) {
Item item = itemRecord.getProperty().getItem();
if (item instanceof JobletProcessItem) {
needToRefreshPalette = true;
}
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (item.getState().isLocked()) {
try {
factory.unlock(item);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (LoginException e) {
ExceptionHandler.process(e);
}
}
ERepositoryStatus status = factory.getStatus(item);
if (status != null && status == ERepositoryStatus.LOCK_BY_USER) {
try {
factory.unlock(item);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (LoginException e) {
ExceptionHandler.process(e);
}
}
}
try {
IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IPath destinationPath = null;
String contentType = "";
if (rNode != null && rNode.getType().equals(ENodeType.SIMPLE_FOLDER)) {
destinationPath = RepositoryNodeUtilities.getPath(rNode);
contentType = rNode.getContentType().name();
}
repositoryUtil.setErrors(false);
repositoryUtil.clear();
repositoryUtil.importItemRecords(manager, itemRecords, monitor, overwrite, destinationPath, contentType);
if (repositoryUtil.hasErrors()) {
throw new InvocationTargetException(new CoreException(new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), //$NON-NLS-1$
"Import errors")));
}
}
};
new ProgressMonitorDialog(getShell()).run(true, true, iRunnableWithProgress);
} catch (InvocationTargetException e) {
Throwable targetException = e.getTargetException();
if (repositoryUtil.getRoutineExtModulesMap().isEmpty()) {
if (targetException instanceof CoreException) {
//$NON-NLS-1$
MessageDialog.openWarning(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("ImportItemWizardPage.ImportSelectedItems"), //$NON-NLS-1$
Messages.getString("ImportItemWizardPage.ErrorsOccured"));
}
}
} catch (InterruptedException e) {
//
}
ResourcesManager curManager = this.manager;
if (curManager instanceof ProviderManager) {
curManager.closeResource();
}
selectedItems = null;
itemRecords.clear();
return true;
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class PaletteSettingPage method okPressed.
protected void okPressed() {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(DisplayUtils.getDefaultShell());
IRunnableWithProgress rwp = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
try {
prf.saveProject(project);
ShowStandardAction.getInstance().doRun();
if (needCodeGen) {
Job refreshTemplates = CorePlugin.getDefault().getCodeGeneratorService().refreshTemplates();
refreshTemplates.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
}
});
}
// ComponentUtilities.updatePalette();
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
}
};
try {
pmd.run(true, false, rwp);
} catch (InvocationTargetException e) {
ExceptionHandler.process(e);
} catch (InterruptedException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class PaletteSettingPage method getComponentsUsedInProject.
public Set<IComponent> getComponentsUsedInProject(Project project) {
if (componentsUsed != null) {
return componentsUsed;
}
componentsUsed = new HashSet<IComponent>();
IProxyRepositoryFactory repositoryFactory = CoreUIPlugin.getDefault().getProxyRepositoryFactory();
try {
ERepositoryObjectType jobType = ERepositoryObjectType.PROCESS;
if (jobType != null) {
List<IRepositoryViewObject> allProcess = repositoryFactory.getAll(project, jobType, true);
addUsedComponents(componentsUsed, allProcess, ComponentCategory.CATEGORY_4_DI);
}
ERepositoryObjectType jobletType = ERepositoryObjectType.JOBLET;
if (jobletType != null) {
List<IRepositoryViewObject> allJoblet = repositoryFactory.getAll(project, jobletType, true);
addUsedComponents(componentsUsed, allJoblet, ComponentCategory.CATEGORY_4_DI);
}
ERepositoryObjectType routeType = ERepositoryObjectType.PROCESS_ROUTE;
if (routeType != null) {
List<IRepositoryViewObject> allRoutes = repositoryFactory.getAll(project, routeType, true);
addUsedComponents(componentsUsed, allRoutes, ComponentCategory.CATEGORY_4_CAMEL);
}
//$NON-NLS-1$
ERepositoryObjectType mrType = ERepositoryObjectType.valueOf("PROCESS_MR");
if (mrType != null) {
List<IRepositoryViewObject> allMr = repositoryFactory.getAll(project, mrType, true);
addUsedComponents(componentsUsed, allMr, ComponentCategory.CATEGORY_4_MAPREDUCE);
addUsedComponents(componentsUsed, allMr, ComponentCategory.CATEGORY_4_SPARK);
}
//$NON-NLS-1$
ERepositoryObjectType stormType = ERepositoryObjectType.valueOf("PROCESS_STORM");
if (stormType != null) {
List<IRepositoryViewObject> allStorm = repositoryFactory.getAll(project, stormType, true);
addUsedComponents(componentsUsed, allStorm, ComponentCategory.CATEGORY_4_STORM);
addUsedComponents(componentsUsed, allStorm, ComponentCategory.CATEGORY_4_SPARKSTREAMING);
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
if (testContainerService != null) {
ERepositoryObjectType testCaseType = testContainerService.getTestCaseObjectType();
if (testCaseType != null) {
List<IRepositoryViewObject> allTestCase = repositoryFactory.getAll(project, testCaseType, true);
addUsedComponents(componentsUsed, allTestCase, ComponentCategory.CATEGORY_4_SPARK);
addUsedComponents(componentsUsed, allTestCase, ComponentCategory.CATEGORY_4_DI);
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return componentsUsed;
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class SecurityProjectSettingPage method createContents.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout(2, false);
composite.setLayout(layout);
button = new Button(composite, SWT.CHECK | SWT.TOP);
//$NON-NLS-1$
button.setText(Messages.getString("SecurityProjectSettingPage.hidePass"));
button.setSelection(pro.getEmfProject().isHidePassword());
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
composite.setEnabled(false);
}
return composite;
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class StatusEditor method createTable.
@Override
protected Table createTable(Composite parent) {
Table contextTable = new Table(parent, SWT.BORDER | SWT.SINGLE);
contextTable.setLinesVisible(true);
contextTable.setHeaderVisible(true);
TableColumn colName = new TableColumn(contextTable, SWT.NONE);
//$NON-NLS-1$
colName.setText(Messages.getString("StatusEditor.codeColumnTitle"));
colName.setWidth(60);
TableColumn colValue = new TableColumn(contextTable, SWT.NONE);
//$NON-NLS-1$
colValue.setText(Messages.getString("StatusEditor.labelColumnTitle"));
colValue.setWidth(150);
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
parent.setEnabled(false);
}
return contextTable;
}
Aggregations