protected RepositoryEvent createEvent(Map<String, Object> parameters) throws CoreException { String parm = (String) parameters.get(ActionConstants.PARM_REPOSITORY_LOCATION); if (parm == null) throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_LOCATION, getId()))); URI location = null; try { location = new URI(parm); } catch (URISyntaxException e) { throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_LOCATION, getId()), e)); } parm = (String) parameters.get(ActionConstants.PARM_REPOSITORY_TYPE); if (parm == null) throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_TYPE, getId()))); int type = 0; try { type = Integer.parseInt(parm); } catch (NumberFormatException e) { throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_TYPE, getId()), e)); } String name = (String) parameters.get(ActionConstants.PARM_REPOSITORY_NICKNAME); //default is to be enabled String enablement = (String) parameters.get(ActionConstants.PARM_REPOSITORY_ENABLEMENT); boolean enabled = enablement == null ? true : Boolean.valueOf(enablement).booleanValue(); return RepositoryEvent.newDiscoveryEvent(location, name, type, enabled); }
protected RepositoryEvent createEvent(Map<String, Object> parameters) throws CoreException { String parm = (String) parameters.get(ActionConstants.PARM_REPOSITORY_LOCATION); if (parm == null) throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_LOCATION, getId()))); URI location = null; try { location = new URI(parm); } catch (URISyntaxException e) { throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_LOCATION, getId()), e)); } parm = (String) parameters.get(ActionConstants.PARM_REPOSITORY_TYPE); if (parm == null) throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_TYPE, getId()))); int type = 0; try { type = Integer.parseInt(parm); } catch (NumberFormatException e) { throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_TYPE, getId()), e)); } String name = (String) parameters.get(ActionConstants.PARM_REPOSITORY_NICKNAME); //default is to be enabled String enablement = (String) parameters.get(ActionConstants.PARM_REPOSITORY_ENABLEMENT); boolean enabled = enablement == null ? true : Boolean.parseBoolean(enablement); return RepositoryEvent.newDiscoveryEvent(location, name, type, enabled); }