use of org.talend.repository.RepositoryWorkUnit in project tdi-studio-se by Talend.
the class TalendWizardArchiveFileResourceExportPage1 method finish.
@Override
public boolean finish() {
List resourcesToExport = getWhiteCheckedResources();
if (!ensureTargetIsValid()) {
return false;
}
// Save dirty editors if possible but do not stop if not all are saved
saveDirtyEditors();
// about to invoke the operation so save our state
saveWidgetValues();
final List results = new ArrayList(1);
CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(new RepositoryWorkUnit("refresh") {
@Override
protected void run() throws LoginException, PersistenceException {
try {
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
Display.getCurrent().syncExec(new Runnable() {
@Override
public void run() {
List resourcesToExport = getWhiteCheckedResources();
boolean r = executeExportOperation(new ArchiveFileExportOperation(null, resourcesToExport, getDestinationValue()));
results.add(r);
}
});
}
});
return results.size() == 1;
}
use of org.talend.repository.RepositoryWorkUnit in project tdi-studio-se by Talend.
the class TalendWizardArchiveFileResourceExportPage2 method finish.
@Override
public boolean finish() {
if (!ensureTargetIsValid()) {
return false;
}
// Save dirty editors if possible but do not stop if not all are saved
saveDirtyEditors();
// about to invoke the operation so save our state
saveWidgetValues();
final List<Boolean> results = new ArrayList<Boolean>(1);
CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(new RepositoryWorkUnit("refresh") {
@Override
protected void run() throws LoginException, PersistenceException {
try {
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
Display.getCurrent().syncExec(new Runnable() {
@Override
public void run() {
List resourcesToExport = getWhiteCheckedResources();
boolean r = executeExportOperation(new ArchiveFileExportOperation(null, resourcesToExport, getDestinationValue()));
results.add(r);
}
});
}
});
return results.size() == 1 && results.get(0) == true;
}
use of org.talend.repository.RepositoryWorkUnit in project tdi-studio-se by Talend.
the class DefaultRunProcessService method storeProjectPreferences.
@Override
public void storeProjectPreferences(IPreferenceStore preferenceStore) {
RepositoryWorkUnit workUnit = new //$NON-NLS-1$
RepositoryWorkUnit(//$NON-NLS-1$
"Store project preferences") {
@Override
protected void run() {
try {
if (preferenceStore instanceof IPersistentPreferenceStore) {
((IPersistentPreferenceStore) preferenceStore).save();
}
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
};
workUnit.setAvoidUnloadResources(true);
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
}
Aggregations