本文整理汇总了Java中org.eclipse.jface.action.IAction.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Java IAction.setChecked方法的具体用法?Java IAction.setChecked怎么用?Java IAction.setChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.action.IAction
的用法示例。
在下文中一共展示了IAction.setChecked方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: togglePausedConsumer
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
protected void togglePausedConsumer(IAction pauseConsumer) {
// The button can get out of sync if two clients are used.
final boolean currentState = queueConnection.isQueuePaused(getSubmissionQueueName());
try {
pauseConsumer.setChecked(!currentState); // We are toggling it.
IPublisher<PauseBean> pauser = service.createPublisher(getUri(), IEventService.CMD_TOPIC);
pauser.setStatusSetName(IEventService.CMD_SET); // The set that other clients may check
pauser.setStatusSetAddRequired(true);
PauseBean pbean = new PauseBean();
pbean.setQueueName(getSubmissionQueueName()); // The queue we are pausing
pbean.setPause(pauseConsumer.isChecked());
pauser.broadcast(pbean);
} catch (Exception e) {
ErrorDialog.openError(getViewSite().getShell(), "Cannot pause queue "+getSubmissionQueueName(), "Cannot pause queue "+getSubmissionQueueName()+"\n\nPlease contact your support representative.",
new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()));
}
pauseConsumer.setChecked(queueConnection.isQueuePaused(getSubmissionQueueName()));
}
示例3: selectionChanged
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof ConnectorTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
action.setChecked(actionModel.isChecked);
}
}
示例4: selectionChanged
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof TransactionTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
action.setChecked(actionModel.isChecked);
}
}
示例5: selectionChanged
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof MobilePageComponentTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
action.setChecked(actionModel.isChecked);
}
}
示例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());
viewer.refresh();
}
};
ret.setImageDescriptor(Activator.getImageDescriptor(icon));
ret.setChecked(Activator.getDefault().getPreferenceStore().getBoolean(preference));
return ret;
}
示例7: 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;
}
示例8: setDynamicMenuOptions
import org.eclipse.jface.action.IAction; //导入方法依赖的package包/类
private void setDynamicMenuOptions(IMenuManager mm) {
mm.add(add);
mm.add(delete);
mm.add(clear);
mm.add(new Separator());
IPointGenerator<?> gen = null;
try {
ISeriesItemDescriptor selected = seriesTable.getSelected();
if (!(selected instanceof GeneratorDescriptor)) return;
gen = ((GeneratorDescriptor)selected).getSeriesObject();
} catch (Exception e1) {
}
final IAction passUnMod = new Action("Enabled", IAction.AS_CHECK_BOX) {
@Override
public void run() {
ISeriesItemDescriptor current = seriesTable.getSelected();
if (current instanceof GeneratorDescriptor) {
try {
((GeneratorDescriptor)current).getSeriesObject().setEnabled(isChecked());
seriesTable.refreshTable();
} catch (Exception e) {
logger.error("Problem refreshing series table!", e);
}
}
}
};
if (gen != null && !gen.isEnabled()) passUnMod.setChecked(true);
mm.add(passUnMod);
}
示例9: 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;
}
示例10: 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());
}
}