@Override public void run(IStructuredSelection selection) { if (fRenameDartElement.isEnabled()) { fRenameDartElement.run(selection); } if (fRenameResource != null && fRenameResource.isEnabled()) { fRenameResource.run(selection); } }
private boolean computeEnabledState() { if (fRenameResource != null) { return fRenameDartElement.isEnabled() || fRenameResource.isEnabled(); } else { return fRenameDartElement.isEnabled(); } }
@Override public void selectionChanged(SelectionChangedEvent event) { fRenameDartElement.selectionChanged(event); if (fRenameResource != null) { fRenameResource.selectionChanged(event); } setEnabled(computeEnabledState()); }
/** * Creates a new <code>RenameAction</code>. The action requires that the selection provided by the * site's selection provider is of type <code> * org.eclipse.jface.viewers.IStructuredSelection</code>. * * @param site the site providing context information for this action */ public RenameAction(IWorkbenchSite site) { super(site); setText(RefactoringMessages.RenameAction_text); fRenameDartElement = new RenameDartElementAction(site); fRenameDartElement.setText(getText()); fRenameResource = new RenameResourceAction(site); fRenameResource.setText(getText()); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, DartHelpContextIds.RENAME_ACTION); }
@Override public void update(ISelection selection) { fRenameDartElement.update(selection); if (fRenameResource != null) { fRenameResource.update(selection); } setEnabled(computeEnabledState()); }