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

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


    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(),
        TextEditorTemplateMessages.TemplatePreferencePage_question_create_new_title,
        TextEditorTemplateMessages.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 (fileStore.fetchInfo().exists()) {
        InputStream input= new BufferedInputStream(fileStore.openInputStream(EFS.NONE, null));
        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.refresh();
    selectionChanged1();
    fTableViewer.setChecked(getEnabledTemplates(), true);
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 updateViewerInput() {
    IStructuredSelection selection= (IStructuredSelection) getTableViewer().getSelection();

    if (selection.size() == 1) {
      TemplatePersistenceData data= (TemplatePersistenceData) selection.getFirstElement();
      Template template= data.getTemplate();
      if(template.getContextTypeId().contains("vhdl"))
      {
        getViewer().unconfigure();
        SourceViewerConfiguration configuration= HdlSourceViewerConfiguration.createForVhdl(new VerilogEditor());
        getViewer().configure(configuration);
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

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.