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


Java ICleanUp.setOptions方法代码示例

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


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

示例1: ensureCleanUpsRegistered

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入方法依赖的package包/类
private synchronized void ensureCleanUpsRegistered() {
	if (fCleanUpDescriptors != null)
		return;


	final ArrayList<CleanUpDescriptor> descriptors= new ArrayList<CleanUpDescriptor>();

	IExtensionPoint point= Platform.getExtensionRegistry().getExtensionPoint(JavaPlugin.getPluginId(), EXTENSION_POINT_NAME);
	IConfigurationElement[] elements= point.getConfigurationElements();
	for (int i= 0; i < elements.length; i++) {
		IConfigurationElement element= elements[i];

		if (CLEAN_UP_CONFIGURATION_ELEMENT_NAME.equals(element.getName())) {
			descriptors.add(new CleanUpDescriptor(element));
		}
	}


	// Make sure we filter those who fail or misbehave
	for (int i= 0; i < descriptors.size(); i++) {
		final CleanUpDescriptor cleanUpDescriptor= descriptors.get(i);
		final boolean disable[]= new boolean[1];
		ISafeRunnable runnable= new SafeRunnable() {
			
			public void run() throws Exception {
				ICleanUp cleanUp= cleanUpDescriptor.createCleanUp();
				if (cleanUp == null)
					disable[0]= true;
				else {
					cleanUp.setOptions(new CleanUpOptions());
					String[] enbledSteps= cleanUp.getStepDescriptions();
					if (enbledSteps != null && enbledSteps.length > 0) {
						JavaPlugin.logErrorMessage(
								Messages.format(FixMessages.CleanUpRegistry_cleanUpAlwaysEnabled_error, new String[] { cleanUpDescriptor.getId(),
								cleanUpDescriptor.fElement.getContributor().getName() }));
						disable[0]= true;
					}
				}
			}
			@Override
			public void handleException(Throwable t) {
				disable[0]= true;
				String message= Messages.format(FixMessages.CleanUpRegistry_cleanUpCreation_error, new String[] { cleanUpDescriptor.getId(),
						cleanUpDescriptor.fElement.getContributor().getName() });
				IStatus status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, t);
				JavaPlugin.log(status);
			}

		};
		SafeRunner.run(runnable);
		if (disable[0])
			descriptors.remove(i--);
	}

	fCleanUpDescriptors= descriptors.toArray(new CleanUpDescriptor[descriptors.size()]);
	sort(fCleanUpDescriptors);

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:59,代码来源:CleanUpRegistry.java


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