Java源码示例:org.eclipse.core.expressions.ExpressionTagNames

示例1
public ClasspathFixProcessorDescriptor(IConfigurationElement element) {
	fConfigurationElement= element;
	fProcessorInstance= null;
	fStatus= null; // undefined
	if (fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT).length == 0) {
		fStatus= Boolean.TRUE;
	}
	IConfigurationElement[] children= fConfigurationElement.getChildren(OVERRIDES);
	if (children.length > 0) {
		fOverriddenIds= new ArrayList<String>(children.length);
		for (int i= 0; i < children.length; i++) {
			fOverriddenIds.add(children[i].getAttribute(ID));
		}
	} else {
		fOverriddenIds= Collections.emptyList();
	}
}
 
示例2
public boolean matches(IJavaProject javaProject) {
	if (fStatus != null) {
		return fStatus.booleanValue();
	}

	IConfigurationElement[] children= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT);
	if (children.length == 1) {
		try {
			ExpressionConverter parser= ExpressionConverter.getDefault();
			Expression expression= parser.perform(children[0]);
			EvaluationContext evalContext= new EvaluationContext(null, javaProject);
			evalContext.addVariable("project", javaProject); //$NON-NLS-1$
			evalContext.addVariable("sourceLevel", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); //$NON-NLS-1$
			return expression.evaluate(evalContext) == EvaluationResult.TRUE;
		} catch (CoreException e) {
			JavaPlugin.log(e);
		}
		return false;
	}
	fStatus= Boolean.FALSE;
	return false;
}
 
示例3
/**
 * @throws CoreException 
 * 
 */
private TextHoverDescriptor(IConfigurationElement configurationElement) throws CoreException {
	this.configurationElement = configurationElement;
	for (IConfigurationElement element : configurationElement.getChildren(TAG_CONTENT_TYPE)) {
		readElement(element);
	}
	IConfigurationElement[] elements = configurationElement.getChildren(ExpressionTagNames.ENABLEMENT);
	enablementExpression = (elements.length > 0) ? ExpressionConverter.getDefault().perform(elements[0]) : null;
}
 
示例4
CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) throws CoreException {
	fElement= element;
	fRegistry= registry;
	IExtension parent= (IExtension) element.getParent();
	fId= parent.getUniqueIdentifier();
	checkNotNull(fId, "id"); //$NON-NLS-1$
	String name= parent.getLabel();
	if (name == null)
		fName= fId;
	else
		fName= name;
	
	IConfigurationElement[] children= fElement.getChildren(ExpressionTagNames.ENABLEMENT);
	if (children.length == 1) {
		ExpressionConverter parser= ExpressionConverter.getDefault();
		fEnablementExpression = parser.perform(children[0]);
	}
	else {
		fEnablementExpression = null;
	}
	
	String icon= element.getAttribute(ICON);
	ImageDescriptor img= null;
	if (icon != null) {
		Bundle bundle= getBundle();
		if (bundle != null) {
			Path path= new Path(icon);
			URL url= FileLocator.find(bundle, path, null);
			img= ImageDescriptor.createFromURL(url);
		}
	}
	fImage= img;

}
 
示例5
public IStatus checkSyntax() {
	IConfigurationElement[] children= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT);
	if (children.length > 1) {
		return new StatusInfo(IStatus.ERROR, "Only one < enablement > element allowed. Disabling " + getID()); //$NON-NLS-1$
	}
	return new StatusInfo(IStatus.OK, "Syntactically correct classpath fix processor"); //$NON-NLS-1$
}
 
示例6
public ContributedProcessorDescriptor(IConfigurationElement element, boolean testMarkerTypes) {
	fConfigurationElement= element;
	fProcessorInstance= null;
	fStatus= null; // undefined
	if (fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT).length == 0) {
		fStatus= Boolean.TRUE;
	}
	fRequiredSourceLevel= element.getAttribute(REQUIRED_SOURCE_LEVEL);
	fHandledMarkerTypes= testMarkerTypes ? getHandledMarkerTypes(element) : null;
}
 
示例7
public IStatus checkSyntax() {
	IConfigurationElement[] children= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT);
	if (children.length > 1) {
		String id= fConfigurationElement.getAttribute(ID);
		return new StatusInfo(IStatus.ERROR, "Only one < enablement > element allowed. Disabling " + id); //$NON-NLS-1$
	}
	return new StatusInfo(IStatus.OK, "Syntactically correct quick assist/fix processor"); //$NON-NLS-1$
}
 
示例8
private boolean matches(ICompilationUnit cunit) {
	if (fRequiredSourceLevel != null) {
		String current= cunit.getJavaProject().getOption(JavaCore.COMPILER_SOURCE, true);
		if (JavaModelUtil.isVersionLessThan(current, fRequiredSourceLevel)) {
			return false;
		}
	}

	if (fStatus != null) {
		return fStatus.booleanValue();
	}

	IConfigurationElement[] children= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT);
	if (children.length == 1) {
		try {
			ExpressionConverter parser= ExpressionConverter.getDefault();
			Expression expression= parser.perform(children[0]);
			EvaluationContext evalContext= new EvaluationContext(null, cunit);
			evalContext.addVariable("compilationUnit", cunit); //$NON-NLS-1$
			IJavaProject javaProject= cunit.getJavaProject();
			String[] natures= javaProject.getProject().getDescription().getNatureIds();
			evalContext.addVariable("projectNatures", Arrays.asList(natures)); //$NON-NLS-1$
			evalContext.addVariable("sourceLevel", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); //$NON-NLS-1$
			return expression.evaluate(evalContext) == EvaluationResult.TRUE;
		} catch (CoreException e) {
			JavaPlugin.log(e);
		}
		return false;
	}
	fStatus= Boolean.FALSE;
	return false;
}
 
示例9
PlatformSupport(IConfigurationElement configurationElement ){
	super(configurationElement);
	this.id = configurationElement.getAttribute(ATTR_ID);
	this.platform = configurationElement.getAttribute(PlatformSupport.ATTR_PLATFORM);
	this.platformId=configurationElement.getAttribute(PlatformSupport.ATTR_PLATFORM_ID);
	configureEnablement(configurationElement.getChildren(ExpressionTagNames.ENABLEMENT));
}
 
示例10
NativeProjectBuilder(IConfigurationElement element) {
	super(element);
	this.id = element.getAttribute(ATTR_ID);
	this.platform = element.getAttribute(PlatformSupport.ATTR_PLATFORM);
	configureEnablement(element.getChildren(ExpressionTagNames.ENABLEMENT));

}