private ParserConfig selectAdoptiveParserConfig() { PreferenceManager prefManager = PreferenceManager.get(); String configFile = prefManager.getCurrentParserConfig(); if (m_isDefaultConfiguration) { configFile = XMLReader.DEFAULT_XMLCONFIG; } if (configFile == null) { MessageBox messageBox = new MessageBox( m_parentComposite.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.APPLICATION_MODAL); messageBox.setText("Check Setting selection"); messageBox.setMessage( "The configuration file is not selected.\r\nDo you want to use the default configuration?"); int result = messageBox.open(); if (result == SWT.YES) { configFile = XMLReader.DEFAULT_XMLCONFIG; } else { configFile = selectCurrentParserConfig(); if (configFile == null) { throw new RuntimeException("Parser config file is not selected!"); } } } ParserConfigReader reader = new ParserConfigReader(configFile); return reader.read(); }
private StackFileInfo postSTackFile( StackFileInfo stackFileInfo, ParserConfig config, String filter, boolean isRecent) { if (stackFileInfo.getTotalWorkingCount() <= 0) { MessageBox messageBox = new MessageBox( m_parentComposite.getShell(), SWT.ICON_ERROR | SWT.YES | SWT.APPLICATION_MODAL); messageBox.setText("File open error"); messageBox.setMessage( new StringBuilder(200) .append("A working thread is not exists in ") .append(stackFileInfo.getFilename()) .append(". configure a ") .append(config.getConfigFilename()) .append(". ") .toString()); messageBox.open(); return null; } if (!isRecent) { PreferenceManager prefManager = PreferenceManager.get(); if (filter == null) { prefManager.addToStackFiles(stackFileInfo.getFilename()); } prefManager.addToAnalyzedStackFiles(stackFileInfo.getFilename()); } return stackFileInfo; }
private String selectCurrentParserConfig() { String fileName = ResourceUtils.selectFileDialog( m_parentComposite, "XML Parser Configuration", new String[] {"XML config", "All Files"}, new String[] {"*.xml", "*.*"}); if (fileName != null) { PreferenceManager.get().setCurrentParserConfig(fileName); displayContent(null); } return fileName; }
private void chooseStackFile() { PreferenceManager prefManager = PreferenceManager.get(); String fileName = ResourceUtils.selectFileDialog( m_parentComposite, "Stack Log File", new String[] {"Stack Log Files", "All Files"}, new String[] {"*.log;*.txt;*.gz;*.stack", "*.*"}); if (fileName == null) { return; } File file = new File(fileName); prefManager.setSelectedPath(file.getParentFile()); openFile(file, false); }