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


Java IDOMAttr.getOwnerElement方法代码示例

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


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

示例1: newUiFieldProposalComputer

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; //导入方法依赖的package包/类
/**
 * Creates a proposal computer for ui:field attribute values (ui:field="_")
 */
public static IProposalComputer newUiFieldProposalComputer(
    ContentAssistRequest contentAssistRequest, IJavaProject javaProject) {

  IDOMAttr attribute = XmlContentAssistUtilities.getAttribute(contentAssistRequest);
  if (attribute == null || attribute.getOwnerElement() == null) {
    return null;
  }

  // Ensure that we are auto-completing an ui:field attribute
  if (!attribute.equals(UiBinderXmlModelUtilities.getFieldAttribute(attribute.getOwnerElement()))) {
    return null;
  }

  IFile f = SseUtilities.resolveFile(contentAssistRequest.getDocumentRegion().getParentDocument());
  Set<IType> subtypes = UiBinderUtilities.getSubtypesFromXml(f, javaProject);
  if (subtypes.isEmpty()) {
    return null;
  }

  String attrValue = XmlContentAssistUtilities.getAttributeValueUsingMatchString(contentAssistRequest);

  return new UiFieldProposalComputer(
      subtypes,
      UiBinderXmlModelUtilities.computeQualifiedWidgetTypeName(attribute.getOwnerElement()),
      javaProject,
      attrValue,
      XmlContentAssistUtilities.getAttributeValueOffset(contentAssistRequest),
      attrValue.length());
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:33,代码来源:ProposalComputerFactory.java

示例2: newUiImportFieldProposalComputer

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; //导入方法依赖的package包/类
/**
 * Creates a proposal computer for autocompleting the java classes for the
 * <ui:import field="___" />
 */
public static IProposalComputer newUiImportFieldProposalComputer(
    ContentAssistRequest contentAssistRequest, IJavaProject javaProject,
    String packageName) {

  IDOMAttr attribute = XmlContentAssistUtilities.getAttribute(contentAssistRequest);
  if (attribute == null || attribute.getOwnerElement() == null) {
    return null;
  }

  // Ensure we are autocompleting an 'ui:import' element attribute
  if (!UiBinderConstants.UI_BINDER_IMPORT_ELEMENT_NAME.equals(attribute.getOwnerElement().getLocalName())) {
    return null;
  }

  // Ensure we are autocompleting the 'field' attribute
  if (!attribute.equals(UiBinderXmlModelUtilities.getFieldAttribute(attribute.getOwnerElement()))) {
    return null;
  }

  String attrValue = XmlContentAssistUtilities.getAttributeValueUsingMatchString(contentAssistRequest);

  CodeCompleteProposalComputer ccpc = new CodeCompleteProposalComputer(
      new int[] {
          CompletionProposal.TYPE_REF, CompletionProposal.PACKAGE_REF,
          CompletionProposal.FIELD_IMPORT, CompletionProposal.FIELD_REF},
      javaProject,
      attrValue,
      XmlContentAssistUtilities.getAttributeValueOffset(contentAssistRequest),
      attrValue.length(), packageName, true);

  return ccpc;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:37,代码来源:ProposalComputerFactory.java

示例3: newUrnTypesProposalComputer

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; //导入方法依赖的package包/类
/**
 * Creates a proposal computer for autocompleting attributes for the UiBinder
 * root element. For example, suggesting the 'urn:import:' in xmlns:g="_
 */
public static IProposalComputer newUrnTypesProposalComputer(
    ContentAssistRequest contentAssistRequest) {
  IDOMAttr attribute = XmlContentAssistUtilities.getAttribute(contentAssistRequest);
  if (attribute == null) {
    return null;
  }

  Element element = attribute.getOwnerElement();
  String attrValue = XmlContentAssistUtilities.getAttributeValueUsingMatchString(contentAssistRequest);

  /*
   * Must be the root element named "UiBinder" (namespace is not checked since
   * we want to allow completion of the attribute to define this namespace.)
   */
  if (!element.getLocalName().equals(UiBinderConstants.UI_BINDER_ELEMENT_NAME)
      || element.getParentNode().getNodeType() == Node.ELEMENT_NODE
      || !attribute.getNamespaceURI().equals(
          UiBinderConstants.XMLNS_NAMESPACE)) {
    return null;
  }

  return new StaticTextProposalComputer(
      new String[] {
          UiBinderConstants.UI_BINDER_XML_NAMESPACE,
          UiBinderConstants.URN_IMPORT_NAMESPACE_BEGINNING},
      attrValue,
      XmlContentAssistUtilities.getAttributeValueOffset(contentAssistRequest),
      attrValue.length(), null);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:34,代码来源:ProposalComputerFactory.java

示例4: newWithTypeProposalComputer

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; //导入方法依赖的package包/类
/**
 * Creates a proposal computer for autocompleting the java classes for the
 * <ui:with ui:type="___" />
 */
public static IProposalComputer newWithTypeProposalComputer(
    ContentAssistRequest contentAssistRequest, IJavaProject javaProject) {

  IDOMAttr attribute = XmlContentAssistUtilities.getAttribute(contentAssistRequest);
  if (attribute == null || attribute.getOwnerElement() == null) {
    return null;
  }

  // Ensure we are autocompleting the 'type' attribute
  if (!attribute.equals(UiBinderXmlModelUtilities.getTypeAttribute(attribute.getOwnerElement()))) {
    return null;
  }

  String attrValue = XmlContentAssistUtilities.getAttributeValueUsingMatchString(contentAssistRequest);

  /*
   * Even though only types are valid, we must also propose packages to get to
   * fully qualified types if the user has typed e.g. "com.".
   */
  return new CodeCompleteProposalComputer(
      new int[]{CompletionProposal.TYPE_REF, CompletionProposal.PACKAGE_REF},
      javaProject,
      attrValue,
      XmlContentAssistUtilities.getAttributeValueOffset(contentAssistRequest),
      attrValue.length(), null, false);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:31,代码来源:ProposalComputerFactory.java

示例5: execute

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException
{
	workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
	if (workbenchWindow == null)
		return null;

	IWorkbenchPage activePage = workbenchWindow.getActivePage();
	if (activePage == null)
		return null;

	editor = HandlerUtil.getActiveEditor(event);
	if (editor == null)
		return null;

	// HandlerUtil.getCurrentSelection(event) does not return
	// the latest 'selection' when the cursor is moved.
	ISelection selection = activePage.getSelection();
	if (selection != null && selection instanceof IStructuredSelection
		&& selection instanceof ITextSelection)
	{
		Object selected = ((IStructuredSelection)selection).getFirstElement();
		if (selected instanceof IDOMAttr)
		{
			IDocument document = editor.getAdapter(IDocument.class);
			final IDOMAttr attr = (IDOMAttr)selected;
			final String attrName = attr.getName();
			final Element tag = attr.getOwnerElement();
			if ("select".equals(attrName) || ("id".equals(attrName)
				&& MybatipseXmlUtil.findEnclosingStatementNode(tag) != null))
			{
				renameStatementId(document, attr);
			}
			else if ("refid".equals(attrName)
				|| ("id".equals(attrName) && "sql".equals(tag.getTagName())))
			{
				renameSqlId(document, attr);
			}
			else if ("resultMap".equals(attrName)
				|| ("id".equals(attrName) && "resultMap".equals(tag.getTagName())))
			{
				int offset = ((ITextSelection)selection).getOffset();
				renameResultMapId(document, attr, offset);
				// OUT param's resultMap option is not supported
			}
		}
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:50,代码来源:XmlElementRenameHandler.java


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