コード例 #1
0
  private void initControls() {

    _switchYardProject =
        SwitchYardProjectManager.instance().getSwitchYardProject(getProject()).createWorkingCopy();
    if (_switchYardProject.needsLoading()) {
      BusyIndicator.showWhile(
          getShell().getDisplay(),
          new Runnable() {
            @Override
            public void run() {
              _switchYardProject.load(new NullProgressMonitor());
            }
          });
    }
    try {
      _ifp = ProjectFacetsManager.create(_switchYardProject.getProject());
      _ifpwc = SharedWorkingCopyManager.getWorkingCopy(_ifp);
      _configuredRuntimes = _ifpwc.getTargetedRuntimes();
    } catch (CoreException e) {
      Activator.getDefault().getLog().log(e.getStatus());
    }

    _settingsGroup.setProject(_ifpwc);

    initTargetRuntime();
    initRuntimeVersion();
    initComponentsTable();

    _useSwitchYardDependencyBOMCheckbox.setSelection(pomUsesSwitchYardBOM());

    String errmsg = null;
    if (!pomDefinesSwitchYardVersion()) {
      _settingsGroup.setRuntimeControlEnablement(false);
    } else if (pomUsesSwitchYardBOM()) {
      if (!isSelectedRuntimeVersion2OrHigher()) {
        // only valid versions with BOM dependency support are 2.0+
        errmsg = Messages.ProjectConfigurationWizardPage_errorMessage_bomRequiresVersion2;
      }
    } else if (!isSelectedConfigurationVersionOkForRuntime()) {
      String configVersion = getMajorMinorFromVersion(getRuntimeVersion().toString());
      errmsg =
          "The Configuration Version must be "
              + configVersion
              + " or lower to work with Library Version "
              + getRuntimeVersion().toString()
              + ".";
    }
    setErrorMessage(errmsg);
    getContainer().updateMessage();
  }
コード例 #2
0
 private void initComponentsTable() {
   _settingsGroup.setCheckedComponents(_switchYardProject.getComponents(), true);
   _settingsGroup
       .getComponentsTable()
       .addCheckStateListener(
           new ICheckStateListener() {
             @Override
             public void checkStateChanged(CheckStateChangedEvent event) {
               if (event.getElement() instanceof ISwitchYardComponentExtension) {
                 if (event.getChecked()) {
                   _switchYardProject.addComponent(
                       (ISwitchYardComponentExtension) event.getElement());
                 } else {
                   _switchYardProject.removeComponent(
                       (ISwitchYardComponentExtension) event.getElement());
                 }
               } else if (event.getElement() instanceof Category) {
                 if (event.getChecked()) {
                   _switchYardProject.addComponents(
                       SwitchYardComponentExtensionManager.instance()
                           .getComponentExtensions((Category) event.getElement()));
                 } else {
                   _switchYardProject.removeComponents(
                       SwitchYardComponentExtensionManager.instance()
                           .getComponentExtensions((Category) event.getElement()));
                 }
               }
             }
           });
 }
コード例 #3
0
  @Override
  public void dispose() {
    if (_switchYardProject != null) {
      _switchYardProject.dispose();
    }

    if (_ifpwc != null) {
      SharedWorkingCopyManager.releaseWorkingCopy(_ifp);
    }

    super.dispose();
  }
コード例 #4
0
 private boolean pomUsesSwitchYardBOM() {
   final MavenProject project = _switchYardProject.getMavenProject();
   DependencyManagement depMgmt = null;
   if (project != null && project.getOriginalModel() != null) {
     final Model originalModel = project.getOriginalModel();
     depMgmt = originalModel.getDependencyManagement();
   } else if (project != null && project.getModel() != null) {
     final Model originalModel = project.getOriginalModel();
     depMgmt = originalModel.getDependencyManagement();
   }
   if (depMgmt != null && !depMgmt.getDependencies().isEmpty()) {
     Iterator<Dependency> depIter = depMgmt.getDependencies().iterator();
     while (depIter.hasNext()) {
       Dependency tempDep = depIter.next();
       if (tempDep.getArtifactId().equals(M2EUtils.SWITCHYARD_BOM_ARTIFACT_ID)) {
         return true;
         //                } else if (tempDep.getArtifactId().equals("fuse-integration-bom")) {
         //                    return true;
       }
     }
   }
   return false;
 }
コード例 #5
0
 private boolean pomDefinesKieVersion() {
   return _switchYardProject.getMavenProject().getProperties().containsKey(M2EUtils.KIE_VERSION);
 }
コード例 #6
0
 private boolean pomDefinesIntegrationVersion() {
   return _switchYardProject
       .getMavenProject()
       .getProperties()
       .containsKey(M2EUtils.INTEGRATION_VERSION);
 }
コード例 #7
0
  private void initRuntimeVersion() {
    ArtifactVersion version = null;
    String versionString = _switchYardProject.getVersion();
    if (versionString != null && versionString.length() > 0) {
      version = new DefaultArtifactVersion(versionString);
    }
    if (version != null) {
      _settingsGroup.getRuntimeVersionsList().setSelection(new StructuredSelection(version), true);
    }
    _settingsGroup
        .getRuntimeVersionsList()
        .getControl()
        .setEnabled(!_switchYardProject.isUsingDependencyManagement());

    boolean integCheckSelected =
        pomDefinesIntegrationVersion() && pomDefinesKieVersion() && pomUsesSwitchYardBOM();
    _settingsGroup.getConfigureIntegrationCheckbox().setSelection(integCheckSelected);

    _settingsGroup
        .getRuntimeVersionsList()
        .addSelectionChangedListener(
            new ISelectionChangedListener() {
              @Override
              public void selectionChanged(SelectionChangedEvent event) {
                ISelection selection = event.getSelection();
                if (selection == null
                    || selection.isEmpty()
                    || !(selection instanceof IStructuredSelection)) {
                  return;
                }
                _switchYardProject.setRuntimeVersion(
                    ((IStructuredSelection) selection).getFirstElement().toString());
              }
            });

    _settingsGroup
        .getIntegrationVersionsList()
        .addSelectionChangedListener(
            new ISelectionChangedListener() {
              @Override
              public void selectionChanged(SelectionChangedEvent event) {
                ISelection selection = event.getSelection();
                if (selection == null
                    || selection.isEmpty()
                    || !(selection instanceof IStructuredSelection)) {
                  return;
                }
                _switchYardProject.setIntegrationVersion(
                    ((IStructuredSelection) selection).getFirstElement().toString());
              }
            });

    _settingsGroup
        .getKieVersionsList()
        .addSelectionChangedListener(
            new ISelectionChangedListener() {
              @Override
              public void selectionChanged(SelectionChangedEvent event) {
                ISelection selection = event.getSelection();
                if (selection == null
                    || selection.isEmpty()
                    || !(selection instanceof IStructuredSelection)) {
                  return;
                }
                _switchYardProject.setKieVersion(
                    ((IStructuredSelection) selection).getFirstElement().toString());
              }
            });
  }