下面列出了com.intellij.psi.PsiCompiledElement#com.intellij.codeInsight.hint.HintManager 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void showPerfViewMessage() {
final FlutterPerformanceView flutterPerfView = ServiceManager.getService(getApp().getProject(), FlutterPerformanceView.class);
flutterPerfView.showForAppRebuildCounts(getApp());
String message = "<html><body>" +
getTooltipHtmlFragment() +
"</body></html>";
final Iterable<SummaryStats> current = perfModelForFile.getStats().getRangeStats(range);
if (current.iterator().hasNext()) {
final SummaryStats first = current.iterator().next();
final XSourcePosition position = first.getLocation().getXSourcePosition();
if (position != null) {
AsyncUtils.invokeLater(() -> {
position.createNavigatable(getApp().getProject()).navigate(true);
HintManager.getInstance().showInformationHint(perfModelForFile.getTextEditor().getEditor(), message);
});
}
}
}
private LightweightHint showEditorHint(@NotNull Editor editor, String message, boolean isError) {
final AtomicReference<LightweightHint> ref = new AtomicReference<>();
ApplicationManager.getApplication().invokeAndWait(() -> {
final JComponent component = isError
? HintUtil.createErrorLabel(message)
: HintUtil.createInformationLabel(message);
final LightweightHint hint = new LightweightHint(component);
ref.set(hint);
HintManagerImpl.getInstanceImpl().showEditorHint(
hint, editor, HintManager.UNDER,
HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING | HintManager.HIDE_BY_OTHER_HINT,
isError ? 0 : 3000, false);
});
return ref.get();
}
private void showPerfViewMessage() {
final FlutterPerformanceView flutterPerfView = ServiceManager.getService(getApp().getProject(), FlutterPerformanceView.class);
flutterPerfView.showForAppRebuildCounts(getApp());
String message = "<html><body>" +
getTooltipHtmlFragment() +
"</body></html>";
final Iterable<SummaryStats> current = perfModelForFile.getStats().getRangeStats(range);
if (current.iterator().hasNext()) {
final SummaryStats first = current.iterator().next();
final XSourcePosition position = first.getLocation().getXSourcePosition();
if (position != null) {
AsyncUtils.invokeLater(() -> {
position.createNavigatable(getApp().getProject()).navigate(true);
HintManager.getInstance().showInformationHint(perfModelForFile.getTextEditor().getEditor(), message);
});
}
}
}
private LightweightHint showEditorHint(@NotNull Editor editor, String message, boolean isError) {
final AtomicReference<LightweightHint> ref = new AtomicReference<>();
ApplicationManager.getApplication().invokeAndWait(() -> {
final JComponent component = isError
? HintUtil.createErrorLabel(message)
: HintUtil.createInformationLabel(message);
final LightweightHint hint = new LightweightHint(component);
ref.set(hint);
HintManagerImpl.getInstanceImpl().showEditorHint(
hint, editor, HintManager.UNDER,
HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING | HintManager.HIDE_BY_OTHER_HINT,
isError ? 0 : 3000, false);
});
return ref.get();
}
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
List<String> refComponents = Arrays.asList(referenceNameToFix.split(Pattern.quote(".")));
List<ElmImportCandidate> candidates = findCandidates(project, refComponents);
if (candidates.isEmpty()) {
HintManager.getInstance().showErrorHint(editor, "No module exporting '" + referenceNameToFix + "' found");
} else if (candidates.size() == 1) {
ElmImportCandidate candidate = candidates.get(0);
fixWithCandidate(project, (ElmFile) file, refComponents, candidate);
} else {
List<ElmImportCandidate> sortedCandidates = new ArrayList<>(candidates);
sortedCandidates.sort((a,b) -> a.moduleName.compareTo(b.moduleName));
promptToSelectCandidate(project, (ElmFile) file, refComponents, sortedCandidates);
}
}
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement psiElement) throws IncorrectOperationException {
PsiElement parent = psiElement.getParent();
if(!(parent instanceof StringLiteralExpression)) {
return;
}
try {
PhpClass phpClass = EntityHelper.resolveShortcutName(project, ((StringLiteralExpression) parent).getContents());
if(phpClass == null) {
throw new Exception("Can not resolve model class");
}
PhpElementsUtil.replaceElementWithClassConstant(phpClass, parent);
} catch (Exception e) {
HintManager.getInstance().showErrorHint(editor, e.getMessage());
}
}
@Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile psiFile) {
PhpClass phpClass = PhpCodeEditUtil.findClassAtCaret(editor, psiFile);
if(phpClass == null) {
HintManager.getInstance().showErrorHint(editor, "No class context found");
return;
}
final Collection<StringLiteralExpression> formTypes = new ArrayList<>();
phpClass.acceptChildren(new FormTypeStringElementVisitor(formTypes));
if(formTypes.size() == 0) {
HintManager.getInstance().showErrorHint(editor, "Nothing to do for me");
return;
}
for (StringLiteralExpression formType : formTypes) {
try {
FormUtil.replaceFormStringAliasWithClassConstant(formType);
} catch (Exception ignored) {
}
}
}
@Override
public void invoke(@NotNull Project project, @NotNull PsiFile psiFile, @Nullable Editor editor, @NotNull PsiElement psiElement, @NotNull PsiElement psiElement1) {
if(editor == null) {
return;
}
Collection<PhpClass> anyByFQN = PhpIndex.getInstance(project).getAnyByFQN(this.expectedClass);
if(anyByFQN.size() == 0) {
return;
}
Collection<ContainerService> suggestions = ServiceUtil.getServiceSuggestionForPhpClass(anyByFQN.iterator().next(), ContainerCollectionResolver.getServices(project));
if(suggestions.size() == 0) {
HintManager.getInstance().showErrorHint(editor, "No suggestion found");
return;
}
ServiceSuggestDialog.create(
editor,
ContainerUtil.map(suggestions, ContainerService::getName),
new MyInsertCallback(editor, psiElement)
);
}
@Override
public void insert(@NotNull String selected) {
String text = this.psiElement.getText();
int i = getServiceChar(text);
if(i < 0) {
HintManager.getInstance().showErrorHint(editor, "No valid char in text range");
return;
}
String afterAtText = text.substring(i);
// strip ending quotes
int length = StringUtils.stripEnd(afterAtText, "'\"").length();
int startOffset = this.psiElement.getTextRange().getStartOffset();
int afterAt = startOffset + i + 1;
editor.getDocument().deleteString(afterAt, afterAt + length - 1);
editor.getDocument().insertString(afterAt, selected);
}
@Nullable
public static PsiElement invokeCreateCompilerPass(@NotNull PhpClass bundleClass, @Nullable Editor editor) {
String className = Messages.showInputDialog("Class name for CompilerPass (no namespace needed): ", "New File", Symfony2Icons.SYMFONY);
if(StringUtils.isBlank(className)) {
return null;
}
if(!PhpNameUtil.isValidClassName(className)) {
Messages.showMessageDialog(bundleClass.getProject(), "Invalid class name", "Error", Symfony2Icons.SYMFONY);
}
try {
return PhpBundleFileFactory.createCompilerPass(bundleClass, className);
} catch (Exception e) {
if(editor != null) {
HintManager.getInstance().showErrorHint(editor, "Error:" + e.getMessage());
} else {
JOptionPane.showMessageDialog(null, "Error:" + e.getMessage());
}
}
return null;
}
public static TextRange getTextRangeBy(Editor editor, CommandContext cmdCtx) {
char key = cmdCtx.getLastCmdKey();
Selector selector = SelectorFactory.createSelectorBy(key, editor);
if (selector == null) {
HintManager.getInstance().showInformationHint(editor, SelectorFactory.HELP_MSG);
return null;
}
TextRange tr = selector.getRange(cmdCtx);
if (tr == null) {
HintManager.getInstance().showInformationHint(editor, "404");
}
return tr;
}
public void highlightAndOfferHint(Editor editor, int offset,
Interval sourceInterval,
JBColor color,
EffectType effectType, String hintText) {
CaretModel caretModel = editor.getCaretModel();
final TextAttributes attr = new TextAttributes();
attr.setForegroundColor(color);
attr.setEffectColor(color);
attr.setEffectType(effectType);
MarkupModel markupModel = editor.getMarkupModel();
markupModel.addRangeHighlighter(
sourceInterval.a,
sourceInterval.b,
InputPanel.TOKEN_INFO_LAYER, // layer
attr,
HighlighterTargetArea.EXACT_RANGE
);
if ( hintText.contains("<") ) {
hintText = hintText.replaceAll("<", "<");
}
// HINT
caretModel.moveToOffset(offset); // info tooltip only shows at cursor :(
HintManager.getInstance().showInformationHint(editor, hintText);
}
static void chooseAmbiguousTargetAndPerform(@NotNull final Project project, final Editor editor,
@NotNull PsiElementProcessor<PsiElement> processor) {
if (editor == null) {
Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"),
CommonBundle.getErrorTitle(), Messages.getErrorIcon());
} else {
int offset = editor.getCaretModel().getOffset();
boolean chosen = GotoDeclarationAction.chooseAmbiguousTarget(editor, offset, processor,
FindBundle.message("find.usages.ambiguous.title", "crap"), null);
if (!chosen) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (editor.isDisposed() || !editor.getComponent().isShowing()) return;
HintManager.getInstance()
.showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error"));
}
}, project.getDisposed());
}
}
}
@RequiredWriteAction
@Override
public void executeWriteAction(final Editor editor, @Nullable Caret caret, DataContext dataContext) {
final SelectionModel selectionModel = editor.getSelectionModel();
int changedLines = 0;
if (selectionModel.hasSelection()) {
changedLines = performAction(editor, new TextRange(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd()));
}
else {
changedLines += performAction(editor, new TextRange(0, editor.getDocument().getTextLength()));
}
if (changedLines == 0) {
HintManager.getInstance().showInformationHint(editor, "All lines already have requested indentation");
}
else {
HintManager.getInstance().showInformationHint(editor, "Changed indentation in " + changedLines + (changedLines == 1 ? " line" : " lines"));
}
}
public static void showErrorHint(@Nonnull Project project,
@Nullable Editor editor,
@Nonnull @Nls String message,
@Nonnull @Nls String title,
@javax.annotation.Nullable String helpId) {
if (ApplicationManager.getApplication().isUnitTestMode()) throw new RefactoringErrorHintException(message);
ApplicationManager.getApplication().invokeLater(() -> {
if (editor == null || editor.getComponent().getRootPane() == null) {
showErrorMessage(title, message, helpId, project);
}
else {
HintManager.getInstance().showErrorHint(editor, message);
}
});
}
@Override
public void doOKAction() {
if (myModifier == null) return;
DebuggerUIUtil.setTreeNodeValue(myValueNode, getExpression().getExpression(), errorMessage -> {
Editor editor = getEditor();
if (editor != null) {
HintManager.getInstance().showErrorHint(editor, errorMessage);
}
else {
Messages.showErrorDialog(myTree, errorMessage);
}
});
super.doOKAction();
}
@Override
public void invoke(@Nonnull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
final List<ProblemDescriptor> descriptions =
ProgressManager.getInstance().runProcess(() -> {
InspectionManager inspectionManager = InspectionManager.getInstance(project);
return InspectionEngine.runInspectionOnFile(file, myToolWrapper, inspectionManager.createNewGlobalContext(false));
}, new EmptyProgressIndicator());
if (!descriptions.isEmpty() && !FileModificationService.getInstance().preparePsiElementForWrite(file)) return;
final AbstractPerformFixesTask fixesTask = applyFixes(project, "Apply Fixes", descriptions, myQuickfixClass);
if (!fixesTask.isApplicableFixFound()) {
HintManager.getInstance().showErrorHint(editor, "Unfortunately '" + myText + "' is currently not available for batch mode\n User interaction is required for each problem found");
}
}
protected void performHighlighting() {
boolean clearHighlights = HighlightUsagesHandler.isClearHighlights(myEditor);
EditorColorsManager manager = EditorColorsManager.getInstance();
TextAttributes attributes = manager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
TextAttributes writeAttributes = manager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);
HighlightUsagesHandler.highlightRanges(HighlightManager.getInstance(myEditor.getProject()),
myEditor, attributes, clearHighlights, myReadUsages);
HighlightUsagesHandler.highlightRanges(HighlightManager.getInstance(myEditor.getProject()),
myEditor, writeAttributes, clearHighlights, myWriteUsages);
if (!clearHighlights) {
WindowManager.getInstance().getStatusBar(myEditor.getProject()).setInfo(myStatusText);
HighlightHandlerBase.setupFindModel(myEditor.getProject()); // enable f3 navigation
}
if (myHintText != null) {
HintManager.getInstance().showInformationHint(myEditor, myHintText);
}
}
private void showMessageIfNeeded() {
if (myWarning != null) {
myEditor.getScrollingModel().disableAnimation();
myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
myEditor.getScrollingModel().enableAnimation();
LogicalPosition hintPosition = myCaret.getLogicalPosition();
if (myWarningLocation != null) {
LogicalPosition targetPosition = myEditor.offsetToLogicalPosition(myWarningLocation.getStartOffset());
Point targetPoint = myEditor.logicalPositionToXY(targetPosition);
if (myEditor.getScrollingModel().getVisibleArea().contains(targetPoint)) {
hintPosition = targetPosition;
}
}
LightweightHint hint = new LightweightHint(HintUtil.createInformationLabel(myWarning));
Point p = HintManagerImpl.getHintPosition(hint, myEditor, hintPosition, HintManager.ABOVE);
HintManagerImpl.getInstanceImpl().showEditorHint(hint, myEditor, p, 0, 0, false);
}
}
@Override
public LightweightHint show(@Nonnull Editor editor, @Nonnull Point p, boolean alignToRight, @Nonnull TooltipGroup group, @Nonnull HintHint hintHint) {
myTrafficLightRenderer = (TrafficLightRenderer)((EditorMarkupModel)editor.getMarkupModel()).getErrorStripeRenderer();
myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint);
repaintTooltipWindow();
LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, true, myPanel.getMinWidth());
LightweightHint hint = new LightweightHint(myPanel);
HintManagerImpl hintManager = (HintManagerImpl)HintManager.getInstance();
hintManager.showEditorHint(hint, editor, p,
HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT |
HintManager.HIDE_BY_SCROLLING, 0, false, hintHint);
hint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
if (myPanel == null) return; //double hide?
myPanel = null;
onHide.run();
}
});
return hint;
}
@Override
public boolean prepareFileForWrite(@Nullable final PsiFile psiFile) {
if (psiFile == null) return false;
final VirtualFile file = psiFile.getVirtualFile();
final Project project = psiFile.getProject();
if (ReadonlyStatusHandler.ensureFilesWritable(project, file)) {
return true;
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
final Editor editor = FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, file), true);
if (editor != null && editor.getComponent().isDisplayable()) {
HintManager.getInstance().showErrorHint(editor, CodeInsightBundle.message("error.hint.file.is.readonly", file.getPresentableUrl()));
}
}
}, project.getDisposed());
return false;
}
private void applyAction(@Nonnull IntentionActionWithTextCaching cachedAction) {
myFinalRunnable = () -> {
HintManager.getInstance().hideAllHints();
if (myProject.isDisposed()) return;
if (myEditor != null && (myEditor.isDisposed() || (!myEditor.getComponent().isShowing() && !ApplicationManager.getApplication().isUnitTestMode()))) return;
if (DumbService.isDumb(myProject) && !DumbService.isDumbAware(cachedAction)) {
DumbService.getInstance(myProject).showDumbModeNotification(cachedAction.getText() + " is not available during indexing");
return;
}
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
PsiFile file = myEditor != null ? PsiUtilBase.getPsiFileInEditor(myEditor, myProject) : myFile;
if (file == null) {
return;
}
ShowIntentionActionsHandler.chooseActionAndInvoke(file, myEditor, cachedAction.getAction(), cachedAction.getText(), myProject);
};
}
private void performOnElement(@Nonnull final Editor editor, @Nonnull T first) {
final TextRange textRange = first.getTextRange();
editor.getSelectionModel().setSelection(textRange.getStartOffset(), textRange.getEndOffset());
final String informationHint = getInformationHint(first);
if (informationHint != null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
HintManager.getInstance().showInformationHint(editor, informationHint);
}
});
}
else {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
HintManager.getInstance().showErrorHint(editor, getErrorHint());
}
});
}
}
private void showHint(@Nullable final Editor editor,
@Nonnull String hint,
@Nonnull FindUsagesHandler handler,
@Nonnull final RelativePoint popupPosition,
int maxUsages,
@Nonnull FindUsagesOptions options,
boolean isWarning) {
Runnable runnable = () -> {
if (!handler.getPsiElement().isValid()) return;
JComponent label = createHintComponent(hint, handler, popupPosition, editor, ShowUsagesAction::hideHints, maxUsages, options, isWarning);
if (editor == null || editor.isDisposed() || !editor.getComponent().isShowing()) {
HintManager.getInstance()
.showHint(label, popupPosition, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING, 0);
}
else {
HintManager.getInstance().showInformationHint(editor, label);
}
};
if (editor == null) {
runnable.run();
}
else {
DesktopAsyncEditorLoader.performWhenLoaded(editor, runnable);
}
}
static void chooseAmbiguousTargetAndPerform(@Nonnull final Project project, final Editor editor, @Nonnull PsiElementProcessor<PsiElement> processor) {
if (editor == null) {
Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
}
else {
int offset = editor.getCaretModel().getOffset();
boolean chosen = GotoDeclarationAction.chooseAmbiguousTarget(editor, offset, processor, FindBundle.message("find.usages.ambiguous.title"), null);
if (!chosen) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (editor.isDisposed() || !editor.getComponent().isShowing()) return;
HintManager.getInstance().showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error"));
}
}, project.getDisposed());
}
}
}
static void chooseAmbiguousTargetAndPerform(@NotNull final Project project,
final Editor editor,
@NotNull PsiElementProcessor<PsiElement> processor) {
if (editor == null) {
Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"),
CommonBundle.getErrorTitle(), Messages.getErrorIcon());
}
else {
int offset = editor.getCaretModel().getOffset();
boolean chosen = GotoDeclarationAction.chooseAmbiguousTarget(editor, offset, processor,
FindBundle.message("find.usages.ambiguous.title", "crap"), null);
if (!chosen) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (editor.isDisposed() || !editor.getComponent().isShowing()) return;
HintManager.getInstance().showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error"));
}
}, project.getDisposed());
}
}
}
private void showReferences(Editor editor, List<PsiElement2UsageTargetAdapter> targets, LogicalPosition position) {
if (targets.isEmpty()) {
short constraint = HintManager.ABOVE;
int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING;
JLabel label = new JLabel("No references found");
label.setBackground(new JBColor(new Color(150, 0, 0), new Color(150, 0, 0)));
LightweightHint hint = new LightweightHint(label);
Point p = HintManagerImpl.getHintPosition(hint, editor, position, constraint);
HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, p, flags, 0, false,
HintManagerImpl.createHintHint(editor, p, hint, constraint).setContentActive(false));
} else {
List<Usage> usages = new ArrayList<>();
targets.forEach(ut -> {
PsiElement elem = ut.getElement();
usages.add(new UsageInfo2UsageAdapter(new UsageInfo(elem, -1, -1, false)));
});
if (editor == null) {
return;
}
Project project = editor.getProject();
if (project == null) {
return;
}
UsageViewPresentation presentation = createPresentation(targets.get(0).getElement(),
new FindUsagesOptions(editor.getProject()), false);
UsageViewManager.getInstance(project)
.showUsages(new UsageTarget[] { targets.get(0) }, usages.toArray(new Usage[usages.size()]),
presentation);
}
}
/**
* Shows the given message as nint
*/
public void showHint(String message) {
ConsoleView console = myLogConsole.getConsole();
Editor myEditor = console != null ? CommonDataKeys.EDITOR.getData((DataProvider) console) : null;
if (myEditor != null) {
HintManager.getInstance().showInformationHint(myEditor, message);
}
}
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile) throws IncorrectOperationException {
PsiDirectory psiDirectory = psiFile.getContainingDirectory();
WriteCommandAction.runWriteCommandAction(project, () -> {
try {
Properties properties = new Properties();
properties.setProperty("CLASSNAME", clazz);
PsiElement element = TemplateFileUtil.createFromTemplate(SqlTplFileTemplateGroupFactory.NUTZ_SQL_TPL_XML, templateFileName, properties, psiDirectory);
NavigationUtil.activateFileWithPsiElement(element, true);
} catch (Exception e) {
HintManager.getInstance().showErrorHint(editor, "Failed: " + e.getLocalizedMessage());
}
});
}
private void initializeUi() {
graphConsoleView.getGlobalParametersTab().add(globalParamEditor.getComponent(), BorderLayout.CENTER);
service.registerParametersProvider(this);
MessageBusConnection mbConnection = messageBus.connect();
mbConnection.subscribe(QueryParametersRetrievalErrorEvent.QUERY_PARAMETERS_RETRIEVAL_ERROR_EVENT_TOPIC,
(exception, editor) -> {
if (editor == null) {
return;
}
String errorMessage;
if (exception.getMessage() != null) {
errorMessage = String.format("%s: %s", PARAMS_ERROR_COMMON_MSG, exception.getMessage());
} else {
errorMessage = PARAMS_ERROR_COMMON_MSG;
}
HintManager.getInstance().showErrorHint(editor, errorMessage);
});
mbConnection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
// If file opened, fileOpenedSync->selectionChanged->fileOpened are called
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
releaseFileSpecificEditor(event.getOldFile());
VirtualFile newFile = event.getNewFile();
if (newFile != null && FileTypeExtensionUtil.isCypherFileTypeExtension(newFile.getExtension()) &&
project.getComponent(DataSourcesComponent.class).getDataSourceContainer().isDataSourceExists(getTabTitle(newFile))) {
setupFileSpecificEditor(project, newFile);
}
}
});
}