Пример #1
0
  public void testDevkitCreation() throws InvocationTargetException, InterruptedException {
    Frame frame = MPSDataKeys.FRAME.getData(DataManager.getInstance().getDataContext());
    Assert.assertNotNull("Main frame not found", frame);

    final NewDevKitDialog dialog = new NewDevKitDialog(null);
    dialog.setProject(myCreatedProject);

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            dialog.showDialog();
          }
        });
    flushAWT();

    JTextField nameField = findTextField("Name");
    getHelper().sendString(new StringEventData(this, nameField, "myDev"));
    flushAWT();
    PathField pathField = findPathField("Path");
    boolean correctSuffix = pathField.getPath().endsWith(nameField.getText());
    Assert.assertTrue("Devkit suffix is not added to path", correctSuffix);

    pressButton(dialog, "OK");
    flushAWT();

    final DevKit devKit = dialog.getResult();
    Assert.assertNotNull("Devkit is not created", devKit);

    boolean isImported = myCreatedProject.getProjectModules(DevKit.class).contains(devKit);
    Assert.assertTrue("Devkit is not imported into project", isImported);
  }
Пример #2
0
 private void updateProjectPath() {
   String projectsPath = getProjectsDir();
   if (myProjectPath.getPath() == null
       || myProjectPath.getPath().length() == 0
       || myProjectPath.getPath().startsWith(projectsPath)) {
     myProjectPath.setPath(projectsPath + File.separator + myProjectName.getText());
   }
 }
Пример #3
0
 public void _check() throws CommitStepException {
   if (myProjectPath.getPath() == null) {
     throw new CommitStepException("Project path should be specified");
   }
   File projectDirFile = new File(myProjectPath.getPath());
   if (!(projectDirFile.isAbsolute())) {
     throw new CommitStepException("Path should be absolute");
   }
   if (myProjectName.getText().length() == 0) {
     throw new CommitStepException("Project name shouldn't be empty");
   }
 }
Пример #4
0
  public JComponent createControlComponent() {
    JPanel panel = new JPanel(new GridLayout(4, 1));

    JLabel nameLabel = new JLabel();
    nameLabel.setText("Name:");
    panel.add(nameLabel);

    myProjectName = new JTextField();
    myProjectName.setName(PROJECT_NAME);
    panel.add(myProjectName);

    JLabel pathLabel = new JLabel();
    pathLabel.setText("Project path:");
    panel.add(pathLabel);

    myProjectPath = new PathField();
    myProjectPath.setName(PROJECT_PATH);
    panel.add(myProjectPath);

    myProjectName.addCaretListener(
        new CaretListener() {
          public void caretUpdate(CaretEvent e) {
            updateProjectPath();
          }
        });

    return panel;
  }
Пример #5
0
  public void _init() {
    super._init();

    myProjectName.setText(myOptions.getProjectName());
    myProjectPath.setPath(myOptions.getProjectPath());

    updateProjectPath();
  }
Пример #6
0
  public void _commit(boolean finishChosen) throws CommitStepException {
    super._commit(finishChosen);

    myOptions.setProjectName(myProjectName.getText());
    myOptions.setProjectPath(myProjectPath.getPath());
  }