use of org.eclipse.core.runtime.IProgressMonitor in project tdi-studio-se by Talend.
the class MemoryRuntimeComposite method disconnectJVM.
private void disconnectJVM() {
final Job disconnectJVM = new //$NON-NLS-1$
Job(//$NON-NLS-1$
"disconnect JVM") {
@Override
protected IStatus run(IProgressMonitor monitor) {
if (isRemoteMonitoring) {
if (currentJvm != null && currentJvm.isConnected()) {
currentJvm.disconnect();
}
}
return Status.OK_STATUS;
}
};
disconnectJVM.schedule();
}
use of org.eclipse.core.runtime.IProgressMonitor in project tdi-studio-se by Talend.
the class FTPWizard method performFinish.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
@Override
public boolean performFinish() {
final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
try {
if (creation) {
String nextId = factory.getNextId();
connectionProperty.setId(nextId);
factory.create(connectionItem, propertiesWizardPage.getDestinationPath());
} else {
RepositoryUpdateManager.updateFileConnection(connectionItem);
boolean isModified = propertiesWizardPage.isNameModifiedByUser();
if (isModified) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
IDesignerCoreService service = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
if (service != null) {
service.refreshComponentView(connectionItem);
}
}
}
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRunnable operation = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
try {
factory.save(connectionItem);
closeLockStrategy();
} catch (PersistenceException e) {
throw new CoreException(new Status(IStatus.ERROR, "", "", e));
}
}
};
workspace.run(operation, null);
}
} catch (Exception e) {
String detailError = e.toString();
new //$NON-NLS-1$
ErrorDialogWidthDetailArea(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
PID, //$NON-NLS-1$
"", detailError);
return false;
}
return true;
}
use of org.eclipse.core.runtime.IProgressMonitor in project tdi-studio-se by Talend.
the class ImportDemoProjectItemsPage method populateExistItemRecords.
private String populateExistItemRecords(final List<ResourcesManager> manager) {
//$NON-NLS-1$
String messageInfo = "";
final Collection<ImportItem> items = new ArrayList<ImportItem>();
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
for (ResourcesManager rm : manager) {
items.addAll(importManager.populateImportingItems(rm, true, monitor));
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
};
try {
new ProgressMonitorDialog(getShell()).run(true, true, op);
} catch (Exception e) {
// ignore me
}
for (ImportItem itemRecord : items) {
if (itemRecord.getExistingItemWithSameId() != null && itemRecord.getExistingItemWithSameId() instanceof RepositoryViewObject) {
RepositoryViewObject reObject = (RepositoryViewObject) itemRecord.getExistingItemWithSameId();
if (itemRecord.getProperty() != null && reObject != null) {
if (!itemRecord.getProperty().getId().equals(reObject.getId()) && itemRecord.getProperty().getLabel().equalsIgnoreCase(reObject.getLabel())) {
messageInfo = Messages.getString("ImportDemoProjectPage.loseItems", reObject.getLabel());
}
if (itemRecord.getProperty().getId().equals(reObject.getId()) && itemRecord.getProperty().getLabel().equals(reObject.getLabel())) {
messageInfo = Messages.getString("ImportDemoProjectPage.overwriteItems");
}
}
}
}
return messageInfo;
}
use of org.eclipse.core.runtime.IProgressMonitor in project tdi-studio-se by Talend.
the class LoginProjectPage method createFetchLicenseJob.
private Job createFetchLicenseJob(Project proj) {
final String projLabel = proj.getLabel();
Job fetchJob = new //$NON-NLS-1$
Job(//$NON-NLS-1$
Messages.getString("LoginProjectPage.fetchLicense.job", proj.getLabel())) {
@Override
protected IStatus run(IProgressMonitor monitor) {
ConnectionBean cBean = loginHelper.getCurrentSelectedConnBean();
try {
String userId = cBean.getUser();
String url = getAdminURL();
JSONObject jsonObj = getRemoteService().getLicenseKey(userId, cBean.getPassword(), url, projLabel);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String fetchedLicense = jsonObj.getString("customerName") + "_" + jsonObj.getString("licenseKey");
String key = loginHelper.getLicenseMapKey(url, projLabel, userId);
loginHelper.putLicense(key, fetchedLicense);
} catch (Exception e) {
ExceptionHandler.process(e);
}
return Status.OK_STATUS;
}
@Override
protected void canceling() {
Thread thread = this.getThread();
try {
// to interrupt the slow network connection
thread.interrupt();
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
};
fetchLicenseJobMap.put(proj, fetchJob);
return fetchJob;
}
use of org.eclipse.core.runtime.IProgressMonitor in project tdi-studio-se by Talend.
the class BuildJobHandler method build.
@Override
public void build(IProgressMonitor monitor) throws Exception {
final IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
try {
buildDelegate(monitor);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
};
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
workspace.run(runnable, workspace.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
Aggregations