当前位置: 首页>>代码示例>>Java>>正文


Java TemplatePersistenceData.getId方法代码示例

本文整理汇总了Java中org.eclipse.jface.text.templates.persistence.TemplatePersistenceData.getId方法的典型用法代码示例。如果您正苦于以下问题:Java TemplatePersistenceData.getId方法的具体用法?Java TemplatePersistenceData.getId怎么用?Java TemplatePersistenceData.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.text.templates.persistence.TemplatePersistenceData的用法示例。


在下文中一共展示了TemplatePersistenceData.getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: directAdd

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
public void directAdd(final TemplatePersistenceData data, final boolean isEdited) {
	if (isEdited) {
		add(data);
	} else {
		// Trick the template store so that (1) the template is considered
		// as "user added" while (2) maintaining a proper id
		final String id = data.getId();
		final TemplatePersistenceData d2 = new TemplatePersistenceData(data.getTemplate(), true) {

			@Override
			public String getId() {
				return id;
			}

		};
		add(d2);
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:19,代码来源:GamlTemplateStore.java

示例2: load

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
public void load() throws IOException {
	if (fProjectStore != null) {
		fProjectStore.load();

		Set<String> datas= new HashSet<String>();
		TemplatePersistenceData[] data= fProjectStore.getTemplateData(false);
		for (int i= 0; i < data.length; i++) {
			datas.add(data[i].getId());
		}

		data= fInstanceStore.getTemplateData(false);
		for (int i= 0; i < data.length; i++) {
			TemplatePersistenceData orig= data[i];
			if (!datas.contains(orig.getId())) {
				TemplatePersistenceData copy= new TemplatePersistenceData(new Template(orig.getTemplate()), orig.isEnabled(), orig.getId());
				fProjectStore.add(copy);
				copy.setDeleted(true);
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:ProjectTemplateStore.java

示例3: addTemplatesFromFile

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
/**
 * Contribute templates defined in file with the give URL.
 * 
 * @param templates
 *          the URL of the file with templates
 */
private void addTemplatesFromFile(final URL templates) {
  if (templates != null) {
    TemplateReaderWriter reader = new TemplateReaderWriter();
    try {
      InputStream openStream = templates.openStream();
      try {
        TemplatePersistenceData[] datas = reader.read(openStream, null);
        int templateCounter = 0;
        for (TemplatePersistenceData data : datas) {
          if (data.getId() == null) {
            templateCounter++;
            TemplatePersistenceData dataWithGenId = new TemplatePersistenceData(data.getTemplate(), data.isEnabled(), templates.getPath() + "." //$NON-NLS-1$
                + templateCounter);
            dataWithGenId.setDeleted(data.isDeleted());
            internalAdd(dataWithGenId);
          } else {
            // if contributed template has an id
            internalAdd(data);
          }
        }
      } finally {
        openStream.close();
      }
    } catch (IOException e) {
      LOG.error(e);
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:35,代码来源:ConfigurableTemplateStore.java

示例4: category

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
public int category(Object element) {
	if (element == COMMENT_NODE) {
		return 1;
	} else if (element == CODE_NODE) {
		return 2;
	}

	TemplatePersistenceData data = (TemplatePersistenceData) element;
	String id = data.getId();

	if (CodeTemplateContextType.NEWTYPE_ID.equals(id)) {
		return 101;
	} else if (CodeTemplateContextType.CLASSBODY_ID.equals(id)) {
		return 102;
	} else if (CodeTemplateContextType.METHODSTUB_ID.equals(id)) {
		return 106;
	} else if (CodeTemplateContextType.CONSTRUCTORSTUB_ID.equals(id)) {
		return 107;
	} else if (CodeTemplateContextType.GETTERSTUB_ID.equals(id)) {
		return 108;
	} else if (CodeTemplateContextType.SETTERSTUB_ID.equals(id)) {
		return 109;
	} else if (CodeTemplateContextType.CATCHBLOCK_ID.equals(id)) {
		return 110;
	} else if (CodeTemplateContextType.FILECOMMENT_ID.equals(id)) {
		return 1;
	} else if (CodeTemplateContextType.TYPECOMMENT_ID.equals(id)) {
		return 2;
	} else if (CodeTemplateContextType.FIELDCOMMENT_ID.equals(id)) {
		return 3;
	} else if (CodeTemplateContextType.CONSTRUCTORCOMMENT_ID.equals(id)) {
		return 4;
	} else if (CodeTemplateContextType.METHODCOMMENT_ID.equals(id)) {
		return 5;
	} else if (CodeTemplateContextType.OVERRIDECOMMENT_ID.equals(id)) {
		return 6;
	} else if (CodeTemplateContextType.DELEGATECOMMENT_ID.equals(id)) {
		return 7;
	} else if (CodeTemplateContextType.GETTERCOMMENT_ID.equals(id)) {
		return 8;
	} else if (CodeTemplateContextType.SETTERCOMMENT_ID.equals(id)) {
		return 9;
	}
	return 1000;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:46,代码来源:CodeTemplateBlock.java

示例5: getText

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
public String getText(Object element) {
	if (element == COMMENT_NODE || element == CODE_NODE) {
		return (String) element;
	}
	TemplatePersistenceData data = (TemplatePersistenceData) element;
	String id = data.getId();
	// if (CodeTemplateContextType.CATCHBLOCK_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_catchblock_label;
	// } else if (CodeTemplateContextType.METHODSTUB_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_methodstub_label;
	// } else if (CodeTemplateContextType.CONSTRUCTORSTUB_ID.equals(id))
	// {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_constructorstub_label;
	// } else if (CodeTemplateContextType.GETTERSTUB_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_getterstub_label;
	// } else if (CodeTemplateContextType.SETTERSTUB_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_setterstub_label;
	// } else if (CodeTemplateContextType.NEWTYPE_ID.equals(id)) {
	// return JSDTTypeScriptUIMessages.CodeTemplateBlock_newtype_label;
	// } else if (CodeTemplateContextType.CLASSBODY_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_classbody_label;
	// } else if (CodeTemplateContextType.FILECOMMENT_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_filecomment_label;
	// } else if (CodeTemplateContextType.TYPECOMMENT_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_typecomment_label;
	// } else if (CodeTemplateContextType.FIELDCOMMENT_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_fieldcomment_label;
	// } else if (CodeTemplateContextType.METHODCOMMENT_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_methodcomment_label;
	// } else if (CodeTemplateContextType.OVERRIDECOMMENT_ID.equals(id))
	// {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_overridecomment_label;
	// } else if (CodeTemplateContextType.DELEGATECOMMENT_ID.equals(id))
	// {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_delegatecomment_label;
	// } else if
	// (CodeTemplateContextType.CONSTRUCTORCOMMENT_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_constructorcomment_label;
	// } else if (CodeTemplateContextType.GETTERCOMMENT_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_gettercomment_label;
	// } else if (CodeTemplateContextType.SETTERCOMMENT_ID.equals(id)) {
	// return
	// JSDTTypeScriptUIMessages.CodeTemplateBlock_settercomment_label;
	// }
	return data.getTemplate().getDescription();
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:61,代码来源:CodeTemplateBlock.java

示例6: add

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
void add(final TemplatePersistenceData t) {
	final String id = t.getId();
	final List<String> path = new ArrayList<>(Arrays.asList(id.split("\\.")));
	add(t, path);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:6,代码来源:TemplateReferenceMenu.java

示例7: category

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
@Override
public int category(Object element) {
	if (element == COMMENT_NODE) {
		return 1;
	} else if (element == CODE_NODE) {
		return 2;
	}

	TemplatePersistenceData data= (TemplatePersistenceData) element;
	String id= data.getId();

	if (CodeTemplateContextType.NEWTYPE_ID.equals(id)) {
		return 101;
	} else if (CodeTemplateContextType.CLASSBODY_ID.equals(id)) {
		return 102;
	} else if (CodeTemplateContextType.INTERFACEBODY_ID.equals(id)) {
		return 103;
	} else if (CodeTemplateContextType.ENUMBODY_ID.equals(id)) {
		return 104;
	} else if (CodeTemplateContextType.ANNOTATIONBODY_ID.equals(id)) {
		return 105;
	} else if (CodeTemplateContextType.METHODSTUB_ID.equals(id)) {
		return 106;
	} else if (CodeTemplateContextType.CONSTRUCTORSTUB_ID.equals(id)) {
		return 107;
	} else if (CodeTemplateContextType.GETTERSTUB_ID.equals(id)) {
		return 108;
	} else if (CodeTemplateContextType.SETTERSTUB_ID.equals(id)) {
		return 109;
	} else if (CodeTemplateContextType.CATCHBLOCK_ID.equals(id)) {
		return 110;
	} else if (CodeTemplateContextType.FILECOMMENT_ID.equals(id)) {
		return 1;
	} else if (CodeTemplateContextType.TYPECOMMENT_ID.equals(id)) {
		return 2;
	} else if (CodeTemplateContextType.FIELDCOMMENT_ID.equals(id)) {
		return 3;
	} else if (CodeTemplateContextType.CONSTRUCTORCOMMENT_ID.equals(id)) {
		return 4;
	} else if (CodeTemplateContextType.METHODCOMMENT_ID.equals(id)) {
		return 5;
	} else if (CodeTemplateContextType.OVERRIDECOMMENT_ID.equals(id)) {
		return 6;
	} else if (CodeTemplateContextType.DELEGATECOMMENT_ID.equals(id)) {
		return 7;
	} else if (CodeTemplateContextType.GETTERCOMMENT_ID.equals(id)) {
		return 8;
	} else if (CodeTemplateContextType.SETTERCOMMENT_ID.equals(id)) {
		return 9;
	}
	return 1000;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:53,代码来源:CodeTemplateBlock.java

示例8: getText

import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; //导入方法依赖的package包/类
@Override
public String getText(Object element) {
	if (element == COMMENT_NODE || element == CODE_NODE) {
		return (String) element;
	}
	TemplatePersistenceData data= (TemplatePersistenceData) element;
	String id=data.getId();
	if (CodeTemplateContextType.CATCHBLOCK_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_catchblock_label;
	} else if (CodeTemplateContextType.METHODSTUB_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_methodstub_label;
	} else if (CodeTemplateContextType.CONSTRUCTORSTUB_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_constructorstub_label;
	} else if (CodeTemplateContextType.GETTERSTUB_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_getterstub_label;
	} else if (CodeTemplateContextType.SETTERSTUB_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_setterstub_label;
	} else if (CodeTemplateContextType.NEWTYPE_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_newtype_label;
	} else if (CodeTemplateContextType.CLASSBODY_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_classbody_label;
	} else if (CodeTemplateContextType.INTERFACEBODY_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_interfacebody_label;
	} else if (CodeTemplateContextType.ENUMBODY_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_enumbody_label;
	} else if (CodeTemplateContextType.ANNOTATIONBODY_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_annotationbody_label;
	} else if (CodeTemplateContextType.FILECOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_filecomment_label;
	} else if (CodeTemplateContextType.TYPECOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_typecomment_label;
	} else if (CodeTemplateContextType.FIELDCOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_fieldcomment_label;
	} else if (CodeTemplateContextType.METHODCOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_methodcomment_label;
	} else if (CodeTemplateContextType.OVERRIDECOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_overridecomment_label;
	} else if (CodeTemplateContextType.DELEGATECOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_delegatecomment_label;
	} else if (CodeTemplateContextType.CONSTRUCTORCOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_constructorcomment_label;
	} else if (CodeTemplateContextType.GETTERCOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_gettercomment_label;
	} else if (CodeTemplateContextType.SETTERCOMMENT_ID.equals(id)) {
		return PreferencesMessages.CodeTemplateBlock_settercomment_label;
	}
	return data.getTemplate().getDescription();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:49,代码来源:CodeTemplateBlock.java


注:本文中的org.eclipse.jface.text.templates.persistence.TemplatePersistenceData.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。