/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityHelper.setupTheme(this);
    setContentView(R.layout.connectionlist);

    LayoutInflater inflator = getLayoutInflater();
    View formJump = inflator.inflate(R.layout.issuejump, null);
    final RedmineIssueJumpForm header = new RedmineIssueJumpForm(formJump);

    formList = new RedmineBaseAdapterListFormHelper<RedmineProjectListAdapter>();
    formList.setList((ListView) findViewById(R.id.listConnectionList));
    formList.setHeader(formJump, true);
    formList.setFooter(inflator.inflate(R.layout.listview_footer, null), false);
    formList.setAdapter(new RedmineProjectListAdapter(getHelper()));
    formList.onRestoreInstanceState(savedInstanceState);

    header.buttonOK.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (!header.Validate()) return;

            ActionActivityHelper help = new ActionActivityHelper(v.getContext());
            ProjectIntent intent = new ProjectIntent(getIntent());
            help.issue(intent.getConnectionId(), header.getIssueId());
          }
        });

    // リスト項目がクリックされた時の処理
    formList.list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long arg3) {
            ListView listView = (ListView) parent;
            Object item = listView.getItemAtPosition(position);
            if (item == null || !(item instanceof RedmineProject)) return;
            onItemSelect((RedmineProject) item);
          }
        });

    /*
    //リスト項目が長押しされた時の処理
    formList.list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
    	public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    		ListView listView = (ListView) parent;
    		RedmineConnection item = (RedmineConnection) listView.getItemAtPosition(position);
    		Bundle bundle = new Bundle();
    		bundle.putInt(DIALOG_PARAM_ID, item.Id());
    		bundle.putString(DIALOG_PARAM_NAME, item.Name());
    		showDialog(DIALOG_ITEM_ACTION, bundle);
    		return false;
    	}
    });
    */
  }
 @Override
 protected void onStart() {
   super.onStart();
   ConnectionIntent intent = new ConnectionIntent(getIntent());
   formList.adapter.setupParameter(intent.getConnectionId());
   formList.refresh();
   if (formList.adapter.getCount() == 0) {
     onRefresh();
   }
 }
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   formList.onRestoreInstanceState(savedInstanceState);
   super.onRestoreInstanceState(savedInstanceState);
 }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   formList.onSaveInstanceState(outState);
   super.onSaveInstanceState(outState);
 }