本文整理匯總了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());
}
}