Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-14667

OpenShift Explorer: dont do any remoting (or any long running tasks) in Action#validate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.1.0.Beta2
    • 4.1.0.Beta1
    • openshift
    • None

    Description

      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:

      at org.jboss.tools.openshift.express.internal.ui.action.DeleteDomainAction.validate(DeleteDomainAction.java:47)
      
      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);
      }
      

      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".

      Attachments

        Issue Links

          Activity

            People

              adietish@redhat.com André Dietisheim
              adietish@redhat.com André Dietisheim
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: