/** * Checks, if the deleted node was the current category to map into. <br> * If <code>true</code>, set category to "unassigned". * * @param editor The editor in which the delete occured. */ private void checkCategoryToMapInto(ObjectMappingMultiPageEditor editor) { ISelection sel = null; IObjectMappingCategoryPO categoryToMapInto = editor.getOmEditorBP().getCategoryToCreateIn(); if (categoryToMapInto != null) { editor.getTreeViewer().setSelection(new StructuredSelection(categoryToMapInto)); sel = editor.getTreeViewer().getSelection(); } if (sel == null || sel.isEmpty()) { editor.getOmEditorBP().setCategoryToCreateIn(null); ObjectMappingModeSourceProvider omsp = (ObjectMappingModeSourceProvider) AbstractJBSourceProvider.getSourceProviderInstance( null, ObjectMappingModeSourceProvider.ID); if (editor.getAut().equals(TestExecution.getInstance().getConnectedAut()) && omsp != null && omsp.isRunning()) { String message = NLS.bind( Messages.TestExecutionContributorAUTStartedMapping, Messages.TestExecutionContributorCatUnassigned); int icon = Constants.MAPPING; Plugin.showStatusLine(icon, message); } } }
/** * @param editor The editor containing the viewer to refresh * @param newSelection The elemented that should be selected after the refresh. */ private void refreshViewer(ObjectMappingMultiPageEditor editor, Object newSelection) { editor.getTreeViewer().refresh(); if (newSelection != null) { checkCategoryToMapInto(editor); editor.getTreeViewer().setSelection(new StructuredSelection(newSelection)); } }