com.intellij.ide.actions.ShowFilePathAction Java Examples

The following examples show how to use com.intellij.ide.actions.ShowFilePathAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlazeCWorkspace.java    From intellij with Apache License 2.0 6 votes vote down vote up
private static void showSetupIssues(ImmutableList<String> issues, BlazeContext context) {
  logger.warn(
      String.format(
          "Issues collecting info from C++ compiler. Showing first few out of %d:\n%s",
          issues.size(), Iterables.limit(issues, 25)));
  IssueOutput.warn("Issues collecting info from C++ compiler (click to see logs)")
      .navigatable(
          new Navigatable() {
            @Override
            public void navigate(boolean b) {
              ShowFilePathAction.openFile(new File(PathManager.getLogPath(), "idea.log"));
            }

            @Override
            public boolean canNavigate() {
              return true;
            }

            @Override
            public boolean canNavigateToSource() {
              return false;
            }
          })
      .submit(context);
}
 
Example #2
Source File: ChangeListStorageImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void notifyUser(String message) {
  final String logFile = ContainerPathManager.get().getLogPath();
  /*String createIssuePart = "<br>" +
                           "<br>" +
                           "Please attach log files from <a href=\"file\">" + logFile + "</a><br>" +
                           "to the <a href=\"url\">YouTrack issue</a>";*/
  Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
                                            "Local History is broken",
                                            message /*+ createIssuePart*/,
                                            NotificationType.ERROR,
                                            new NotificationListener() {
                                              @Override
                                              public void hyperlinkUpdate(@Nonnull Notification notification,
                                                                          @Nonnull HyperlinkEvent event) {
                                                if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                                                  if ("url".equals(event.getDescription())) {
                                                    BrowserUtil.launchBrowser("http://youtrack.jetbrains.net/issue/IDEA-71270");
                                                  }
                                                  else {
                                                    File file = new File(logFile);
                                                    ShowFilePathAction.openFile(file);
                                                  }
                                                }
                                              }
                                            }), null);
}
 
Example #3
Source File: UploadNotification.java    From markdown-image-kit with MIT License 5 votes vote down vote up
/**
 * Notify upload failure.
 *
 * @param fileNotFoundListMap   the file not found list map
 * @param uploadFailuredListMap the upload failured list map
 * @param project               the project
 */
public static void notifyUploadFailure(Map<VirtualFile, List<String>> fileNotFoundListMap,
                                       Map<VirtualFile, List<String>> uploadFailuredListMap,
                                       Project project) {
    StringBuilder content = new StringBuilder();

    StringBuilder fileNotFoundContent = new StringBuilder();
    StringBuilder uploadFailuredContent = new StringBuilder();

    if (fileNotFoundListMap.size() > 0) {
        buildContent(fileNotFoundListMap, fileNotFoundContent, "Image Not Found:");
    }

    if (uploadFailuredListMap.size() > 0) {
        buildContent(uploadFailuredListMap, uploadFailuredContent, "Image Upload Failured:");
    }
    content.append(fileNotFoundContent).append(uploadFailuredContent);
    Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_GROUP, "Upload Warning",
                                              content.toString(), NotificationType.WARNING, new NotificationListener.Adapter() {
        @Override
        protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
            URL url = e.getURL();
            if (url != null) {
                try {
                    ShowFilePathAction.openFile(new File(url.toURI()));
                } catch (URISyntaxException ex) {
                    log.warn("invalid URL: " + url, ex);
                }
            }
            hideBalloon(notification.getBalloon());
        }
    }), project);
}
 
Example #4
Source File: LocateInFinderAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void doAction(AnActionEvent anActionEvent) {
    String npmLocation = RNPathUtil.getRNProjectPath(getProject());

    if (npmLocation != null) {
        ShowFilePathAction.openFile(new File(npmLocation + File.separatorChar + "package.json"));
    }
}
 
Example #5
Source File: EditorTabbedContainer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseClicked(MouseEvent e) {
  if (UIUtil.isActionClick(e, MouseEvent.MOUSE_CLICKED) && (e.isMetaDown() || !SystemInfo.isMac && e.isControlDown())) {
    final TabInfo info = myTabs.findInfo(e);
    if (info != null && info.getObject() != null) {
      final VirtualFile vFile = (VirtualFile)info.getObject();
      if (vFile != null) {
        ShowFilePathAction.show(vFile, e);
      }
    }
  }
}
 
Example #6
Source File: VcsGeneralConfigurationPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public VcsGeneralConfigurationPanel(final Project project) {

    myProject = project;

    myOnFileAddingGroup = new JRadioButton[]{
      myShowDialogOnAddingFile,
      myPerformActionOnAddingFile,
      myDoNothingOnAddingFile
    };

    myOnFileRemovingGroup = new JRadioButton[]{
      myShowDialogOnRemovingFile,
      myPerformActionOnRemovingFile,
      myDoNothingOnRemovingFile
    };

    myPromptsPanel.setLayout(new GridLayout(3, 0));

    List<VcsShowOptionsSettingImpl> options = ProjectLevelVcsManagerEx.getInstanceEx(project).getAllOptions();

    for (VcsShowOptionsSettingImpl setting : options) {
      if (!setting.getApplicableVcses().isEmpty() || project.isDefault()) {
        final JCheckBox checkBox = new JCheckBox(setting.getDisplayName());
        myPromptsPanel.add(checkBox);
        myPromptOptions.put(setting, checkBox);
      }
    }

    myPromptsPanel.setSize(myPromptsPanel.getPreferredSize());                           // todo check text!
    myOnPatchCreation.setName((SystemInfo.isMac ? "Reveal patch in" : "Show patch in ") +
                              ShowFilePathAction.getFileManagerName() + " after creation:");
  }
 
Example #7
Source File: ProjectViewSelectInExplorerTarget.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void selectIn(SelectInContext context, boolean requestFocus) {
  VirtualFile file = ShowFilePathAction.findLocalFile(context.getVirtualFile());
  if (file != null) {
    ShowFilePathAction.openFile(new File(file.getPresentableUrl()));
  }
}
 
Example #8
Source File: LocateInFinderAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
public static String getActionName() {
    return SystemInfo.isMac ? "Reveal Project in Finder" : "Show Project in " + ShowFilePathAction.getFileManagerName();
}
 
Example #9
Source File: OpenSelectedDirectoryAction.java    From IDEA-Native-Terminal-Plugin with MIT License 4 votes vote down vote up
@Nullable
private static VirtualFile getSelectedFile(@NotNull AnActionEvent event) {
    return ShowFilePathAction.findLocalFile(event.getData(CommonDataKeys.VIRTUAL_FILE));
}
 
Example #10
Source File: SetAsDefaultDirectoryAction.java    From IDEA-Native-Terminal-Plugin with MIT License 4 votes vote down vote up
@Nullable
private static VirtualFile getSelectedFile(@NotNull AnActionEvent event) {
    return ShowFilePathAction.findLocalFile(event.getData(CommonDataKeys.VIRTUAL_FILE));
}
 
Example #11
Source File: PsiNavigationSupportImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void openDirectoryInSystemFileManager(@Nonnull File file) {
  ShowFilePathAction.openDirectory(file);
}
 
Example #12
Source File: ProjectViewSelectInExplorerTarget.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean canSelect(SelectInContext context) {
  VirtualFile file = ShowFilePathAction.findLocalFile(context.getVirtualFile());
  return file != null;
}