use of net.sourceforge.sqlexplorer.util.PartAdapter2 in project tdq-studio-se by Talend.
the class FileListEditor method init.
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
// Configure the editor
setSite(site);
setInput(input);
// Create the text editor
editor = new TextEditor();
editor.init(site, input);
// Make sure we get notification that our editor is closing because
// we may need to stop running queries
getSite().getPage().addPartListener(new PartAdapter2() {
/* (non-JavaDoc)
* @see net.sourceforge.sqlexplorer.util.PartAdapter2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
*/
public void partClosed(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == FileListEditor.this) {
onCloseEditor();
}
}
});
// If we havn't got a view, then try for the current session in the ConnectionsView
if (getSession() == null) {
ConnectionsView view = SQLExplorerPlugin.getDefault().getConnectionsView();
if (view != null) {
User user = view.getDefaultUser();
if (user != null)
user.queueForNewSession(new SessionEstablishedAdapter() {
@Override
public void sessionEstablished(Session session) {
setSession(session);
}
});
}
}
}
use of net.sourceforge.sqlexplorer.util.PartAdapter2 in project tdq-studio-se by Talend.
the class SQLEditor method init.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IEditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
// Configure the editor
setSite(site);
// PTODO qzhang fixed bug 3904: syschronize the resource.
if (input instanceof FileEditorInput) {
try {
((FileEditorInput) input).getFile().getParent().refreshLocal(IResource.DEPTH_ONE, null);
} catch (CoreException e) {
e.printStackTrace();
}
}
setInput(input);
// Create the text editor
textEditor = new SQLTextEditor(this);
textEditor.init(site, input);
// setPartName(getSite().getPage().getLabel());
// Make sure we get notification that our editor is closing because
// we may need to stop running queries
getSite().getPage().addPartListener(new PartAdapter2() {
/*
* (non-JavaDoc)
*
* @see net.sourceforge.sqlexplorer.util.PartAdapter2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
*/
@Override
public void partClosed(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == SQLEditor.this) {
onCloseEditor();
}
}
});
// If we havn't got a view, then try for the current session in the ConnectionsView
if (getSession() == null) {
ConnectionsView view = SQLExplorerPlugin.getDefault().getConnectionsView();
if (view != null) {
User user = view.getDefaultUser();
if (user != null) {
user.queueForNewSession(new SessionEstablishedAdapter() {
@Override
public void sessionEstablished(Session session) {
setSession(session);
}
});
}
}
}
}
Aggregations