下面列出了怎么用org.eclipse.ui.IActionBars的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void fillActionBars(IActionBars theActionBars) {
if (!contribute) {
return;
}
openFileAction.setContext(getContext());
OpenAction customOpenAction = createCustomOpenAction();
if (openFileAction.getOpenAction().isEnabled()) {
theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
customOpenAction);
} else if (UIDArtifactFilters
.isUIDArtifact(((IStructuredSelection) getContext().getSelection()).getFirstElement())) {
theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
customOpenAction);
}
}
private void fillActionBars() {
IActionBars actionBars = getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fRefreshSingleElementAction);
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), fRemoveFromViewAction);
IToolBarManager toolBar = actionBars.getToolBarManager();
fActionGroups.fillActionBars(actionBars);
toolBar.add(fRefreshViewAction);
toolBar.add(fCancelSearchAction);
for (int i = 0; i < fToggleCallModeActions.length; i++) {
toolBar.add(fToggleCallModeActions[i]);
}
toolBar.add(fHistoryDropDownAction);
toolBar.add(fPinViewAction);
}
/**
* This accesses a cached version of the property sheet.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public IPropertySheetPage getPropertySheetPage() {
PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage(editingDomain) {
@Override
public void setSelectionToViewer(List<?> selection) {
GenconfEditor.this.setSelectionToViewer(selection);
GenconfEditor.this.setFocus();
}
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this, actionBars);
}
};
propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
propertySheetPages.add(propertySheetPage);
return propertySheetPage;
}
@Override
public void setActionBars(IActionBars actionBars) {
// pin action
pinAction = new PinAction();
pinAction.setText("Pin");
pinAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.PIN));
actionBars.getToolBarManager().add(pinAction);
CreateFeatureStructrueValue createAction = new CreateFeatureStructrueValue();
createAction.setImageDescriptor(CasEditorPlugin.getTaeImageDescriptor(Images.ADD));
actionBars.getToolBarManager().add(createAction);
// TODO: setActionBars is depreciated, but registration of change listener
// does not work in init method
getSite().getSelectionProvider().addSelectionChangedListener(createAction);
// delete action
DeleteFeatureStructureValue deleteAction = new DeleteFeatureStructureValue();
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
getSite().getSelectionProvider().addSelectionChangedListener(deleteAction);
actionBars.getToolBarManager().add(
ActionFactory.DELETE.create(getSite().getWorkbenchWindow()));
}
/**
* This accesses a cached version of the property sheet.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IPropertySheetPage getPropertySheetPage ()
{
PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage ( editingDomain, ExtendedPropertySheetPage.Decoration.MANUAL) {
@Override
public void setSelectionToViewer ( List<?> selection )
{
OsgiEditor.this.setSelectionToViewer ( selection );
OsgiEditor.this.setFocus ();
}
@Override
public void setActionBars ( IActionBars actionBars )
{
super.setActionBars ( actionBars );
getActionBarContributor ().shareGlobalActions ( this, actionBars );
}
};
propertySheetPage.setPropertySourceProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
propertySheetPages.add ( propertySheetPage );
return propertySheetPage;
}
/**
* This accesses a cached version of the property sheet.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IPropertySheetPage getPropertySheetPage() {
PropertySheetPage propertySheetPage =
new ExtendedPropertySheetPage(editingDomain) {
@Override
public void setSelectionToViewer(List<?> selection) {
EipEditor.this.setSelectionToViewer(selection);
EipEditor.this.setFocus();
}
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this, actionBars);
}
};
propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
propertySheetPages.add(propertySheetPage);
return propertySheetPage;
}
/**
* This accesses a cached version of the property sheet.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IPropertySheetPage getPropertySheetPage ()
{
PropertySheetPage propertySheetPage =
new ExtendedPropertySheetPage ( editingDomain )
{
@Override
public void setSelectionToViewer ( List<?> selection )
{
SecurityEditor.this.setSelectionToViewer ( selection );
SecurityEditor.this.setFocus ();
}
@Override
public void setActionBars ( IActionBars actionBars )
{
super.setActionBars ( actionBars );
getActionBarContributor ().shareGlobalActions ( this, actionBars );
}
};
propertySheetPage.setPropertySourceProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
propertySheetPages.add ( propertySheetPage );
return propertySheetPage;
}
/**
* This accesses a cached version of the property sheet.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IPropertySheetPage getPropertySheetPage ()
{
PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage ( editingDomain ) {
@Override
public void setSelectionToViewer ( List<?> selection )
{
GlobalizeEditor.this.setSelectionToViewer ( selection );
GlobalizeEditor.this.setFocus ();
}
@Override
public void setActionBars ( IActionBars actionBars )
{
super.setActionBars ( actionBars );
getActionBarContributor ().shareGlobalActions ( this, actionBars );
}
};
propertySheetPage.setPropertySourceProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
propertySheetPages.add ( propertySheetPage );
return propertySheetPage;
}
private void resetAction(ActionRegistry registry) {
if (getSite() == null) {
return;
}
final IActionBars bars = getSite().getActionBars();
String id = ActionFactory.UNDO.getId();
bars.setGlobalActionHandler(id, registry.getAction(id));
id = ActionFactory.REDO.getId();
bars.setGlobalActionHandler(id, registry.getAction(id));
id = ActionFactory.DELETE.getId();
bars.setGlobalActionHandler(id, registry.getAction(id));
bars.updateActionBars();
}
private static void showMessage(Shell shell, IActionBars actionBars, String msg) {
if (actionBars != null) {
IStatusLineManager statusLine= actionBars.getStatusLineManager();
if (statusLine != null)
statusLine.setMessage(msg);
}
shell.getDisplay().beep();
}
public void fillActionBars(IActionBars actionBars) {
if (hasContributedToViewMenu)
return;
IMenuManager topLevelSubMenu = new MenuManager(
WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Top_Level_Element_);
addActions(topLevelSubMenu);
actionBars.getMenuManager().insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, topLevelSubMenu);
hasContributedToViewMenu = true;
}
private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
// fillLocalPullDown(bars.getMenuManager());
fillLocalToolBar(bars.getToolBarManager());
LapseMultiActionGroup group =
new LapseCheckboxActionGroup(
new IAction[]{
hideSafeAction, hideNoSourceAction, showSQLAction, showXSSAction, showPTAction,showHttpResponseAction,showCommandInjectionAction,showLDAPAction,showXPathAction},
new boolean[]{true, true, false, false, false,false,false,false,false});
group.addActions(bars.getMenuManager());
}
private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
//fillLocalPullDown(bars.getMenuManager());
fillLocalToolBar(bars.getToolBarManager());
fPullDownActions = new LapseLayoutActionGroup(this);
fPullDownActions.fillActionBars(bars);
}
private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
fillLocalToolBar(bars.getToolBarManager());
LapseMultiActionGroup group =
new LapseCheckboxActionGroup(
new IAction[] {hideNonWebAction, hideNoSourceAction},
new boolean[] {true , true});
group.addActions(bars.getMenuManager());
}
/**
* Updates the action bars for this page site.
*/
private void updateActionBars( )
{
IPageSite site = page == null ? null : page.getSite( );
IActionBars actionBars = site == null ? null : site.getActionBars( );
if ( actionBars != null )
{
actionBars.updateActionBars( );
}
}
@Override
public void fillActionBars(final IActionBars actionBars) {
if (inViewPart && canEnableOpenAction()) {
openGroup.fillActionBars(actionBars);
if (openAndExpandAction == null && openGroup.getOpenAction().isEnabled()) {
actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openGroup.getOpenAction());
} else if (openAndExpandAction != null && openAndExpandAction.isEnabled()) {
actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openAndExpandAction);
}
}
}
public void fillActionBars(IActionBars actionBars) {
// renameAction.setTextActionHandler(textActionHandler);
updateActionBars();
actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction);
actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
}
private void createActions() {
IActionBars actionBars = getViewSite().getActionBars();
IToolBarManager toolBarManager = actionBars.getToolBarManager();
openEditorAction = new OpenEditorAction(this);
openEditorAction.setEnabled(false);
toolBarManager.add(openEditorAction);
toolBarManager.add(new DerivedSourceDropDownAction(this));
}
public void unfillActionBars(IActionBars actionBars) {
if (fHasContributedToViewMenu) {
// Create layout sub menu
if (fLayoutSubMenu != null) {
actionBars.getMenuManager().remove(fLayoutSubMenu);
fLayoutSubMenu.dispose();
fLayoutSubMenu= null;
}
fHasContributedToViewMenu = false;
}
}
public void fillActionBars(IActionBars actionBars) {
if (!contributedToViewMenu) {
try {
super.fillActionBars(actionBars);
workingSetActionGroup.fillActionBars(actionBars);
if (workingSetRootModeActionGroup != null) {
workingSetRootModeActionGroup.fillActionBars(actionBars);
}
} finally {
contributedToViewMenu = true;
}
}
}
@Override
public void fillActionBars(final IActionBars theActionBars) {
if (!contribute) { return; }
final IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof WrappedFile) {
openFileAction.selectionChanged(selection);
theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openFileAction);
}
}
@Override
public void fillActionBars(IActionBars actionBars) {
Assert.isNotNull(actionBars);
super.fillActionBars(actionBars);
fActionBars= actionBars;
updateGlobalActionHandlers();
}
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
// Add a tool bar button to display counters data cumulatively
IActionBars bars = getViewSite().getActionBars();
bars.getToolBarManager().appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getCumulativeAction());
}
public void fillActionBars(IActionBars actionBar) {
super.fillActionBars(actionBar);
fReferencesGroup.fillActionBars(actionBar);
// fDeclarationsGroup.fillActionBars(actionBar);
//// fImplementorsGroup.fillActionBars(actionBar);
// fReadAccessGroup.fillActionBars(actionBar);
// fWriteAccessGroup.fillActionBars(actionBar);
// fOccurrencesGroup.fillActionBars(actionBar);
}
@Override
protected void fillToolbar(IToolBarManager tbm) {
super.fillToolbar(tbm);
IActionBars actionBars = getSite().getActionBars();
if (actionBars != null) {
actionBars.setGlobalActionHandler(CopyQualifiedNameAction.ACTION_HANDLER_ID, getCopyQualifiedNameAction());
}
if (getLayout() != FLAG_LAYOUT_FLAT)
addGroupActions(tbm);
}
public void fillActionBars(IActionBars actionBars) {
super.fillActionBars(actionBars);
if (fGroups == null)
return;
for (int i= 0; i < fGroups.length; i++) {
fGroups[i].fillActionBars(actionBars);
}
}
public void fillActionBars(IActionBars theActionBars) {
if (!contribute) {
return;
}
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof IFile) {
openFileAction.selectionChanged(selection);
theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openFileAction);
}
}
@Override
public void fillActionBars(IActionBars actionBars) {
super.fillActionBars(actionBars);
setGlobalActionHandlers(actionBars);
fillToolBar(actionBars.getToolBarManager());
fillViewMenu(actionBars.getMenuManager());
}
@Override
public void fillActionBars(IActionBars actionBars) {
IToolBarManager tbm = actionBars.getToolBarManager();
for (IAdaptable.Bound<IViewer> va : getContributions()) {
if (va instanceof IAction) {
tbm.add((IAction) va);
} else if (va instanceof IContributionItem) {
tbm.add((IContributionItem) va);
}
}
}
@Override
public void fillActionBars(IActionBars actionBars) {
IMenuManager viewMenu = actionBars.getMenuManager();
ICommonActionExtensionSite site = getActionSite();
IContributionItem contributionItem = viewMenu.find(ShowResourcesContribution.ID);
if (contributionItem != null) {
viewMenu.remove(contributionItem);
}
if (ProjectUtils.isWorkspaceContainsXdsProjects()) {
viewMenu.add(new ShowResourcesContribution(site.getStructuredViewer(), site.getExtensionStateModel()));
}
}