use of org.eclipse.ui.navigator.resources.ProjectExplorer in project n4js by eclipse.
the class WorkingSetManagerBrokerImpl method asyncRefreshCommonViewer.
private void asyncRefreshCommonViewer(final ProjectExplorer explorer, final boolean resetInput) {
// do deferred initialization
this.getWorkingSetManagers().stream().filter(m -> (m instanceof IDeferredInitializer)).map(m -> (IDeferredInitializer) m).filter(m -> m.isInitializationRequired()).forEach(m -> {
m.lateInit();
});
final CommonViewer viewer = explorer.getCommonViewer();
final Display d = getDisplay();
if (!d.isDisposed()) {
if (resetInput) {
d.asyncExec(() -> {
final WorkingSetManager activeManager = getActiveManager();
if (activeManager != null)
activeManager.discardWorkingSetCaches();
if (!viewer.getTree().isDisposed())
viewer.setInput(viewer.getInput());
});
} else {
d.asyncExec(() -> {
final WorkingSetManager activeManager = getActiveManager();
if (activeManager != null)
activeManager.discardWorkingSetCaches();
if (!viewer.getTree().isDisposed())
viewer.refresh(true);
});
}
}
}
use of org.eclipse.ui.navigator.resources.ProjectExplorer in project InformationSystem by ObeoNetwork.
the class DatabaseImportWizard method performFinish.
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
public boolean performFinish() {
// First, check if a connection to the database can be established
if (databaseInfos != null) {
Connection connection = null;
DataSource dataSource = databaseInfos.getDataSource();
if (dataSource != null) {
try {
connection = dataSource.getConnection();
} catch (DataSourceException e) {
// Unable to connect
String message = "Unable to connect to database.\n\nReason : " + e.getCause().getMessage();
MessageDialog.openError(getShell(), "Import database...", message);
return false;
} finally {
JdbcUtils.closeConnection(connection);
}
}
}
String filename = mainPage.getTxtModelFile().getText();
boolean result = DatabaseImportHelper.importDatabaseIntoModel(databaseInfos, filename, mainPage.getReferencedFiles());
if (result == true) {
MessageDialog.openInformation(getShell(), "Database imported", "The database has been imported.\nThe model file '" + filename + "' has been created.");
IViewPart explorer = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("org.eclipse.ui.navigator.ProjectExplorer");
if (explorer != null) {
if (explorer instanceof ProjectExplorer) {
ProjectExplorer projectExplorer = (ProjectExplorer) explorer;
// Create a selection to point on the generated file
final IFile generatedFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filename));
projectExplorer.selectReveal(new StructuredSelection(generatedFile));
}
}
} else {
MessageDialog.openError(getShell(), "Error while importing database", "The database could not be imported.");
}
return result;
}
Aggregations