[jbosstools-issues] [JBoss JIRA] (JBIDE-14667) OpenShift Explorer: dont do any remoting (or any long running tasks) in Action#validate

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Tue May 28 09:33:06 EDT 2013


    [ https://issues.jboss.org/browse/JBIDE-14667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777410#comment-12777410 ] 

Andre Dietisheim commented on JBIDE-14667:
------------------------------------------

I removed the #validate method since it

1) ensures there are no long-running tasks in it
2) it'll make migration to commands easier 
                
> OpenShift Explorer: dont do any remoting (or any long running tasks) in Action#validate
> ---------------------------------------------------------------------------------------
>
>                 Key: JBIDE-14667
>                 URL: https://issues.jboss.org/browse/JBIDE-14667
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: openshift
>    Affects Versions: 4.1.0.Beta1
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>             Fix For: 4.1.0.Beta2
>
>
> The OpenShift Explorer was developed using jface actions (we'll replace those with commands when the workload is lower). In those actions a base class offers #validate to execute basic enablement tasks etc.
> #validate is executed whenever a context-menu - that contains those actions - is about to pop up. Thus #validate should not do any long running tasks since they would potentially block the UI.
> example of bad code:
> Another issue is the validation in the various Actions of the OpenShift Explorer. The above stack-trace shows that the error is caused by DeleteDomainAction#validate:
> {code}
> at org.jboss.tools.openshift.express.internal.ui.action.DeleteDomainAction.validate(DeleteDomainAction.java:47)
> {code}
> {code:title=DeleteDomainAction} 
> @Override
> public void validate() {
> 	boolean enable = false;
> 	final Connection connection = UIUtils.getFirstElement(getSelection(), Connection.class);
> 	if (connection != null) {
> 		if (connection.isConnected()) {
> 			try {
> 				if (connection.getDefaultDomain() != null) {
> 					enable = true;
> 				}
> 			} catch (OpenShiftException e) {
> 				Logger.warn("Failed to retrieve User domain, prompting for creation", e);
> 			}
> 		}
> 	}
> 	setEnabled(enable);
> }
> {code}
> Validate should not do long-running taks, should not do remoting like the one here. 
> We should review all actions to NOT do remoting (above: connection.getDefaultDomain()). They should all fail lenient:
> Stay enabled even though eventually not possible (ex. there's no domain) and fail when executed: "no domain present, cannot delete".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list