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

Adding the runtime detection path manually

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 4.0.0.Beta1
    • 4.0.0.Alpha2
    • runtime-detection
    • None

      While writing my bot tests I need to add a runtime detection path manually (because there's a native window that cannot be operated by bot). There are some issues that I've come across. I am not sure if those are really issues or are intended so I am describing them here:

      I add the path through the following code while the preferences dialog is open:

      RuntimeUIActivator.getDefault().getModel().addRuntimePath(new RuntimePath(path));
      

      However, the path is not added to the table, maybe because the table viewer in RuntimePreferencePage is not refreshed:

      runtimePathChangeListener = new IRuntimePathChangeListener() {
         public void changed() {
            Display.getDefault().asyncExec(new Runnable() {
               public void run() {
                  if (runtimePathChangeListener != null) {
                     viewer.setInput(RuntimeUIActivator.getRuntimePaths());
                  }
      	}
            });
         }
      };
      RuntimeUIActivator.getDefault().getModel().addRuntimePathChangeListener(runtimePathChangeListener);
      

      There used to be a workaround for this - to close the preferences and open it again. However, when I click the OK button, all runtime paths are taken from the table (not from the model) and stored to the preferences store - since the table has not been refreshed the table is empty and an empty list is stored.

      @Override
      public boolean performOk() {
         RuntimeUIActivator.getDefault().getModel().setRuntimePaths(runtimePaths);
         RuntimeUIActivator.getDefault().saveRuntimePreferences();
         return super.performOk();
      }
      

      This is even different behavior to the performApply method (I think those methods should have the same result). In this method the paths from model are stored to the preferences store.

      @Override
      protected void performApply() {
         RuntimeUIActivator.getDefault().saveRuntimePreferences();
      }
      

            snjeza_jira Snjezana Peco (Inactive)
            ljelinko@redhat.com Lucia Jelinkova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: