當前位置: 首頁>>代碼示例>>Java>>正文


Java ISharedImages類代碼示例

本文整理匯總了Java中org.eclipse.ui.ISharedImages的典型用法代碼示例。如果您正苦於以下問題:Java ISharedImages類的具體用法?Java ISharedImages怎麽用?Java ISharedImages使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ISharedImages類屬於org.eclipse.ui包,在下文中一共展示了ISharedImages類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getImage

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:27,代碼來源:EclipseUtil.java

示例2: decorate

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
@Override
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IResource) {
        IResource res = (IResource) element;
        IProject proj = res.getProject();
        try {
            if (proj != null && proj.isAccessible() && proj.hasNature(NATURE.ID)) {
                IMarker[] markers = res.findMarkers(MARKER.ERROR, false,
                        IResource.DEPTH_INFINITE);
                if (markers.length > 0) {
                    decoration.addOverlay(PlatformUI.getWorkbench().getSharedImages()
                            .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR));
                }
            }
        } catch (CoreException e) {
            Log.log(e);
        }
    }
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:20,代碼來源:PgDecorator.java

示例3: getTitleImage

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
@Override
public Image getTitleImage() {
    Image image = super.getTitleImage();
    try {
        IEditorInput input = getEditorInput();
        IResource file = ResourceUtil.getResource(input);
        if (input.exists() && file != null
                && file.findMarkers(MARKER.ERROR, false, IResource.DEPTH_ZERO).length > 0) {
            if (errorTitleImage == null) {
                errorTitleImage = new DecorationOverlayIcon(image,
                        PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
                                ISharedImages.IMG_DEC_FIELD_ERROR), IDecoration.BOTTOM_LEFT)
                        .createImage();
            }
            return errorTitleImage;
        }
    } catch (CoreException e) {
        Log.log(e);
    }
    return image;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:22,代碼來源:SQLEditor.java

示例4: getImage

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
@Override
public Image getImage(Object element) {
  if (element instanceof IProject) {
    if (((IProject) element).isOpen()) {
      return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
    } else {
      return PlatformUI.getWorkbench().getSharedImages()
          .getImage(SharedImages.IMG_OBJ_PROJECT_CLOSED);
    }
  } else if (element instanceof IFolder) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
  } else if (element instanceof IFile) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
  } else if (element instanceof IMarker) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OPEN_MARKER);
  }

  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:20,代碼來源:SigTypeLabelProvider.java

示例5: getImage

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
@Override
public Image getImage(final Object element) {
  if (element instanceof IProject) {
    if (((IProject) element).isOpen()) {
      return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
    } else {
      return PlatformUI.getWorkbench().getSharedImages()
          .getImage(SharedImages.IMG_OBJ_PROJECT_CLOSED);
    }
  } else if (element instanceof IFolder) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
  } else if (element instanceof IFile) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
  } else if (element instanceof IMarker) {
    return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OPEN_MARKER);
  }

  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:20,代碼來源:WizardTreeViewLabelProvider.java

示例6: CopyAction

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
public CopyAction(final Display display, final ISelectionProvider selectionProvider) {
  this.display = display;
  this.selectionProvider = selectionProvider;
  setToolTipText("Copy");
  setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
  setDisabledImageDescriptor(PlatformUI
      .getWorkbench()
      .getSharedImages()
      .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
  selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(final SelectionChangedEvent event) {
      setEnabled(!event.getSelection().isEmpty());
    }
  });
  setEnabled(!selectionProvider.getSelection().isEmpty());
}
 
開發者ID:AndreasWBartels,項目名稱:libraries,代碼行數:19,代碼來源:CopyAction.java

示例7: SaveIntersectionGraphmlAction

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
public SaveIntersectionGraphmlAction(
  final IShellProvider shellProvider,
  final ILogger logger,
  final IObjectListModel<IItem> selectedItems,
  final IDependenciesModel dependenciesModel,
  final IBooleanModel enableNormalizeGraphModel) {
  this.shellProvider = shellProvider;
  this.logger = logger;
  this.selectedItems = selectedItems;
  this.dependenciesModel = dependenciesModel;
  this.enableNormalizeGraphModel = enableNormalizeGraphModel;
  setToolTipText("Save projects intersection dependencies as graphml-file");
  setImageDescriptor(PlatformUI
      .getWorkbench()
      .getSharedImages()
      .getImageDescriptor(ISharedImages.IMG_ETOOL_SAVE_EDIT));
}
 
開發者ID:AndreasWBartels,項目名稱:libraries,代碼行數:18,代碼來源:SaveIntersectionGraphmlAction.java

示例8: UpdateDependencyModelAction

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
public UpdateDependencyModelAction(
  final IShellProvider shellProvider,
  final Canceler canceler,
  final ILogger logger,
  final IJavaModel model,
  final IDependenciesModel dependenciesModel,
  final INameHitMaps nameHitMaps) {
  this.logger = logger;
  this.nameHitMaps = nameHitMaps;
  setToolTipText(TOOLTIP_TEXT);
  setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
  this.shellProvider = shellProvider;
  this.canceler = canceler;
  this.model = model;
  this.dependenciesModel = dependenciesModel;
}
 
開發者ID:AndreasWBartels,項目名稱:libraries,代碼行數:17,代碼來源:UpdateDependencyModelAction.java

示例9: getImage

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
/**
 * 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) {
		logWarning("No image registry found!");
		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;
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:28,代碼來源:EclipseUtil.java

示例10: setStatus

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
public void setStatus(final String message, final boolean valid) {
    final Runnable r = new Runnable() {
        @Override
        public void run() {
            if (isDisposed()) {
                return;
            }

            statusMessage = message;

            if (valid) {
                statusImage = null;
            } else {
                statusImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
            }

            refresh();
        }
    };

    if (getDisplay().getThread() == Thread.currentThread()) {
        r.run();
    } else {
        UIHelpers.runOnUIThread(getDisplay(), true, r);
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:27,代碼來源:EditorStatusControl.java

示例11: getImageForWorkItemQueryFolder

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
public static Image getImageForWorkItemQueryFolder(final ImageHelper imageHelper, final QueryFolder queryFolder) {
    /*
     * Deleted item, is not in the tree anymore (has no parent.) The label
     * decorator can call this method during the refresh where we're being
     * removed, thus handle it gracefully.
     */
    if (queryFolder.getParent() == null) {
        return null;
    }

    if (GUID.EMPTY.equals(new GUID(queryFolder.getParent().getID()))) {
        // This is a top level "Team Queries" / "My Queries" folder
        if (queryFolder.isPersonal()) {
            return imageHelper.getImage("images/wit/query_group_my.gif"); //$NON-NLS-1$
        }
        return imageHelper.getImage("images/wit/query_group_team.gif"); //$NON-NLS-1$
    }

    return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:21,代碼來源:WorkItemHelpers.java

示例12: createErrorStatusComposite

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
private Composite createErrorStatusComposite(
    final FormToolkit toolkit,
    final Composite parent,
    final TeamExplorerContext context) {
    final Composite composite = toolkit.createComposite(parent);
    composite.setBackground(parent.getBackground());

    // Form-style border painting not enabled (0 pixel margins OK) because
    // no applicable controls in this composite
    SWTUtil.gridLayout(composite, 1, false, 0, 0);

    errorStatusLabel = toolkit.createLabel(composite, "", SWT.WRAP); //$NON-NLS-1$
    errorStatusLabel.setBackground(parent.getBackground());
    errorStatusLabel.setForeground(parent.getForeground());
    errorStatusLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE));

    GridDataBuilder.newInstance().applyTo(errorStatusLabel);
    return composite;
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:20,代碼來源:TeamExplorerPendingChangesPage.java

示例13: getImage

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
public Image getImage(Object element) {
	final String s;
	switch (((PreviewFile)element).type) {
	case IResource.PROJECT:
		s= SharedImages.IMG_OBJ_PROJECT; break;
	case IResource.FOLDER:
		s= ISharedImages.IMG_OBJ_FOLDER; break;
	default:
		s= ISharedImages.IMG_OBJ_FILE; break;
	}
	final Image baseImage= PlatformUI.getWorkbench().getSharedImages().getImage(s);
	final ImageDescriptor overlay = getOverlay(element);
	if (overlay == null)
		return baseImage;
	try {
              return fImageCache.createImage(new OverlayIcon(baseImage, new ImageDescriptor[] {overlay}, new int[] {OverlayIcon.BOTTOM_RIGHT}, new Point(baseImage.getBounds().width, baseImage.getBounds().height)));
          } catch (Exception e) {
          	SVNUIPlugin.log(e.getMessage());
          }
          return null;
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:22,代碼來源:SVNDecoratorPreferencesPage.java

示例14: createContents

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
public Control createContents(Composite parent) {
	if (getCompareResult() instanceof String) {		
		
		setMessage("Testing");
		
		Composite composite = new Composite(parent, SWT.NULL);
		GridLayout layout = new GridLayout();
		layout.numColumns = 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(GridData.FILL_BOTH));			
		Label iconLabel = new Label(composite, SWT.WRAP);
		iconLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));			
		Label errorLabel = new Label(composite, SWT.WRAP);
		GridData gd = new GridData();
		gd.widthHint = 500;
		errorLabel.setLayoutData(gd);
		errorLabel.setText((String)getCompareResult());
		parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
		composite.setBackground(parent.getBackground());
		errorLabel.setBackground(parent.getBackground());
		iconLabel.setBackground(parent.getBackground());
		return composite;
	}
	return super.createContents(parent);
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:26,代碼來源:SVNAbstractCompareEditorInput.java

示例15: createTerminateAction

import org.eclipse.ui.ISharedImages; //導入依賴的package包/類
private Action createTerminateAction() {
  Action terminate = new Action(Messages.getString("action.stop")) {
    @Override
    public void run() {
      DeployJob job = console.getJob();
      if (job != null) {
        job.cancel();
        update();
      }
    }
  };
  terminate.setToolTipText(Messages.getString("action.stop"));
  terminate.setImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP));
  terminate.setHoverImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP));
  terminate.setDisabledImageDescriptor(getSharedImage(ISharedImages.IMG_ELCL_STOP_DISABLED));
  return terminate;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:18,代碼來源:DeployConsolePageParticipant.java


注:本文中的org.eclipse.ui.ISharedImages類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。