本文整理汇总了Java中com.intellij.find.FindModel.clone方法的典型用法代码示例。如果您正苦于以下问题:Java FindModel.clone方法的具体用法?Java FindModel.clone怎么用?Java FindModel.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.find.FindModel
的用法示例。
在下文中一共展示了FindModel.clone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
Editor editor = e.getRequiredData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
EditorSearchSession search = e.getRequiredData(EditorSearchSession.SESSION_KEY);
if (project.isDisposed()) return;
FindModel oldModel = FindManager.getInstance(project).getFindInFileModel();
FindModel newModel = oldModel.clone();
String text = search.getTextInField();
if (StringUtil.isEmpty(text)) return;
newModel.setStringToFind(text);
FindUtil.findAllAndShow(project, editor, newModel);
}
示例2: showFindUsages
import com.intellij.find.FindModel; //导入方法依赖的package包/类
private static void showFindUsages(@NotNull Project project,
@NotNull String propertyName,
@NotNull String selectedString,
@NotNull String replaceWith,
@NotNull MavenDomProjectModel model) {
UsageViewManager manager = UsageViewManager.getInstance(project);
if (manager == null) return;
assureFindToolWindowRegistered(project);
FindManager findManager = FindManager.getInstance(project);
FindModel findModel = createFindModel(findManager, selectedString, replaceWith);
final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(true, findModel);
final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(project, true, presentation);
findManager.getFindInProjectModel().copyFrom(findModel);
final FindModel findModelCopy = (FindModel)findModel.clone();
ReplaceInProjectManager.getInstance(project)
.searchAndShowUsages(manager, new MyUsageSearcherFactory(model, propertyName, selectedString), findModelCopy, presentation,
processPresentation,
findManager);
}
示例3: 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);
}
示例4: actionPerformed
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
Editor editor = getEditorSearchComponent().getEditor();
Project project = editor.getProject();
if (project != null && !project.isDisposed()) {
final FindModel model = FindManager.getInstance(project).getFindInFileModel();
final FindModel realModel = (FindModel)model.clone();
String text = getEditorSearchComponent().getTextInField();
if (StringUtil.isEmpty(text)) return;
realModel.setStringToFind(text);
FindUtil.findAllAndShow(project, editor, realModel);
}
}
示例5: startFindInProject
import com.intellij.find.FindModel; //导入方法依赖的package包/类
public void startFindInProject(@Nonnull FindModel findModel) {
if (findModel.getDirectoryName() != null && FindInProjectUtil.getDirectory(findModel) == null) {
return;
}
com.intellij.usages.UsageViewManager manager = com.intellij.usages.UsageViewManager.getInstance(myProject);
if (manager == null) return;
final FindManager findManager = FindManager.getInstance(myProject);
findManager.getFindInProjectModel().copyFrom(findModel);
final FindModel findModelCopy = findModel.clone();
final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(FindSettings.getInstance().isShowResultsInSeparateView(), findModelCopy);
final boolean showPanelIfOnlyOneUsage = !FindSettings.getInstance().isSkipResultsWithOneUsage();
final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(myProject, showPanelIfOnlyOneUsage, presentation);
ConfigurableUsageTarget usageTarget = new FindInProjectUtil.StringUsageTarget(myProject, findModel);
((FindManagerImpl)FindManager.getInstance(myProject)).getFindUsagesManager().addToHistory(usageTarget);
manager.searchAndShowUsages(new UsageTarget[]{usageTarget}, () -> processor -> {
myIsFindInProgress = true;
try {
Processor<UsageInfo> consumer = info -> {
Usage usage = UsageInfo2UsageAdapter.CONVERTER.fun(info);
usage.getPresentation().getIcon(); // cache icon
return processor.process(usage);
};
FindInProjectUtil.findUsages(findModelCopy, myProject, consumer, processPresentation);
}
finally {
myIsFindInProgress = false;
}
}, processPresentation, presentation, null);
}
示例6: startFindInProject
import com.intellij.find.FindModel; //导入方法依赖的package包/类
public void startFindInProject(@NotNull FindModel findModel) {
if (findModel.getDirectoryName() != null && FindInProjectUtil.getDirectory(findModel) == null) {
return;
}
com.intellij.usages.UsageViewManager manager = com.intellij.usages.UsageViewManager.getInstance(myProject);
if (manager == null) return;
final FindManager findManager = FindManager.getInstance(myProject);
findManager.getFindInProjectModel().copyFrom(findModel);
final FindModel findModelCopy = findModel.clone();
final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(FindSettings.getInstance().isShowResultsInSeparateView(), findModelCopy);
final boolean showPanelIfOnlyOneUsage = !FindSettings.getInstance().isSkipResultsWithOneUsage();
final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(myProject, showPanelIfOnlyOneUsage, presentation);
ConfigurableUsageTarget usageTarget = new FindInProjectUtil.StringUsageTarget(myProject, findModel);
((FindManagerImpl)FindManager.getInstance(myProject)).getFindUsagesManager().addToHistory(usageTarget);
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 {
Processor<UsageInfo> consumer = new Processor<UsageInfo>() {
@Override
public boolean process(UsageInfo info) {
Usage usage = UsageInfo2UsageAdapter.CONVERTER.fun(info);
usage.getPresentation().getIcon(); // cache icon
return processor.process(usage);
}
};
FindInProjectUtil.findUsages(findModelCopy, myProject, consumer, processPresentation);
}
finally {
myIsFindInProgress = false;
}
}
};
}
},
processPresentation,
presentation,
null
);
}