コード例 #1
0
 protected boolean validateAndApply() {
   String newName = myNameField.getText().trim();
   if (newName.length() == 0) {
     newName = null;
   }
   if (shouldCheckName(newName)) {
     final LibraryTable.ModifiableModel tableModifiableModel = getTableModifiableModel();
     if (tableModifiableModel != null && !(tableModifiableModel instanceof ModuleLibraryTable)) {
       if (newName == null) {
         Messages.showErrorDialog(
             ProjectBundle.message("library.name.not.specified.error", newName),
             ProjectBundle.message("library.name.not.specified.title"));
         return false;
       }
       if (LibraryEditingUtil.libraryAlreadyExists(tableModifiableModel, newName)) {
         Messages.showErrorDialog(
             ProjectBundle.message("library.name.already.exists.error", newName),
             ProjectBundle.message("library.name.already.exists.title"));
         return false;
       }
     }
     myLibraryRootsComponent.renameLibrary(newName);
   }
   myLibraryRootsComponent.applyProperties();
   return true;
 }
コード例 #2
0
 public LibraryEditorDialogBase(
     final Component parent, final LibraryRootsComponent libraryRootsComponent) {
   super(parent, true);
   myLibraryRootsComponent = libraryRootsComponent;
   libraryRootsComponent.resetProperties();
   setTitle(ProjectBundle.message("library.configure.title"));
   Disposer.register(getDisposable(), myLibraryRootsComponent);
 }
コード例 #3
0
  @Override
  protected JComponent createNorthPanel() {
    String currentName = myLibraryRootsComponent.getLibraryEditor().getName();
    myNameField = new JTextField(currentName);
    myNameField.selectAll();

    FormBuilder formBuilder =
        FormBuilder.createFormBuilder().addLabeledComponent("&Name:", myNameField);
    addNorthComponents(formBuilder);
    return formBuilder.addVerticalGap(10).getPanel();
  }
コード例 #4
0
 public void setContextModule(Module module) {
   myLibraryRootsComponent.setContextModule(module);
 }
コード例 #5
0
 @Override
 protected JComponent createCenterPanel() {
   return myLibraryRootsComponent.getComponent();
 }