コード例 #1
0
ファイル: NewDevkitUITest.java プロジェクト: qyqx/MPS
  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());
  }