221
220
public void addHelpMenu() {
222
221
IMenuManager menu = getViewSite().getActionBars().getMenuManager();
223
help = new MenuManager(Messages.getString("SystemTapView.Help")); //$NON-NLS-1$
222
IMenuManager help = new MenuManager(Messages.getString("SystemTapView.Help")); //$NON-NLS-1$
225
224
createHelpActions();
231
public void createHelpActions() {
230
private void createHelpActions() {
232
231
helpVersion = new Action(Messages.getString("SystemTapView.Version")) { //$NON-NLS-1$
236
Process pr = RuntimeProcessFactory.getFactory().exec("stap -V", null); //$NON-NLS-1$
235
Process pr = RuntimeProcessFactory.getFactory().exec("stap -V", null); //$NON-NLS-1$
237
236
BufferedReader buf = new BufferedReader(
238
237
new InputStreamReader(pr.getErrorStream()));
239
238
String line = ""; //$NON-NLS-1$
264
protected void createSaveAction() {
263
private void createSaveAction() {
265
264
//Save callgraph.out
266
265
saveFile = new Action(Messages.getString("SystemTapView.SaveMenu")){ //$NON-NLS-1$
269
268
Shell sh = new Shell();
270
269
FileDialog dialog = new FileDialog(sh, SWT.SAVE);
271
270
String filePath = dialog.open();
306
305
* @param sourcePath
308
307
public void saveData(String targetFile) {
310
File file = new File(targetFile);
312
file.createNewFile();
314
File sFile = new File(sourcePath);
315
if (!sFile.exists()) {
319
FileInputStream fileIn = null;
320
FileOutputStream fileOut = null;
321
FileChannel channelIn = null;
322
FileChannel channelOut = null;
324
fileIn = new FileInputStream(sFile);
325
fileOut = new FileOutputStream(file);
326
channelIn = fileIn.getChannel();
327
channelOut = fileOut.getChannel();
329
if (channelIn == null || channelOut == null) {
333
long size = channelIn.size();
334
MappedByteBuffer buf = channelIn.map(
335
FileChannel.MapMode.READ_ONLY, 0, size);
337
channelOut.write(buf);
340
if (channelIn != null) {
343
if (channelOut != null) {
346
if (fileIn != null) {
349
if (fileOut != null) {
353
} catch (IOException e) {
354
CallgraphCorePlugin.logException(e);
309
File file = new File(targetFile);
311
file.createNewFile();
313
File sFile = new File(sourcePath);
314
if (!sFile.exists()) {
318
try (FileInputStream fileIn = new FileInputStream(sFile); FileOutputStream fileOut = new FileOutputStream(file);
319
FileChannel channelIn = fileIn.getChannel(); FileChannel channelOut = fileOut.getChannel()){
321
if (channelIn == null || channelOut == null) {
325
long size = channelIn.size();
326
MappedByteBuffer buf = channelIn.map(
327
FileChannel.MapMode.READ_ONLY, 0, size);
329
channelOut.write(buf);
331
} catch (IOException e) {
332
CallgraphCorePlugin.logException(e);
358
336
public void setSourcePath(String file) {
359
337
sourcePath = file;