當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。