private void layoutButtons() { int offset = 0; if (PROPERTIES.get("os.name").equals("macosx")) { if (closeButton != null && closeButton.isVisible()) { closeButton.setLocation(offset, 0); offset += getHeight() + 1; } if (minimizeButton != null && minimizeButton.isVisible()) { minimizeButton.setLocation(offset, 0); offset += getHeight() + 1; } if (restoreButton != null && restoreButton.isVisible()) { restoreButton.setLocation(offset, 0); offset += getHeight() + 1; } } else { if (closeButton != null && closeButton.isVisible()) { closeButton.setLocation(getWidth() - closeButton.getSize().x - offset, 0); offset += getHeight() + 1 + closeButton.getSize().x; } if (restoreButton != null && restoreButton.isVisible()) { restoreButton.setLocation(getWidth() - offset, 0); offset += getHeight() + 1; } if (minimizeButton != null && minimizeButton.isVisible()) { minimizeButton.setLocation(getWidth() - offset, 0); offset += getHeight() + 1; } } }
/** /!\ Public for test purpose */ public void validate() { // if runtime is selected other than NO RUNTIME if (getSelectedRuntime() != null) { // determine the camel version of that runtime String runtimeCamelVersion = determineRuntimeCamelVersion(getSelectedRuntime()); if (UNKNOWN_CAMEL_VERSION.equals(runtimeCamelVersion)) { if (!Widgets.isDisposed(camelVersionCombo)) { camelVersionCombo.setEnabled(true); } camelInfoText.setText( Messages .FuseIntegrationProjectWizardRuntimeAndCamelPage_WarningMessageWhenCamelVersionCannotBeDeterminedInRuntime); } else { // and compare if selected camel version fits that version if (!isCompatible(runtimeCamelVersion, getSelectedCamelVersion())) { // Display warning and suggest the correct version camelInfoText.setText( NLS.bind( Messages.newProjectWizardRuntimePageCamelVersionsDontMatchWarning, runtimeCamelVersion)); } else { camelInfoText.setText(""); // $NON-NLS-1$ } if (!Widgets.isDisposed(camelVersionCombo)) { camelVersionCombo.setEnabled(false); } } } else { if (!Widgets.isDisposed(camelVersionCombo)) { camelVersionCombo.setEnabled(true); } if (!Widgets.isDisposed(camelInfoText)) { camelInfoText.setText(""); // $NON-NLS-1$ } } // TODO: leaving that out until we decide to support other camel versions than the ones we ship // try { // getWizard().getContainer().run(false, false, new IRunnableWithProgress() { // @Override // public void run(IProgressMonitor monitor) throws InvocationTargetException, // InterruptedException { // monitor.beginTask(Messages.newProjectWizardRuntimePageResolveDependencyStatus, // IProgressMonitor.UNKNOWN); // validateCamelVersion(); // monitor.done(); // } // }); // } catch (Exception ex) { // ProjectTemplatesActivator.pluginLog().logError(ex); // } if (!Widgets.isDisposed(warningIconLabel) && !Widgets.isDisposed(camelInfoText)) { warningIconLabel.setVisible(!camelInfoText.getText().isEmpty()); } if (!Widgets.isDisposed(runtimeComboViewer) && !Widgets.isDisposed(camelVersionCombo)) { setPageComplete( !Strings.isBlank(runtimeComboViewer.getSelection().toString()) && !Strings.isBlank(camelVersionCombo.getText()) && !warningIconLabel.isVisible()); } }