コード例 #1
0
  @Override
  protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
      handleConverterSelection();
      IConvertManagedBuildObject convertBuildObject = null;
      try {
        convertBuildObject =
            (IConvertManagedBuildObject)
                getSelectedConversionElement().createExecutableExtension("class"); // $NON-NLS-1$
      } catch (CoreException e) {
        ManagedBuilderUIPlugin.log(e);
      }
      if (convertBuildObject != null) {
        String fromId = getSelectedConversionElement().getAttribute("fromId"); // $NON-NLS-1$
        String toId = getSelectedConversionElement().getAttribute("toId"); // $NON-NLS-1$

        IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
        if (info != null) {
          IManagedProject managedProject = info.getManagedProject();
          if (managedProject != null) {
            if (convertBuildObject.convert(managedProject, fromId, toId, true) == null) {
              setConversionSuccessful(false);
            } else {
              setConversionSuccessful(true);
            }
          } else {
            setConversionSuccessful(false);
          }
        } else {
          setConversionSuccessful(false);
        }
      } else {
        setConversionSuccessful(false);
      }
    }
    super.buttonPressed(buttonId);
  }
コード例 #2
0
 @Override
 public Preferences getPreferences() {
   return ManagedBuilderUIPlugin.getDefault().getPluginPreferences();
 }