コード例 #1
0
  /** {@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));
  }
 /**
  * Get the message to be displayed at the top of the dialog.<br>
  * If the project is (or input) is selected, the display in addition to the project name.<br>
  *
  * @param project Project that is (or input) selection
  * @return Message
  */
 private String getDialogMessage(IProject project) {
   String projectName = CmnStringUtil.EMPTY;
   if (project != null) {
     projectName = project.getName();
   }
   return String.format(
       MessagePropertiesUtil.getMessage(MessagePropertiesUtil.SELECTED_OUTPUT_FOLDER),
       projectName);
 }
 /** {@inheritDoc} */
 @Override
 public void widgetSelected(SelectionEvent e) {
   BrowseFileButtonSelectionListener.LOGGER.info(
       MessagePropertiesUtil.getMessage(MessagePropertiesUtil.LOG_OPEN_SELECT_FILE_DOALOG));
   // Specify from the browse button output destination, (file name set to
   // the end) create a path
   IFolder targetFolder = folderBrowse();
   if (targetFolder != null) {
     StringBuilder sb = new StringBuilder();
     sb.append(targetFolder.getProject().getName());
     sb.append(CmnFileUtil.FILE_SEPARATOR);
     sb.append(targetFolder.getProjectRelativePath());
     sb.append(CmnFileUtil.FILE_SEPARATOR);
     sb.append(page.getKnowhowFileName());
     outputPlace.setText(sb.toString());
   }
 }