本文整理汇总了Java中org.eclipse.jface.util.Policy.logException方法的典型用法代码示例。如果您正苦于以下问题:Java Policy.logException方法的具体用法?Java Policy.logException怎么用?Java Policy.logException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.util.Policy
的用法示例。
在下文中一共展示了Policy.logException方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.eclipse.jface.util.Policy; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if(selection.isEmpty())
return null;
Collection<IProject> projects = SelectionUtils.getProjects(selection);
if(!projects.isEmpty()){
try {
CodeScannerView view = (CodeScannerView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(CodeScannerView.ID);
if(view != null){
view.scan(projects);
}
} catch (PartInitException e) {
Policy.logException(e);
}
}
return null;
}
示例2: loadSavedResults
import org.eclipse.jface.util.Policy; //导入方法依赖的package包/类
private void loadSavedResults() {
String fileName = getScanResultFileLocation();
try {
ScanResult result = RulesJSONProcessor.INSTANCE.fetchResults(fileName);
results.clear();
if (result.getRuleResults() != null) {
for (RuleScanResult ruleResult : result.getRuleResults()) {
results.put(ruleResult.getRule(),
ruleResult.getDescriptors());
}
}
tagsViewer.setInput(results.keySet().toArray());
tagsViewer
.setSelection(results.isEmpty() ? StructuredSelection.EMPTY
: new StructuredSelection(results.keySet()
.iterator().next()));
loadLbl.setText(Messages.bind(
Messages.CodeScannerView_SCANRESULTS_TIME,
DateFormat.getDateTimeInstance().format(
result.getSearchDate())));
} catch (FileNotFoundException e) {
Policy.logException(e);
}
}
示例3: fill
import org.eclipse.jface.util.Policy; //导入方法依赖的package包/类
/**
* The control item implementation of this <code>IContributionItem</code>
* method calls the <code>createControl</code> framework method to
* create a control under the given parent, and then creates
* a new tool item to hold it.
* Subclasses must implement <code>createControl</code> rather than
* overriding this method.
*/
public final void fill(ToolBar parent, int index) {
Control control = createControl(parent);
if (control == null) {
Policy.logException(new IllegalStateException("createControl(Composite) of " + getClass() //$NON-NLS-1$
+ " returned null, cannot fill toolbar")); //$NON-NLS-1$
} else {
ToolItem ti = new ToolItem(parent, SWT.SEPARATOR, index);
ti.setControl(control);
ti.setWidth(computeWidth(control));
mainControl = ti;
}
}
示例4: getFontRecord
import org.eclipse.jface.util.Policy; //导入方法依赖的package包/类
/**
* Return the font record for the key.
*
* @param symbolicName
* The key for the record.
* @return FontRecord
*/
private FontRecord getFontRecord(String symbolicName) {
Assert.isNotNull(symbolicName);
Object result = stringToFontRecord.get(symbolicName);
if (result != null) {
return (FontRecord) result;
}
result = stringToFontData.get(symbolicName);
FontRecord fontRecord;
if (result == null) {
fontRecord = defaultFontRecord();
} else {
fontRecord = createFont(symbolicName, (FontData[]) result);
}
if (fontRecord == null) {
fontRecord = defaultFontRecord();
if (Display.getCurrent() == null) { // log error but don't throw an
// exception to preserve
// existing functionality
String msg = "Unable to create font \"" + symbolicName + "\" in a non-UI thread. Using default font instead."; //$NON-NLS-1$ //$NON-NLS-2$
Policy.logException(new SWTException(msg));
return fontRecord; // don't add it to the cache; if later asked
// from UI thread, a proper font will be
// created
}
}
stringToFontRecord.put(symbolicName, fontRecord);
return fontRecord;
}