当前位置: 首页>>代码示例>>Java>>正文


Java IAction.setImageDescriptor方法代码示例

本文整理汇总了Java中org.eclipse.jface.action.IAction.setImageDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java IAction.setImageDescriptor方法的具体用法?Java IAction.setImageDescriptor怎么用?Java IAction.setImageDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.action.IAction的用法示例。


在下文中一共展示了IAction.setImageDescriptor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPreferenceAction

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createPreferenceAction(String label, String preference, String icon) {
	IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
		@Override
		public void run() {
			Activator.getDefault().getPreferenceStore().setValue(preference, isChecked());
			try {
				viewer.reset();
			} catch (Exception e) {
				logger.error("Cannot refresh scannable viewer!", e);
			}
		}
	};
	ret.setImageDescriptor(Activator.getImageDescriptor(icon));
	ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
	return ret;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:17,代码来源:MonitorView.java

示例2: buildContextMenu

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
public void buildContextMenu(IMenuManager menu) {
	GEFActionConstants.addStandardActionGroups(menu);

	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionIdConstants.MODIFY_ACTION_ID));

	IAction saveAction = getAction(ActionFactory.SAVE.getId());
	saveAction.setImageDescriptor(Activator.getImageDescriptor(Activator.IMAGE_SAVE));

	menu.appendToGroup(GEFActionConstants.GROUP_SAVE, saveAction);
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, createExportMenuManager());
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.IMPORT_DATABASE_ACTION_ID));
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.CHANGE_DATABASE_ACTION_ID));

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:18,代码来源:DbToolGefEditorContextMenuProvider.java

示例3: createPreferenceAction

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createPreferenceAction(String label, String preference, String icon) {
	IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
		@Override
		public void run() {
			Activator.getDefault().getPreferenceStore().setValue(preference, isChecked());
			viewer.refresh();
		}
	};
	ret.setImageDescriptor(Activator.getImageDescriptor(icon));
	ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
	return ret;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:13,代码来源:DetectorView.java

示例4: createRegionActions

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createRegionActions() {

		final String regionViewName = PlotUtil.getRegionViewName();
		final ToolTip tip = new ToolTip(viewer.getTable().getShell(), SWT.BALLOON);

		MenuAction rois = new MenuAction("Add Region");

		ActionContributionItem menu  = (ActionContributionItem)system.getActionBars().getMenuManager().find(BasePlottingConstants.ADD_REGION);
		IAction        menuAction = (IAction)menu.getAction();

		for (RegionType regionType : regionTypes) {

            IAction action = new Action("Press to click and drag a "+regionType.getName()+" on '"+PlotUtil.getRegionViewName()+"'") {
		@Override
				public void run() {
			try {
						ScanRegions.createRegion(system, regionType, null);
						ViewUtil.showTip(tip, "Click and drag in the '"+regionViewName+"' to create a scan region.");
					} catch (Exception e) {
						logger.error("Unable to create region!", e);
					}
			rois.setSelectedAction(this);
		}
            };

			final ImageDescriptor des = findImageDescriptor(menuAction, regionType.getId());
            action.setImageDescriptor(des);
            rois.add(action);
		}

		rois.setSelectedAction(rois.getAction(0));
		return rois;
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:34,代码来源:ScanRegionView.java

示例5: createButtonAction

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createButtonAction(String propName, String label, String iconPath, DelegatingSelectionProvider prov) {
	IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
		@Override
		public void run() {
			updatePositionSelection(propName, isChecked(), prov);
		}
	};
	ret.setChecked(store.getBoolean(propName));
	ret.setImageDescriptor(Activator.getImageDescriptor(iconPath));
	return ret;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:12,代码来源:ScanView.java

示例6: createPreferenceAction

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private IAction createPreferenceAction(String label, String preference, String icon) {
	IAction ret = new Action(label, IAction.AS_CHECK_BOX) {
		@Override
		public void run() {
			Activator.getDefault().getPreferenceStore().setValue(preference, isChecked());
			updateJob.schedule();
		}
	};
	ret.setImageDescriptor(Activator.getImageDescriptor(icon));
	ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
	return ret;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:13,代码来源:ExecuteView.java

示例7: fillContextMenu

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);

	ActionContributionItem pasteContribution = getPasteContribution(menu.getItems());
	menu.remove(pasteContribution);
	IAction pasteAction = new Action(PASTE_ACTION_TEXT) {
		@Override
		public void run() {
			IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
					.getService(IHandlerService.class);
			try {
				JobCopyParticipant.setCopiedFileList(new ArrayList<>());
				handlerService.executeCommand(PASTE_COMMAND_ID, null);
			} catch (Exception exception) {
				logger.warn("Error while pasting job files :: {}",exception.getMessage());
			}
		}
	};
	pasteAction.setAccelerator(SWT.MOD1 | 'v');
	Bundle bundle = Platform.getBundle(MENU_PLUGIN_NAME);
	URL imagePath = BundleUtility.find(bundle,ImagePathConstant.PASTE_IMAGE_PATH.getValue());
	ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imagePath);
	pasteAction.setImageDescriptor(imageDescriptor);
	menu.insertAfter(COPY_ACTION_ID, pasteAction);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:28,代码来源:CustomEditActionProvider.java

示例8: createConnectionActions

import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private void createConnectionActions() {

		connectors.clear();

		String lastId = Activator.getDefault().getPreferenceStore().getString(DevicePreferenceConstants.STREAM_ID);


		final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.stream");
		for (IConfigurationElement e : eles) {

			CheckableActionGroup group = new CheckableActionGroup();
			try {
				final IStreamConnection<ILazyDataset> connection = (IStreamConnection<ILazyDataset>)e.createExecutableExtension("stream");
				connectors.add(connection);
				connection.setId(e.getAttribute("id"));
				connection.setLabel(e.getAttribute("label"));

				final String iconPath = e.getAttribute("icon");
				ImageDescriptor icon=null;
			if (iconPath!=null) {
				final String   id    = e.getContributor().getName();
				final Bundle   bundle= Platform.getBundle(id);
				final URL      entry = bundle.getEntry(iconPath);
				icon = ImageDescriptor.createFromURL(entry);
			}

			final MenuAction menu = new MenuAction(connection.getLabel());
			final IAction connect = new Action(connection.getLabel(), IAction.AS_CHECK_BOX) {
				@Override
					public void run() {
					connect(connection);
				}
			};
			connect.setImageDescriptor(icon);
			connect.setChecked(lastId!=null && lastId.equals(connection.getId()));
			group.add(connect);
			menu.add(connect);
			menu.setSelectedAction(connect);

			final IAction configure = new Action("Configure...") {
				@Override
					public void run() {
					configure(connection);
				}
			};
			menu.add(configure);

			getViewSite().getActionBars().getToolBarManager().add(menu);

			} catch (Exception ne) {
				logger.error("Problem creating stream connection for "+e, ne);
			}

			getViewSite().getActionBars().getToolBarManager().add(new Separator());
		}

	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:58,代码来源:StreamView.java


注:本文中的org.eclipse.jface.action.IAction.setImageDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。