use of com.intellij.pom.Navigatable in project intellij-community by JetBrains.
the class XmlAttributeDeclImpl method navigate.
@Override
public void navigate(final boolean requestFocus) {
if (isPhysical()) {
super.navigate(requestFocus);
return;
}
final PsiNamedElement psiNamedElement = XmlUtil.findRealNamedElement(this);
Navigatable navigatable = PsiNavigationSupport.getInstance().getDescriptor(psiNamedElement);
if (psiNamedElement instanceof XmlEntityDecl) {
navigatable = PsiNavigationSupport.getInstance().createNavigatable(psiNamedElement.getProject(), psiNamedElement.getContainingFile().getVirtualFile(), psiNamedElement.getTextRange().getStartOffset() + psiNamedElement.getText().indexOf(getName()));
}
if (navigatable != null) {
navigatable.navigate(requestFocus);
}
}
use of com.intellij.pom.Navigatable in project intellij-community by JetBrains.
the class AddNewPropertyFileAction method update.
@Override
public void update(AnActionEvent e) {
final Navigatable[] data = CommonDataKeys.NAVIGATABLE_ARRAY.getData(e.getDataContext());
if (data != null && data.length == 1) {
if (data[0] instanceof ResourceBundleNode || data[0] instanceof CustomResourceBundlePropertiesFileNode) {
final ResourceBundle resourceBundle = (ResourceBundle) ((ProjectViewNode) data[0]).getValue();
LOG.assertTrue(resourceBundle != null);
if (CreateResourceBundleDialogComponent.getResourceBundlePlacementDirectory(resourceBundle) != null) {
e.getPresentation().setEnabledAndVisible(true);
return;
}
}
}
e.getPresentation().setEnabledAndVisible(false);
}
use of com.intellij.pom.Navigatable in project intellij-community by JetBrains.
the class CompilerTask method doAddMessage.
private void doAddMessage(final CompilerMessage message) {
synchronized (myMessageViewLock) {
if (myErrorTreeView != null) {
final Navigatable navigatable = message.getNavigatable();
final VirtualFile file = message.getVirtualFile();
final CompilerMessageCategory category = message.getCategory();
final int type = translateCategory(category);
final String[] text = convertMessage(message);
if (navigatable != null) {
final String groupName = file != null ? file.getPresentableUrl() : category.getPresentableText();
myErrorTreeView.addMessage(type, text, groupName, navigatable, message.getExportTextPrefix(), message.getRenderTextPrefix(), message.getVirtualFile());
} else {
myErrorTreeView.addMessage(type, text, file, -1, -1, message.getVirtualFile());
}
final boolean shouldAutoActivate = !myMessagesAutoActivated && (CompilerMessageCategory.ERROR.equals(category) || (CompilerMessageCategory.WARNING.equals(category) && !ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()));
if (shouldAutoActivate) {
myMessagesAutoActivated = true;
activateMessageView();
}
}
}
}
use of com.intellij.pom.Navigatable in project intellij-community by JetBrains.
the class OccurenceNavigatorActionBase method actionPerformed.
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null)
return;
OccurenceNavigator navigator = getNavigator(e.getDataContext());
if (navigator == null) {
return;
}
if (!hasOccurenceToGo(navigator)) {
return;
}
OccurenceNavigator.OccurenceInfo occurenceInfo = go(navigator);
if (occurenceInfo == null) {
return;
}
Navigatable descriptor = occurenceInfo.getNavigateable();
if (descriptor != null && descriptor.canNavigate()) {
descriptor.navigate(true);
}
if (occurenceInfo.getOccurenceNumber() == -1 || occurenceInfo.getOccurencesCount() == -1) {
return;
}
WindowManager.getInstance().getStatusBar(project).setInfo(IdeBundle.message("message.occurrence.N.of.M", occurenceInfo.getOccurenceNumber(), occurenceInfo.getOccurencesCount()));
}
use of com.intellij.pom.Navigatable in project intellij-community by JetBrains.
the class EditSourceForDialogAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final Navigatable[] navigatableArray = e.getData(CommonDataKeys.NAVIGATABLE_ARRAY);
if (navigatableArray != null && navigatableArray.length > 0) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
OpenSourceUtil.navigate(navigatableArray);
}
});
DialogWrapper dialog = DialogWrapper.findInstance(mySourceComponent);
if (dialog != null && dialog.isModal()) {
dialog.doCancelAction();
}
}
}
Aggregations