/**
  * Returns this plug-in's template store.
  *
  * @return the template store of this plug-in instance
  */
 public TemplateStore getTemplateStore() {
   if (fStore == null) {
     fStore =
         new ContributionTemplateStore(
             getContextTypeRegistry(),
             PhingUi.getDefault().getPreferenceStore(),
             CUSTOM_TEMPLATES_KEY);
     try {
       fStore.load();
     } catch (IOException e) {
       PhingUi.log(e);
     }
   }
   return fStore;
 }
  /* (non-Javadoc)
   * @see org.eclipse.jface.window.Window#close()
   */
  public boolean close() {
    IDialogSettings settings = PhingUi.getDefault().getDialogSettings();
    settings.put(DIALOG_SETTING, fShowAll);

    Object[] result = getResult();
    if (result != null && result.length > 0) {
      settings.put(
          LAST_CONTAINER, ((IResource) result[0]).getParent().getFullPath().toPortableString());
    }
    return super.close();
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  protected Control createDialogArea(Composite parent) {

    Composite result = (Composite) super.createDialogArea(parent);
    final Button button = new Button(result, SWT.CHECK);
    button.setText(fFilterMessage);
    button.setFont(parent.getFont());

    IDialogSettings settings = PhingUi.getDefault().getDialogSettings();
    fShowAll = settings.getBoolean(DIALOG_SETTING);

    String lastPath = settings.get(LAST_CONTAINER);
    if (lastPath != null) {
      IPath path = Path.fromPortableString(lastPath);
      IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
      setInitialSelection(resource);
    }

    fFilter.considerExtension(!fShowAll);
    getTreeViewer().addFilter(fFilter);
    if (!fShowAll) {
      button.setSelection(true);
    }

    button.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            if (button.getSelection()) {
              fShowAll = false;
            } else {
              fShowAll = true;
            }
            fFilter.considerExtension(!fShowAll);
            getTreeViewer().refresh();
          }
        });
    applyDialogFont(result);
    return result;
  }