org.eclipse.ui.actions.RetargetAction Java Examples
The following examples show how to use
org.eclipse.ui.actions.RetargetAction.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicCompilationUnitEditorActionContributor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public BasicCompilationUnitEditorActionContributor() { fRetargetContentAssist= new RetargetAction(JdtActionConstants.CONTENT_ASSIST, JavaEditorMessages.ContentAssistProposal_label); fRetargetContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fRetargetContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fRetargetContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); markAsPartListener(fRetargetContentAssist); fContentAssist= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistProposal."); //$NON-NLS-1$ fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); fContextInformation= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistContextInformation."); //$NON-NLS-1$ fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); fQuickAssistAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "CorrectionAssistProposal."); //$NON-NLS-1$ fQuickAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST); fChangeEncodingAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "Editor.ChangeEncodingAction."); //$NON-NLS-1$ }
Example #2
Source File: OccurrencesSearchMenuAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * {@inheritDoc} */ public void init(IWorkbenchWindow window) { disposeSubmenuActions(); // paranoia code: double initialization should not happen if (window != null) { fPartService= window.getPartService(); if (fPartService != null) { fRetargetActions= new RetargetAction[] { createSubmenuAction(fPartService, JdtActionConstants.FIND_OCCURRENCES_IN_FILE, ActionMessages.OccurrencesSearchMenuAction_occurrences_in_file_label, IJavaEditorActionDefinitionIds.SEARCH_OCCURRENCES_IN_FILE), createSubmenuAction(fPartService, JdtActionConstants.FIND_IMPLEMENT_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_implementing_methods_label, IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENT_OCCURRENCES_IN_FILE), createSubmenuAction(fPartService, JdtActionConstants.FIND_EXCEPTION_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_throwing_exception_label, IJavaEditorActionDefinitionIds.SEARCH_EXCEPTION_OCCURRENCES_IN_FILE), createSubmenuAction(fPartService, JdtActionConstants.FIND_METHOD_EXIT_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_method_exits_label, IJavaEditorActionDefinitionIds.SEARCH_METHOD_EXIT_OCCURRENCES), createSubmenuAction(fPartService, JdtActionConstants.FIND_BREAK_CONTINUE_TARGET_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_break_continue_target_label, IJavaEditorActionDefinitionIds.SEARCH_BREAK_CONTINUE_TARGET_OCCURRENCES) }; } } }
Example #3
Source File: OccurrencesSearchMenuAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void updateActions() { IWorkbenchPart activePart= JavaPlugin.getActivePage().getActivePart(); if (!(activePart instanceof JavaEditor)) return; ISelection javaSelection= getEditorSelection((JavaEditor) activePart); if (javaSelection == null) return; for (int i= 0; i < fRetargetActions.length; i++) { RetargetAction action= fRetargetActions[i]; IAction actionHandler= action.getActionHandler(); if (actionHandler instanceof SelectionDispatchAction) { ((SelectionDispatchAction) actionHandler).update(javaSelection); } } }
Example #4
Source File: ERDiagramActionBarContributor.java From ermasterr with Apache License 2.0 | 5 votes |
public void initRetargetActions(final EditorPart newEditor) { final Iterator iter = getActionRegistry().getActions(); while (iter.hasNext()) { final IAction action = (IAction) iter.next(); if (action instanceof RetargetAction) { ((RetargetAction) action).partActivated(newEditor); } } }
Example #5
Source File: BasicJavaEditorActionContributor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void init(IActionBars bars, IWorkbenchPage page) { fToggleBreadcrumbAction= new ToggleBreadcrumbAction(page); Iterator<RetargetAction> e= fPartListeners.iterator(); while (e.hasNext()) page.addPartListener(e.next()); super.init(bars, page); bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation); bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_MARK_OCCURRENCES, fToggleMarkOccurrencesAction); bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_BREADCRUMB, fToggleBreadcrumbAction); }
Example #6
Source File: BasicJavaEditorActionContributor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void dispose() { Iterator<RetargetAction> e= fPartListeners.iterator(); while (e.hasNext()) getPage().removePartListener(e.next()); fPartListeners.clear(); setActiveEditor(null); fToggleBreadcrumbAction.dispose(); super.dispose(); }
Example #7
Source File: OccurrencesSearchMenuAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private RetargetAction createSubmenuAction(IPartService partService, String actionID, String text, String actionDefinitionId) { RetargetAction action= new RetargetAction(actionID, text); action.setActionDefinitionId(actionDefinitionId); partService.addPartListener(action); IWorkbenchPart activePart = partService.getActivePart(); if (activePart != null) { action.partActivated(activePart); } return action; }
Example #8
Source File: DesignerActionBarContributor.java From birt with Eclipse Public License 1.0 | 5 votes |
private void updateDynamicItems( String actionId, IMenuManager menu ) { RetargetAction action = (RetargetAction) getAction( actionId ); if ( action != null && action.getActionHandler( ) instanceof MenuUpdateAction ) { ( (MenuUpdateAction) action.getActionHandler( ) ).updateMenu( (MenuManager) menu ); } }
Example #9
Source File: DesignerActionBarContributor.java From birt with Eclipse Public License 1.0 | 5 votes |
private void updateInsertGroupMenu( String actionId, IMenuManager menu ) { RetargetAction action = (RetargetAction) getAction( actionId ); if ( action != null && action.getActionHandler( ) instanceof InsertGroupMenuAction ) { ( (InsertGroupMenuAction) action.getActionHandler( ) ).updateMenu( (MenuManager) menu ); } }
Example #10
Source File: DesignerActionBarContributor.java From birt with Eclipse Public License 1.0 | 5 votes |
private void updateEditMenu( IContributionManager menubar ) { IContributionItem editMenu = menubar.find( IWorkbenchActionConstants.M_EDIT ); if ( editMenu instanceof IMenuManager ) { ( (IMenuManager) editMenu ).addMenuListener( new IMenuListener( ) { public void menuAboutToShow( IMenuManager manager ) { refreshUpdateAction( ActionFactory.CUT.getId( ) ); refreshUpdateAction( ActionFactory.COPY.getId( ) ); refreshUpdateAction( ActionFactory.PASTE.getId( ) ); refreshUpdateAction( ActionFactory.DELETE.getId( ) ); } private void refreshUpdateAction( String actionId ) { if ( getActionRegistry( ) != null ) { RetargetAction action = (RetargetAction) getAction( actionId ); if ( action != null && action.getActionHandler( ) != null && action.getActionHandler( ) instanceof UpdateAction ) { ( (UpdateAction) action.getActionHandler( ) ).update( ); } } } } ); } }
Example #11
Source File: ERDiagramActionBarContributor.java From ermasterr with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void buildActions() { addRetargetAction(new RetargetAction(ActionFactory.SELECT_ALL.getId(), "selectAll")); addRetargetAction(new RetargetAction(ActionFactory.PRINT.getId(), "print")); addRetargetAction(new DeleteRetargetAction()); addRetargetAction(new RetargetAction(ActionFactory.COPY.getId(), "copy")); addRetargetAction(new RetargetAction(ActionFactory.PASTE.getId(), "paste")); addRetargetAction(new UndoRetargetAction()); addRetargetAction(new RedoRetargetAction()); final ZoomInRetargetAction zoomInAction = new ZoomInRetargetAction(); zoomInAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ZOOM_IN)); final ZoomOutRetargetAction zoomOutAction = new ZoomOutRetargetAction(); zoomOutAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ZOOM_OUT)); addRetargetAction(zoomInAction); addRetargetAction(zoomOutAction); addRetargetAction(new ZoomAdjustRetargetAction()); final RetargetAction gridAction = new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, ResourceString.getResourceString("action.title.grid"), IAction.AS_CHECK_BOX); gridAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.GRID)); addRetargetAction(gridAction); final RetargetAction gridSnapAction = new RetargetAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, ResourceString.getResourceString("action.title.grid.snap"), IAction.AS_CHECK_BOX); gridSnapAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.GRID_SNAP)); addRetargetAction(gridSnapAction); final RetargetAction tooltipAction = new RetargetAction(TooltipAction.ID, ResourceString.getResourceString("action.title.tooltip"), IAction.AS_CHECK_BOX); tooltipAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.TOOLTIP)); addRetargetAction(tooltipAction); final RetargetAction lockEditAction = new RetargetAction(LockEditAction.ID, ResourceString.getResourceString("action.title.lock.edit"), IAction.AS_CHECK_BOX); lockEditAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.LOCK_EDIT)); addRetargetAction(lockEditAction); addRetargetAction(new ExportToDBRetargetAction()); final AlignmentRetargetAction alignLeftAction = new AlignmentRetargetAction(PositionConstants.LEFT); alignLeftAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_LEFT)); alignLeftAction.setDisabledImageDescriptor(null); addRetargetAction(alignLeftAction); final AlignmentRetargetAction alignCenterAction = new AlignmentRetargetAction(PositionConstants.CENTER); alignCenterAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_CENTER)); alignCenterAction.setDisabledImageDescriptor(null); addRetargetAction(alignCenterAction); final AlignmentRetargetAction alignRightAction = new AlignmentRetargetAction(PositionConstants.RIGHT); alignRightAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_RIGHT)); alignRightAction.setDisabledImageDescriptor(null); addRetargetAction(alignRightAction); final AlignmentRetargetAction alignTopAction = new AlignmentRetargetAction(PositionConstants.TOP); alignTopAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_TOP)); alignTopAction.setDisabledImageDescriptor(null); addRetargetAction(alignTopAction); final AlignmentRetargetAction alignMiddleAction = new AlignmentRetargetAction(PositionConstants.MIDDLE); alignMiddleAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_MIDDLE)); alignMiddleAction.setDisabledImageDescriptor(null); addRetargetAction(alignMiddleAction); final AlignmentRetargetAction alignBottomAction = new AlignmentRetargetAction(PositionConstants.BOTTOM); alignBottomAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.ALIGN_BOTTOM)); alignBottomAction.setDisabledImageDescriptor(null); addRetargetAction(alignBottomAction); final MatchWidthRetargetAction matchWidthAction = new MatchWidthRetargetAction(); matchWidthAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.MATCH_WIDTH)); matchWidthAction.setDisabledImageDescriptor(null); addRetargetAction(matchWidthAction); final MatchHeightRetargetAction matchHeightAction = new MatchHeightRetargetAction(); matchHeightAction.setImageDescriptor(ERDiagramActivator.getImageDescriptor(ImageKey.MATCH_HEIGHT)); matchHeightAction.setDisabledImageDescriptor(null); addRetargetAction(matchHeightAction); addRetargetAction(new HorizontalLineRetargetAction()); addRetargetAction(new VerticalLineRetargetAction()); addRetargetAction(new ChangeBackgroundColorRetargetAction()); }
Example #12
Source File: ERDiagramActionBarContributor.java From erflute with Apache License 2.0 | 4 votes |
@Override protected void buildActions() { addRetargetAction(new RetargetAction(ActionFactory.SELECT_ALL.getId(), "selectAll")); addRetargetAction(new RetargetAction(ActionFactory.PRINT.getId(), "print")); addRetargetAction(new DeleteRetargetAction()); addRetargetAction(new RetargetAction(ActionFactory.COPY.getId(), "copy")); addRetargetAction(new RetargetAction(ActionFactory.PASTE.getId(), "paste")); addRetargetAction(new UndoRetargetAction()); addRetargetAction(new RedoRetargetAction()); final ZoomInRetargetAction zoomInAction = new ZoomInRetargetAction(); zoomInAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ZOOM_IN)); final ZoomOutRetargetAction zoomOutAction = new ZoomOutRetargetAction(); zoomOutAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ZOOM_OUT)); addRetargetAction(zoomInAction); addRetargetAction(zoomOutAction); addRetargetAction(new ZoomAdjustRetargetAction()); final RetargetAction gridAction = new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, DisplayMessages.getMessage("action.title.grid"), IAction.AS_CHECK_BOX); gridAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.GRID)); addRetargetAction(gridAction); final RetargetAction tooltipAction = new RetargetAction(ToggleMainColumnAction.ID, DisplayMessages.getMessage("action.title.tooltip"), IAction.AS_CHECK_BOX); tooltipAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.TOOLTIP)); addRetargetAction(tooltipAction); final RetargetAction toggleMainColumnAction = new RetargetAction(ToggleMainColumnAction.ID, DisplayMessages.getMessage("action.title.mainColumn"), IAction.AS_CHECK_BOX); toggleMainColumnAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.MAIN_COLUMN)); addRetargetAction(toggleMainColumnAction); final RetargetAction exportDdlAction = new RetargetAction(ExportToDDLAction.ID, DisplayMessages.getMessage("dialog.title.export.ddl"), IAction.AS_CHECK_BOX); exportDdlAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.EXPORT_DDL)); addRetargetAction(exportDdlAction); final RetargetAction lockEditAction = new RetargetAction(LockEditAction.ID, DisplayMessages.getMessage("action.title.lock.edit"), IAction.AS_CHECK_BOX); lockEditAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.LOCK_EDIT)); addRetargetAction(lockEditAction); addRetargetAction(new ExportToDBRetargetAction()); final AlignmentRetargetAction alignLeftAction = new AlignmentRetargetAction(PositionConstants.LEFT); alignLeftAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_LEFT)); alignLeftAction.setDisabledImageDescriptor(null); addRetargetAction(alignLeftAction); final AlignmentRetargetAction alignCenterAction = new AlignmentRetargetAction(PositionConstants.CENTER); alignCenterAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_CENTER)); alignCenterAction.setDisabledImageDescriptor(null); addRetargetAction(alignCenterAction); final AlignmentRetargetAction alignRightAction = new AlignmentRetargetAction(PositionConstants.RIGHT); alignRightAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_RIGHT)); alignRightAction.setDisabledImageDescriptor(null); addRetargetAction(alignRightAction); final AlignmentRetargetAction alignTopAction = new AlignmentRetargetAction(PositionConstants.TOP); alignTopAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_TOP)); alignTopAction.setDisabledImageDescriptor(null); addRetargetAction(alignTopAction); final AlignmentRetargetAction alignMiddleAction = new AlignmentRetargetAction(PositionConstants.MIDDLE); alignMiddleAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_MIDDLE)); alignMiddleAction.setDisabledImageDescriptor(null); addRetargetAction(alignMiddleAction); final AlignmentRetargetAction alignBottomAction = new AlignmentRetargetAction(PositionConstants.BOTTOM); alignBottomAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.ALIGN_BOTTOM)); alignBottomAction.setDisabledImageDescriptor(null); addRetargetAction(alignBottomAction); final MatchWidthRetargetAction matchWidthAction = new MatchWidthRetargetAction(); matchWidthAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.MATCH_WIDTH)); matchWidthAction.setDisabledImageDescriptor(null); addRetargetAction(matchWidthAction); final MatchHeightRetargetAction matchHeightAction = new MatchHeightRetargetAction(); matchHeightAction.setImageDescriptor(Activator.getImageDescriptor(ImageKey.MATCH_HEIGHT)); matchHeightAction.setDisabledImageDescriptor(null); addRetargetAction(matchHeightAction); addRetargetAction(new HorizontalLineRetargetAction()); addRetargetAction(new VerticalLineRetargetAction()); addRetargetAction(new ChangeBackgroundColorRetargetAction()); }
Example #13
Source File: BasicJavaEditorActionContributor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected final void markAsPartListener(RetargetAction action) { fPartListeners.add(action); }
Example #14
Source File: DesignerActionBarContributor.java From birt with Eclipse Public License 1.0 | 4 votes |
protected void buildActions( ) { if ( isBuilt ) return; isBuilt = true; addRetargetAction( new UndoRetargetAction( ) ); addRetargetAction( new RedoRetargetAction( ) ); addRetargetAction( new DeleteRetargetAction( ) ); addRetargetAction( new ZoomInRetargetAction( ) ); addRetargetAction( new ZoomOutRetargetAction( ) ); addRetargetAction( new RetargetAction( ActionFactory.CUT.getId( ), null ) ); addRetargetAction( new RetargetAction( ActionFactory.COPY.getId( ), null ) ); addRetargetAction( new RetargetAction( ActionFactory.PASTE.getId( ), null ) ); addRetargetAction( new RetargetAction( ImportCSSStyleAction.ID, ImportCSSStyleAction.ACTION_TEXT ) ); addRetargetAction( new RetargetAction( AddStyleAction.ID, Messages.getString( "DesignerActionBarContributor.style.new" ) ) ); //$NON-NLS-1$ addRetargetAction( new RetargetAction( ApplyStyleMenuAction.ID, null ) ); addRetargetAction( new RetargetAction( EditStyleMenuAction.ID, null ) ); addRetargetAction( new RetargetAction( DeleteStyleMenuAction.ID, null ) ); addRetargetAction( new RetargetAction( EditGroupMenuAction.ID, null ) ); addRetargetAction( new RetargetAction( InsertGroupMenuAction.ID, null ) ); registerActions( new RegisterAction[]{ new RegisterAction( GEFActionConstants.TOGGLE_RULER_VISIBILITY, Messages.getString( "DesignerActionBarContributor.menu.element-showRuler" ), //$NON-NLS-1$ IAction.AS_CHECK_BOX ) } ); registerActions( new RegisterAction[]{ new RegisterAction( ToggleMarginVisibilityAction.ID, ToggleMarginVisibilityAction.LABEL, IAction.AS_CHECK_BOX ) } ); registerActions( getInsertElementActions( ) ); registerActions( elementActions ); addRetargetAction( new RetargetAction( ImportLibraryAction.ID, ImportLibraryAction.ACTION_TEXT ) ); addRetargetAction( new RetargetAction( InsertAggregationAction.ID, InsertAggregationAction.TEXT ) ); addRetargetAction( new RetargetAction( InsertRelativeTimePeriodAction.ID, InsertRelativeTimePeriodAction.TEXT ) ); }
Example #15
Source File: INodeProvider2.java From birt with Eclipse Public License 1.0 | votes |
public RetargetAction[] getRetargetActions( Object object );