/** {@inheritDoc} */ @Override public void run() { CreateChapterPopupMenuAction.LOGGER.debug(CmnStringUtil.EMPTY); InputDialog inputDialog = new InputDialog( PluginUtil.getActiveWorkbenchShell(), ResourceUtil.inputChapterSubject, ResourceUtil.inputChapterName, null, null); if (inputDialog.open() == InputDialog.OK) { // Pretreatment TreeViewer entryViewer = (TreeViewer) treeViewer; Object[] expandedNodes = entryViewer.getExpandedElements(); entryViewer.getTree().setRedraw(false); // Entry Processing List<EntryOperator> entryList = treeViewer.getInputEntry(); ChapterEntry chapter = new ChapterEntry(); chapter.setKey(ResourceUtil.dummyChapterID); chapter.setName(inputDialog.getValue()); chapter.setLevel(0); entryList.add(chapter); treeViewer.setEntryListData(entryList); // Post-processing treeViewer.refreshTreeViewer(true); entryViewer.setExpandedElements(expandedNodes); entryViewer.getTree().setRedraw(true); } CreateChapterPopupMenuAction.LOGGER.info( MessagePropertiesUtil.getMessage(MessagePropertiesUtil.LOG_CREATE_CONTEXTMENULIST)); }
/** * View the file selection dialog.<br> * Called when the know-how of creating XML files "Browse" button is pressed.<br> * * @return File */ private IFolder folderBrowse() { String filePath = page.outputFilePath(); String filePathExcludeProjectName = page.getOutputFilePathExcludeProjectName(); if (CmnStringUtil.isEmpty(filePath)) { return null; } // Create dialog final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( PluginUtil.getActiveWorkbenchShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); // Set the resources that are displayed in the dialog // IProject project = PluginUtil.getProject(filePath); // this.page.getSelectionProject(); IProject selectionProject = this.page.getSelectionProject(); dialog.setInput(selectionProject); dialog.setMessage(getDialogMessage(this.page.getSelectionProject())); dialog.setTitle(ResourceUtil.selectOutput); dialog.setHelpAvailable(false); // Add ViewerFileter dialog.addFilter( new ViewerFilter() { /** {@inheritDoc} */ @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IFolder) { return true; } return false; } }); // dialog.getFirstResult(); // Open the dialog. if (dialog.open() == Window.OK) { Object result = dialog.getFirstResult(); if (result instanceof IFolder) { return (IFolder) result; } } return null; }