/** * Returns the filename for the ImageData. * * @return {@link String} or <code>null</code> if the file cannot be found */ private String getFilePath() { if (location == null) return new Path(name).toOSString(); URL resource = location.getResource(name); if (resource == null) return null; try { if (!InternalPolicy.OSGI_AVAILABLE) {// Stand-alone case return new Path(resource.getFile()).toOSString(); } return new Path(FileLocator.toFileURL(resource).getPath()).toOSString(); } catch (IOException e) { Policy.logException(e); return null; } } }
Policy.logException(e); } else if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) { String path = url.getPath();
} catch (IOException e) { if (logIOException) { Policy.logException(e); } else if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) { if (name.endsWith("@2x.png") || name.endsWith("@1.5x.png")) { //$NON-NLS-1$ //$NON-NLS-2$
Policy.logException(e); } else if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) { String path = url.getPath();
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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. */ @Override 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)); } } }
/** * 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. */ @Override 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)); } } }