本文整理汇总了Java中com.intellij.find.FindModel.setOpenInNewTab方法的典型用法代码示例。如果您正苦于以下问题:Java FindModel.setOpenInNewTab方法的具体用法?Java FindModel.setOpenInNewTab怎么用?Java FindModel.setOpenInNewTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.find.FindModel
的用法示例。
在下文中一共展示了FindModel.setOpenInNewTab方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
protected void execute(@NotNull final Project project) {
FindManager findManager = FindManager.getInstance(project);
UsageViewManager usageViewManager = UsageViewManager.getInstance(project);
FindModel findModel = (FindModel)findManager.getFindInProjectModel().clone();
findModel.setStringToFind(myTextToFind);
findModel.setReplaceState(false);
findModel.setOpenInNewTabVisible(true);
findModel.setOpenInNewTabEnabled(true);
findModel.setOpenInNewTab(true);
findModel.setFileFilter(SdkConstants.FN_BUILD_GRADLE);
findManager.getFindInProjectModel().copyFrom(findModel);
final FindModel findModelCopy = (FindModel)findModel.clone();
UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(findModel.isOpenInNewTabEnabled(), findModelCopy);
boolean showPanelIfOnlyOneUsage = !FindSettings.getInstance().isSkipResultsWithOneUsage();
final FindUsagesProcessPresentation processPresentation =
FindInProjectUtil.setupProcessPresentation(project, showPanelIfOnlyOneUsage, presentation);
UsageTarget usageTarget = new FindInProjectUtil.StringUsageTarget(project, findModel);
usageViewManager.searchAndShowUsages(new UsageTarget[]{usageTarget}, new Factory<UsageSearcher>() {
@Override
public UsageSearcher create() {
return new UsageSearcher() {
@Override
public void generate(@NotNull final Processor<Usage> processor) {
AdapterProcessor<UsageInfo, Usage> consumer =
new AdapterProcessor<UsageInfo, Usage>(processor, UsageInfo2UsageAdapter.CONVERTER);
//noinspection ConstantConditions
FindInProjectUtil.findUsages(findModelCopy, project, consumer, processPresentation);
}
};
}
}, processPresentation, presentation, null);
}
示例2: findInProject
import com.intellij.find.FindModel; //导入方法依赖的package包/类
public void findInProject(@Nonnull DataContext dataContext) {
final boolean isOpenInNewTabEnabled;
final boolean toOpenInNewTab;
Content selectedContent = UsageViewManager.getInstance(myProject).getSelectedContent(true);
if (selectedContent != null && selectedContent.isPinned()) {
toOpenInNewTab = true;
isOpenInNewTabEnabled = false;
}
else {
toOpenInNewTab = FindSettings.getInstance().isShowResultsInSeparateView();
isOpenInNewTabEnabled = UsageViewManager.getInstance(myProject).getReusableContentsCount() > 0;
}
final FindManager findManager = FindManager.getInstance(myProject);
final FindModel findModel = findManager.getFindInProjectModel().clone();
findModel.setReplaceState(false);
findModel.setOpenInNewTabVisible(true);
findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled);
findModel.setOpenInNewTab(toOpenInNewTab);
initModel(findModel, dataContext);
findManager.showFindDialog(findModel, () -> {
findModel.setOpenInNewTabVisible(false);
if (isOpenInNewTabEnabled) {
FindSettings.getInstance().setShowResultsInSeparateView(findModel.isOpenInNewTab());
}
startFindInProject(findModel);
findModel.setOpenInNewTabVisible(false); //todo check it in both cases: dialog & popup
});
}
示例3: findInProject
import com.intellij.find.FindModel; //导入方法依赖的package包/类
public void findInProject(@NotNull DataContext dataContext) {
final boolean isOpenInNewTabEnabled;
final boolean toOpenInNewTab;
Content selectedContent = UsageViewManager.getInstance(myProject).getSelectedContent(true);
if (selectedContent != null && selectedContent.isPinned()) {
toOpenInNewTab = true;
isOpenInNewTabEnabled = false;
}
else {
toOpenInNewTab = FindSettings.getInstance().isShowResultsInSeparateView();
isOpenInNewTabEnabled = UsageViewManager.getInstance(myProject).getReusableContentsCount() > 0;
}
final FindManager findManager = FindManager.getInstance(myProject);
final FindModel findModel = findManager.getFindInProjectModel().clone();
findModel.setReplaceState(false);
findModel.setOpenInNewTabVisible(true);
findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled);
findModel.setOpenInNewTab(toOpenInNewTab);
FindInProjectUtil.setDirectoryName(findModel, dataContext);
String text = PlatformDataKeys.PREDEFINED_TEXT.getData(dataContext);
if (text != null) {
FindModel.initStringToFindNoMultiline(findModel, text);
}
else {
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
FindUtil.initStringToFindWithSelection(findModel, editor);
}
findManager.showFindDialog(findModel, new Runnable() {
@Override
public void run() {
findModel.setOpenInNewTabVisible(false);
if (isOpenInNewTabEnabled) {
FindSettings.getInstance().setShowResultsInSeparateView(findModel.isOpenInNewTab());
}
startFindInProject(findModel);
}
});
findModel.setOpenInNewTabVisible(false);
}
示例4: applyTo
import com.intellij.find.FindModel; //导入方法依赖的package包/类
private void applyTo(@NotNull FindModel model, boolean findAll) {
model.setCaseSensitive(myCbCaseSensitive.isSelected());
if (model.isReplaceState()) {
model.setPreserveCase(myCbPreserveCase.isSelected());
}
model.setWholeWordsOnly(myCbWholeWordsOnly.isSelected());
String selectedSearchContextInUi = (String)mySearchContext.getSelectedItem();
FindModel.SearchContext searchContext = FindModel.SearchContext.ANY;
if (FindBundle.message("find.context.in.literals.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.IN_STRING_LITERALS;
}
else if (FindBundle.message("find.context.in.comments.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.IN_COMMENTS;
}
else if (FindBundle.message("find.context.except.comments.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.EXCEPT_COMMENTS;
}
else if (FindBundle.message("find.context.except.literals.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.EXCEPT_STRING_LITERALS;
} else if (FindBundle.message("find.context.except.comments.and.literals.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS;
}
model.setSearchContext(searchContext);
model.setRegularExpressions(myCbRegularExpressions.isSelected());
String stringToFind = getStringToFind();
model.setStringToFind(stringToFind);
if (model.isReplaceState()){
model.setPromptOnReplace(true);
model.setReplaceAll(false);
String stringToReplace = getStringToReplace();
model.setStringToReplace(StringUtil.convertLineSeparators(stringToReplace));
}
if (!model.isMultipleFiles()){
model.setForward(myRbForward.isSelected());
model.setFromCursor(myRbFromCursor.isSelected());
model.setGlobal(myRbGlobal.isSelected());
}
else{
if (myCbToOpenInNewTab != null){
model.setOpenInNewTab(myCbToOpenInNewTab.isSelected());
}
model.setProjectScope(myRbProject.isSelected());
model.setDirectoryName(null);
model.setModuleName(null);
model.setCustomScopeName(null);
model.setCustomScope(null);
model.setCustomScope(false);
if (myRbDirectory.isSelected()) {
String directory = getDirectory();
model.setDirectoryName(directory == null ? "" : directory);
model.setWithSubdirectories(myCbWithSubdirectories.isSelected());
}
else if (myRbModule.isSelected()) {
model.setModuleName((String)myModuleComboBox.getSelectedItem());
}
else if (myRbCustomScope.isSelected()) {
SearchScope selectedScope = myScopeCombo.getSelectedScope();
String customScopeName = selectedScope == null ? null : selectedScope.getDisplayName();
model.setCustomScopeName(customScopeName);
model.setCustomScope(selectedScope == null ? null : selectedScope);
model.setCustomScope(true);
}
}
model.setFindAll(findAll);
String mask = getFileTypeMask();
model.setFileFilter(mask);
}
示例5: findInProject
import com.intellij.find.FindModel; //导入方法依赖的package包/类
public void findInProject(@NotNull DataContext dataContext) {
final boolean isOpenInNewTabEnabled;
final boolean[] toOpenInNewTab = new boolean[1];
Content selectedContent = UsageViewManager.getInstance(myProject).getSelectedContent(true);
if (selectedContent != null && selectedContent.isPinned()) {
toOpenInNewTab[0] = true;
isOpenInNewTabEnabled = false;
}
else {
toOpenInNewTab[0] = myToOpenInNewTab;
isOpenInNewTabEnabled = UsageViewManager.getInstance(myProject).getReusableContentsCount() > 0;
}
final FindManager findManager = FindManager.getInstance(myProject);
final FindModel findModel = (FindModel) findManager.getFindInProjectModel().clone();
findModel.setReplaceState(false);
findModel.setOpenInNewTabVisible(true);
findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled);
findModel.setOpenInNewTab(toOpenInNewTab[0]);
FindInProjectUtil.setDirectoryName(findModel, dataContext);
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
FindUtil.initStringToFindWithSelection(findModel, editor);
findManager.showFindDialog(findModel, new Runnable() {
@Override
public void run() {
findModel.setOpenInNewTabVisible(false);
final PsiDirectory psiDirectory = FindInProjectUtil.getPsiDirectory(findModel, myProject);
if (findModel.getDirectoryName() != null && psiDirectory == null){
return;
}
if (isOpenInNewTabEnabled) {
myToOpenInNewTab = toOpenInNewTab[0] = findModel.isOpenInNewTab();
}
com.intellij.usages.UsageViewManager manager = com.intellij.usages.UsageViewManager.getInstance(myProject);
if (manager == null) return;
findManager.getFindInProjectModel().copyFrom(findModel);
final FindModel findModelCopy = (FindModel)findModel.clone();
final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(myToOpenInNewTab, findModelCopy);
final boolean showPanelIfOnlyOneUsage = !FindSettings.getInstance().isSkipResultsWithOneUsage();
final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(myProject, showPanelIfOnlyOneUsage, presentation);
UsageTarget usageTarget = StringUtil.isEmpty(findModel.getStringToFind()) ? createFileByTypeTarget(findModel)
: new FindInProjectUtil.StringUsageTarget(findModel.getStringToFind());
manager.searchAndShowUsages(new UsageTarget[] {usageTarget},
new Factory<UsageSearcher>() {
@Override
public UsageSearcher create() {
return new UsageSearcher() {
@Override
public void generate(@NotNull final Processor<Usage> processor) {
myIsFindInProgress = true;
try {
AdapterProcessor<UsageInfo, Usage> consumer = new AdapterProcessor<UsageInfo, Usage>(processor, UsageInfo2UsageAdapter.CONVERTER);
FindInProjectUtil.findUsages(findModelCopy, psiDirectory, myProject, true, consumer, processPresentation);
}
finally {
myIsFindInProgress = false;
}
}
};
}
},
processPresentation,
presentation,
null
);
}
});
findModel.setOpenInNewTabVisible(false);
}
示例6: applyTo
import com.intellij.find.FindModel; //导入方法依赖的package包/类
private void applyTo(@NotNull FindModel model, boolean findAll) {
model.setCaseSensitive(myCbCaseSensitive.isSelected());
if (model.isReplaceState()) {
model.setPreserveCase(myCbPreserveCase.isSelected());
}
model.setWholeWordsOnly(myCbWholeWordsOnly.isSelected());
model.setInStringLiteralsOnly(myCbInStringLiteralsOnly.isSelected());
model.setInCommentsOnly(myCbInCommentsOnly.isSelected());
model.setRegularExpressions(myCbRegularExpressions.isSelected());
String stringToFind = getStringToFind();
model.setStringToFind(stringToFind);
if (model.isReplaceState()){
model.setPromptOnReplace(true);
model.setReplaceAll(false);
String stringToReplace = getStringToReplace();
model.setStringToReplace(StringUtil.convertLineSeparators(stringToReplace));
}
if (!model.isMultipleFiles()){
model.setForward(myRbForward.isSelected());
model.setFromCursor(myRbFromCursor.isSelected());
model.setGlobal(myRbGlobal.isSelected());
}
else{
if (myCbToOpenInNewTab != null){
model.setOpenInNewTab(myCbToOpenInNewTab.isSelected());
}
model.setProjectScope(myRbProject.isSelected());
model.setDirectoryName(null);
model.setModuleName(null);
model.setCustomScopeName(null);
model.setCustomScope(null);
model.setCustomScope(false);
if (myRbDirectory.isSelected()) {
String directory = getDirectory();
model.setDirectoryName(directory == null ? "" : directory);
model.setWithSubdirectories(myCbWithSubdirectories.isSelected());
}
else if (myRbModule.isSelected()) {
model.setModuleName((String)myModuleComboBox.getSelectedItem());
}
else if (myRbCustomScope.isSelected()) {
SearchScope selectedScope = myScopeCombo.getSelectedScope();
String customScopeName = selectedScope == null ? null : selectedScope.getDisplayName();
model.setCustomScopeName(customScopeName);
model.setCustomScope(selectedScope == null ? null : selectedScope);
model.setCustomScope(true);
}
}
model.setFindAll(findAll);
String mask = getFileTypeMask();
model.setFileFilter(mask);
}