92 public class PIPageEditor extends MultiPageEditorPart implements IResourceChangeListener |
92 public class PIPageEditor extends MultiPageEditorPart implements IResourceChangeListener |
93 { |
93 { |
94 public static final String PI_ID = "com.nokia.carbide.cpp.pi"; //$NON-NLS-1$ |
94 public static final String PI_ID = "com.nokia.carbide.cpp.pi"; //$NON-NLS-1$ |
95 |
95 |
96 // PI menu groups for adding plug-in specific actions/menu items |
96 // PI menu groups for adding plug-in specific actions/menu items |
97 public static final String includeFilesGroup = "includeFile"; //$NON-NLS-1$ |
97 public static final String INCLUDE_FILES_GROUP = "includeFile"; //$NON-NLS-1$ |
98 public static final String reportsGroup = "reports"; //$NON-NLS-1$ |
98 public static final String REPORTS_GROUP = "reports"; //$NON-NLS-1$ |
99 public static final String viewOptionsGroup = "viewOptions"; //$NON-NLS-1$ |
99 public static final String VIEW_OPTIONS_GROUP = "viewOptions"; //$NON-NLS-1$ |
100 public static final String exportsGroup = "exports"; //$NON-NLS-1$ |
100 public static final String EXPORTS_GROUP = "exports"; //$NON-NLS-1$ |
101 public static final String additionsGroup = "additions"; //$NON-NLS-1$ |
101 public static final String ADDITIONS_GROUP = "additions"; //$NON-NLS-1$ |
102 |
102 |
103 // PI menu identifier |
103 // PI menu identifier |
104 public static final String menuID = "com.nokia.carbide.cpp.pi.menuID"; //$NON-NLS-1$ |
104 public static final String MENU_ID = "com.nokia.carbide.cpp.pi.menuID"; //$NON-NLS-1$ |
105 |
105 |
106 // indices of the three standard pages that have graphs |
106 // indices of the three standard pages that have graphs |
107 public static final int THREADS_PAGE = 0; |
107 public static final int THREADS_PAGE = 0; |
108 public static final int BINARIES_PAGE = 1; |
108 public static final int BINARIES_PAGE = 1; |
109 public static final int FUNCTIONS_PAGE = 2; |
109 public static final int FUNCTIONS_PAGE = 2; |
455 * Profile File Report |
455 * Profile File Report |
456 * ----------------------------- |
456 * ----------------------------- |
457 * CPU Load Graph -> |
457 * CPU Load Graph -> |
458 * ----------------------------- |
458 * ----------------------------- |
459 */ |
459 */ |
460 currentManager.add(new Separator(PIPageEditor.includeFilesGroup)); |
460 currentManager.add(new Separator(PIPageEditor.INCLUDE_FILES_GROUP)); |
461 currentManager.add(new Separator(PIPageEditor.reportsGroup)); |
461 currentManager.add(new Separator(PIPageEditor.REPORTS_GROUP)); |
462 currentManager.add(new Separator(PIPageEditor.viewOptionsGroup)); |
462 currentManager.add(new Separator(PIPageEditor.VIEW_OPTIONS_GROUP)); |
463 currentManager.add(new Separator(PIPageEditor.exportsGroup)); |
463 currentManager.add(new Separator(PIPageEditor.EXPORTS_GROUP)); |
464 currentManager.add(new Separator(PIPageEditor.additionsGroup)); |
464 currentManager.add(new Separator(PIPageEditor.ADDITIONS_GROUP)); |
465 |
465 |
466 } |
466 } |
467 }); |
467 }); |
468 } |
468 } |
469 |
469 |
470 public static void addExportAction(IAction action) { |
470 public static void addExportAction(IAction action) { |
471 if (action == null) |
471 if (action == null) |
472 return; |
472 return; |
473 |
473 |
474 currentManager.appendToGroup(PIPageEditor.exportsGroup, action); |
474 currentManager.appendToGroup(PIPageEditor.EXPORTS_GROUP, action); |
475 } |
475 } |
476 |
476 |
477 public static void addIncludeAction(IAction action) { |
477 public static void addIncludeAction(IAction action) { |
478 if (action == null) |
478 if (action == null) |
479 return; |
479 return; |
480 |
480 |
481 if (currentManager.find(menuID + Messages.getString("PIPageEditor.includeActionEnding")) == null) { //$NON-NLS-1$ |
481 if (currentManager.find(MENU_ID + Messages.getString("PIPageEditor.includeActionEnding")) == null) { //$NON-NLS-1$ |
482 includeManager = new MenuManager(Messages.getString("PIPageEditor.includeOtherFile"), menuID + Messages.getString("PIPageEditor.includeActionEnding")); //$NON-NLS-1$ //$NON-NLS-2$ |
482 includeManager = new MenuManager(Messages.getString("PIPageEditor.includeOtherFile"), MENU_ID + Messages.getString("PIPageEditor.includeActionEnding")); //$NON-NLS-1$ //$NON-NLS-2$ |
483 currentManager.add(includeManager); |
483 currentManager.add(includeManager); |
484 } |
484 } |
485 |
485 |
486 includeManager.add(action); |
486 includeManager.add(action); |
487 } |
487 } |
488 |
488 |
489 public static void addReportAction(IAction action) { |
489 public static void addReportAction(IAction action) { |
490 if (action == null) |
490 if (action == null) |
491 return; |
491 return; |
492 |
492 |
493 currentManager.appendToGroup(PIPageEditor.reportsGroup, action); |
493 currentManager.appendToGroup(PIPageEditor.REPORTS_GROUP, action); |
494 } |
494 } |
495 |
495 |
496 public static void addReportManager(IMenuManager menuManager) { |
496 public static void addReportManager(IMenuManager menuManager) { |
497 if (menuManager == null) |
497 if (menuManager == null) |
498 return; |
498 return; |
499 |
499 |
500 currentManager.appendToGroup(PIPageEditor.reportsGroup, menuManager); |
500 currentManager.appendToGroup(PIPageEditor.REPORTS_GROUP, menuManager); |
501 } |
501 } |
502 |
502 |
503 public static void addViewOptionManager(IMenuManager menuManager) { |
503 public static void addViewOptionManager(IMenuManager menuManager) { |
504 if (menuManager == null) |
504 if (menuManager == null) |
505 return; |
505 return; |
506 |
506 |
507 if (menuManager == currentManager) |
507 if (menuManager == currentManager) |
508 return; |
508 return; |
509 |
509 |
510 currentManager.appendToGroup(PIPageEditor.viewOptionsGroup, menuManager); |
510 currentManager.appendToGroup(PIPageEditor.VIEW_OPTIONS_GROUP, menuManager); |
511 } |
511 } |
512 |
512 |
513 /** |
513 /** |
514 * The <code>MultiPageEditorPart</code> implementation of this |
514 * The <code>MultiPageEditorPart</code> implementation of this |
515 * <code>IWorkbenchPart</code> method disposes all nested editors. |
515 * <code>IWorkbenchPart</code> method disposes all nested editors. |
914 IPath editorPath = ((IFileEditorInput)getEditorInput()).getFile().getFullPath(); |
914 IPath editorPath = ((IFileEditorInput)getEditorInput()).getFile().getFullPath(); |
915 // see if current change event is relevant to this Editor |
915 // see if current change event is relevant to this Editor |
916 delta = delta.findMember(editorPath); |
916 delta = delta.findMember(editorPath); |
917 if (delta != null) { |
917 if (delta != null) { |
918 int deltaKind = delta.getKind(); |
918 int deltaKind = delta.getKind(); |
919 switch(deltaKind) { |
919 if(deltaKind == IResourceDelta.REMOVED || deltaKind == IResourceDelta.REMOVED_PHANTOM){ |
920 case IResourceDelta.REMOVED: |
|
921 case IResourceDelta.REMOVED_PHANTOM: |
|
922 Display.getDefault().syncExec(new Runnable() { |
920 Display.getDefault().syncExec(new Runnable() { |
923 public void run() { |
921 public void run() { |
924 PIPageEditor.this.getSite().getPage().closeEditor(PIPageEditor.this, false); |
922 PIPageEditor.this.getSite().getPage().closeEditor(PIPageEditor.this, false); |
925 } |
923 } |
926 }); |
924 }); |
927 break; |
925 } |
928 } |
|
929 } |
926 } |
930 } |
927 } |
931 } |
928 } |
932 |
929 |
933 protected void pageChange(int newPageIndex) { |
930 protected void pageChange(int newPageIndex) { |