Ejemplo n.º 1
0
  public IStatus buildLanguage(
      IProject project,
      IFile langFile,
      Map<String, String> overrideProperties,
      IProgressMonitor monitor) {
    SDKHelper antHelper = new SDKHelper(this, monitor);

    try {
      Map<String, String> properties = new HashMap<String, String>();

      if (overrideProperties != null) {
        properties.putAll(overrideProperties);
      }

      String langDirLocation = langFile.getParent().getRawLocation().toOSString();

      String langFileName = langFile.getFullPath().removeFileExtension().lastSegment();

      properties.put(ISDKConstants.PROPERTY_LANG_DIR, langDirLocation);
      properties.put(ISDKConstants.PROPERTY_LANG_FILE, langFileName);

      final IPath buildFile = project.getFile(ISDKConstants.PROJECT_BUILD_XML).getRawLocation();

      final String workingDir = getDefaultWorkingDir(buildFile);

      antHelper.runTarget(
          buildFile, ISDKConstants.TARGET_BUILD_LANG_CMD, properties, true, workingDir);
    } catch (Exception e) {
      return SDKCorePlugin.createErrorStatus(e);
    }

    return Status.OK_STATUS;
  }
Ejemplo n.º 2
0
  public IStatus runCommand(
      IProject project,
      IFile buildXmlFile,
      String command,
      Map<String, String> overrideProperties,
      IProgressMonitor monitor) {
    final SDKHelper antHelper = new SDKHelper(this, monitor);

    try {
      Map<String, String> properties = new HashMap<String, String>();

      if (overrideProperties != null) {
        properties.putAll(overrideProperties);
      }

      final IPath buildFile = buildXmlFile.getRawLocation();
      final String workingDir = getDefaultWorkingDir(buildFile);

      antHelper.runTarget(buildFile, command, properties, true, workingDir);
    } catch (Exception e) {
      return SDKCorePlugin.createErrorStatus(e);
    }

    return Status.OK_STATUS;
  }
Ejemplo n.º 3
0
  public IStatus directDeploy(
      IProject project,
      Map<String, String> overrideProperties,
      boolean separateJRE,
      IProgressMonitor monitor) {
    try {
      SDKHelper antHelper = new SDKHelper(this, monitor);

      Map<String, String> properties = new HashMap<String, String>();

      if (overrideProperties != null) {
        properties.putAll(overrideProperties);
      }

      final IPath buildFile = project.getFile(ISDKConstants.PROJECT_BUILD_XML).getRawLocation();
      final String workingDir = getDefaultWorkingDir(buildFile);

      antHelper.runTarget(
          buildFile, ISDKConstants.TARGET_DIRECT_DEPLOY, properties, separateJRE, workingDir);
    } catch (Exception e) {
      return SDKCorePlugin.createErrorStatus(e);
    }

    return Status.OK_STATUS;
  }
Ejemplo n.º 4
0
  public IStatus buildWSDD(
      IProject project, IFile serviceXmlFile, Map<String, String> overrideProperties) {
    SDKHelper antHelper = new SDKHelper(this);

    try {
      Map<String, String> properties = new HashMap<String, String>();

      if (overrideProperties != null) {
        properties.putAll(overrideProperties);
      }

      String serviceFile = serviceXmlFile.getRawLocation().toOSString();

      properties.put(
          ISDKConstants.PROPERTY_SERVICE_FILE, serviceXmlFile.getRawLocation().toOSString());
      properties.put(ISDKConstants.PROPERTY_SERVICE_INPUT_FILE, serviceFile);

      final IPath buildFile = project.getFile(ISDKConstants.PROJECT_BUILD_XML).getRawLocation();
      final String workingDir = getDefaultWorkingDir(buildFile);

      antHelper.runTarget(buildFile, ISDKConstants.TARGET_BUILD_WSDD, properties, true, workingDir);
    } catch (Exception e) {
      return SDKCorePlugin.createErrorStatus(e);
    }

    return Status.OK_STATUS;
  }
Ejemplo n.º 5
0
  public IPath createNewExtProject(
      String extName,
      String extDisplayName,
      boolean separateJRE,
      String workingDir,
      String baseDir,
      IProgressMonitor monitor) {
    try {
      SDKHelper antHelper = new SDKHelper(this, monitor);

      Map<String, String> properties = new HashMap<String, String>();

      properties.put(ISDKConstants.PROPERTY_EXT_NAME, extName);
      properties.put(ISDKConstants.PROPERTY_EXT_DISPLAY_NAME, extDisplayName);

      // create a space for new portlet template to get built
      IPath tempPath =
          SDKCorePlugin.getDefault()
              .getStateLocation()
              .append(ISDKConstants.TARGET_CREATE)
              .append(String.valueOf(System.currentTimeMillis()));
      // if (!newPortletPath.toFile().mkdirs()) {
      // throw new
      // CoreException(SDKPlugin.createErrorStatus("Unable to create directory in state location"));
      // }

      properties.put(ISDKConstants.PROPERTY_EXT_PARENT_DIR, tempPath.toOSString());

      if (baseDir != null) {
        properties.put("plugin.type.dir", baseDir); // $NON-NLS-1$
      }

      antHelper.runTarget(
          getLocation().append(ISDKConstants.EXT_PLUGIN_ANT_BUILD),
          ISDKConstants.TARGET_CREATE,
          properties,
          separateJRE,
          workingDir);

      return tempPath;
    } catch (Exception e) {
      SDKCorePlugin.logError(e);
    }

    return null;
  }
Ejemplo n.º 6
0
  public IPath createNewPortletProject(
      String portletName,
      String portletDisplayName,
      String portletFramework,
      boolean separateJRE,
      String workingDir,
      String baseDir,
      IProgressMonitor monitor) {
    SDKHelper antHelper = new SDKHelper(this, monitor);

    try {
      Map<String, String> properties = new HashMap<String, String>();

      properties.put(ISDKConstants.PROPERTY_PORTLET_NAME, portletName);
      properties.put(ISDKConstants.PROPERTY_PORTLET_DISPLAY_NAME, portletDisplayName);
      properties.put(ISDKConstants.PROPERTY_PORTLET_FRAMEWORK, portletFramework);

      // create a space for new portlet template to get built
      IPath newPortletPath =
          SDKCorePlugin.getDefault()
              .getStateLocation()
              .append(ISDKConstants.TARGET_CREATE)
              .append(String.valueOf(System.currentTimeMillis()));

      properties.put(ISDKConstants.PROPERTY_PORTLET_PARENT_DIR, newPortletPath.toOSString());

      if (baseDir != null) {
        properties.put("plugin.type.dir", baseDir); // $NON-NLS-1$
      }

      antHelper.runTarget(
          getLocation().append(ISDKConstants.PORTLET_PLUGIN_ANT_BUILD),
          ISDKConstants.TARGET_CREATE,
          properties,
          separateJRE,
          workingDir);

      return newPortletPath;
    } catch (Exception e) {
      SDKCorePlugin.logError(e);
    }

    return null;
  }
Ejemplo n.º 7
0
  protected IStatus runTarget(
      IProject project,
      Map<String, String> properties,
      String target,
      boolean separateJRE,
      IProgressMonitor monitor) {
    SDKHelper antHelper = new SDKHelper(this, monitor);

    try {
      final IPath buildFile = project.getFile(ISDKConstants.PROJECT_BUILD_XML).getRawLocation();
      final String workingDir = getDefaultWorkingDir(buildFile);

      antHelper.runTarget(buildFile, target, properties, separateJRE, workingDir);
    } catch (CoreException e) {
      return SDKCorePlugin.createErrorStatus(e);
    }

    return Status.OK_STATUS;
  }
Ejemplo n.º 8
0
  public IStatus compileThemePlugin(IProject project, Map<String, String> overrideProperties) {
    SDKHelper antHelper = new SDKHelper(this);

    try {
      Map<String, String> properties = new HashMap<String, String>();

      if (overrideProperties != null) {
        properties.putAll(overrideProperties);
      }

      final IPath buildFile = project.getFile(ISDKConstants.PROJECT_BUILD_XML).getRawLocation();
      final String workingDir = getDefaultWorkingDir(buildFile);

      antHelper.runTarget(buildFile, ISDKConstants.TARGET_COMPILE, properties, true, workingDir);
    } catch (Exception e) {
      return SDKCorePlugin.createErrorStatus(e);
    }

    return Status.OK_STATUS;
  }
Ejemplo n.º 9
0
  @Override
  public void onInitialized() {
    ECInitParams params = SDKHelper.getInstance().getParams();

    if (!params.validate()) {
      ViewInject.toast("error");
      // Intent intent = new Intent(ACTION_SDK_CONNECT);
      // intent.putExtra("error", -1);
      // mContext.sendBroadcast(intent);
      return;
    }

    if (params.validate()) {
      ECDevice.login(params);
    }
  }