public HydrographCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition,
Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
Assert.isNotNull(replacementString);
Assert.isTrue(replacementOffset >= 0);
Assert.isTrue(replacementLength >= 0);
Assert.isTrue(cursorPosition >= 0);
fReplacementString = replacementString;
fReplacementOffset = replacementOffset;
fReplacementLength = replacementLength;
fCursorPosition = cursorPosition;
fImage = image;
fDisplayString = displayString;
fContextInformation = contextInformation;
fAdditionalProposalInfo = additionalProposalInfo;
}
java类org.eclipse.swt.graphics.Image的实例源码
HydrographCompletionProposal.java 文件源码
项目:Hydrograph
阅读 24
收藏 0
点赞 0
评论 0
N4JSProjectExplorerLabelProvider.java 文件源码
项目:n4js
阅读 31
收藏 0
点赞 0
评论 0
@Override
public Image getImage(final Object element) {
if (element instanceof WorkingSet) {
return decorator.decorateImage(WORKING_SET_IMG, element);
}
// (temporarily) disabled because #isSourceFolder() and #isOutputFolder() obtain a lock on the workspace
// (e.g. they call IResource#exists() on IFolder 'element') and this seems to cause performance issues with
// locks that egit is obtaining for doing cyclic updates (see IDE-2269):
// if (element instanceof IFolder) {
// final IFolder folder = (IFolder) element;
// if (helper.isSourceFolder(folder) || helper.isOutputFolder(folder)) {
// return decorator.decorateImage(SRC_FOLDER_IMG, element);
// }
// }
return delegate.getImage(element);
}
EclipseUtil.java 文件源码
项目:eclipse-bash-editor
阅读 25
收藏 0
点赞 0
评论 0
/**
* Get image by path from image registry. If not already registered a new
* image will be created and registered. If not createable a fallback image
* is used instead
*
* @param path
* @param pluginId
* - plugin id to identify which plugin image should be loaded
* @return image
*/
public static Image getImage(String path, String pluginId) {
ImageRegistry imageRegistry = getImageRegistry();
if (imageRegistry == null) {
return null;
}
Image image = imageRegistry.get(path);
if (image == null) {
ImageDescriptor imageDesc = createImageDescriptor(path, pluginId);
image = imageDesc.createImage();
if (image == null) {
image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
}
imageRegistry.put(path, image);
}
return image;
}
BaseModelLabelProvider.java 文件源码
项目:bdf2
阅读 34
收藏 0
点赞 0
评论 0
public Image getImage(Object objects) {
if (objects == null || objects.equals(StructuredSelection.EMPTY)) {
return null;
}
Object object = ((IStructuredSelection) objects).getFirstElement();
if (object instanceof TableEditPart || object instanceof TableTreeEditPart) {
return Activator.getImage(Activator.IMAGE_TABLE_16);
} else if (object instanceof ColumnEditPart || object instanceof ColumnTreeEditPart) {
return Activator.getImage(Activator.IMAGE_COLUMN_16);
} else if (object instanceof SchemaEditPart || object instanceof SchemaTreeEditPart) {
return Activator.getImage(Activator.IMAGE_SCHEMA_16);
} else if (object instanceof ConnectionEditPart) {
return Activator.getImage(Activator.IMAGE_CONNECTION);
}
return null;
}
StatisticsDialog.java 文件源码
项目:convertigo-eclipse
阅读 28
收藏 0
点赞 0
评论 0
private void addStats() {
for (String key : statsProject.keySet()) {
if (key != project.getName()) {
CLabel title = new CLabel(descriptifRight, SWT.BOLD);
title.setText(key);
title.setImage(new Image(display, getClass()
.getResourceAsStream(
"images/stats_"
+ key.replaceAll(" ", "_")
.toLowerCase() + "_16x16.png")));
title.setBackground(new Color(display, 255, 255, 255));
title.setMargins(10, 10, 0, 0);
FontData[] fd = title.getFont().getFontData();
fd[0].setStyle(SWT.BOLD);
title.setFont(new Font(title.getFont().getDevice(), fd));
CLabel subText = new CLabel(descriptifRight, SWT.NONE);
subText.setText(statsProject.get(key)
.replaceAll("<br/>", "\r\n").replaceAll(" ", " "));
subText.setBackground(new Color(display, 255, 255, 255));
subText.setMargins(30, 0, 0, 0);
}
}
}
PluginDialog.java 文件源码
项目:ide-plugins
阅读 30
收藏 0
点赞 0
评论 0
protected void createTopContent(String title, InputStream imageName) {
Composite top = new Composite(composite, SWT.NONE);
top.setLayout(new GridLayout(2, false));
top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
top.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
final Image image = new Image(top.getDisplay(), imageName);
Image resized = resizeImage(image, 48, 48);
Label labelImage = new Label(top, SWT.CENTER);
labelImage.setImage(resized);
Label label = new Label(top, SWT.NONE);
label.setText(title);
final Font newFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
label.setFont(newFont);
label.setBackground(rowColorSelection);
createLineContent();
top.addDisposeListener(e -> {
newFont.dispose();
resized.dispose();
});
}
ImageRepository.java 文件源码
项目:tap17-muggl-javaee
阅读 26
收藏 0
点赞 0
评论 0
/**
* Private Constructor.
*/
private ImageRepository() {
this.folderImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/Fairytale_folder.png"));
this.moonImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/Nuvola_apps_kmoon.png"));
this.checkImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/400px-P_yes_green.svg.png"));
this.logfileImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/Gartoon-Gedit-icon.png"));
this.helpImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/Nuvola_apps_filetypes.png"));
this.infoImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/Info_icon.png"));
this.refreshImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/Arrow_refresh.png"));
this.editImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/edit16.png"));
this.pushImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/push16.png"));
this.popImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/pop16.png"));
this.emptyImage = new Image(Display.getDefault(),
ImageRepository.class.getResourceAsStream("/images/empty16.png"));
}
ModelFieldLabelProvider.java 文件源码
项目:scanning
阅读 31
收藏 0
点赞 0
评论 0
/**
* The <code>LabelProvider</code> implementation of this
* <code>ILabelProvider</code> method returns <code>null</code>.
* Subclasses may override.
*/
@Override
public Image getImage(Object ofield) {
if (ofield == null) return null;
FieldValue field = (FieldValue)ofield;
Object element = field.get();
if (element instanceof Boolean) {
if (ticked==null) ticked = Activator.getImageDescriptor("icons/ticked.png").createImage();
if (unticked==null) unticked = Activator.getImageDescriptor("icons/unticked.gif").createImage();
Boolean val = (Boolean)element;
return val ? ticked : unticked;
}
return null;
}
DetectorView.java 文件源码
项目:scanning
阅读 32
收藏 0
点赞 0
评论 0
protected Image getIcon(String fullPath) throws IOException {
if (fullPath==null) return defaultIcon;
if ("".equals(fullPath)) return defaultIcon;
try {
if (iconMap.containsKey(fullPath)) return iconMap.get(fullPath);
final String[] sa = fullPath.split("/");
final Bundle bundle = Platform.getBundle(sa[0]);
if (bundle==null) return defaultIcon;
if (bundle!=null) {
Image image = new Image(null, bundle.getResource(sa[1]+"/"+sa[2]).openStream());
iconMap.put(fullPath, image);
}
return iconMap.get(fullPath);
} catch (Exception ne) {
logger.debug("Cannot get icon for "+fullPath, ne);
return defaultIcon;
}
}
SWTResourceManager.java 文件源码
项目:Sensors
阅读 34
收藏 0
点赞 0
评论 0
/**
* Returns an {@link Image} stored in the file at the specified path.
*
* @param path
* the path to the image file
* @return the {@link Image} stored in the file at the specified path
*/
public static Image getImage(String path) {
Image image = m_imageMap.get(path);
if (image == null) {
try {
image = getImage(new FileInputStream(path));
m_imageMap.put(path, image);
} catch (Exception e) {
image = getMissingImage();
m_imageMap.put(path, image);
}
}
return image;
}
ViewDataPreferencesDialog.java 文件源码
项目:Hydrograph
阅读 32
收藏 0
点赞 0
评论 0
private ControlDecoration addDecorator(Control control, String message) {
ControlDecoration txtDecorator = new ControlDecoration(control, SWT.LEFT);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
FieldDecorationRegistry.DEC_ERROR);
Image img = fieldDecoration.getImage();
txtDecorator.setImage(img);
txtDecorator.setDescriptionText(message);
txtDecorator.setMarginWidth(3);
return txtDecorator;
}
NodeImageConfig.java 文件源码
项目:bdf2
阅读 28
收藏 0
点赞 0
评论 0
public Image getSmallImage(){
if(this.customSmallImage==null){
return this.defaultSmallImage;
}else{
return this.customSmallImage;
}
}
SubscriptionManagerUI.java 文件源码
项目:BiglyBT
阅读 29
收藏 0
点赞 0
评论 0
protected Graphic
loadGraphic(
UISWTInstance swt,
String name )
{
Image image = swt.loadImage( "com/biglybt/ui/images/" + name );
Graphic graphic = swt.createGraphic(image );
icon_list.add(image);
return( graphic );
}
SWTResourceManager.java 文件源码
项目:APITools
阅读 32
收藏 0
点赞 0
评论 0
/**
* Returns an {@link Image} stored in the file at the specified path.
*
* @param path
* the path to the image file
* @return the {@link Image} stored in the file at the specified path
*/
public static Image getImage(String path) {
Image image = m_imageMap.get(path);
if (image == null) {
try {
image = getImage(new FileInputStream(path));
m_imageMap.put(path, image);
} catch (Exception e) {
image = getMissingImage();
m_imageMap.put(path, image);
}
}
return image;
}
GHOLD_170_ImageCaching_PluginUITest.java 文件源码
项目:n4js
阅读 30
收藏 0
点赞 0
评论 0
/**
* Checks the indirect {@link Image image} caching.
*/
@Test
public void testIndirectImageCaching() {
final ImageDescriptor desc1 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
final ImageDescriptor desc2 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
final Image img1 = desc1.createImage();
final Image img2 = desc2.createImage();
assertTrue("Expected different reference of images.", img1 != img2);
}
ProjectLabelDecorator.java 文件源码
项目:gw4e.project
阅读 22
收藏 0
点赞 0
评论 0
@Override
public Image decorateImage(Image image, Object element) {
if (image!=null) {
if (element instanceof IProject) {
IProject project = (IProject) element;
boolean b = GW4ENature.hasGW4ENature(project);
if (b) {
DecorationOverlayIcon icon = new DecorationOverlayIcon(image, GW_DESCRIPTOR, IDecoration.TOP_LEFT);
Image ret = (Image)resourceManager.get(icon);
return ret;
}
}
}
return image;
}
XpectLabelProvider.java 文件源码
项目:n4js
阅读 35
收藏 0
点赞 0
评论 0
@Override
public void dispose() {
for (Iterator<Image> i = imageCache.values().iterator(); i.hasNext();) {
i.next().dispose();
}
imageCache.clear();
}
UISWTGraphicImpl.java 文件源码
项目:BiglyBT
阅读 28
收藏 0
点赞 0
评论 0
@Override
public boolean equals(Object obj) {
if (super.equals(obj)) {
return true;
}
if (obj instanceof UISWTGraphic) {
Image img2 = ((UISWTGraphic) obj).getImage();
if (img2 == null) {
return img == null;
}
return img2.equals(img);
}
return false;
}
SWTResourceManager.java 文件源码
项目:APITools
阅读 30
收藏 0
点赞 0
评论 0
/**
* @return the small {@link Image} that can be used as placeholder for missing image.
*/
private static Image getMissingImage() {
Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
//
GC gc = new GC(image);
gc.setBackground(getColor(SWT.COLOR_RED));
gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
gc.dispose();
//
return image;
}
ProjectCompareTree.java 文件源码
项目:n4js
阅读 27
收藏 0
点赞 0
评论 0
@Override
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0) {
final ProjectComparisonEntry entry = (ProjectComparisonEntry) element;
final EObject api = entry.getElementAPI();
if (api != null)
return projectCompareTreeHelper.getImage(api);
}
return null;
}
UISWTGraphicImpl.java 文件源码
项目:BiglyBT
阅读 33
收藏 0
点赞 0
评论 0
@Override
public Image getImage() {
if (img == null || img.isDisposed()) {
return null;
}
try {
img.getDevice();
} catch (Throwable t) {
return null;
}
return img;
}
EnumTable.java 文件源码
项目:openaudible
阅读 28
收藏 0
点赞 0
评论 0
private void layoutColumns() {
columns = getColumnsToDisplay();
tableColumns.clear();
TableColumn cols[] = table.getColumns();
int index = 0;
for (F o : columns) {
TableColumn column;
// Check to see if column already set...
if (cols.length > index) {
column = cols[index];
} else {
column = new TableColumn(table, SWT.LEFT);
column.addSelectionListener(getColumnListener());
}
String n = getColumnName(o);
Image r = getColumnImage(o);
column.setImage(r);
column.setText(n);
column.setWidth(getColumnWidth(o));
column.setData(o);
tableColumns.add(column);
index++;
}
// Make sure we didn't shrink. May not be tested.
while (table.getColumns().length > columns.length) {
table.getColumn(columns.length).dispose(); // last one
}
assert (table.getColumns().length == columns.length);
//
setColumWidths();
}
AbstractExportToSingleFileWizardPage.java 文件源码
项目:n4js
阅读 26
收藏 0
点赞 0
评论 0
/**
* Displays a Yes/No question to the user with the specified message and returns the user's response.
*
* @param message
* the question to ask
* @return <code>true</code> for Yes, and <code>false</code> for No
*/
private boolean queryYesNoQuestion(String message) {
MessageDialog dialog = new MessageDialog(getContainer().getShell(),
IDEWorkbenchMessages.Question,
(Image) null, message, MessageDialog.NONE,
new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
@Override
protected int getShellStyle() {
return super.getShellStyle() | SWT.SHEET;
}
};
return dialog.open() == 0;
}
WorkingSetAdapter.java 文件源码
项目:n4js
阅读 26
收藏 0
点赞 0
评论 0
WorkingSetAdapter(final WorkingSet delegate) {
this.delegate = delegate;
imageDescriptorSupplier = memoize(() -> {
final Image image = WorkingSetAdapter.this.delegate.getWorkingSetManager().getImage().orNull();
if (image != null) {
return ImageDescriptor.createFromImage(image);
}
return null;
});
}
WidgetUtility.java 文件源码
项目:Hydrograph
阅读 28
收藏 0
点赞 0
评论 0
/**
* This Method use to create error message decorator,Its show an error image with message on applied controller field.
* @param control
* @param message
* @return ControlDecoration
*/
public static ControlDecoration addDecorator(Control control,String message){
ControlDecoration txtDecorator = new ControlDecoration(control,SWT.LEFT);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
Image img = fieldDecoration.getImage();
txtDecorator.setImage(img);
txtDecorator.setDescriptionText(message);
return txtDecorator;
}
ImageCanvas.java 文件源码
项目:AppleCommander
阅读 29
收藏 0
点赞 0
评论 0
/**
* Constructor for ImageCanvas.
*/
public ImageCanvas(Composite parent, int style, Image image, Object layoutData) {
super(parent, style | SWT.SHELL_TRIM | SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE);
this.image = image;
setLayoutData(layoutData);
setSize(image.getImageData().width, image.getImageData().height);
addPaintListener(this);
}
TableTreeNodeLabelProvider.java 文件源码
项目:bdf2
阅读 26
收藏 0
点赞 0
评论 0
public Image getImage(Object element) {
TableTreeNode node = (TableTreeNode) element;
if (node.isTable) {
return Activator.getImage(Activator.IMAGE_TABLE);
} else {
return Activator.getImage(Activator.IMAGE_DATABASE_CONNECT);
}
}
GraphList.java 文件源码
项目:n4js
阅读 27
收藏 0
点赞 0
评论 0
@Override
public Image getImage(Object element) {
if (((ListEntry) element).type == GraphType.AST) {
return imageAST;
}
if (((ListEntry) element).type == GraphType.CFG)
return imageCFG;
return null;
}
SaveJobFileBeforeRunDialog.java 文件源码
项目:Hydrograph
阅读 27
收藏 0
点赞 0
评论 0
private Image getSWTImage() {
Shell shell = getShell();
final Display display;
if (shell == null || shell.isDisposed()) {
shell = getParentShell();
}
if (shell == null || shell.isDisposed()) {
display = Display.getCurrent();
// The dialog should be always instantiated in UI thread.
// However it was possible to instantiate it in other threads
// (the code worked in most cases) so the assertion covers
// only the failing scenario. See bug 107082 for details.
Assert.isNotNull(display,
"The dialog should be created in UI thread"); //$NON-NLS-1$
} else {
display = shell.getDisplay();
}
final Image[] image = new Image[1];
display.syncExec(new Runnable() {
public void run() {
image[0] = display.getSystemImage(SWT.ICON_QUESTION);
}
});
return image[0];
}
SWTResourceManager.java 文件源码
项目:AgentWorkbench
阅读 30
收藏 0
点赞 0
评论 0
/**
* Returns an {@link Image} encoded by the specified {@link InputStream}.
*
* @param stream
* the {@link InputStream} encoding the image data
* @return the {@link Image} encoded by the specified input stream
*/
protected static Image getImage(InputStream stream) throws IOException {
try {
Display display = Display.getCurrent();
ImageData data = new ImageData(stream);
if (data.transparentPixel > 0) {
return new Image(display, data, data.getTransparencyMask());
}
return new Image(display, data);
} finally {
stream.close();
}
}