本文整理汇总了Java中com.intellij.database.psi.DbPsiFacade类的典型用法代码示例。如果您正苦于以下问题:Java DbPsiFacade类的具体用法?Java DbPsiFacade怎么用?Java DbPsiFacade使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbPsiFacade类属于com.intellij.database.psi包,在下文中一共展示了DbPsiFacade类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.intellij.database.psi.DbPsiFacade; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
myFixture.configureFromExistingVirtualFile(myFixture.copyFileToProject("classes.php"));
DbPsiFacade facade = DbPsiFacade.getInstance(myFixture.getProject());
if (facade.getDataSources().size() == 0) {
TestDataSource source = new TestDataSource(myFixture.getProject());
facade.getDataSources().add(source);
List<DbDataSource> dataSources = facade.getDataSources();
}
}
示例2: AndroidDbManager
import com.intellij.database.psi.DbPsiFacade; //导入依赖的package包/类
public AndroidDbManager(@NotNull DbPsiFacade dbFacade) {
super(dbFacade, AndroidDataSourceStorage.getInstance(dbFacade.getProject()).getDataSources());
}
示例3: invoke
import com.intellij.database.psi.DbPsiFacade; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project,
final Editor editor,
@NotNull final PsiElement psiElement) throws IncorrectOperationException {
final ExtractorProperties extractorProperties =
ProjectSettings.getExtractorProperties(SimpleDataContext.getProjectContext(project));
final List<DbDataSource> dataSources = DbPsiFacade.getInstance(project).getDataSources();
if (dataSources.isEmpty()) {
showPopup(editor, MessageType.ERROR, "Could not find datasource.");
return;
}
final String selectedDataSourceName = extractorProperties.getSelectedDataSourceName();
final DbDataSource dataSource = getDataSource(editor, dataSources, selectedDataSourceName);
final String query;
if (editor.getSelectionModel().hasSelection()) {
query = StringUtil.trim(editor.getSelectionModel().getSelectedText());
} else {
final SmartPsiElementPointer<SqlSelectStatement> pointer = getNearestPointer(project, psiElement);
if (pointer != null) {
query = pointer.getElement().getText();
final int startOffset = pointer.getRange().getStartOffset();
int endOffset = pointer.getRange().getEndOffset();
if (editor.getDocument().getText(TextRange.create(endOffset, endOffset + 1)).equals(";")) {
endOffset += 1; // take semicolon after query
}
editor.getSelectionModel().setSelection(startOffset, endOffset);
} else {
query = null;
}
}
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
applySelectionChange(project, editor, extractorProperties, dataSource, query);
}
});
}