use of org.jkiss.dbeaver.ui.editors.INonPersistentEditorInput in project dbeaver by dbeaver.
the class SQLEditor method getTitleToolTip.
@Override
public String getTitleToolTip() {
DBPDataSourceContainer dataSourceContainer = getDataSourceContainer();
if (dataSourceContainer == null) {
return super.getTitleToolTip();
}
final IEditorInput editorInput = getEditorInput();
String scriptPath;
if (editorInput instanceof IFileEditorInput) {
scriptPath = ((IFileEditorInput) editorInput).getFile().getFullPath().toString();
} else if (editorInput instanceof IPathEditorInput) {
scriptPath = ((IPathEditorInput) editorInput).getPath().toString();
} else if (editorInput instanceof IURIEditorInput) {
final URI uri = ((IURIEditorInput) editorInput).getURI();
if ("file".equals(uri.getScheme())) {
scriptPath = new File(uri).getAbsolutePath();
} else {
scriptPath = uri.toString();
}
} else if (editorInput instanceof INonPersistentEditorInput) {
scriptPath = "SQL Console";
} else {
scriptPath = editorInput.getName();
if (CommonUtils.isEmpty(scriptPath)) {
scriptPath = "<not a file>";
}
}
StringBuilder tip = new StringBuilder();
tip.append("Script: ").append(scriptPath).append(" \nConnection: ").append(dataSourceContainer.getName()).append(" \nType: ").append(dataSourceContainer.getDriver().getFullName()).append(" \nURL: ").append(dataSourceContainer.getConnectionConfiguration().getUrl());
Map<String, Object> vars = getScriptVariables(null, scriptPath);
if (vars.get(VAR_ACTIVE_DATABASE) != null) {
tip.append(" \nDatabase: ").append(vars.get(VAR_ACTIVE_DATABASE));
}
if (vars.get(VAR_ACTIVE_SCHEMA) != null) {
tip.append(" \nSchema: ").append(vars.get(VAR_ACTIVE_SCHEMA));
}
return tip.toString();
}
use of org.jkiss.dbeaver.ui.editors.INonPersistentEditorInput in project dbeaver by serge-rider.
the class SQLEditor method getTitleToolTip.
@Override
public String getTitleToolTip() {
DBPDataSourceContainer dataSourceContainer = getDataSourceContainer();
if (dataSourceContainer == null) {
return super.getTitleToolTip();
}
final IEditorInput editorInput = getEditorInput();
String scriptPath;
if (editorInput instanceof IFileEditorInput) {
scriptPath = ((IFileEditorInput) editorInput).getFile().getFullPath().toString();
} else if (editorInput instanceof IPathEditorInput) {
scriptPath = ((IPathEditorInput) editorInput).getPath().toString();
} else if (editorInput instanceof IURIEditorInput) {
final URI uri = ((IURIEditorInput) editorInput).getURI();
if ("file".equals(uri.getScheme())) {
scriptPath = new File(uri).getAbsolutePath();
} else {
scriptPath = uri.toString();
}
} else if (editorInput instanceof INonPersistentEditorInput) {
scriptPath = "SQL Console";
} else {
scriptPath = editorInput.getName();
if (CommonUtils.isEmpty(scriptPath)) {
scriptPath = "<not a file>";
}
}
StringBuilder tip = new StringBuilder();
tip.append("Script: ").append(scriptPath).append(" \nConnection: ").append(dataSourceContainer.getName()).append(" \nType: ").append(dataSourceContainer.getDriver().getFullName()).append(" \nURL: ").append(dataSourceContainer.getConnectionConfiguration().getUrl());
Map<String, Object> vars = getScriptVariables(null, scriptPath);
if (vars.get(VAR_ACTIVE_DATABASE) != null) {
tip.append(" \nDatabase: ").append(vars.get(VAR_ACTIVE_DATABASE));
}
if (vars.get(VAR_ACTIVE_SCHEMA) != null) {
tip.append(" \nSchema: ").append(vars.get(VAR_ACTIVE_SCHEMA));
}
return tip.toString();
}
Aggregations