本文整理汇总了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);
}