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


Java IJavaElement.JAVA_PROJECT属性代码示例

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


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

示例1: getTarget

/**
 * Returns the target of this resource change.
 * @param elem the changed element
 * @return the target of the change, or an empty string if the target is not either a project, package, or file
 */
private String getTarget(IJavaElement elem) {
    if (elem == null) {
        return "";
    }
    
    int type = elem.getElementType();
    if (type == IJavaElement.JAVA_PROJECT) {
        return "Project";
        
    } else if (type == IJavaElement.PACKAGE_DECLARATION) {
        return "Package";
        
    } else if (type == IJavaElement.COMPILATION_UNIT) {
        return "File";
    }
    
    return elem.getElementName() + "@" + elem.getElementType();
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:23,代码来源:ResourceMacro.java

示例2: getName

/**
 * Obtains the name of the specified element.
 * @param elem the element
 * @param type the type of the element
 * @return the name string
 */
public static String getName(IJavaElement elem) {
    int type = elem.getElementType();
    if (type == IJavaElement.JAVA_PROJECT) {
        return elem.getResource().getName();
        
    } else if (type == IJavaElement.PACKAGE_DECLARATION) {
        IPackageFragment jpackage = (IPackageFragment)elem;
        return jpackage.getElementName();
        
    } else if (type == IJavaElement.COMPILATION_UNIT) {
        return elem.getResource().getName();
    }
    
    return "";
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:21,代码来源:ResourceMacro.java

示例3: visit

private void visit(IJavaElementDelta delta) {
	IJavaElement el = delta.getElement();
	switch (el.getElementType()) {
	case IJavaElement.JAVA_MODEL:
		for (IJavaElementDelta c : delta.getAffectedChildren()) {
			visit(c);
		}
		break;
	case IJavaElement.JAVA_PROJECT:
		IJavaProject javaProject = (IJavaProject) el;
		if (isClasspathChanged(delta)) {
			detectionJob.analyze(javaProject);
		}
		break;
	default:
		break;
	}
}
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:18,代码来源:ClasspathChangeListener.java

示例4: visit

private void visit(IJavaElementDelta delta) {
	IJavaElement el = delta.getElement();
	switch (el.getElementType()) {
	case IJavaElement.JAVA_MODEL:
		visitChildren(delta);
		break;
	case IJavaElement.JAVA_PROJECT:
		if (isClasspathChanged(delta.getFlags()) && platformHolder.isCurrentPlatformProject(delta.getElement().getJavaProject())) {
			notifyClasspathChanged((IJavaProject) el);
		}
		break;
	default:
		break;
	}
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:15,代码来源:ClasspathChagedListener.java

示例5: collectCompilationUnits

private void collectCompilationUnits(Object element, Collection<IJavaElement> result, String packagePrefix) {
	try {
		if (element instanceof IJavaElement) {
			IJavaElement elem = (IJavaElement) element;
			if (elem.exists()) {
				switch (elem.getElementType()) {
					case IJavaElement.TYPE:
						if (elem.getParent().getElementType() == IJavaElement.COMPILATION_UNIT) {
							result.add(elem.getParent());
						}
						break;
					case IJavaElement.COMPILATION_UNIT:
						result.add(elem);
						break;
					case IJavaElement.IMPORT_CONTAINER:
						result.add(elem.getParent());
						break;
					case IJavaElement.PACKAGE_FRAGMENT:
						collectCompilationUnits((IPackageFragment) elem, result);
						break;
					case IJavaElement.PACKAGE_FRAGMENT_ROOT:
						collectCompilationUnits((IPackageFragmentRoot) elem, result, packagePrefix);
						break;
					case IJavaElement.JAVA_PROJECT:
						IPackageFragmentRoot[] roots = ((IJavaProject) elem).getPackageFragmentRoots();
						for (int k = 0; k < roots.length; k++) {
							collectCompilationUnits(roots[k], result, null);
						}
						break;
				}
			}
		}
	} catch (CoreException e) {
		JavaLanguageServerPlugin.logException("Problem collection compilation unit ", e);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:36,代码来源:OrganizeImportsCommand.java

示例6: appendElementLabel

/**
 * Appends the label for a Java element with the flags as defined by this class.
 *
 * @param element the element to render
 * @param flags the rendering flags.
 */
public void appendElementLabel(IJavaElement element, long flags) {
	int type= element.getElementType();
	IPackageFragmentRoot root= null;

	if (type != IJavaElement.JAVA_MODEL && type != IJavaElement.JAVA_PROJECT && type != IJavaElement.PACKAGE_FRAGMENT_ROOT) {
		root= JavaModelUtil.getPackageFragmentRoot(element);
	}
	if (root != null && getFlag(flags, JavaElementLabels.PREPEND_ROOT_PATH)) {
		appendPackageFragmentRootLabel(root, JavaElementLabels.ROOT_QUALIFIED);
		fBuilder.append(JavaElementLabels.CONCAT_STRING);
	}

	switch (type) {
	case IJavaElement.METHOD:
		appendMethodLabel((IMethod) element, flags);
		break;
	case IJavaElement.FIELD:
		appendFieldLabel((IField) element, flags);
		break;
	case IJavaElement.LOCAL_VARIABLE:
		appendLocalVariableLabel((ILocalVariable) element, flags);
		break;
	case IJavaElement.TYPE_PARAMETER:
		appendTypeParameterLabel((ITypeParameter) element, flags);
		break;
	case IJavaElement.INITIALIZER:
		appendInitializerLabel((IInitializer) element, flags);
		break;
	case IJavaElement.TYPE:
		appendTypeLabel((IType) element, flags);
		break;
	case IJavaElement.CLASS_FILE:
		appendClassFileLabel((IClassFile) element, flags);
		break;
	case IJavaElement.COMPILATION_UNIT:
		appendCompilationUnitLabel((ICompilationUnit) element, flags);
		break;
	case IJavaElement.PACKAGE_FRAGMENT:
		appendPackageFragmentLabel((IPackageFragment) element, flags);
		break;
	case IJavaElement.PACKAGE_FRAGMENT_ROOT:
		appendPackageFragmentRootLabel((IPackageFragmentRoot) element, flags);
		break;
	case IJavaElement.IMPORT_CONTAINER:
	case IJavaElement.IMPORT_DECLARATION:
	case IJavaElement.PACKAGE_DECLARATION:
		appendDeclarationLabel(element, flags);
		break;
	case IJavaElement.JAVA_PROJECT:
	case IJavaElement.JAVA_MODEL:
		fBuilder.append(element.getElementName());
		break;
	default:
		fBuilder.append(element.getElementName());
	}

	if (root != null && getFlag(flags, JavaElementLabels.APPEND_ROOT_PATH)) {
		fBuilder.append(JavaElementLabels.CONCAT_STRING);
		appendPackageFragmentRootLabel(root, JavaElementLabels.ROOT_QUALIFIED);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:67,代码来源:JavaElementLabelComposer.java


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