Package org.eclipse.jface.text.templates.persistence

Examples of org.eclipse.jface.text.templates.persistence.TemplatePersistenceData


   */
  protected void updateViewerInput() {
    IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection();

    if (selection.size() == 1) {
      TemplatePersistenceData data= (TemplatePersistenceData) selection.getFirstElement();
      Template template= data.getTemplate();
      fPatternViewer.getDocument().set(template.getPattern());
    } else {
      fPatternViewer.getDocument().set(""); //$NON-NLS-1$
    }
  }
View Full Code Here


    int selectionCount= selection.size();
    int itemCount= fTableViewer.getTable().getItemCount();
    boolean canRestore= fTemplateStore.getTemplateData(true).length != fTemplateStore.getTemplateData(false).length;
    boolean canRevert= false;
    for (Iterator it= selection.iterator(); it.hasNext();) {
      TemplatePersistenceData data= (TemplatePersistenceData) it.next();
      if (data.isModified()) {
        canRevert= true;
        break;
      }
    }
View Full Code Here

    if (it.hasNext()) {
      Template template= new Template("", "", ((TemplateContextType) it.next()).getId(), "", true);   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

      Template newTemplate= editTemplate(template, false, true);
      if (newTemplate != null) {
        TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true);
        fTemplateStore.add(data);
        fTableViewer.refresh();
        fTableViewer.setChecked(data, true);
        fTableViewer.setSelection(new StructuredSelection(data));
      }
View Full Code Here

    Object[] objects= selection.toArray();
    if ((objects == null) || (objects.length != 1))
      return;

    TemplatePersistenceData data= (TemplatePersistenceData) selection.getFirstElement();
    edit(data);
  }
View Full Code Here

      if (!newTemplate.getName().equals(oldTemplate.getName()) &&
        MessageDialog.openQuestion(getShell(),
        TemplatesMessages.TemplatePreferencePage_question_create_new_title,
        TemplatesMessages.TemplatePreferencePage_question_create_new_message))
      {
        data= new TemplatePersistenceData(newTemplate, true);
        fTemplateStore.add(data);
        fTableViewer.refresh();
      } else {
        data.setTemplate(newTemplate);
        fTableViewer.refresh(data);
View Full Code Here

      if (file.exists()) {
        InputStream input= new BufferedInputStream(new FileInputStream(file));
        try {
          TemplatePersistenceData[] datas= reader.read(input, null);
          for (int i= 0; i < datas.length; i++) {
            TemplatePersistenceData data= datas[i];
            fTemplateStore.add(data);
          }
        } finally {
          try {
            input.close();
View Full Code Here

  private void remove() {
    IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection();

    Iterator elements= selection.iterator();
    while (elements.hasNext()) {
      TemplatePersistenceData data= (TemplatePersistenceData) elements.next();
      fTemplateStore.delete(data);
    }

    fTableViewer.refresh();
  }
View Full Code Here

  private void revert() {
    IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection();

    Iterator elements= selection.iterator();
    while (elements.hasNext()) {
      TemplatePersistenceData data= (TemplatePersistenceData) elements.next();
      data.revert();
      fTableViewer.setChecked(data, data.isEnabled());
    }

    selectionChanged1();
    fTableViewer.refresh();
  }
View Full Code Here

    /*
     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
     */
    public String getColumnText(Object element, int columnIndex) {
      TemplatePersistenceData data = (TemplatePersistenceData) element;
      Template template= data.getTemplate();

      switch (columnIndex) {
        case 0:
          return template.getName();
        case 1:
View Full Code Here

   */
  private void addTemplate(Template template) {
    Template newTemplate;
    newTemplate= editTemplate(template, false, true);
    if (newTemplate != null) {
      TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true);
      getTemplateStore().add(data);
      saveTemplateStore();
      refresh();
      fTreeViewer.setSelection(new StructuredSelection(data), true);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.templates.persistence.TemplatePersistenceData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.