use of org.eclipse.jface.operation.IRunnableWithProgress in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method updateItemsVersion.
private void updateItemsVersion() {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
//$NON-NLS-1$
monitor.beginTask("", getModifiedVersionItems().size() * 100);
Set<ERepositoryObjectType> types = new HashSet<ERepositoryObjectType>();
for (RepositoryObject object : getModifiedVersionItems()) {
// IRepositoryViewObject repositoryObject = object.getRepositoryNode().getObject();
if (object != null && object.getProperty() != null) {
if (object.getStatusCode().equals(object.getProperty().getStatusCode())) {
final Item item = object.getProperty().getItem();
item.getProperty().setOldStatusCode(object.getStatusCode());
// types.add(object.getRepositoryNode().getObjectType());
try {
// }
if (object != null) {
// obj.setVersion(object.getNewVersion());
FACTORY.save(project, object.getProperty());
} else {
// FACTORY.save(project, item.getProperty());
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
monitor.worked(100);
}
// RepositoryManager.refresh(types);
monitor.done();
}
};
// final ProgressMonitorJobsDialog dialog = new ProgressMonitorJobsDialog(null);
final ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
try {
dialog.run(false, false, runnable);
} catch (InvocationTargetException e) {
ExceptionHandler.process(e);
} catch (InterruptedException e) {
ExceptionHandler.process(e);
}
}
use of org.eclipse.jface.operation.IRunnableWithProgress 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.jface.operation.IRunnableWithProgress in project tdi-studio-se by Talend.
the class ErDiagramComposite method createErDiagram.
/**
* admin Comment method "createErDiagram".
*
* @return
*/
private ErDiagram createErDiagram(boolean isShowDesignerPage) {
erDiagram = new ErDiagram();
erDiagram.setErDiagramComposite(this);
if (isShowDesignerPage) {
IRunnableWithProgress progress = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
//$NON-NLS-1$
monitor.beginTask("", IProgressMonitor.UNKNOWN);
try {
List<MetadataColumn> selectedColumns = new ArrayList<MetadataColumn>();
List<MetadataTable> tables = EMFRepositoryNodeManager.getInstance().getTables(getNodes(), selectedColumns);
erDiagram.setMetadataTables(tables);
List<String[]> fks = EMFRepositoryNodeManager.getInstance().getPKFromTables(tables, erDiagram.getErDiagramComposite().getDialog().getSelectedContext());
for (MetadataTable metadataTable : tables) {
Table table = new Table();
table.setMetadataTable(metadataTable, selectedColumns);
table.setErDiagram(erDiagram);
erDiagram.addTable(table);
}
erDiagram.setRelations(fks);
} finally {
monitor.done();
}
}
};
UIUtils.runWithProgress(progress, true, dialog.getProgressMonitor(), dialog.getShell());
} else {
erDiagram.setMetadataTables(new ArrayList<MetadataTable>());
erDiagram.setRelations(new ArrayList<String[]>());
}
return erDiagram;
}
use of org.eclipse.jface.operation.IRunnableWithProgress in project tdi-studio-se by Talend.
the class CreateTableCommand method execute.
@Override
public void execute() {
for (MetadataTable metadataTable : metaTables) {
if (!tableNames.contains(metadataTable.getSourceName())) {
Table table = new Table();
table.setMetadataTable(metadataTable, null);
table.setErDiagram(erDiagram);
erDiagram.addTable(table);
erDiagram.getMetadataTables().add(metadataTable);
}
}
IRunnableWithProgress progress = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
//$NON-NLS-1$
monitor.beginTask("", IProgressMonitor.UNKNOWN);
try {
fks = EMFRepositoryNodeManager.getInstance().getPKFromTables(erDiagram.getMetadataTables(), erDiagram.getErDiagramComposite().getDialog().getSelectedContext());
} finally {
monitor.done();
}
}
};
ISQLBuilderDialog dialog = erDiagram.getErDiagramComposite().getDialog();
UIUtils.runWithProgress(progress, true, dialog.getProgressMonitor(), dialog.getShell());
erDiagram.setRelations(fks);
}
use of org.eclipse.jface.operation.IRunnableWithProgress in project tesb-studio-se by Talend.
the class WebServiceUIPresenter method refreshPageByWsdl.
@Override
public void refreshPageByWsdl(final String wsdlLocation) {
webServiceUI.setErrorMessage(null);
portTableModel.removeAll();
functionTableModel.removeAll();
IRunnableWithProgress retrieveData = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Retrieve WSDL parameter from net.", IProgressMonitor.UNKNOWN);
try {
retrieveData(wsdlLocation);
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
};
try {
webServiceUI.runWithProgress(retrieveData);
if (currentSetting.hasRpcOperation()) {
webServiceUI.setErrorMessage(Messages.getString("WebServiceUI.NotSupportRpc"));
}
final List<String> ports = new ArrayList<String>(portFunctionsMap.keySet());
portTableModel.addAll(ports);
if (!ports.isEmpty()) {
functionTableModel.addAll(portFunctionsMap.get(ports.get(0)));
webServiceUI.selectFirstFunction();
}
} catch (InvocationTargetException e) {
webServiceUI.setErrorMessage("Error getting service description: " + e.getCause().getMessage());
webServiceUI.setPageComplete(false);
} catch (InterruptedException e) {
// ignore e.
}
}
Aggregations