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

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


    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(),
        "New variable",
        "New variable message"))
      {
        data= new TemplatePersistenceData(newTemplate, true);
        fTemplateStore.add(data);
        fTableViewer.refresh();
      } else {
        data.setTemplate(newTemplate);
        fTableViewer.refresh(data);
View Full Code Here

  private void add() {
    Template template= new Template("", "", CONTEXT_TYPE_ID, "", 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.setSelection(new StructuredSelection(data));
    }
  }
View Full Code Here

    IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection();

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

    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

   */
  protected void loadContributedTemplates() throws IOException {
    IConfigurationElement[] extensions= getTemplateExtensions();
    Collection contributed= readContributedTemplates(extensions);
    for (Iterator it= contributed.iterator(); it.hasNext();) {
      TemplatePersistenceData data= (TemplatePersistenceData) it.next();
      internalAdd(data);
    }
  }
View Full Code Here

          stream= new BufferedInputStream(url.openStream());
          TemplateReaderWriter reader= new TemplateReaderWriter();
          TemplatePersistenceData[] datas= reader.read(stream, bundle);
          for (int i= 0; i < datas.length; i++) {
            TemplatePersistenceData data= datas[i];
            if (data.isCustom()) {
              if (data.getId() == null)
                EditorsPlugin.logErrorMessage(NLSUtility.format(ContributionTemplateMessages.ContributionTemplateStore_ignore_no_id, data.getTemplate().getName()));
              else
                EditorsPlugin.logErrorMessage(NLSUtility.format(ContributionTemplateMessages.ContributionTemplateStore_ignore_deleted, data.getTemplate().getName()));
            } else if (!validateTemplate(data.getTemplate())) {
              if (contextExists(data.getTemplate().getContextTypeId()))
                EditorsPlugin.logErrorMessage(NLSUtility.format(ContributionTemplateMessages.ContributionTemplateStore_ignore_validation_failed, data.getTemplate().getName()));
            } else {
              templates.add(data);
            }
          }
        } finally {
View Full Code Here

              bAutoInsert= true;
            else
              bAutoInsert= Boolean.valueOf(autoInsert).booleanValue();
           
            Template template= new Template(name, desc, contextTypeId, pattern, bAutoInsert);
            TemplatePersistenceData data= new TemplatePersistenceData(template, true, id);
            if (validateTemplate(template))
              map.add(data);
          }
        }
      }
View Full Code Here

      }
    });

    fTableViewer.addCheckStateListener(new ICheckStateListener() {
      public void checkStateChanged(CheckStateChangedEvent event) {
        TemplatePersistenceData d= (TemplatePersistenceData) event.getElement();
        d.setEnabled(event.getChecked());
      }
    });

    Composite buttons= new Composite(innerParent, SWT.NONE);
    buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
View Full Code Here

   */
  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

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.